private void validateInput() { String value = ""; switch (inputType) { case TEXTBOX: value = ((TextBox)input).getValue(); break; case TEXTAREA: value = ((TextArea)input).getValue(); break; case PASSWORD: value = ((PasswordTextBox)input).getValue(); break; } if (isOptional && value.length() == 0) { setInputValid(true); } else { if (validationStr != null) { setInputValid(value.matches(validationStr)); } else { setInputValid(true); } } }
public ChangePasswordPopup(UserSecurityInfo user) { super(false); this.user = user; password1 = new PasswordTextBox(); password2 = new PasswordTextBox(); FlexTable layout = new FlexTable(); layout.setWidget(0, 0, new HTML("Change Password for " + user.getUsername())); layout.setWidget(1, 0, new HTML("Password:")); layout.setWidget(1, 1, password1); layout.setWidget(2, 0, new HTML("Password (again):")); layout.setWidget(2, 1, password2); layout.setWidget(3, 0, new ExecuteChangePasswordButton(this)); layout.setWidget(3, 1, new ClosePopupButton(this)); setWidget(layout); }
/** * Swaps a TextBox with an element of the same type for remember password. The text box needs to be within an panel. The styles of the text box are also * copied * * @param textBox * @param elementId * @return */ @SuppressWarnings("unchecked") public static <T extends TextBox> T swap (T textBox, String elementId) { Panel parent = (Panel) textBox.getParent(); T newTextBox = null; if (textBox instanceof PasswordTextBox) { newTextBox = (T) PasswordTextBox .wrap(DOM.getElementById(elementId)); } else if (textBox instanceof TextBox) { newTextBox = (T) TextBox.wrap(DOM.getElementById(elementId)); } newTextBox.getElement().setAttribute("class", textBox.getElement().getAttribute("class")); newTextBox.removeFromParent(); parent.getElement().insertBefore(newTextBox.getElement(), textBox.getElement()); textBox.removeFromParent(); return newTextBox; }
public TextBoxExample() { super("Text Boxes"); TextBox text = new TextBox(); text.setVisibleLength(15); text.setMaxLength(10); add(text); TextBox readOnly = new TextBox(); readOnly.setReadOnly(true); readOnly.setVisibleLength(15); readOnly.setText("Read only text"); add(readOnly); PasswordTextBox password = new PasswordTextBox(); password.setVisibleLength(15); add(password); }
/** * Creates a new MockPasswordTextBox component. * * @param editor editor of source file the component belongs to. */ public MockPasswordTextBox(SimpleEditor editor) { super(editor, TYPE, images.passwordtextbox()); // Initialize mock PasswordTextBox UI. passwordTextBoxWidget = new PasswordTextBox(); // Change PasswordTextBox text so that it doesn't show up as a blank box in the designer. passwordTextBoxWidget.setText("**********"); initWrapper(passwordTextBoxWidget); }
@Override public void onClick(ClickEvent event) { super.onClick(event); PasswordTextBox password1 = popup.getPassword1(); PasswordTextBox password2 = popup.getPassword2(); UserSecurityInfo userInfo = popup.getUser(); RealmSecurityInfo realmInfo = AggregateUI.getUI().getRealmInfo(); String pw1 = password1.getText(); String pw2 = password2.getText(); if (pw1 == null || pw2 == null || pw1.length() == 0) { Window.alert("Password cannot be blank"); } else if (pw1.equals(pw2)) { if (realmInfo == null || userInfo == null) { Window.alert("Unable to obtain required information from server"); } else { CredentialsInfo credential; try { credential = CredentialsInfoBuilder.build(userInfo.getUsername(), realmInfo, pw1); } catch (NoSuchAlgorithmException e) { Window.alert("Unable to build credentials hash"); return; } baseUrl = realmInfo.getChangeUserPasswordURL(); // Construct a JSOP request String parameters = credential.getRequestParameters(); String url = baseUrl + "?" + parameters + "&callback="; getJson(jsonRequestId++, url, this); } } else { Window.alert("The passwords do not match. Please retype the password."); } }
public static MessageBox password(String caption, String message, MessageBoxListener listener) { final MessageBox mb = new MessageBox(); mb.setText(caption); mb.setButtons(BTN_OK_CANCEL, listener); mb._dockPanel.add(new Label(message), DockPanel.NORTH); mb._textBox = new PasswordTextBox(); mb._dockPanel.add(mb._textBox, DockPanel.CENTER); mb.center(); mb._textBox.setFocus(true); return mb; }
public LoginWidget(AsyncCallback<Void> logincb, AsyncCallback<Void> logoutcb) { this.resize(1, 2); this.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT); this.addStyleName("easyvote-LoginWidget"); LoginHandler handler = new LoginHandler(); whoAmIPanel = new HorizontalPanel(); whoAmIPanel.setVisible(false); userIdLabel = new Label(); userIdLabel.addStyleName("LoginWidget-component"); whoAmIPanel.add(userIdLabel); logoutButton = new Button("Logout"); logoutButton.addStyleName("LoginWidget-logoutButton"); logoutButton.addClickHandler(new LogoutHandler()); whoAmIPanel.add(logoutButton); setWidget(0, 1, whoAmIPanel); inputPanel = new FlowPanel(); loginCallback = logincb; logoutCallback = logoutcb; nameField = new TextBox(); nameField.setText("VoterID"); nameField.addStyleName("LoginWidget-component"); nameField.addKeyUpHandler(handler); inputPanel.add(nameField); passField = new PasswordTextBox(); passField.setText("Password"); passField.addKeyUpHandler(handler); passField.addStyleName("LoginWidget-component"); inputPanel.add(passField); sendButton = new Button("Login"); sendButton.addClickHandler(handler); inputPanel.add(sendButton); this.setWidget(0, 0, inputPanel); }
public void onModuleLoad() { final DialogBox loginBox=new DialogBox(); loginBox.setAnimationEnabled(true); loginBox.setGlassEnabled(true); loginBox.setTitle("This panel allows you to login to the system."); final VerticalPanel vp=new VerticalPanel(); final PasswordTextBox ptb=new PasswordTextBox(); final Button lbutton=new Button("Go"); vp.add(ptb); vp.add(lbutton); loginBox.add(vp); lbutton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if(ptb.getText().startsWith("abracadabra")) { user=ptb.getText().substring("abracadabra".length()); loadModule(); loginBox.hide(); } else Window.alert("Sorry better luck next time :)"); } }); loginBox.center(); }
public PasswordTextBoxByDomId(FDesc fielddescriptor, WidgetRDesc wrDesc) { super(fielddescriptor); String domId = wrDesc.getPropValue(IneFormProperties.domId); if (domId == null) return; Element element = DOM.getElementById(domId); textBox = element == null ? new PasswordTextBox() : PasswordTextBox.wrap(element); updateWidth(wrDesc); initWidget(textBox); textBox.addStyleName(ResourceHelper.ineformRes().style().textBoxFW()); }
public PasswordTextBox getOldPwd(){ return oldPwd; }
public PasswordTextBox getNewPwd(){ return newPwd; }
public PasswordTextBox getVerPwd(){ return verPwd; }
ClonedPasswordTextBox(PasswordTextBox ptb) { // Get the Element from the PasswordTextBox. // Call DOM.clone to make a deep clone of that element. // Pass that cloned element to the super constructor. super(DOM.clone(ptb.getElement(), true)); }
public PasswordTextBox getPassword1() { return password1; }
public PasswordTextBox getPassword2() { return password2; }
public Widget getWidget() { return new PasswordTextBox(); }
public void setValue( Widget w, JSONValue value ) { ((PasswordTextBox) w).setText( Marshalls.string.get( value ) ); }
public JSONValue getValue( Widget widget ) { return Marshalls.string.get( MD5.md5( ((PasswordTextBox) widget).getText() ) ); }
public InputPassword() { super(new PasswordTextBox()); this.setParser(StringParser.get()); this.setRenderer(StringRenderer.get()); }
protected InputPassword(InputPassword source) { super(new PasswordTextBox(), source); }
public PasswordTextBoxFW(FDesc fielddescriptor, WidgetRDesc wrDesc) { super(fielddescriptor); textBox = new PasswordTextBox(); updateWidth(wrDesc); initWidget(textBox); }
public PasswordTextBox getPasswordTextBox() { return passwordTextBox; }
/** * Instantiates a new LoginView. */ public LoginView() { errorPanel = new AlertPanel(Type.ERROR); infoPanel = new AlertPanel(Type.INFO); kaaAdminStyle = Utils.kaaAdminStyle; initWidget(uiBinder.createAndBindUi(this)); loginTitle.getElement().setInnerSafeHtml( SafeHtmlUtils.fromSafeConstant(Utils.messages.loginTitle())); usernameBox = new TextBox(); usernameBox.setName("j_username"); usernameBox.setWidth("100%"); passwordBox = new PasswordTextBox(); passwordBox.setName("j_password"); passwordBox.setWidth("100%"); Label loginLabel = new Label(Utils.constants.username()); loginTable.setWidget(0, 0, loginLabel); loginTable.setWidget(0, 1, usernameBox); Label passwordLabel = new Label(Utils.constants.password()); loginTable.setWidget(1, 0, passwordLabel); loginTable.setWidget(1, 1, passwordBox); forgotPasswordLabel = new Label(Utils.constants.forgotPassword()); forgotPasswordLabel.addStyleName(Utils.kaaAdminStyle.linkLabel()); loginTable.setWidget(2, 0, forgotPasswordLabel); loginTable.getFlexCellFormatter().setWidth(0, 0, "130px"); loginTable.getFlexCellFormatter() .setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); loginTable.getFlexCellFormatter() .setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); loginTable.getFlexCellFormatter() .setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); loginTable.getFlexCellFormatter() .setColSpan(2, 0, 2); loginButton = new Button(Utils.constants.login()); loginButton.addStyleName(Utils.kaaAdminStyle.loginButton()); loginTable.setWidget(3, 2, loginButton); loginButton.getElement().getStyle().setMarginTop(15, Unit.PX); loginForm.setWidget(loginTable); loginForm.setAction(""); }
public PasswordTextBox getPasswordBox() { return passwordBox; }
/** * Initialize this example. */ @ShowcaseSource @Override public Widget onInitialize() { // Create a panel to layout the widgets VerticalPanel vpanel = new VerticalPanel(); vpanel.setSpacing(5); // Add a normal and disabled text box TextBox normalText = new TextBox(); normalText.ensureDebugId("cwBasicText-textbox"); // Set the normal text box to automatically adjust its direction according // to the input text. Use the Any-RTL heuristic, which sets an RTL direction // iff the text contains at least one RTL character. normalText.setDirectionEstimator(AnyRtlDirectionEstimator.get()); TextBox disabledText = new TextBox(); disabledText.ensureDebugId("cwBasicText-textbox-disabled"); disabledText.setText(constants.cwBasicTextReadOnly()); disabledText.setEnabled(false); vpanel.add(new HTML(constants.cwBasicTextNormalLabel())); vpanel.add(createTextExample(normalText, true)); vpanel.add(createTextExample(disabledText, false)); // Add a normal and disabled password text box PasswordTextBox normalPassword = new PasswordTextBox(); normalPassword.ensureDebugId("cwBasicText-password"); PasswordTextBox disabledPassword = new PasswordTextBox(); disabledPassword.ensureDebugId("cwBasicText-password-disabled"); disabledPassword.setText(constants.cwBasicTextReadOnly()); disabledPassword.setEnabled(false); vpanel.add(new HTML("<br><br>" + constants.cwBasicTextPasswordLabel())); vpanel.add(createTextExample(normalPassword, true)); vpanel.add(createTextExample(disabledPassword, false)); // Add a text area TextArea textArea = new TextArea(); textArea.ensureDebugId("cwBasicText-textarea"); textArea.setVisibleLines(5); vpanel.add(new HTML("<br><br>" + constants.cwBasicTextAreaLabel())); vpanel.add(createTextExample(textArea, true)); // Return the panel return vpanel; }