Java Code Examples for com.google.gwt.user.client.ui.VerticalPanel#setCellHorizontalAlignment()

The following examples show how to use com.google.gwt.user.client.ui.VerticalPanel#setCellHorizontalAlignment() . 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: Icon.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new icon with the specified caption.
 *
 * @param image  image shown on icon (preferably 16 x 16px)
 * @param caption  caption shown below image
 */
public Icon(Image image, String caption) {

  panel = new VerticalPanel() {
    @Override
    public void onBrowserEvent(Event event) {
      Icon.this.onBrowserEvent(event);
    }
  };
  panel.add(image);
  panel.setCellHorizontalAlignment(image, VerticalPanel.ALIGN_CENTER);
  captionLabel = new Label(caption);
  panel.add(captionLabel);

  initWidget(panel);

  setStylePrimaryName("ode-Icon");
}
 
Example 2
Source File: DebugConsolePopup.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Logout popup
 */
public DebugConsolePopup() {
	// Establishes auto-close when click outside
	super(false, false);

	setText(Main.i18n("debug.console.label"));
	vPanel = new VerticalPanel();
	button = new Button(Main.i18n("button.close"), this);
	text = new HTML(Main.i18n("debug.enable.disable"));

	vPanel.add(new HTML("<br>"));
	vPanel.add(text);
	vPanel.add(Log.getLogger(DivLogger.class).getWidget());
	vPanel.add(new HTML("<br>"));
	vPanel.add(button);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER);

	button.setStyleName("okm-YesButton");

	super.hide();
	Log.getLogger(DivLogger.class).getWidget().setVisible(true);
	setWidget(vPanel);
}
 
Example 3
Source File: LogoutPopup.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Logout popup
 */
public LogoutPopup() {
	// Establishes auto-close when click outside
	super(false, true);

	vPanel = new VerticalPanel();
	text = new HTML(Main.i18n("logout.logout"));
	button = new Button(Main.i18n("button.close"), this);

	vPanel.setWidth("250px");
	vPanel.setHeight("100px");

	vPanel.add(new HTML("<br>"));
	vPanel.add(text);
	vPanel.add(new HTML("<br>"));
	vPanel.add(button);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(text, VerticalPanel.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER);

	button.setStyleName("okm-YesButton");

	super.hide();
	setWidget(vPanel);
}
 
Example 4
Source File: WorkflowWidget.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * WorkflowWidget
 */
public WorkflowWidget(String name, String uuid, WorkflowWidgetToFire workflowWidgetToFire, Map<String, Object> workflowVariables) {
	this.name = name;
	this.uuid = uuid;
	this.workflowWidgetToFire = workflowWidgetToFire;
	this.workflowVariables = workflowVariables;
	drawed = false;

	vPanel = new VerticalPanel();
	hPanel = new HorizontalPanel();
	manager = new FormManager(this);

	vPanel.setWidth("300px");
	vPanel.setHeight("50px");

	vPanel.add(new HTML("<br>"));
	vPanel.add(manager.getTable());
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(hPanel, VerticalPanel.ALIGN_CENTER);

	initWidget(vPanel);
}
 
Example 5
Source File: DialogBox.java    From swellrt with Apache License 2.0 6 votes vote down vote up
/**
 * Creates dialog box.
 *
 * @param popup - UniversalPopup on which the dialog is based
 * @param title - title placed in the title bar
 * @param innerWidget - the inner widget of the dialog
 * @param dialogButtons - buttons
 */
static public void create(UniversalPopup popup, String title, Widget innerWidget, DialogButton[] dialogButtons) {
  // Title
  popup.getTitleBar().setTitleText(title);

  VerticalPanel contents = new VerticalPanel();
  popup.add(contents);

  // Message
  contents.add(innerWidget);

  // Buttons
  HorizontalPanel buttonPanel = new HorizontalPanel();
  for(DialogButton dialogButton : dialogButtons) {
    Button button = new Button(dialogButton.getTitle());
    button.setStyleName(Dialog.getCss().dialogButton());
    buttonPanel.add(button);
    dialogButton.link(button);
  }
  contents.add(buttonPanel);
  buttonPanel.setStyleName(Dialog.getCss().dialogButtonPanel());
  contents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);
}
 
Example 6
Source File: AppUtils.java    From swcv with MIT License 6 votes vote down vote up
public static DialogBox createShadow()
{
    final DialogBox box = new DialogBox();
    VerticalPanel rows = new VerticalPanel();
    rows.setSpacing(1);
    HTML html = new HTML("<div></div>");
    rows.add(html);
    rows.addStyleName("blackTransparent");
    rows.setCellHeight(html, "" + Window.getClientHeight());
    rows.setCellWidth(html, "" + Window.getClientWidth());

    rows.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER);
    rows.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_MIDDLE);

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(rows);
    box.setWidget(hp);
    return box;
}
 
