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

The following examples show how to use com.google.gwt.user.client.ui.FlowPanel#add() . 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
public TimeBoxMenu() {
    super(true);
    setStyleName("gwt-TimeBox-menu");
    addAutoHidePartner(textbox.getElement());

    FlowPanel container = new FlowPanel();

    int numOptions = (int) (DAY / INTERVAL);
    options = new TimeBoxMenuOption[numOptions];

    // we need to use times for formatting, but we don't keep
    // them around. the purpose is only to generate text to
    // insert into the textbox.
    for (int i = 0; i < numOptions; i++) {
        options[i] = new TimeBoxMenuOption(i * INTERVAL);
        container.add(options[i]);
    }

    add(container);
}
 
Example 2
@Override
protected Widget asWidget(final Context<T> context) {
    form = context.xa ? new Form<>(XADataSource.class) : new Form<>(DataSource.class);
    TextAreaItem connectionUrl = new TextAreaItem("connectionUrl", "Connection URL");
    NonRequiredTextBoxItem user = new NonRequiredTextBoxItem("username", "Username");
    PasswordBoxItem pass = new PasswordBoxItem("password", "Password") {{
        setRequired(false);
    }};
    NonRequiredTextBoxItem domain = new NonRequiredTextBoxItem("securityDomain", "Security Domain");

    if (context.xa) {
        form.setFields(user, pass, domain);
    } else {
        form.setFields(connectionUrl, user, pass, domain);
    }

    FlowPanel body = new FlowPanel();
    body.add(new FormHelpPanel(context.dataSourceHelp, form).asWidget());
    body.add(form.asWidget());
    return body;
}
 
Example 3
@Override
protected Widget asWidget(final Context context) {
    final FlowPanel panel = new FlowPanel();

    HTML description = new HTML(Console.CONSTANTS.common_label_chooseFile());
    description.getElement().setAttribute("style", "padding-bottom:15px;");
    panel.add(description);

    form = new FormPanel();

    // create a panel to hold all of the form widgets.
    VerticalPanel formPanel = new VerticalPanel();
    form.setWidget(formPanel);

    // create a FileUpload widgets.
    fileUpload = new FileUpload();
    fileUpload.setName("uploadFormElement");
    IdHelper.setId(fileUpload, id(), "file");
    formPanel.add(fileUpload);

    panel.add(form);
    return panel;
}
 
Example 4
@Override
protected Widget asWidget(final HandlerContext context) {
    ComplexAttributeForm fileAttributeForm = new ComplexAttributeForm(
            "file",
            wizard.getSecurityContext(),
            wizard.getResourceDescription()
    );
    formAssets = fileAttributeForm.build();

    FlowPanel layout = new FlowPanel();

    ContentDescription text = new ContentDescription(
            Console.CONSTANTS.logFileDescription());
    layout.add(text);
    layout.add(formAssets.asWidget());
    formAssets.getForm().setEnabled(true);

    return layout;
}
 
Example 5
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 6
SuggestionDisplayImpl() {
	this.suggestionPopup = new PopupPanel(true, false);
	this.suggestionPopup.setPreviewingAllNativeEvents(true);
	StyleUtils.addStyle(this.suggestionPopup, ContentAssistAspect.STYLE_POPUP);
	FlowPanel dropdownContainer = new FlowPanel();
	StyleUtils.addStyle(dropdownContainer, ContentAssistAspect.STYLE_DROPDOWN);
	StyleUtils.addStyle(dropdownContainer, ContentAssistAspect.STYLE_OPEN);
	dropdownContainer.add(this.suggestionsContainer);
	this.suggestionPopup.setWidget(dropdownContainer);
}
 
Example 7
/**
 * load the moderation page, and setect tab index 0
 * For now, only one tab exists
 */
public static void loadModerationPage() {

  INSTANCE.reports = new ReportList();

  FlowPanel reportsContainer = new FlowPanel();
  reportsContainer.add(INSTANCE.reports);

  INSTANCE.add(reportsContainer, MESSAGES.moderationPageBoxCaption());
  INSTANCE.selectTab(0);

  // Styling options
  INSTANCE.addStyleName("gallery");
}
 
