Java Code Examples for com.google.gwt.user.client.ui.HTML#addStyleName()

The following examples show how to use com.google.gwt.user.client.ui.HTML#addStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the report section
 */
private void initAppShare() {
  final HTML sharePrompt = new HTML();
  sharePrompt.setHTML(MESSAGES.gallerySharePrompt());
  sharePrompt.addStyleName("primary-prompt");
  final TextBox urlText = new TextBox();
  urlText.addStyleName("action-textbox");
  urlText.setText(Window.Location.getHost() + MESSAGES.galleryGalleryIdAction() + app.getGalleryAppId());
  urlText.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      urlText.selectAll();
    }
  });
  appSharePanel.add(sharePrompt);
  appSharePanel.add(urlText);
}
 
Example 2
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
   * Helper method called by constructor to initialize ui components
   */
  private void initComponents() {
    // Initialize UI
    panel = new VerticalPanel();
    panel.setWidth("100%");
    galleryGUI = new FlowPanel();
    appSingle = new FlowPanel();
    appDetails = new FlowPanel();
    appHeader = new FlowPanel();
    appInfo = new FlowPanel();
    appAction = new FlowPanel();
    appAuthor = new FlowPanel();
    appMeta = new FlowPanel();
    appDates = new FlowPanel();
    appPrimaryWrapper = new FlowPanel();
    appSecondaryWrapper = new FlowPanel();
    appDescPanel = new FlowPanel();
    appReportPanel = new FlowPanel();
    appSharePanel = new FlowPanel();
    appActionTabs = new TabPanel();
    sidebarTabs = new TabPanel();
    appComments = new FlowPanel();
    appCommentsList = new FlowPanel();
    appsByAuthor = new FlowPanel();
    appsByTags = new FlowPanel();
    appsRemixes = new FlowPanel();
    returnToGallery = new FlowPanel();
//    tagSelected = "";

    appCreated = new Label();
    appChanged = new Label();
    descBox = new FlowPanel();
    titleBox = new FlowPanel();
    desc = new TextArea();
    titleText = new TextArea();
    moreInfoText = new TextArea();
    creditText = new TextArea();
    ccLicenseRef = new HTML(MESSAGES.galleryCcLicenseRef());
    ccLicenseRef.addStyleName("app-action-html");
  }
 
Example 3
Source File: SelectPatchStep.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected IsWidget body(final ApplyContext context) {
    FormPanel form = new FormPanel();
    FlowPanel panel = new FlowPanel();
    form.setWidget(panel);
    panel.add(new Label(Console.CONSTANTS.patch_manager_select_patch_body()));

    if (!context.standalone) {
        info = new HTML("");
        info.getElement().getStyle().setMarginTop(2, Style.Unit.EM);
        panel.add(info);
    }

    FlowPanel uploadPanel = new FlowPanel();
    uploadPanel.getElement().getStyle().setMarginTop(2, Style.Unit.EM);
    InlineLabel uploadLabel = new InlineLabel(Console.CONSTANTS.patch_manager_select_patch_upload());
    uploadLabel.getElement().getStyle().setMarginRight(1, Style.Unit.EM);
    uploadPanel.add(uploadLabel);
    context.fileUpload = new FileUpload();
    context.fileUpload.setName("patch_file");
    context.fileUpload.getElement().setId(asId(PREFIX, getClass(), "_Upload"));
    uploadPanel.add(context.fileUpload);
    panel.add(uploadPanel);

    errorMessages = new HTML(
            "<i class=\"icon-exclamation-sign\"></i> " + Console.CONSTANTS.patch_manager_select_file());
    errorMessages.addStyleName("error");
    errorMessages.setVisible(false);
    panel.add(errorMessages);

    return form;
}
 
Example 4
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method called by constructor to initialize the report section
 */
