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

The following examples show how to use com.google.gwt.user.client.ui.VerticalPanel#setHorizontalAlignment() . 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: SimpleNonVisibleComponentsPanel.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Creates new component design panel for non-visible components.
 */
public SimpleNonVisibleComponentsPanel() {
  // Initialize UI
  VerticalPanel panel = new VerticalPanel();
  panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

  heading = new Label("");
  heading.setStyleName("ya-NonVisibleComponentsHeader");
  panel.add(heading);

  componentsPanel = new FlowPanel();
  componentsPanel.setStyleName("ode-SimpleUiDesignerNonVisibleComponents");
  panel.add(componentsPanel);

  initWidget(panel);
}
 
Example 2
Source File: Echoes.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void createLyricsDialog()
{
	lyricsDialog = new DialogBox();
	VerticalPanel vPanel = new VerticalPanel();
	vPanel.setHeight( "100%" );
	vPanel.setHorizontalAlignment( VerticalPanel.ALIGN_CENTER );
	vPanel.setVerticalAlignment( VerticalPanel.ALIGN_MIDDLE );
	lyricsDialog.add( vPanel );
	
	lyrics = new HTML();
	ScrollPanel scrollPanel = new ScrollPanel();
	scrollPanel.setWidth( "300px" );
	scrollPanel.setHeight( "250px" );
	scrollPanel.add( lyrics );
	vPanel.add( scrollPanel );
	
	Button close = new NativeButton( "Close" );
	close.addClickListener( new ClickListener() {
		public void onClick( Widget arg0 ) {
			lyricsDialog.hide();
		}
	} );
	vPanel.add( close );
}
 
Example 3
Source File: StatusPanelWidget.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private void initializeStatusPanel() {
	String comboWidth = "125px";
	statusPanel = new VerticalPanel();
	StyleInjector.inject(".statusPanelStyle { " + "background: #E0ECF8;"
			+ "border-radius: 5px 10px;" + "opacity: 0.8}");
	statusPanel.setStyleName("statusPanelStyle");

	statusPanel.setSpacing(5);
	statusPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

	initializeLayerCombo(comboWidth);
	initializeEpsgCombo(comboWidth);
	initializeStatusGrid();

	statusPanel.add(new FieldLabel(layerCombo, UIMessages.INSTANCE
			.sbSelectLayerLabel()));
	statusPanel.add(new FieldLabel(epsgCombo, UIMessages.INSTANCE
			.sbEpsgLabel()));
	statusPanel.add(statusGrid);

	statusPanel.setVisible(false);
}
 
Example 4
Source File: TemplateUploadWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * The UI consists of a vertical panel that holds a drop-down list box,
 *   a Horizontal panel that holds the templates list (cell list) plus
 *   the selected template. This is inserted in the Wizard dialog.
 *
 * @param templates should never be null
 * @return the main panel for Wizard dialog.
 */
VerticalPanel createUI(final ArrayList<TemplateInfo> templates) {
  VerticalPanel panel = new VerticalPanel();
  panel.setStylePrimaryName("gwt-SimplePanel");
  panel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
  panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

  templatePanel = new HorizontalPanel();
  templatePanel.add(makeTemplateSelector(templates));
  if (templates.size() > 0)
    templatePanel.add(new TemplateWidget(templates.get(0), templateHostUrl));

  templatesMenu = makeTemplatesMenu();

  HorizontalPanel hPanel = new HorizontalPanel();
  hPanel.add(templatesMenu);
  removeButton = new Button("Remove this repository", new ClickHandler() {
      @Override
      public void onClick(ClickEvent arg0) {
        removeCurrentlySelectedRepository();
      }
    });
  removeButton.setVisible(false);
  hPanel.add(removeButton);
  panel.add(hPanel);
  panel.add(templatePanel);
  return panel;
}
 
Example 5
Source File: JoinDataDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private Widget createPanel() {
	final VerticalPanel vPanel = new VerticalPanel();
	vPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);

	vPanel.add(createTabPanel());
	vPanel.add(separatorPanel);
	vPanel.add(loadFileButton);
	vPanel.add(comboPanel);
	vPanel.add(layerAttributeComboPanel);

	return vPanel;
}
 
Example 6
Source File: PreviewFileCommand.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
@Override
public void execute(final ProjectNode node) {
  final DialogBox dialogBox = new DialogBox();
  dialogBox.setText(node.getName());
  dialogBox.setStylePrimaryName("ode-DialogBox");

  //setting position of dialog box
  dialogBox.center();
  dialogBox.setAnimationEnabled(true);

  //button element
  final Button closeButton = new Button(MESSAGES.closeFilePreview());
  closeButton.getElement().setId("closeButton");
  closeButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        dialogBox.hide();
      }
    });

  HorizontalPanel buttonPanel = new HorizontalPanel();
  buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
  buttonPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
  buttonPanel.add(closeButton);

  VerticalPanel dialogPanel = new VerticalPanel();
  dialogPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
  dialogPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);

  Widget filePreview = generateFilePreview(node);
  dialogPanel.clear();
  dialogPanel.add(filePreview);

  dialogPanel.add(buttonPanel);
  dialogPanel.setWidth("300px");

  dialogBox.setGlassEnabled(false);
  dialogBox.setModal(false);

  // Set the contents of the Widget
  dialogBox.setWidget(dialogPanel);
  dialogBox.center();
  dialogBox.show();
}
 
Example 7
Source File: ClientUtils.java    From sc2gears with Apache License 2.0 4 votes vote down vote up
/**
 * Displays a Details dialog box.<br>
 * Renders a table with 2 columns: name and value pairs.
 * @param caption title of the dialog
 * @param values  values to be displayed; each element is an array (name-value pair) which defines a row
 */
public static void displayDetailsDialog( final String caption, final Object[][] values ) {
	final DialogBox dialogBox = new DialogBox( true );
	dialogBox.setText( caption );
	dialogBox.setGlassEnabled( true );
	
	final VerticalPanel content = new VerticalPanel();
	content.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
	
	final FlexTable table = new FlexTable();
	table.setBorderWidth( 1 );
	table.setCellSpacing( 0 );
	table.setCellPadding( 3 );
	
	
	final CellFormatter cellFormatter = table.getCellFormatter();
	for ( int i = 0; i < values.length; i++ ) {
		// Name
		table.setWidget( i, 0, new Label( values[ i ][ 0 ].toString() ) );
		cellFormatter.addStyleName( i, 0, "headerRow" );
		
		final Object value = values[ i ] [ 1 ];
		
		if ( value == null )
			table.setWidget( i, 1, new Label() );
		else if ( value instanceof Widget ) 
			table.setWidget( i, 1, (Widget) value );
		else if ( value instanceof Date )
			table.setWidget( i, 1, createTimestampWidget( (Date) value ) );
		else {
			String stringValue;
			if ( value instanceof String )
				stringValue = (String) value;
			else if ( value instanceof Number )
				stringValue = NUMBER_FORMAT   .format( (Number) value );
			else
				stringValue = value.toString();
			table.setWidget( i, 1, new Label( stringValue ) );
		}
		cellFormatter.addStyleName( i, 1, "row" + ( i & 0x01 ) );
		cellFormatter.setHorizontalAlignment( i, 1, HasHorizontalAlignment.ALIGN_LEFT );
	}
	
	content.add( table );
	
	content.add( createVerticalEmptyWidget( 8 ) );
	content.add( ClientUtils.createDialogCloseButton( dialogBox, "Close" ) );
	content.add( createVerticalEmptyWidget( 8 ) );
	
	dialogBox.setWidget( content );
	
	dialogBox.center();
}