Example 8
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 9
@Override
protected Widget asWidget(final Context context) {
    FlowPanel body = new FlowPanel();

    deployNew = new RadioButton("deployment_kind", Console.CONSTANTS.uploadNewDeployment());
    deployNew.addStyleName("radio-block");
    IdHelper.setId(deployNew, id(), "deployNew");
    addDescription(deployNew, Console.CONSTANTS.uploadNewDeploymentDescription());

    deployExisting = new RadioButton("deployment_kind", Console.CONSTANTS.chooseFromContentRepository());
    deployExisting.addStyleName("radio-block");
    IdHelper.setId(deployExisting, id(), "deployExisting");
    addDescription(deployExisting,Console.CONSTANTS.chooseFromContentRepositoryDescription());

    deployUnmanaged = new RadioButton("deployment_kind", Console.CONSTANTS.createUnmanaged());
    deployUnmanaged.addStyleName("radio-block");
    IdHelper.setId(deployUnmanaged, id(), "deployUnmanaged");
    addDescription(deployUnmanaged, Console.CONSTANTS.createUnmanagedDescription());

    if (showDeployNew) {
        body.add(deployNew);
    }
    if (showDeployExisting) {
        body.add(deployExisting);
    }
    if (showDeployUnmanaged) {
        body.add(deployUnmanaged);
    }
    return body;
}
 
Example 10
/**
 * Initialize the Emulator UI
 */
private void initializeUI() {
   // Create textboxes and set default hostname and port
   _hostname = new TextBox();
   _hostname.setText(DEFAULT_HOST);
   _hostname.getElement().setPropertyString("placeholder", "hostname");
   _port = new TextBox();
   _port.setText(String.valueOf(DEFAULT_PORT));
   _port.getElement().setPropertyString("placeholder", "port");

   // Create button to connect
   _button = new Button("Connect");
   // Create the info/status label, initially not visible
   _info = new InlineLabel();
   _info.setVisible(false);

   // register the button action
   _button.addClickHandler(new ClickHandler() {
      public void onClick(final ClickEvent event) {
         final String hostname = _hostname.getText();
         final int port = Integer.valueOf(_port.getText());
         new PortAsyncCallback(hostname, port).execute();
      }
   });
   
   // Create panel for textbox, button and info label
   final FlowPanel div = new FlowPanel();
   div.setStylePrimaryName("emulator-controls");
   _hostname.setStyleName("emulator-hostname");
   _port.setStyleName("emulator-port");
   _button.setStyleName("emulator-connect");
   _info.setStyleName("emulator-info");
   div.add(_hostname);
   div.add(_port);
   div.add(_button);
   div.add(_info);

   // add the controls before the map so that the div doesn't cover the map
   RootLayoutPanel.get().add(div);
}
 
Example 11
@SuppressWarnings("static")
private FlowPanel createComplexWidget() {
  FlowPanel panel = new FlowPanel();
  FlowPanel child = new FlowPanel();
  panel.add(child);
  return panel;
}
 
Example 12
Source Project: appinventor-extensions   File: Ode.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Display a dialog box with a provided warning message.
 *
 * @param message The message to display
 */

public void genericWarning(String inputMessage) {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.warningDialogTitle());
  dialogBox.setHeight("100px");
  dialogBox.setWidth("400px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML("<p>" + inputMessage + "</p>");
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button okButton = new Button("OK");
  okButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
      }
    });
  holder.add(okButton);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.show();
}
 
Example 13
@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 14
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 15
@SuppressWarnings("static")
private FlowPanel createComplexWidget() {
  FlowPanel panel = new FlowPanel();
  FlowPanel child = new FlowPanel();
  panel.add(child);
  return panel;
}
 
Example 16
private void drawObject(final FlowPanel container, final int n, final JSONObject jsonObject) {
  for (final String key : jsonObject.keySet()) {
    container.add(createHeader(n, key));

    final FlowPanel subPanel = new FlowPanel();

    container.add(subPanel);
    subPanel.getElement().getStyle().setProperty("border", "2px solid gray");
    subPanel.getElement().getStyle().setProperty("marginLeft", "4px");
    subPanel.getElement().getStyle().setProperty("padding", "12px");

    display(n + 1, subPanel, jsonObject.get(key));
  }
}
 
Example 17
/**
 * 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);
  }
}
 
Example 18
private void drawNumber(final FlowPanel container, final double doubleValue) {
  container.add(new Label(String.valueOf(doubleValue)));
}
 
Example 19
private void drawNull(final FlowPanel container) {
  container.add(new Label("Null"));
}
 
Example 20
private void drawBoolean(final FlowPanel container, final boolean bool) {
  container.add(new Label(String.valueOf(bool)));
}