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

The following examples show how to use com.google.gwt.user.client.ui.FlowPanel#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
/**
 * 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 2
Source Project: unitime   File: UniTimeDialogBox.java    License: Apache License 2.0 6 votes vote down vote up
public UniTimeDialogBox(boolean autoHide, boolean modal) {
      super(autoHide, modal);
      
setAnimationEnabled(true);
setGlassEnabled(true);
	
      iContainer = new FlowPanel();
      iContainer.addStyleName("dialogContainer");
      
      iClose = new Anchor();
  	iClose.setTitle(MESSAGES.hintCloseDialog());
      iClose.setStyleName("close");
      iClose.addClickHandler(new ClickHandler() {
      	@Override
          public void onClick(ClickEvent event) {
              onCloseClick(event);
          }
      });
      iClose.setVisible(autoHide);

      iControls = new FlowPanel();
      iControls.setStyleName("dialogControls");        
      iControls.add(iClose);
  }
 
Example 3
public static Widget createPanel() {
  // http://tobiasahlin.com/spinkit/
  // MIT
  FlowPanel flowPanel = new FlowPanel();
  flowPanel.addStyleName("sk-cube-grid");

  for (int i = 1; i <= 9; i++) {
    FlowPanel child = new FlowPanel();
    child.addStyleName("sk-cube sk-cube" + i);
    flowPanel.add(child);
  }

  FlowPanel container = GwtUIUtil.fillAndReturn(new FlowPanel());
  container.getElement().getStyle().setProperty("display", "flex");
  container.getElement().getStyle().setProperty("justifyContent", "center");

  flowPanel.getElement().getStyle().setProperty("alignSelf", "center");
  container.add(flowPanel);
  return container;
}
 
Example 4
Source Project: core   File: Wizard.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
public Footer() {
    cancel = new DefaultButton(CONSTANTS.common_label_cancel());
    cancel.addClickHandler(clickEvent -> onCancel());
    cancel.addStyleName("wizard-cancel");
    IdHelper.setId(cancel, id(), "cancel");

    back = new DefaultButton(CONSTANTS.wizard_back());
    back.addClickHandler(clickEvent -> onBack());
    IdHelper.setId(back, id(), "back");

    next = new DefaultButton(CONSTANTS.common_label_next());
    next.addClickHandler(clickEvent -> onNext());
    next.addStyleName("primary");
    IdHelper.setId(next, id(), "next");

    panel = new FlowPanel();
    panel.addStyleName("wizard-footer");
    panel.add(cancel);
    panel.add(back);
    panel.add(next);
}
 
Example 5
/**
 * Creates the GUI components for a regular app tab.
 * This method resides here because it needs access to global variables.
 * @param container: the FlowPanel that this app tab will reside.
 * @param content: the sub-panel that contains the actual app content.
 */
private void addGalleryAppTab(FlowPanel container, FlowPanel content, final String incomingUserId) {
  // Search specific
  generalTotalResultsLabel = new Label();
  container.add(generalTotalResultsLabel);

  final OdeAsyncCallback<GalleryAppListResult> byAuthorCallback = new OdeAsyncCallback<GalleryAppListResult>(
    // failure message
    MESSAGES.galleryError()) {
    @Override
    public void onSuccess(GalleryAppListResult appsResult) {
      refreshApps(appsResult,false);
    }
  };
  Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
  container.add(content);

  buttonNext = new Label();
  buttonNext.setText(MESSAGES.galleryMoreApps());
  buttonNext.addStyleName("active");

  FlowPanel next = new FlowPanel();
  next.add(buttonNext);
  next.addStyleName("gallery-nav-next");
  container.add(next);
  buttonNext.addClickHandler(new ClickHandler() {
    //  @Override
    public void onClick(ClickEvent event) {
       if (!appCatalogExhausted) {
            // If the next page still has apps to retrieve, do it
            appCatalogCounter += NUMAPPSTOSHOW;
            Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
          }
    }
  });
}
 
Example 6
Source Project: vaadin-grid-util   File: VButtonValueRenderer.java    License: MIT License 5 votes vote down vote up
/**
 * dirty hack - before we fire onClick we keep last clicked button because of the lost of RelativeElement during converting and the
 * issue of different layouts
 */
@Override
public FlowPanel createWidget() {
	FlowPanel buttonBar = GWT.create(FlowPanel.class);
	buttonBar.setStylePrimaryName("v-button-bar");

	int buttonsAdded = 0;
	if ((this.buttonBITM & VIEW_BITM) != 0) {
		buttonBar.add(genButton(VIEW_BITM));
		buttonsAdded++;
	}
	if ((this.buttonBITM & EDIT_BITM) != 0) {
		buttonBar.add(genButton(EDIT_BITM));
		buttonsAdded++;
	}
	if ((this.buttonBITM & DELETE_BITM) != 0) {
		buttonBar.add(genButton(DELETE_BITM));
		buttonsAdded++;
	}

	FlowPanel panel = GWT.create(FlowPanel.class);
	panel.setStylePrimaryName(STYLE_NAME);
	if (buttonsAdded == 3) {
		panel.addStyleName("three-buttons");
	} else if (buttonsAdded == 2) {
		panel.addStyleName("two-buttons");
	} else {
		panel.addStyleName("one-button");
	}
	panel.add(buttonBar);

	HTML valueLabel = GWT.create(HTML.class);
	valueLabel.setStylePrimaryName("v-cell-value");
	panel.add(valueLabel);
	return panel;
}
 
