com.google.gwt.user.client.ui.HasHorizontalAlignment Java Examples

The following examples show how to use com.google.gwt.user.client.ui.HasHorizontalAlignment. 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: BasicToolBar.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private void initializew3wPanel() {
	w3wPanel = new HorizontalPanel();
	w3wPanel.setSpacing(5);
	w3wPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	StyleInjector.inject(".w3wPanel { " + "background: #E0ECF8;"
			+ "border-radius: 5px 10px;" + "opacity: 0.8}");
	w3wPanel.setStyleName("w3wPanel");
	w3wPanel.setWidth("415px");

	wordsLabel = new Label();
	w3wAnchor = new AnchorBuilder().setHref("https://what3words.com/")
			.setText(UIMessages.INSTANCE.what3Words())
			.setTitle("https://what3words.com/").build();
	w3wAnchor.getElement().getStyle().setColor("#FF0000");
	w3wAnchor.setVisible(false);
	w3wPanel.add(w3wAnchor);
	w3wPanel.add(wordsLabel);
}
 
Example #2
Source File: MockSwitch.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Draw the SVG graphic of the toggle switch. It can be drawn in either checked or
 * unchecked positions, each with their own colors.
 *
 */
private void paintSwitch() {
  if (isInitialized) {
    panel.remove(switchGraphic);
  } else {
    isInitialized = true;
  }
  switchGraphic = new SVGPanel();
  int switchHeight = 14;  // pixels (Android asset is 28 px at 160 dpi)

  int switchWidth = (int) Math.round(switchHeight * 2);
  switchGraphic.setWidth(switchWidth + "px");
  switchGraphic.setHeight(switchHeight + "px");

  switchGraphic.setInnerSVG("<rect x=\"0\" y=\"0\" rx=\"" +
          switchHeight/2 + "\" yx=\"" + switchWidth/2 + "\" stroke-width=\"1\" stroke=\"black\"" +
          "height=\"" + switchHeight + "\" width=\"" + switchWidth + "\" fill=\"" + (checked? trackColorActive : trackColorInactive) + "\" />" +
          "<circle cx=\"" + (checked? switchWidth - switchHeight/2: switchHeight/2) + "\" fill=\"" + (checked? thumbColorActive : thumbColorInactive) + "\" " +
          "cy=\"" + (switchHeight/2) + "\" r=\"" + (switchHeight/2 - 1) + "\"/>");
  panel.add(switchGraphic);
  panel.setCellWidth(switchGraphic, switchWidth + "px");
  panel.setCellHorizontalAlignment(switchGraphic, HasHorizontalAlignment.ALIGN_RIGHT);
  panel.setCellVerticalAlignment(switchGraphic, HasVerticalAlignment.ALIGN_MIDDLE);
  toggleWidget = panel;
  refreshForm();
}
 
Example #3
Source File: MechanismProviderFilteringSaslServerFilterEditor.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void setupTable() {
    table = new DefaultCellTable<>(5, nameProvider);
    table.setSelectionModel(selectionModel);

    // columns
    Column<ModelNode, String> providerNameColumn = createColumn("provider-name");
    Column<ModelNode, String> mechanismNameColumn = createColumn("mechanism-name");
    Column<ModelNode, String> providerVersionColumn = createColumn("provider-version");
    Column<ModelNode, String> versionComparisonColumn = createColumn("version-comparison");
    providerNameColumn.setSortable(true);
    providerNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mechanismNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    providerVersionColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    versionComparisonColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.addColumn(providerNameColumn, "Provider Name");
    table.addColumn(mechanismNameColumn, "Mechanism Name");
    table.addColumn(providerVersionColumn, "Provider Version");
    table.addColumn(versionComparisonColumn, "Version Comparison");
    table.setColumnWidth(providerNameColumn, 30, Style.Unit.PCT);
    table.setColumnWidth(mechanismNameColumn, 30, Style.Unit.PCT);
    table.setColumnWidth(providerVersionColumn, 20, Style.Unit.PCT);
    table.setColumnWidth(versionComparisonColumn, 20, Style.Unit.PCT);
}
 