Example 7
Source File: AppUtils.java    From swcv with MIT License 6 votes vote down vote up
public static DialogBox createLoadingBox()
{
    final DialogBox box = new DialogBox();
    VerticalPanel rows = new VerticalPanel();
    rows.setSpacing(1);

    HTML html = new HTML("<img src=\"" + GWT.getHostPageBaseURL() + "static/imgs/loader.gif\" alt=\"loading\" />");
    rows.add(html);
    rows.addStyleName("whiteWithBorder");
    rows.setCellHeight(html, "100");
    rows.setCellWidth(html, "300");

    rows.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER);
    rows.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_MIDDLE);

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(rows);
    box.setWidget(hp);
    box.hide();
    return box;
}
 
Example 8
Source File: DialogBox.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
/**
 * Creates dialog box.
 *
 * @param popup - UniversalPopup on which the dialog is based
 * @param title - title placed in the title bar
 * @param innerWidget - the inner widget of the dialog
 * @param dialogButtons - buttons
 */
static public void create(UniversalPopup popup, String title, Widget innerWidget, DialogButton[] dialogButtons) {
  // Title
  popup.getTitleBar().setTitleText(title);

  VerticalPanel contents = new VerticalPanel();
  popup.add(contents);

  // Message
  contents.add(innerWidget);

  // Buttons
  HorizontalPanel buttonPanel = new HorizontalPanel();
  for(DialogButton dialogButton : dialogButtons) {
    Button button = new Button(dialogButton.getTitle());
    button.setStyleName(Dialog.getCss().dialogButton());
    buttonPanel.add(button);
    dialogButton.link(button);
  }
  contents.add(buttonPanel);
  buttonPanel.setStyleName(Dialog.getCss().dialogButtonPanel());
  contents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);
}
 
Example 9
Source File: Box.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a button with a click handler which will execute the given command.
 */
private void addControlButton(VerticalPanel panel, String caption, final Command command) {
  TextButton button = new TextButton(caption);
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      command.execute();
    }
  });
  panel.add(button);
  panel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER);
}
 
Example 10
Source File: AppUtils.java    From swcv with MIT License 5 votes vote down vote up
public static DialogBox createMessageBox(String message, final DialogBox shadow)
{
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox();

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    dialogBox.setWidget(dialogContents);

    // Add an image to the dialog
    HTML html = new HTML(message);
    dialogContents.add(html);
    dialogContents.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER);

    // Add a close button at the bottom of the dialog
    Button closeButton = new Button("Close", new ClickHandler()
    {
        public void onClick(ClickEvent event)
        {
            if (shadow != null)
                shadow.hide();
            dialogBox.hide();
        }
    });

    dialogContents.add(closeButton);
    dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_RIGHT);
    dialogBox.addStyleName("errorBox inconsolataNormal");
    // Return the dialog box
    return dialogBox;
}
 
Example 11
Source File: TopPanel.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
private void addMotd(VerticalPanel panel) {
  MotdBox motdBox = MotdBox.getMotdBox();
  panel.add(motdBox);
  panel.setCellHorizontalAlignment(motdBox, HorizontalPanel.ALIGN_RIGHT);
  panel.setCellVerticalAlignment(motdBox, HorizontalPanel.ALIGN_BOTTOM);
}
 
Example 12
Source File: TabWorkspace.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * TabWorkspace
 */
public TabWorkspace() {
	vPanel = new VerticalPanel();
	iframe = new Frame("about:blank");

	DOM.setElementProperty(iframe.getElement(), "frameborder", "0");
	DOM.setElementProperty(iframe.getElement(), "marginwidth", "0");
	DOM.setElementProperty(iframe.getElement(), "marginheight", "0");

	// Commented because on IE show clear if allowtransparency=true
	DOM.setElementProperty(iframe.getElement(), "allowtransparency", "false");
	DOM.setElementProperty(iframe.getElement(), "scrolling", "auto");

	iframe.setUrl(Main.CONTEXT + "/extra/index.jsp");
	iframe.setStyleName("okm-Iframe");

	vPanel.add(iframe);
	vPanel.setCellHorizontalAlignment(iframe, HasAlignment.ALIGN_CENTER);

	vPanel.setWidth("100%");
	vPanel.setHeight("100%");

	// User workspace values
	if (GeneralComunicator.getWorkspace() == null) {
		timer = new Timer() {
			@Override
			public void run() {
				if (GeneralComunicator.getWorkspace() == null) {
					firstTimeLoadingWorkspace();
				} else {
					init();
				}
			}
		};

		firstTimeLoadingWorkspace();
	} else {
		init();
	}

	initWidget(vPanel);
}