private void initReportSection() {
  final HTML reportPrompt = new HTML();
  reportPrompt.setHTML(MESSAGES.galleryReportPrompt());
  reportPrompt.addStyleName("primary-prompt");
  final TextArea reportText = new TextArea();
  reportText.addStyleName("action-textarea");
  final Button submitReport = new Button(MESSAGES.galleryReportButton());
  submitReport.addStyleName("action-button");
  final Label descriptionError = new Label();
  descriptionError.setText("Description required");
  descriptionError.setStyleName("ode-ErrorMessage");
  descriptionError.setVisible(false);
  appReportPanel.add(reportPrompt);
  appReportPanel.add(descriptionError);
  appReportPanel.add(reportText);
  appReportPanel.add(submitReport);

  final OdeAsyncCallback<Boolean> isReportdByUserCallback = new OdeAsyncCallback<Boolean>(
      // failure message
      MESSAGES.galleryError()) {
        @Override
        public void onSuccess(Boolean isAlreadyReported) {
          if(isAlreadyReported) { //already reported, cannot report again
            reportPrompt.setHTML(MESSAGES.galleryAlreadyReportedPrompt());
            reportText.setVisible(false);
            submitReport.setVisible(false);
            submitReport.setEnabled(false);
          } else {
            submitReport.addClickHandler(new ClickHandler() {
              public void onClick(ClickEvent event) {
                final OdeAsyncCallback<Long> reportClickCallback = new OdeAsyncCallback<Long>(
                    // failure message
                    MESSAGES.galleryError()) {
                      @Override
                      public void onSuccess(Long id) {
                        reportPrompt.setHTML(MESSAGES.galleryReportCompletionPrompt());
                        reportText.setVisible(false);
                        submitReport.setVisible(false);
                        submitReport.setEnabled(false);
                      }
                  };
                if (!reportText.getText().trim().isEmpty()){
                  Ode.getInstance().getGalleryService().addAppReport(app, reportText.getText(),
                    reportClickCallback);
                  descriptionError.setVisible(false);
                } else {
                  descriptionError.setVisible(true);
                }
              }
            });
          }
        }
    };
  Ode.getInstance().getGalleryService().isReportedByUser(app.getGalleryAppId(),
      isReportdByUserCallback);
}
 
Example 5
Source File: Util.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generate selectable widget text
 */
public static HTML createSelectable(String html) {
	HTML widget = new HTML(html);
	widget.addStyleName("okm-EnableSelect");
	return widget;
}
 
Example 6
Source File: MessageCenterView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Widget asWidget()
{

    HorizontalPanel layout = new HorizontalPanel();
    layout.getElement().setAttribute("title", "Notification Center");
    layout.setStyleName("notification-center");

    messageButton = new HTML(MESSAGE_LABEL+": "+messageCenter.getNewMessageCount());
    messageButton.addStyleName("notification-button");

    ClickHandler clickHandler = new ClickHandler() {
        public void onClick(ClickEvent event) {

            int numMessages = fetchMessages(messagePopup);
            if(numMessages==0)numMessages=1;

            int width = 250;
            int height = numMessages*35;

            int btnRight = messageButton.getAbsoluteLeft()+messageButton.getOffsetWidth();

            messagePopup.setPopupPosition(
                    btnRight-width,// - (width+10- messageButton.getOffsetWidth()) ,
                    messageButton.getAbsoluteTop() + 25
            );

            messagePopup.show();
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                    messagePopup.focusOnFirstMessage();
                }
            });


            messagePopup.setWidth(width+"px");
            messagePopup.setHeight(height+"px");
        }
    };

    messageButton.addClickHandler(clickHandler);

    messageDisplay = new HorizontalPanel();
    messageDisplay.getElement().setAttribute("role", "log");
    messageDisplay.getElement().setAttribute("aria-live", "polite");
    messageDisplay.getElement().setAttribute("aria-atomic", "true");

    layout.add(messageDisplay);
    layout.add(messageButton);

    messageDisplay.getElement().getParentElement().setAttribute("style", "width:100%;padding-right:5px");
    messageDisplay.getElement().getParentElement().setAttribute("align", "right");

    messageButton.getElement().getParentElement().setAttribute("style", "width:60px");
    messageButton.getElement().getParentElement().setAttribute("align", "right");

    // register listener
    messageCenter.addMessageListener(this);
    Console.getEventBus().addHandler(ReloadEvent.TYPE, this);

    return layout;
}