Example #4
Source File: SecurityDomainRealmEditor.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void setupTable() {
    table = new DefaultCellTable<>(5);
    table.setSelectionModel(selectionModel);

    // columns
    Column<ModelNode, String> realmColumn = createColumn("realm");
    Column<ModelNode, String> principalTransformColumn = createColumn("principal-transformer");
    Column<ModelNode, String> roleDecoderColumn = createColumn("role-decoder");
    Column<ModelNode, String> roleMapperColumn = createColumn("role-mapper");
    realmColumn.setSortable(true);
    realmColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    principalTransformColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    roleDecoderColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    roleMapperColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.addColumn(realmColumn, "Realm");
    table.addColumn(principalTransformColumn, "Principal Transform");
    table.addColumn(roleDecoderColumn, "Role Decoder");
    table.addColumn(roleMapperColumn, "Role Mapper");
    table.setColumnWidth(realmColumn, 30, Style.Unit.PCT);
    table.setColumnWidth(principalTransformColumn, 30, Style.Unit.PCT);
    table.setColumnWidth(roleDecoderColumn, 20, Style.Unit.PCT);
    table.setColumnWidth(roleMapperColumn, 20, Style.Unit.PCT);
}
 
Example #5
Source File: GwtLabelImplConnector.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
  super.onStateChanged(stateChangeEvent);

  getWidget().setText(getState().caption);

  switch (getState().myHorizontalAlignment) {
    case LEFT:
      getWidget().setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
      break;
    case CENTER:
      getWidget().setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
      break;
    case RIGHT:
      getWidget().setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      break;
  }
}
 
Example #6
Source File: CurriculaTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public HorizontalAlignmentConstant getColumnAlignment(CurriculumColumn column) {
	switch (column) {
	case SELECT:
		return HasHorizontalAlignment.ALIGN_CENTER;
	case LAST_LIKE:
	case PROJECTION:
	case REQUESTED:
	case ENROLLED:
	case SNAPSHOT_REQUESTED:
	case SNAPSHOT_PROJECTION:
	case REGISTERED:
		return HasHorizontalAlignment.ALIGN_RIGHT;
	default:
		return HasHorizontalAlignment.ALIGN_LEFT;
	}
}
 
Example #7
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 #8
Source File: ConstantPermissionMappingEditor.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void setupTable() {
    table = new DefaultCellTable<>(5);
    table.setSelectionModel(selectionModel);

    // columns
    Column<ModelNode, String> classNameColumn = createColumn("class-name");
    Column<ModelNode, String> moduleColumn = createColumn("module");
    Column<ModelNode, String> targetNameColumn = createColumn("target-name");
    Column<ModelNode, String> actionColumn = createColumn("action");
    classNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    moduleColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    targetNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    actionColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.addColumn(classNameColumn, "Class name");
    table.addColumn(moduleColumn, "Module");
    table.addColumn(targetNameColumn, "Target name");
    table.addColumn(actionColumn, "Action");
    table.setColumnWidth(classNameColumn, 40, Style.Unit.PCT);
    table.setColumnWidth(moduleColumn, 20, Style.Unit.PCT);
    table.setColumnWidth(targetNameColumn, 25, Style.Unit.PCT);
    table.setColumnWidth(actionColumn, 15, Style.Unit.PCT);
}
 
Example #9
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 #10
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 #11
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 #12
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 #13
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adding addMessageReceivedRow
 *
 * @param messageReceived
 */
private void addMessageReceivedRow(final GWTMessageReceived messageReceived) {
	int rows = dataTable.getRowCount();
	boolean seen = (messageReceived.getSeenDate() == null);
	dataTable.insertRow(rows);

	// Sets folder object
	data.put(new Integer(dataIndexValue), messageReceived);

	dataTable.setHTML(rows, 0, "");
	dataTable.setHTML(rows, 1, UtilComunicator.getTextAsBoldHTML(messageReceived.getFrom(), seen));
	dataTable.setHTML(
			rows,
			2,
			UtilComunicator.getTextAsBoldHTML(
					GeneralComunicator.i18nExtension("messaging.message.type.message.sent"), seen));
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	dataTable.setHTML(rows, 3, UtilComunicator.getTextAsBoldHTML(dtf.format(messageReceived.getSentDate()), seen));
	dataTable.setHTML(rows, 4, UtilComunicator.getTextAsBoldHTML(messageReceived.getSubject(), seen));
	dataTable.setHTML(rows, 5, "" + (dataIndexValue++));

	// Format
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_CENTER);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasHorizontalAlignment.ALIGN_LEFT);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasHorizontalAlignment.ALIGN_LEFT);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasHorizontalAlignment.ALIGN_CENTER);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 4, HasHorizontalAlignment.ALIGN_LEFT);
	dataTable.getCellFormatter().setVisible(rows, 5, false);

	for (int i = 0; i < 5; i++) {
		dataTable.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect");
	}
}
 
