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

The following examples show how to use com.google.gwt.user.client.ui.HorizontalPanel#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: Toolbar.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes and assembles all commands into buttons in the toolbar.
 */
public Toolbar() {
  buttonMap = new HashMap<String, TextButton>();
  dropDownButtonMap = new HashMap<String, DropDownButton>();

  leftButtons = new HorizontalPanel();
  leftButtons.setSpacing(4);

  rightButtons = new HorizontalPanel();
  rightButtons.setSpacing(4);
  rightButtons.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);

  HorizontalPanel toolbar = new HorizontalPanel();
  toolbar.add(leftButtons);  // this nesting keeps buttons left aligned
  toolbar.add(rightButtons);
  toolbar.setCellHorizontalAlignment(rightButtons, HorizontalPanel.ALIGN_RIGHT);
  toolbar.setWidth("100%");
  toolbar.setStylePrimaryName("ya-Toolbar");

  initWidget(toolbar);
}
 
Example 2
Source File: TopPanel.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
private void addLogo(HorizontalPanel panel) {
  // Logo is a link to App Inv homepage. Add timestamp to logo url
  // to get around browsers that agressively cache the image! This
  // same trick is used in StorageUtil.getFilePath().
  Image logo = new Image(LOGO_IMAGE_URL + "?t=" + System.currentTimeMillis());
  logo.setSize("180px", "40px");
  logo.setStyleName("ode-Logo");
  String logoUrl = ode.getSystemConfig().getLogoUrl();
  if (!Strings.isNullOrEmpty(logoUrl)) {
    logo.addClickHandler(new WindowOpenClickHandler(logoUrl));
  }
  panel.add(logo);
  panel.setCellWidth(logo, "230px");
  panel.setCellHorizontalAlignment(logo, HorizontalPanel.ALIGN_LEFT);
  panel.setCellVerticalAlignment(logo, HorizontalPanel.ALIGN_MIDDLE);
}
 
Example 3
Source File: Status.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The status
 */
public Status() {
	super(false, true);
	hPanel = new HorizontalPanel();
	image = new Image(OKMBundleResources.INSTANCE.indicator());
	msg = new HTML("");
	space = new HTML("");

	hPanel.add(image);
	hPanel.add(msg);
	hPanel.add(space);

	hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
	hPanel.setCellWidth(image, "30px");
	hPanel.setCellWidth(space, "7px");

	hPanel.setHeight("25px");

	msg.setStyleName("okm-NoWrap");

	super.hide();
	setWidget(hPanel);
}
 
Example 4
Source File: Status.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Status
 */
public Status() {
	super(false, true);
	hPanel = new HorizontalPanel();
	image = new Image(OKMBundleResources.INSTANCE.indicator());
	msg = new HTML("");
	space = new HTML("");

	hPanel.add(image);
	hPanel.add(msg);
	hPanel.add(space);

	hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
	hPanel.setCellWidth(image, "30px");
	hPanel.setCellWidth(space, "7px");

	hPanel.setHeight("25px");

	msg.setStyleName("okm-NoWrap");

	super.hide();
	setWidget(hPanel);
}
 
Example 5
Source File: SimplePaletteItem.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new palette item.
 *
 * @param scd component descriptor for palette item
 * @param dropTargetProvider provider of targets that palette items can be dropped on
 */
public SimplePaletteItem(SimpleComponentDescriptor scd, DropTargetProvider dropTargetProvider) {
  this.dropTargetProvider = dropTargetProvider;
  this.scd = scd;

  componentPrototype = null;

  // Initialize palette item UI
  HorizontalPanel panel = new HorizontalPanel();
  panel.setStylePrimaryName("ode-SimplePaletteItem");

  Image image = scd.getImage();
  image.setStylePrimaryName("ode-SimplePaletteItem-icon");
  panel.add(image);
  panel.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_LEFT);
  panel.setCellWidth(image, "30px");

  Label label = new Label(ComponentsTranslation.getComponentName(scd.getName()));
  label.setHorizontalAlignment(Label.ALIGN_LEFT);
  label.addStyleName("ode-SimplePaletteItem-caption");
  panel.add(label);

  HorizontalPanel optPanel = new HorizontalPanel();

  ComponentHelpWidget helpImage = new ComponentHelpWidget(scd);
  optPanel.add(helpImage);
  optPanel.setCellHorizontalAlignment(helpImage, HorizontalPanel.ALIGN_LEFT);

  if (scd.getExternal()) {
    ComponentRemoveWidget deleteImage = new ComponentRemoveWidget(scd);
    optPanel.add(deleteImage);
    optPanel.setCellHorizontalAlignment(deleteImage, HorizontalPanel.ALIGN_RIGHT);
  }

  panel.add(optPanel);
  panel.setCellHorizontalAlignment(optPanel, HorizontalPanel.ALIGN_RIGHT);

  panel.setWidth("100%");
  add(panel);
  setWidth("100%");

  addHandlers();
}
 