Example 7
public StreamingProgress(final LogStore logStore, int timeout) {
    super(false, true);
    this.timeout = timeout;

    setWidth(WIDTH + "px");
    setHeight(HEIGHT + "px");
    setGlassEnabled(true);
    setId(getElement(), WINDOW, BASE_ID, "stream_in_progress");
    setStyleName("default-window");

    FlowPanel content = new FlowPanel();
    content.addStyleName("stream-log-file-pending");
    content.add(new Pending(Console.CONSTANTS.downloadInProgress()));
    cancel = new Button(Console.CONSTANTS.common_label_cancel());
    setId(cancel.getElement(), BUTTON, BASE_ID, "cancel_stream");
    cancel.addStyleName("cancel");
    cancel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            PendingStreamingRequest request = logStore.getPendingStreamingRequest();
            if (request != null) {
                request.cancel();
                done();
            }
        }
    });
    content.add(cancel);
    setWidget(content);
}
 
Example 8
/**
 * Creates a new GalleryList
 */
public GalleryList() {

  gallery = GalleryClient.getInstance();
  gallery.addListener(this);
  galleryGF = new GalleryGuiFactory();

  selectedApps = new ArrayList<GalleryApp>();

  // Initialize UI
  galleryGUI = new FlowPanel();
  galleryGUI.addStyleName("gallery");
  appTabs = new TabPanel();
  appRecent = new FlowPanel();
  appFeatured = new FlowPanel();
  appPopular = new FlowPanel();
  appSearch = new FlowPanel();
  appTutorial = new FlowPanel();
  appRecentContent = new FlowPanel();
  appFeaturedContent = new FlowPanel();
  appPopularContent = new FlowPanel();
  appSearchContent = new FlowPanel();
  appTutorialContent = new FlowPanel();
  searchText = new TextBox();

  // HTML segment for gallery typeface
  HTML headerExtra = new HTML(
      "<link href='http://fonts.googleapis.com/css?" +
      "family=Roboto:400,300,100' rel='stylesheet' type='text/css'>");
  galleryGUI.add(headerExtra);

  // Add content to panels
  appFeaturedTab = new GalleryAppTab(appFeatured, appFeaturedContent, REQUEST_FEATURED);
  appRecentTab = new GalleryAppTab(appRecent, appRecentContent, REQUEST_RECENT);
  appSearchTab = new GalleryAppTab(appSearch, appSearchContent, REQUEST_SEARCH);
  appPopularTab = new GalleryAppTab(appPopular, appPopularContent, REQUEST_MOSTLIKED);
  appTutorialTab = new GalleryAppTab(appTutorial, appTutorialContent, REQUEST_TUTORIAL);
  // don't think we need because in regular addgallerytab below

  // Add panels to main tabPanel
  appTabs.add(appRecent, "Recent");
  appTabs.add(appTutorial,"Tutorials");
  appTabs.add(appFeatured, "Featured");
  appTabs.add(appPopular, "Popular");
  appTabs.add(appSearch, "Search");
  appTabs.selectTab(0);
  appTabs.addStyleName("gallery-app-tabs");
  galleryGUI.add(appTabs);

  // Initialize top-level GUI
  VerticalPanel panel = new VerticalPanel();
  panel.setWidth("100%");
  panel.add(galleryGUI);

  initWidget(panel);
}
 
Example 9
/**
 * Creates list of comments in the app page.
 * @param comments: list of returned gallery comments from callback.
 * @param container: the GUI panel where comments will reside.
 */
public void generateAppPageComments(List<GalleryComment> comments, FlowPanel container) {
  container.clear();  // so don't show previous listing
  if (comments == null) {
    Label noComments = new Label("This app does not have any comments yet.");
    noComments.addStyleName("comment-nope");
    container.add(noComments);
    return;
  }

  for ( GalleryComment c : comments) {
    FlowPanel commentItem = new FlowPanel();
    FlowPanel commentPerson = new FlowPanel();
    FlowPanel commentMeta = new FlowPanel();
    FlowPanel commentContent = new FlowPanel();

    // Add commentPerson, default avatar for now
    Image cPerson = new Image();
    cPerson.setUrl(PERSON_URL);
    commentPerson.add(cPerson);
    commentPerson.addStyleName("comment-person");
    commentItem.add(commentPerson);

    // Add commentContent
    Label cAuthor = new Label(c.getUserName());
    cAuthor.addStyleName("comment-author");
    commentMeta.add(cAuthor);

    Date commentDate = new Date(c.getTimeStamp());
    DateTimeFormat dateFormat = DateTimeFormat.getFormat("yyyy/MM/dd hh:mm:ss a");
    Label cDate = new Label(" on " + dateFormat.format(commentDate));
    cDate.addStyleName("comment-date");
    commentMeta.add(cDate);

    commentMeta.addStyleName("comment-meta");
    commentContent.add(commentMeta);

    Label cText = new Label(c.getComment());
    cText.addStyleName("comment-text");
    commentContent.add(cText);

    commentContent.addStyleName("comment-content");
    commentItem.add(commentContent);

    commentItem.addStyleName("comment-item");
    commentItem.addStyleName("clearfix");
    container.add(commentItem);
  }
}