Example #14
Source File: OpenProjectDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private Widget createUrlToShareAnchor() {
	urlPanel = new HorizontalPanel();
	urlPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	urlPanel.setSpacing(1);
	urlToShareAnchor = new AnchorBuilder().build();
	urlPanel.add(urlToShareAnchor);
	Image img = new Image(ImageProvider.INSTANCE.externalLink16());
	urlPanel.add(img);
	urlPanel.setVisible(false);
	return urlPanel;
}
 
Example #15
Source File: Admin.java    From sc2gears with Apache License 2.0 5 votes vote down vote up
@Override
public void onModuleLoad() {
	mainPanel.setWidth( "100%" );
	DOM.setStyleAttribute( mainPanel.getElement(), "marginBottom", "10px" );
	mainPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
	mainPanel.add( ClientUtils.styledWidget( new Label( "Sc2gears™ Database Admin Page" ), "h1" ) );
	menuPanel.add( ClientUtils.createCheckingUserWidget() );
	mainPanel.add( menuPanel );
	RootPanel.get().add( mainPanel );
	
	SERVICE_ASYNC.getUserInfo( new AsyncCallback< RpcResult< UserInfo > >() {
		@Override
		public void onSuccess( final RpcResult< UserInfo > rpcResult ) {
			Admin.userInfo = rpcResult.getValue();
			menuPanel.clear();
			if ( userInfo.getUserName() == null )
				menuPanel.add( new HTML( "You are not logged in. You can login <a href=\"" + userInfo.getLoginUrl() + "\">here</a>." ) );
			else if ( !userInfo.isAdmin() )
				menuPanel.add( new HTML( "You are not authorized to view this page. You can logout <a href=\"" + userInfo.getLogoutUrl() + "\">here</a>." ) );
			else {
				ClientUtils.createAndSetupLogoutLink( "Logout " + userInfo.getUserName(), userInfo.getLogoutUrl() );
				final MenuItem[] MENU_ITEMS = MenuItem.values();
				menu = new Menu( MENU_ITEMS, mainPanel );
				// Too many menu items, menu is too big, make it smaller:
				for ( int i = 0; i < MENU_ITEMS.length; i++ )
					menu.setTabHTML( i, "<span style='font-size:80%'>" + MENU_ITEMS[ i ].label + "</span>" );
				menuPanel.add( menu );
				// Go to home page
				menu.setPage( new HomePage() );
			}
		}
		@Override
		public void onFailure( final Throwable caught ) {
			menuPanel.clear();
			menuPanel.add( new Label( "Failed to reach the server. Try refreshing the page." ) );
		}
	} );
}
 
Example #16
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 #17
Source File: Page.java    From sc2gears with Apache License 2.0 5 votes vote down vote up
/**
   * Creates a new Page.
   * @param title    displayable title of the page; can be <code>null</code>
   * @param pageName page name to be logged
   */
  public Page( final String title, final String pageName ) {
setWidth( "100%" );
setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );

if ( title != null )
	add( ClientUtils.styledWidget( new Label( title ), "h2" ) );

add( infoPanel );

ClientUtils.trackAnalyticsPageView( pageName );
  }
 
Example #18
Source File: SettingsPanel.java    From swcv with MIT License 5 votes vote down vote up
private Widget createLabel(String text)
{
    Label label = new Label(text);
    label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    //label.addStyleName("small");
    return label;
}
 
Example #19
Source File: GeoDataImportDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private Widget createUrlToShareAnchor() {
	urlPanel = new HorizontalPanel();
	urlPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	urlPanel.setSpacing(1);
	urlToShareAnchor = new AnchorBuilder().build();
	urlPanel.add(urlToShareAnchor);
	Image img = new Image(ImageProvider.INSTANCE.externalLink16());
	urlPanel.add(img);
	urlPanel.setVisible(false);
	return urlPanel;
}
 
