예제 #1
0
  /** @see com.alkacon.geranium.client.ui.input.I_FormWidget#setErrorMessage(java.lang.String) */
  public void setErrorMessage(String errorMessage) {

    if (ClientStringUtil.isNotEmptyOrWhitespaceOnly(errorMessage)) {
      if (ClientStringUtil.isNotEmptyOrWhitespaceOnly(m_errorMessageWidth)) {
        m_error.setWidth(m_errorMessageWidth);
      } else {
        m_error.setWidth((getOffsetWidth() - 8) + Unit.PX.toString());
      }
      m_textboxContainer.removeStyleName(CSS.textBoxPanel());
      m_textboxContainer.addStyleName(CSS.textBoxPanelError());
    } else {
      m_textboxContainer.removeStyleName(CSS.textBoxPanelError());
      m_textboxContainer.addStyleName(CSS.textBoxPanel());
    }
    m_error.setText(errorMessage);
  }
예제 #2
0
  /** Constructs a new instance of this widget. */
  public TextBox() {

    setEnabled(true);
    m_textbox.setStyleName(CSS.textBox());
    m_textbox.getElement().setId("CmsTextBox_" + (idCounter++));

    TextBoxHandler handler = new TextBoxHandler("");
    m_textbox.addMouseOverHandler(handler);
    m_textbox.addMouseOutHandler(handler);
    m_textbox.addFocusHandler(handler);
    m_textbox.addBlurHandler(handler);
    m_textbox.addValueChangeHandler(handler);
    m_textbox.addKeyPressHandler(handler);

    m_handler = handler;

    m_textboxContainer.setStyleName(CSS.textBoxPanel());
    m_textboxContainer.addStyleName(I_LayoutBundle.INSTANCE.generalCss().cornerAll());
    m_textboxContainer.addStyleName(I_LayoutBundle.INSTANCE.generalCss().textMedium());
    m_panel.add(m_textboxContainer);
    m_panel.add(m_error);
    m_textboxContainer.add(m_textbox);
    m_textboxContainer.setPaddingX(4);
    sinkEvents(Event.ONPASTE);
    initWidget(m_panel);
  }