TextBox(Element element, String styleName) { super(element); if (styleName != null) { setStyleName(styleName); } }
TextBox(Element element, String styleName) { super(element); if (styleName != null) { setStyleName(styleName); } }
TextBox(Element element, String styleName) { super(element); if (styleName != null) { setStyleName(styleName); } }
/** * Sets the error status. */ public void setError(boolean hasError) { if (hasError) { String curStyle = box.getStyleName(); if (!curStyle.equals(errorStyle)) { if (!curStyle.equals(textBoxStyle)) { textBoxStyle = curStyle; } box.setStyleName(errorStyle); } } else { box.setStyleName(textBoxStyle); } }
public static TextBox createTextFieldForResourceWidget() { final TextBox textField = new TextBox(); textField.setStyleName( "textSuggest" ); return textField; }
/** * Sets the error status. */ public void setError(boolean hasError) { if (hasError) { String curStyle = box.getStyleName(); if (!curStyle.equals(errorStyle)) { if (!curStyle.equals(textBoxStyle)) { textBoxStyle = curStyle; } box.setStyleName(errorStyle); } } else { box.setStyleName(textBoxStyle); } }
public static TextBox createTextField() { final TextBox textField = new TextBox(); textField.setStyleName( "formText" ); return textField; }
public void onKeyDown(Widget sender, char keyCode, int modifiers) { String curStyle = box.getStyleName(); if (errorStyle.equals(curStyle)) { box.setStyleName(textBoxStyle); } } });
public void onKeyDown(Widget sender, char keyCode, int modifiers) { String curStyle = box.getStyleName(); if (errorStyle.equals(curStyle)) { box.setStyleName(textBoxStyle); } } });
public static TextWidget makeTermRequestWidget(final EIInstance eiInstance) { final TextWidget termRequest = makeNonOntologyTextWidget( eiInstance, SweetUIConstants.termRequestEntity, "" ); termRequest.label.setStyleName( "TermFormLabel" ); termRequest.valueField.setStyleName( "TermFormText" ); return termRequest; }
/** * Takes the given text box and sets the style and * max length for the box. Limits how many characters can * be entered. * @param box * @return */ protected TextBox createTextBox(final TextBox box) { box.setStyleName( TEXT_BOX_STYLE ); box.setMaxLength( MAX_TEXT_AREA ); box.getElement().setAttribute( MAX_LENGTH_ATTRIBUTE, Integer.toString( MAX_TEXT_FIELD ) ); return box; }
private void init() { DateBoxBundle.INSTANCE.css().ensureInjected(); setStyleName("form-control"); getTextBox().setStyleName("form-control"); }
@Override protected Widget buildWidget (ConfigField field) { _box = new TextBox(); _box.setStyleName("configStringEditor"); _box.setVisibleLength(40); resetField(); _box.addChangeHandler(new ChangeHandler() { public void onChange (ChangeEvent changeEvent) { // if the string fails conversion, just reset to the old value if (_field.type.toValue(_box.getText().trim()) == null) { _box.setText(_field.valStr); } updateModificationState(); } }); return _box; }
/** * Builds the user name box. * * @return the text box */ private TextBox buildUserNameBox() { TextBox userNameBox = new TextBox(); userNameBox.setStyleName("h1"); userNameBox.setFocus(true); String userNameValue = debugMode ? "unitTester@blackducksoftware.com" : "@blackducksoftware.com"; userNameBox.setText(userNameValue); userNameBox.setAlignment(TextAlignment.LEFT); userNameBox.setSize("265px", "20px"); return userNameBox; }
private void initializeTextFields() { emailText = new TextBox(); emailText.setStyleName( ELEMENT_STYLE ); emailText.setVisibleLength(50); emailText.setMaxLength(70); messageText = new TextArea(); messageText.setStyleName( ELEMENT_STYLE ); messageText.setVisibleLines(4); clearTextFields(); }
/** * Create a box that holds the current page. */ protected void createCurrentPageBox() { // Setup the widget currentPageBox.setStyleName(resources.getStyle().css().currentPageBox()); currentPageBox.setText("1"); // Disallow non-numeric pages KeyboardListenerAdapter listener = new KeyboardListenerAdapter() { @Override public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == (char) KEY_ENTER) { PagingOptions.this.table.gotoPage(getPagingBoxValue(), false); } else if ((!Character.isDigit(keyCode)) && (keyCode != (char) KEY_TAB) && (keyCode != (char) KEY_BACKSPACE) && (keyCode != (char) KEY_DELETE) && (keyCode != (char) KEY_ENTER) && (keyCode != (char) KEY_HOME) && (keyCode != (char) KEY_END) && (keyCode != (char) KEY_LEFT) && (keyCode != (char) KEY_UP) && (keyCode != (char) KEY_RIGHT) && (keyCode != (char) KEY_DOWN)) { ((TextBox) sender).cancelKey(); } } }; // Add the listener currentPageBox.addKeyboardListener(listener); }
/** * Builds the server box. * * @return the text box */ private TextBox buildServerBox() { TextBox serverBox = new TextBox(); serverBox.setStyleName("h1"); serverBox.setFocus(true); String serverValue = debugMode ? "http://seneca.blackducksoftware.com" : ".blackducksoftware.com"; serverBox.setText(serverValue); serverBox.setAlignment(TextAlignment.LEFT); serverBox.setSize("265px", "20px"); serverBox.setFocus(true); return serverBox; }
/** * Create a box that holds the current page. */ protected void createCurrentPageBox() { // Setup the widget currentPageBox.setStyleName(resources.getStyle().css().currentPageBox()); currentPageBox.setText("1"); // Disallow non-numeric pages KeyboardListenerAdapter listener = new KeyboardListenerAdapter() { @Override public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == (char) KEY_ENTER) { TreeTablePagingOptions.this.table.gotoPage(getPagingBoxValue(), false); } else if ((!Character.isDigit(keyCode)) && (keyCode != (char) KEY_TAB) && (keyCode != (char) KEY_BACKSPACE) && (keyCode != (char) KEY_DELETE) && (keyCode != (char) KEY_ENTER) && (keyCode != (char) KEY_HOME) && (keyCode != (char) KEY_END) && (keyCode != (char) KEY_LEFT) && (keyCode != (char) KEY_UP) && (keyCode != (char) KEY_RIGHT) && (keyCode != (char) KEY_DOWN)) { ((TextBox) sender).cancelKey(); } } }; // Add the listener currentPageBox.addKeyboardListener(listener); }
/** * Create a box that holds the current page. */ protected void createCurrentPageBox() { // Setup the widget currentPageBox.setStyleName(resources.getStyle().css().currentPageBox()); currentPageBox.setText("1"); // Disallow non-numeric pages KeyboardListenerAdapter listener = new KeyboardListenerAdapter() { @Override public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == (char) KEY_ENTER) { PagingOptions.this.table.gotoPage(getPagingBoxValue(), false); } else if ((!Character.isDigit(keyCode)) && (keyCode != (char) KEY_TAB) && (keyCode != (char) KEY_BACKSPACE) && (keyCode != (char) KEY_DELETE) && (keyCode != (char) KEY_ENTER) && (keyCode != (char) KEY_HOME) && (keyCode != (char) KEY_END) && (keyCode != (char) KEY_LEFT) && (keyCode != (char) KEY_UP) && (keyCode != (char) KEY_RIGHT) && (keyCode != (char) KEY_DOWN)) { ((TextBox) sender).cancelKey(); } } }; // Add the listener currentPageBox.addKeyboardListener(listener); }
/** * Prepares the selected value box for displaying. */ protected void prepareSelectedValue() { TextBox selectedValue = getSelectedValue(); selectedValue.setReadOnly(!isCustomTextAllowed()); selectedValue.setStyleName("selected-value"); if(getHeight() != null) { getLayout().setHeight("100%"); getLayout().getCellFormatter().setHeight(0, 0, "100%"); getSelectedValue().setHeight("100%"); } if (getWidth() != null) { getLayout().setWidth("100%"); getLayout().getCellFormatter().setWidth(0, 0, "100%"); getSelectedValue().setWidth("100%"); } }