Example #20
Source File: PlaygroundView.java    From caja with Apache License 2.0 5 votes vote down vote up
private void initFeedbackPanel() {
  playgroundUI.feedbackPanel.setHorizontalAlignment(
      HasHorizontalAlignment.ALIGN_RIGHT);
  for (Menu menu : Menu.values()) {
    Anchor menuItem = new Anchor();
    menuItem.setHTML(menu.description);
    menuItem.setHref(menu.url);
    menuItem.setWordWrap(false);
    menuItem.addStyleName("menuItems");
    playgroundUI.feedbackPanel.add(menuItem);
    playgroundUI.feedbackPanel.setCellWidth(menuItem, "100%");
  }
}
 
Example #21
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adding addMessageSentRow
 *
 * @param messageSent
 */
private void addMessageSentRow(final GWTTextMessageSent messageSent) {
	int rows = dataTable.getRowCount();
	dataTable.insertRow(rows);
	// Sets folder object
	data.put(new Integer(dataIndexValue), messageSent);

	dataTable.setHTML(rows, 0, "");
	dataTable.setHTML(rows, 1, messageSent.getTo());
	dataTable.setHTML(rows, 2, GeneralComunicator.i18nExtension("messaging.message.type.message.sent"));
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	dataTable.setHTML(rows, 3, dtf.format(messageSent.getSentDate()));
	dataTable.setHTML(rows, 4, messageSent.getSubject());
	dataTable.setHTML(rows, 5, "" + (dataIndexValue++));

	// Format
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_CENTER);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasHorizontalAlignment.ALIGN_LEFT);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasHorizontalAlignment.ALIGN_LEFT);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasHorizontalAlignment.ALIGN_CENTER);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 4, HasHorizontalAlignment.ALIGN_LEFT);
	dataTable.getCellFormatter().setVisible(rows, 5, false);

	for (int i = 0; i < 5; i++) {
		dataTable.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect");
	}
}
 
Example #22
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 #23
Source File: SimplePermissionMappingEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void setupTable() {
    table = new DefaultCellTable<>(5);
    table.setSelectionModel(selectionModel);

    // columns
    Column<ModelNode, String> matchAll = createColumn("match-all");
    Column<ModelNode, String> principals = createColumn("principals");
    Column<ModelNode, String> roles = createColumn(ROLES);
    Column<ModelNode, ModelNode> linkOpenDetailsColumn = new Column<ModelNode, ModelNode>(
            new ViewLinkCell<>(Console.CONSTANTS.common_label_view(), this::showDetailModal)) {
        @Override
        public ModelNode getValue(ModelNode node) {
            return node;
        }
    };

    matchAll.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    principals.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    roles.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    linkOpenDetailsColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.addColumn(matchAll, "Match All");
    table.addColumn(principals, "Principals");
    table.addColumn(roles, "Roles");
    table.addColumn(linkOpenDetailsColumn, "Permissions");
    table.setColumnWidth(matchAll, 20, Style.Unit.PCT);
    table.setColumnWidth(principals, 30, Style.Unit.PCT);
    table.setColumnWidth(roles, 30, Style.Unit.PCT);
    table.setColumnWidth(linkOpenDetailsColumn, 20, Style.Unit.PCT);
}
 
Example #24
Source File: LayerCatalogDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private ColumnModel<LayerDef> createColumnList(LayerDefProperties props, 
		RowExpander<LayerDef> rowExpander) {
	
	rowExpander.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	rowExpander.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	
	ColumnConfig<LayerDef, String> nameColumn = new ColumnConfig<LayerDef, String>(
			props.name(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UIMessages.INSTANCE.layerManagerToolText() + "</b>"));
	nameColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, String> typeColumn = new ColumnConfig<LayerDef, String>(
			props.type(), 75, UICatalogMessages.INSTANCE.type());
	typeColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	typeColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, ImageResource> iconColumn = new ColumnConfig<LayerDef, ImageResource>(
			props.icon(), 32, "");
	iconColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	iconColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	iconColumn.setCell(new ImageResourceCell() {
		@Override
		public void render(Context context, ImageResource value, SafeHtmlBuilder sb) {
			super.render(context, value, sb);
		}
	});
			
	List<ColumnConfig<LayerDef, ?>> columns = new ArrayList<ColumnConfig<LayerDef, ?>>();
	columns.add(rowExpander);
	columns.add(iconColumn);		
	columns.add(nameColumn);
	columns.add(typeColumn);		
	
	return new ColumnModel<LayerDef>(columns);
}
 
