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

The following examples show how to use com.google.gwt.user.client.ui.TextBox#addStyleName() . These examples are extracted from open source projects. 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
/**
 * 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
/**
 * Creates the GUI components for search tab.
 *
 * @param searchApp: the FlowPanel that search tab will reside.
 */
private void addGallerySearchTab(FlowPanel searchApp) {
  // Add search GUI
  FlowPanel searchPanel = new FlowPanel();
  final TextBox searchText = new TextBox();
  searchText.addStyleName("gallery-search-textarea");
  Button sb = new Button(MESSAGES.gallerySearchForAppsButton());
  searchPanel.add(searchText);
  searchPanel.add(sb);
  searchPanel.addStyleName("gallery-search-panel");
  searchApp.add(searchPanel);
  appSearchContent.addStyleName("gallery-search-results");
  searchApp.add(appSearchContent);
  searchApp.addStyleName("gallery-search");

  sb.addClickHandler(new ClickHandler() {
    //  @Override
    public void onClick(ClickEvent event) {
      gallery.FindApps(searchText.getText(), 0, NUMAPPSTOSHOW, 0, true);
    }
  });
}
 
Example 3
/**
 * Creates a guest signature panel, with components fully instantiated and
 * attached. 
 * 
 */
public GuestSignaturePanel() {
  entryUpdateHandlers = new ArrayList<EntryUpdateHandler>();
  guestSignaturePanel = new HorizontalPanel();

  // Create guest signature panel widgets
  guestNameBox = new TextBox();
  guestMessageBox = new TextBox();
  guestNameLabel = new Label("Your Name:");
  guestMessageLabel = new Label("Message:");
  signButton = new Button("Sign!");

  // Set up the widget guest signature panel widget styles (additional to
  // standard styles)
  guestNameLabel.addStyleName("gb-Label");
  guestMessageLabel.addStyleName("gb-Label");
  guestNameBox.addStyleName("gb-NameBox");
  guestMessageBox.addStyleName("gb-MessageBox");

  // Attach components together
  guestSignaturePanel.add(guestNameLabel);
  guestSignaturePanel.add(guestNameBox);
  guestSignaturePanel.add(guestMessageLabel);
  guestSignaturePanel.add(guestMessageBox);
  guestSignaturePanel.add(signButton);

  signButton.addClickHandler(this);

 /* The initWidget(Widget) method inherited from the Composite class must be
  * called exactly once in the constructor to declare the widget that this 
  * composite class is wrapping. */
  initWidget(guestSignaturePanel);
}
 
Example 4
SearchBox(final String editorId) {

            // first part: setup the visible widgets
            final TextBox findTextBox = new TextBox();
            findTextBox.addStyleName("ace_search_field");
            findTextBox.getElement().setAttribute("placeholder", "Find");
            setId(findTextBox, BASE_ID + editorId, "find_input");

            ToolButton findButton = new ToolButton("Find", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    editor.search(findTextBox.getValue());
                }
            });
            setId(findButton, BASE_ID + editorId, "find");

            Button findPrev = new Button(SafeHtmlUtils.fromSafeConstant("<i class=\"icon-angle-left\"></i>"));
            findPrev.addStyleName("toolstrip-button");
            findPrev.getElement().setAttribute("action", "findPrev"); // AceEditor action wiring
            setId(findPrev, BASE_ID + editorId, "prev_match");

            Button findNext = new Button(SafeHtmlUtils.fromSafeConstant("<i class=\"icon-angle-right\"></i>"));
            findNext.addStyleName("toolstrip-button");
            findNext.getElement().setAttribute("action", "findNext"); // AceEditor action wiring
            setId(findNext, BASE_ID + editorId, "next_match");

            ToolButton refresh = new ToolButton(Console.CONSTANTS.common_label_refresh(),
                    event -> presenter.onRefreshLogFile(name));

            ToolStrip searchTools = new ToolStrip();
            searchTools.addToolWidget(findTextBox);
            searchTools.addToolButton(findButton);
            searchTools.addToolWidget(findPrev);
            searchTools.addToolWidget(findNext);
            searchTools.addToolButton(refresh);

            searchTools.getElement().getStyle().setPaddingLeft(0, PX);
            searchTools.getElement().getStyle().setMarginBottom(0.5, EM);
            findTextBox.getElement().getStyle().setWidth(30, EM);
            findTextBox.getElement().getStyle().setMarginRight(1, EM);
            findTextBox.getElement().getStyle().setMarginBottom(0, PX);
            findTextBox.getElement().getParentElement().getStyle().setVerticalAlign(MIDDLE);
            findButton.getElement().getStyle().setMarginLeft(1, EM);
            findButton.getElement().getStyle().setHeight(25, PX);
            findButton.getElement().getParentElement().getStyle().setVerticalAlign(MIDDLE);
            findPrev.getElement().getStyle().setHeight(25, PX);
            findPrev.getElement().getParentElement().getStyle().setVerticalAlign(MIDDLE);
            findNext.getElement().getStyle().setHeight(25, PX);
            findNext.getElement().getParentElement().getStyle().setVerticalAlign(MIDDLE);
            refresh.getElement().getStyle().setMarginLeft(1, EM);

            // next part: rebuild the original search box
            FlowPanel searchForm = div("ace_search_form", false);
            searchForm.add(searchTools);

            FlowPanel replaceForm = div("ace_replace_form", true);
            replaceForm.add(hiddenTextBox("ace_search_field"));
            replaceForm.add(hiddenButton("replaceAndFindNext", "ace_replacebtn"));
            replaceForm.add(hiddenButton("replaceAll", "ace_replacebtn"));

            FlowPanel searchOptions = div("ace_search_options", true);
            searchOptions.add(hiddenButton("toggleRegexpMode", "ace_button"));
            searchOptions.add(hiddenButton("toggleCaseSensitive", "ace_button"));
            searchOptions.add(hiddenButton("toggleWholeWords", "ace_button"));

            FlowPanel searchBox = div("ace_search_log_viewer", false);
            searchBox.getElement().setId(BASE_ID + editorId + "_search_panel");
            searchBox.add(hiddenButton("close", "ace_searchbtn_close"));
            searchBox.add(searchForm);
            searchBox.add(replaceForm);
            searchBox.add(searchOptions);

            initWidget(searchBox);
        }