public void prepareView() {
   Messages messages = presenter.getBrowserFactory().getMessages();
   setCreateRequestTitle(messages.createRequestTitle());
   setToLabel(messages.to());
   setRequestTitleLabel(messages.requestTitle());
   setRequestDescriptionLabel(messages.requestDescription());
   setExpectsAnswerLabel(messages.expectsAnswer());
   setPublishRequestButtonText(messages.publishRequest());
   setCancelButtonText(messages.cancel());
   requestTitleContainer.setText("");
   requestDescriptionContainer.setText("");
   toContainer.setText("");
   expectsAnswerContainer.setValue(false);
 }
Exemple #2
0
 @Override
 public void setValue(Enum<?> value) {
   this.value = value;
   if (null != value) {
     holder.setText(value.name());
   }
 }
Exemple #3
0
 /* (non-Javadoc)
  * @see gwtupload.client.Uploader#setI18Constants(gwtupload.client.IUploader.UploaderConstants)
  */
 @Override
 public void setI18Constants(UploaderConstants strs) {
   super.setI18Constants(strs);
   if (button != null && button instanceof HasText) {
     ((HasText) button).setText(strs.uploaderSend());
   }
 }
Exemple #4
0
  /**
   * This constructor allows to use an existing form panel.
   *
   * @param type file input to use
   * @param status Customized status widget to use
   * @param submitButton Customized button which submits the form
   * @param form Customized form panel
   */
  public SingleUploader(
      FileInputType type, IUploadStatus status, Widget submitButton, FormPanel form) {
    super(type, form);

    final Uploader thisInstance = this;

    if (status == null) {
      status = new BaseUploadStatus();
      super.add(status.getWidget());
    }
    super.setStatusWidget(status);

    this.button = submitButton;
    if (submitButton != null) {
      submitButton.addStyleName("submit");
      if (submitButton instanceof HasClickHandlers) {
        ((HasClickHandlers) submitButton)
            .addClickHandler(
                new ClickHandler() {
                  public void onClick(ClickEvent event) {
                    thisInstance.submit();
                  }
                });
      }
      if (submitButton instanceof HasText) {
        ((HasText) submitButton).setText(I18N_CONSTANTS.uploaderSend());
      }
      // The user could have attached the button anywhere in the page.
      if (!submitButton.isAttached()) {
        super.add(submitButton);
      }
    }
  }
Exemple #5
0
 @Override
 public void onKeyUp(KeyUpEvent event) {
   String text = source.getText();
   if (text.compareTo(lastString) != 0) {
     lastString = text;
     onRealChange(text);
   }
 }
 protected void appendText(T wrapped, String data) {
   if (HasText.class.isInstance(wrapped)) {
     ((HasText) wrapped).setText(data);
   } else {
     Text text = JavaScriptObjects.newText(data);
     wrapped.getElement().appendChild(text);
   }
 }
Exemple #7
0
  /**
   * ************************************* Sets the button text.
   *
   * @param sText The new button text
   */
  @Override
  public void setText(String sText) {
    sText = getContext().expandResource(sText);
    this.sText = sText;

    HasText rWidget = (HasText) getWidget();

    rWidget.setText(sText);

    if (rWidget instanceof PushButton) {
      // GWT bug: text of other states will not be set sometimes
      PushButton rPushButton = (PushButton) rWidget;

      rPushButton.getUpFace().setText(sText);
      rPushButton.getDownFace().setText(sText);
      rPushButton.getUpHoveringFace().setText(sText);
      rPushButton.getDownHoveringFace().setText(sText);
      rPushButton.getUpDisabledFace().setText(sText);
      rPushButton.getDownDisabledFace().setText(sText);
    }
  }
 public static void internationalize(Widget b, Map<String, String> strs, String ktext) {
   if (strs == null) return;
   String text = strs.get(ktext);
   String title = strs.get(ktext + ".title");
   if (text != null && text.length() > 0) {
     if (b instanceof HasHTML) ((HasHTML) b).setText(text);
     else if (b instanceof HasText) ((HasText) b).setText(text);
     else if (b instanceof GWTCDatePickerAbstract)
       ((GWTCDatePickerAbstract) b).setCaptionText(text);
     else
       System.out.println(
           "GWTCDatePickerAbstract.internationalize: unknown element "
               + b
               + " "
               + ktext
               + " "
               + text);
   }
   if (title != null && title.length() > 0) b.setTitle(title);
 }
Exemple #9
0
  /**
   * ************************************* Sets an image and/or text on a button widget.
   *
   * @param rWidget The button widget
   * @param sText The button text (NULL or empty for none)
   * @param rImage The button image
   * @param rTextPosition The position of the text relative to the image
   */
  void setButtonImage(HasText rWidget, String sText, Image rImage, AlignedPosition rTextPosition) {
    if (rImage instanceof ImageRef) {
      ImageRef rBitmap = (ImageRef) rImage;

      if (rWidget instanceof PushButton && (sText == null || sText.length() == 0)) {
        com.google.gwt.user.client.ui.Image rGwtImage = rBitmap.getGwtImage();

        PushButton rPushButton = (PushButton) rWidget;

        rPushButton.getUpFace().setImage(rGwtImage);
        rPushButton.getUpDisabledFace().setImage(rGwtImage);
        rPushButton.getUpHoveringFace().setImage(rGwtImage);
        rPushButton.getDownFace().setImage(rGwtImage);
        rPushButton.getDownDisabledFace().setImage(rGwtImage);
        rPushButton.getDownHoveringFace().setImage(rGwtImage);
      } else {
        String sImageLabel =
            createImageLabel(
                sText, rBitmap, rTextPosition, HasHorizontalAlignment.ALIGN_CENTER, "100%");

        if (rWidget instanceof PushButton) {
          PushButton rPushButton = (PushButton) rWidget;

          rPushButton.getUpFace().setHTML(sImageLabel);
          rPushButton.getUpDisabledFace().setHTML(sImageLabel);
          rPushButton.getUpHoveringFace().setHTML(sImageLabel);
          rPushButton.getDownFace().setHTML(sImageLabel);
          rPushButton.getDownDisabledFace().setHTML(sImageLabel);
          rPushButton.getDownHoveringFace().setHTML(sImageLabel);
        } else if (rWidget instanceof HasHTML) {
          ((HasHTML) rWidget).setHTML(sImageLabel);
        }
      }
    } else {
      rWidget.setText(sText);
    }
  }
 public void setRequestDescriptionLabel(String requestDescriptionLabel) {
   requestDescriptionLabelContainer.setText(requestDescriptionLabel);
 }
 public void setRequestTitleLabel(String requestTitleLabel) {
   requestTitleLabelContainer.setText(requestTitleLabel);
 }
 public void setToLabel(String toLabel) {
   toLabelContainer.setText(toLabel);
 }
 public void setCreateRequestTitle(String createRequestTitle) {
   createRequestTitleContainer.setText(createRequestTitle);
 }
 public String getRequestDescription() {
   return requestDescriptionContainer.getText();
 }
 public String getRequestTitle() {
   return requestTitleContainer.getText();
 }
Exemple #16
0
 /** This static method exists purely to ensure BeanParser handles overloaded methods correctly. */
 public static void setPopupText(HasText t, String text) {
   t.setText(text);
 }