Example #25
Source File: GenericListComplexAttribute.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void setupTable() {
    table = new DefaultCellTable<>(10);
    table.setSelectionModel(selectionModel);

    // columns
    for (Property propDescription: resourceDescription.get(ATTRIBUTES).asPropertyList()) {
        Column<ModelNode, String> column = createColumn(propDescription.getName());
        column.setSortable(true);
        column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        table.addColumn(column, label(propDescription.getName()));
    };
}
 
Example #26
Source File: SimpleEditPage.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public HorizontalAlignmentConstant getCellAlignment() {
	switch (iField.getType()) {
	case toggle:
		return HasHorizontalAlignment.ALIGN_CENTER;
	case students:
		return HasHorizontalAlignment.ALIGN_RIGHT;
	default:
		return HasHorizontalAlignment.ALIGN_LEFT;
	}
}
 
Example #27
Source File: ClassificationsEdit.java    From unitime with Apache License 2.0 5 votes vote down vote up
public MyCell(CurriculumInterface curriculum, CurriculumClassificationInterface classification) {
	iCurriculum	= curriculum;
	iClasf = classification;
	
	iPanel = new HorizontalPanel();
	
	iTextBox = new UniTimeTextBox(6, ValueBoxBase.TextAlignment.RIGHT);
	iTextBox.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			try {
				if (iTextBox.getText().isEmpty()) {
					iClasf.setExpected(null);
				} else {
					iClasf.setExpected(Integer.valueOf(iTextBox.getText()));
				}
			} catch (Exception e) {
				iClasf.setExpected(null);
			}
			update();
			for (MySumCell sum: iSums)
				sum.update();
		}
	});
	
	iRearLabel = new HTML("", false);
	iRearLabel.setWidth("50px");
	iRearLabel.setStyleName("unitime-Label");
	iRearLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iPanel.add(iTextBox);
	iPanel.setCellVerticalAlignment(iTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
	
	iPanel.add(iRearLabel);
	iPanel.setCellVerticalAlignment(iRearLabel, HasVerticalAlignment.ALIGN_MIDDLE);

	initWidget(iPanel);	
	
	update();
}
 
Example #28
Source File: ClassificationsEdit.java    From unitime with Apache License 2.0 5 votes vote down vote up
public MySumCell(List<MyCell> cells) {
	iCells = cells;
	for (MyCell cell: iCells)
		cell.iSums.add(this);
	
	iPanel = new HorizontalPanel();
	
	iTextBox = new HTML("", false);
	iTextBox.setWidth("60px");
	iTextBox.setStyleName("unitime-Label");
	iTextBox.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iRearLabel = new HTML("", false);
	iRearLabel.setWidth("55px");
	iRearLabel.setStyleName("unitime-Label");
	iRearLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iPanel.add(iTextBox);
	iPanel.setCellVerticalAlignment(iTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
	
	iPanel.add(iRearLabel);
	iPanel.setCellVerticalAlignment(iRearLabel, HasVerticalAlignment.ALIGN_MIDDLE);

	initWidget(iPanel);	
	
	update();
}
 
Example #29
Source File: RoomsTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
protected HorizontalAlignmentConstant getColumnAlignment(RoomsColumn column, int idx) {
	switch (column) {
	case CAPACITY:
	case EXAM_CAPACITY:
	case AREA:
		return HasHorizontalAlignment.ALIGN_RIGHT;
	default:
		return HasHorizontalAlignment.ALIGN_LEFT;
	}
}
 
Example #30
Source File: DataTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public HorizontalAlignmentConstant getCellAlignment() {
	if (iHeader == null || iHeader.getAlignment() == null)
		return HasHorizontalAlignment.ALIGN_LEFT;
	switch (iHeader.getAlignment()) {
	case CENTER: return HasHorizontalAlignment.ALIGN_CENTER;
	case LEFT: return HasHorizontalAlignment.ALIGN_LEFT;
	case RIGHT: return HasHorizontalAlignment.ALIGN_RIGHT;
	default: return HasHorizontalAlignment.ALIGN_LEFT;
	}
}