Example 6
Source File: HomePage.java    From sc2gears with Apache License 2.0 4 votes vote down vote up
@Override
  public void buildGUI() {
add( ClientUtils.createVerticalEmptyWidget( 30 ) );

final HorizontalPanel greetingsPanel = new HorizontalPanel();
add( greetingsPanel );

if ( sharedApiAccountUserInfo == null ) {
	// Greeting
	if ( apiUserInfo.getLastVisit() == null ) {
		greetingsPanel.add( new Label( "Welcome " ) );
		greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
		greetingsPanel.add( ClientUtils.styledWidget( new Label( apiUserInfo.getUserName() ), "strong" ) );
		greetingsPanel.add( new Label( "!" ) );
	}
	else {
		greetingsPanel.add( new Label( "Welcome back" ) );
		greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
		greetingsPanel.add( ClientUtils.styledWidget( new Label( apiUserInfo.getUserName() ), "strong" ) );
		greetingsPanel.add( new Label( "! Your last visit was at:" ) );
		greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
		greetingsPanel.add( ClientUtils.createTimestampWidget( apiUserInfo.getLastVisit() ) );
	}
}
else {
	if ( sharedApiAccountUserInfo.isHasApiAccount() )
		greetingsPanel.add( new Label( "You are now viewing the" ) );
	else
		greetingsPanel.add( new Label( "You do NOT have access to the" ) );
	greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 9 ) );
	greetingsPanel.add( ClientUtils.styledWidget( new Label( sharedApiAccountUserInfo.getSharedApiAccount() ), "strong" ) );
	greetingsPanel.add( ClientUtils.createHorizontalEmptyWidget( 9 ) );
	greetingsPanel.add( new Label( "API account!" ) );
}

// Replay parser engine version
if ( apiUserInfo.getRepParserEngineVer() != null ) {
	add( ClientUtils.createVerticalEmptyWidget( 30 ) );
	final HorizontalPanel rowPanel = new HorizontalPanel();
	rowPanel.add( new Label( "Replay parser engine version:" ) );
	rowPanel.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
	rowPanel.add( ClientUtils.styledWidget( new Label( apiUserInfo.getRepParserEngineVer() ), "strong" ) );
	add( rowPanel );
}

// Parsing service tester page
add( ClientUtils.createVerticalEmptyWidget( 30 ) );
add( new Anchor( "Parsing Service Tester page", "/parsing_service_tester.html", "_blank" ) );

add( ClientUtils.createVerticalEmptyWidget( 70 ) );

// Footer
final HorizontalPanel linksPanel = new HorizontalPanel();
linksPanel.setWidth( "500px" );
DOM.setStyleAttribute( linksPanel.getElement(), "padding", "2px" );
DOM.setStyleAttribute( linksPanel.getElement(), "borderTop", "1px solid #555555" );
linksPanel.addStyleName( "noWrap" );
linksPanel.add( new Anchor( "About the Service", "https://sites.google.com/site/sc2gears/parsing-service", "_blank" ) );
linksPanel.add( ClientUtils.createHorizontalEmptyWidget( 10 ) );
linksPanel.add( new Anchor( "Terms of Service", "https://sites.google.com/site/sc2gears/parsing-service#TOC-Terms-of-Service", "_blank" ) );
linksPanel.add( ClientUtils.createHorizontalEmptyWidget( 10 ) );
linksPanel.add( new Anchor( "Privacy Policy", "https://sites.google.com/site/sc2gears/parsing-service#TOC-Privacy-Policy", "_blank" ) );
linksPanel.add( ClientUtils.createHorizontalEmptyWidget( 15 ) );
final Label lastLabel = new Label( "© András Belicza, 2011-2014, Icons: Fugue" );
DOM.setStyleAttribute( lastLabel.getElement(), "color", "#555555" );
DOM.setStyleAttribute( lastLabel.getElement(), "paddingTop", "3px" );
linksPanel.add( lastLabel );
linksPanel.setCellWidth( lastLabel, "100%" );
linksPanel.setCellHorizontalAlignment( lastLabel, HasHorizontalAlignment.ALIGN_RIGHT );
for ( int i = linksPanel.getWidgetCount() - 1; i >= 0; i-- )
	DOM.setStyleAttribute( linksPanel.getWidget( i ).getElement(), "fontSize", "80%" );
add( linksPanel );
  }