List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setVerticalAlignment
public void setVerticalAlignment(VerticalAlignmentConstant align)
From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.SkyAtmosphere.java
License:Apache License
@Override public void buildPanel() { _csVPanel = new ViewerPanel(); Camera camera = _csVPanel.getViewer().camera; ViewOptions viewOptions = new ViewOptions(); viewOptions.destinationPos = Cartesian3.fromDegrees(-75.5847, 40.0397, 1000.0); viewOptions.orientation = new HeadingPitchRoll(-Math.PI_OVER_TWO(), 0.2, 0.0); camera.setView(viewOptions);//from w w w . ja v a 2s .c o m HorizontalPanel hueShiftHPanel = new HorizontalPanel(); hueShiftHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); hueShiftHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hueShiftHPanel.setSpacing(10); _hueShiftSlider = new Slider("hueShift", -100, 100, 0); _hueShiftSlider.setStep(1); _hueShiftSlider.setWidth("150px"); _hueShiftSlider.addListener(new MSliderListener()); _hueShiftTBox = new TextBox(); _hueShiftTBox.addChangeHandler(new MChangeHandler()); _hueShiftTBox.setText("0"); _hueShiftTBox.setSize("30px", "12px"); hueShiftHPanel.add(_hueShiftSlider); hueShiftHPanel.add(_hueShiftTBox); HorizontalPanel saturationShiftHPanel = new HorizontalPanel(); saturationShiftHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); saturationShiftHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); saturationShiftHPanel.setSpacing(10); _saturationShiftSlider = new Slider("saturationShift", -100, 100, 0); _saturationShiftSlider.setStep(1); _saturationShiftSlider.setWidth("150px"); _saturationShiftSlider.addListener(new MSliderListener()); _saturationShiftTBox = new TextBox(); _saturationShiftTBox.addChangeHandler(new MChangeHandler()); _saturationShiftTBox.setText("0"); _saturationShiftTBox.setSize("30px", "12px"); saturationShiftHPanel.add(_saturationShiftSlider); saturationShiftHPanel.add(_saturationShiftTBox); HorizontalPanel brightnessShiftHPanel = new HorizontalPanel(); brightnessShiftHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); brightnessShiftHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); brightnessShiftHPanel.setSpacing(10); _brightnessShiftSlider = new Slider("brightnessShift", -100, 100, 0); _brightnessShiftSlider.setStep(1); _brightnessShiftSlider.setWidth("150px"); _brightnessShiftSlider.addListener(new MSliderListener()); _brightnessShiftTBox = new TextBox(); _brightnessShiftTBox.addChangeHandler(new MChangeHandler()); _brightnessShiftTBox.setText("0"); _brightnessShiftTBox.setSize("30px", "12px"); brightnessShiftHPanel.add(_brightnessShiftSlider); brightnessShiftHPanel.add(_brightnessShiftTBox); CheckBox lightingCBox = new CheckBox(); lightingCBox.setWidth("100px"); lightingCBox.setValue(true); lightingCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) { _csVPanel.getViewer() .scene().globe.enableLighting = !_csVPanel.getViewer().scene().globe.enableLighting; } }); CheckBox fogCBox = new CheckBox(); fogCBox.setWidth("100px"); fogCBox.setValue(true); fogCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) { _csVPanel.getViewer().scene().fog.enabled = !_csVPanel.getViewer().scene().fog.enabled; } }); FlexTable flexTable = new FlexTable(); flexTable.setHTML(1, 0, "<font color=\"white\">hueShift</font>"); flexTable.setWidget(1, 1, hueShiftHPanel); flexTable.setHTML(2, 0, "<font color=\"white\">saturationShift</font>"); flexTable.setWidget(2, 1, saturationShiftHPanel); flexTable.setHTML(3, 0, "<font color=\"white\">brightnessShift</font>"); flexTable.setWidget(3, 1, brightnessShiftHPanel); flexTable.setHTML(4, 0, "<font color=\"white\">Toggle Lighting</font>"); flexTable.setWidget(4, 1, lightingCBox); flexTable.setHTML(5, 0, "<font color=\"white\">Toggle Fog</font>"); flexTable.setWidget(5, 1, fogCBox); AbsolutePanel aPanel = new AbsolutePanel(); aPanel.add(_csVPanel); aPanel.add(flexTable, 20, 20); contentPanel.add(new HTML("<p>Adjust hue, saturation, and brightness of the sky/atmosphere.</p>")); contentPanel.add(aPanel); initWidget(contentPanel); }
From source file:org.cruxframework.crux.widgets.client.scrollbanner.ScrollBanner.java
License:Apache License
/** * Default constructor// w w w.j av a2 s . co m */ public ScrollBanner() { HorizontalPanel basePanel = new HorizontalPanel(); basePanel.setStyleName(DEFAULT_STYLE_NAME); basePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); messagesLabel = new Label(" "); messagesLabel.setStyleName("message"); messagesLabel.getElement().getStyle().setProperty("overflow", "hidden"); HorizontalPanel verticalCenteringPanel = createMessageVerticalCenteringPanel(); SimplePanel overflowHiddenPanel = createMessageOverflowHiddenPanel(verticalCenteringPanel); basePanel.add(overflowHiddenPanel); basePanel.setCellHorizontalAlignment(overflowHiddenPanel, HasHorizontalAlignment.ALIGN_CENTER); basePanel.setCellVerticalAlignment(overflowHiddenPanel, HasVerticalAlignment.ALIGN_MIDDLE); VerticalPanel controllersPanel = createScrollingControlPanel(); basePanel.add(controllersPanel); basePanel.setCellWidth(controllersPanel, "30"); basePanel.setCellHorizontalAlignment(controllersPanel, HasHorizontalAlignment.ALIGN_RIGHT); basePanel.getElement().getStyle().setProperty("tableLayout", "fixed"); initWidget(basePanel); }
From source file:org.cruxframework.crux.widgets.client.scrollbanner.ScrollBanner.java
License:Apache License
/** * Creates a panel for vertical centering short texts. * @return//from w w w .ja v a2 s. c om */ private HorizontalPanel createMessageVerticalCenteringPanel() { HorizontalPanel verticalCenteringPanel = new HorizontalPanel(); verticalCenteringPanel.setHeight("100%"); verticalCenteringPanel.setWidth("100%"); verticalCenteringPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalCenteringPanel.add(messagesLabel); return verticalCenteringPanel; }
From source file:org.dashbuilder.renderer.google.client.GoogleTableDisplayerView.java
License:Apache License
protected HorizontalPanel createTablePager() { HorizontalPanel pagerPanel = new HorizontalPanel(); pagerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); pagerPanel.getElement().setAttribute("cellpadding", "5"); Pagination pagination = new Pagination(); pagination.setPaginationSize(PaginationSize.NONE); for (int i = leftMostPageNumber; i <= rightMostPageNumber; i++) { AnchorListItem pageLink = new AnchorListItem(Integer.toString(i)); final Integer _currentPage = i; if (currentPage != i) { pageLink.setActive(false);// w w w .ja va2 s .c om pageLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { getPresenter().gotoPage(_currentPage.intValue()); } }); } else { pageLink.setActive(true); } pagination.add(pageLink); } Icon leftPageIcon = new Icon(IconType.ANGLE_LEFT); leftPageIcon.setSize(IconSize.LARGE); leftPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); leftPageIcon.sinkEvents(Event.ONCLICK); leftPageIcon.addHandler(createGotoPageHandler(currentPage - 1), ClickEvent.getType()); Tooltip leftPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoPreviousPage()); leftPageTooltip.add(leftPageIcon); Icon rightPageIcon = new Icon(IconType.ANGLE_RIGHT); rightPageIcon.setSize(IconSize.LARGE); rightPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); rightPageIcon.sinkEvents(Event.ONCLICK); rightPageIcon.addHandler(createGotoPageHandler(currentPage + 1), ClickEvent.getType()); Tooltip rightPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoNextPage()); rightPageTooltip.add(rightPageIcon); Icon firstPageIcon = new Icon(IconType.ANGLE_DOUBLE_LEFT); firstPageIcon.setSize(IconSize.LARGE); firstPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); firstPageIcon.sinkEvents(Event.ONCLICK); firstPageIcon.addHandler(createGotoPageHandler(1), ClickEvent.getType()); Tooltip firstPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoFirstPage()); firstPageTooltip.add(firstPageIcon); Icon lastPageIcon = new Icon(IconType.ANGLE_DOUBLE_RIGHT); lastPageIcon.setSize(IconSize.LARGE); lastPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); lastPageIcon.sinkEvents(Event.ONCLICK); lastPageIcon.addHandler(createGotoPageHandler(totalPages), ClickEvent.getType()); Tooltip lastPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoLastPage()); lastPageTooltip.add(lastPageIcon); pagerPanel.add(firstPageTooltip); pagerPanel.add(leftPageTooltip); pagerPanel.add(pagination); pagerPanel.add(rightPageTooltip); pagerPanel.add(lastPageTooltip); if (totalPagesHintEnabled) { pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_pages( Integer.toString(leftMostPageNumber), Integer.toString(rightMostPageNumber), Integer.toString(totalPages)))); } if (totalRowsHintEnabled) { int currentRowsShown = currentPage * pageSize > totalRows ? totalRows : currentPage * pageSize; pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_rows( Integer.toString(((currentPage - 1) * pageSize) + 1), Integer.toString(currentRowsShown), Integer.toString(totalRows)))); } return pagerPanel; }
From source file:org.dataconservancy.dcs.access.client.upload.MetadataSetEditor.java
License:Apache License
public MetadataSetEditor() { this.stack = new DecoratedStackPanel(); VerticalPanel panel = new VerticalPanel(); panel.add(stack);//ww w .j av a 2 s . c om final TextBox schema = new TextBox(); Button add = new Button("Add"); Button remove = new Button("Remove"); HorizontalPanel hp = new HorizontalPanel(); hp.add(new Label("Schema:")); hp.add(schema); hp.add(add); hp.add(remove); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); hp.setSpacing(5); panel.add(hp); add.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { String s = schema.getText().trim(); if (s.length() > 0) { stack.add(new MetadataEditor(s), s); stack.showStack(stack.getWidgetCount() - 1); } } }); remove.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { int i = stack.getSelectedIndex(); if (i != -1) { stack.remove(i); if (stack.getWidgetCount() > 0) { stack.showStack(0); } } } }); initWidget(panel); }
From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.ConstraintValueEditor.java
License:Apache License
private Panel widgets(Widget left, Widget right) { HorizontalPanel panel = new HorizontalPanel(); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); panel.add(left);/* w ww.jav a 2 s . c o m*/ panel.add(right); panel.setWidth("100%"); return panel; }
From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.factPattern.Connectives.java
License:Apache License
public Widget connectives(SingleFieldConstraint c, String factClass) { HorizontalPanel hp = new HorizontalPanel(); if (c.connectives != null && c.connectives.length > 0) { hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); for (int i = 0; i < c.connectives.length; i++) { ConnectiveConstraint con = c.connectives[i]; hp.add(connectiveOperatorDropDown(con)); hp.add(connectiveValueEditor(con)); if (!isReadOnly) { Image clear = DroolsGuvnorImages.INSTANCE.DeleteItemSmall(); clear.setAltText(Constants.INSTANCE.RemoveThisRestriction()); clear.setTitle(Constants.INSTANCE.RemoveThisRestriction()); clear.addClickHandler(createClickHandlerForClearImageButton(c, i)); hp.add(clear);//ww w.j a va 2 s . co m } } } return hp; }
From source file:org.drools.guvnor.client.decisiontable.GuidedDecisionTableWidget.java
License:Apache License
private void refreshAttributeWidget() { this.attributeConfigWidget.clear(); if (guidedDecisionTable.getMetadataCols().size() > 0) { HorizontalPanel hp = new HorizontalPanel(); hp.add(new HTML(" ")); hp.add(new SmallLabel(Constants.INSTANCE.Metadata1())); attributeConfigWidget.add(hp);// ww w. jav a 2 s . co m } for (MetadataCol52 atc : guidedDecisionTable.getMetadataCols()) { HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.add(new HTML(" ")); if (!isReadOnly) { hp.add(removeMeta(atc)); } final SmallLabel label = makeColumnLabel(atc); hp.add(label); final MetadataCol52 at = atc; final CheckBox hide = new CheckBox(Constants.INSTANCE.HideThisColumn()); hide.setStyleName("form-field"); hide.setValue(atc.isHideColumn()); hide.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setHideColumn(hide.getValue()); dtable.setColumnVisibility(at, !at.isHideColumn()); setColumnLabelStyleWhenHidden(label, hide.getValue()); } }); hp.add(new HTML(" ")); hp.add(hide); attributeConfigWidget.add(hp); } if (guidedDecisionTable.getAttributeCols().size() > 0) { HorizontalPanel hp = new HorizontalPanel(); hp.add(new HTML(" ")); hp.add(new SmallLabel(Constants.INSTANCE.Attributes())); attributeConfigWidget.add(hp); } for (AttributeCol52 atc : guidedDecisionTable.getAttributeCols()) { final AttributeCol52 at = atc; HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.add(new HTML(" ")); if (!isReadOnly) { hp.add(removeAttr(at)); } final SmallLabel label = makeColumnLabel(atc); hp.add(label); final TextBox defaultValue = new TextBox(); final DTCellValue52 dcv = at.getDefaultValue(); defaultValue.setStyleName("form-field"); defaultValue.setText((dcv == null ? "" : dcv.getStringValue())); defaultValue.setEnabled(!isReadOnly); defaultValue.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { at.setDefaultValue(new DTCellValue52(defaultValue.getText())); } }); if (at.getAttribute().equals(RuleAttributeWidget.SALIENCE_ATTR)) { hp.add(new HTML(" ")); final CheckBox useRowNumber = new CheckBox(Constants.INSTANCE.UseRowNumber()); useRowNumber.setStyleName("form-field"); useRowNumber.setValue(at.isUseRowNumber()); useRowNumber.setEnabled(!isReadOnly); hp.add(useRowNumber); hp.add(new SmallLabel("(")); final CheckBox reverseOrder = new CheckBox(Constants.INSTANCE.ReverseOrder()); reverseOrder.setStyleName("form-field"); reverseOrder.setValue(at.isReverseOrder()); reverseOrder.setEnabled(at.isUseRowNumber() && !isReadOnly); useRowNumber.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setUseRowNumber(useRowNumber.getValue()); reverseOrder.setEnabled(useRowNumber.getValue()); dtable.updateSystemControlledColumnValues(); } }); reverseOrder.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setReverseOrder(reverseOrder.getValue()); dtable.updateSystemControlledColumnValues(); } }); hp.add(reverseOrder); hp.add(new SmallLabel(")")); } hp.add(new HTML(" ")); hp.add(new SmallLabel(Constants.INSTANCE.DefaultValue())); hp.add(defaultValue); final CheckBox hide = new CheckBox(Constants.INSTANCE.HideThisColumn()); hide.setStyleName("form-field"); hide.setValue(at.isHideColumn()); hide.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { at.setHideColumn(hide.getValue()); dtable.setColumnVisibility(at, !at.isHideColumn()); setColumnLabelStyleWhenHidden(label, hide.getValue()); } }); hp.add(new HTML(" ")); hp.add(hide); attributeConfigWidget.add(hp); setupColumnsNote(); } }
From source file:org.drools.guvnor.client.widgets.tables.GuvnorSimplePager.java
License:Apache License
/** * Construct a {@link SimplePager} with the specified resources. * //from ww w . ja va2s . c o m * @param location * the location of the text relative to the buttons * @param resources * the {@link org.drools.guvnor.client.resources.GuvnorSimplePagerResources} to use * @param showFastForwardButton * if true, show a fast-forward button that advances by a larger * increment than a single page * @param fastForwardRows * the number of rows to jump when fast forwarding * @param showLastPageButton * if true, show a button to go the the last page */ public GuvnorSimplePager(TextLocation location, GuvnorSimplePagerResources resources, boolean showFastForwardButton, final int fastForwardRows, boolean showLastPageButton) { this.resources = resources; this.fastForwardRows = fastForwardRows; this.style = resources.simplePagerStyle(); this.style.ensureInjected(); // Create the buttons. String disabledStyle = style.disabledButton(); firstPage = new ImageButton(resources.simplePagerFirstPage(), resources.simplePagerFirstPageDisabled(), disabledStyle); firstPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { firstPage(); } }); nextPage = new ImageButton(resources.simplePagerNextPage(), resources.simplePagerNextPageDisabled(), disabledStyle); nextPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { nextPage(); } }); prevPage = new ImageButton(resources.simplePagerPreviousPage(), resources.simplePagerPreviousPageDisabled(), disabledStyle); prevPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { previousPage(); } }); if (showLastPageButton) { lastPage = new ImageButton(resources.simplePagerLastPage(), resources.simplePagerLastPageDisabled(), disabledStyle); lastPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { lastPage(); } }); } else { lastPage = null; } if (showFastForwardButton) { fastForward = new ImageButton(resources.simplePagerFastForward(), resources.simplePagerFastForwardDisabled(), disabledStyle); fastForward.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(getPage() + getFastForwardPages()); } }); } else { fastForward = null; } // Construct the widget. HorizontalPanel layout = new HorizontalPanel(); layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); initWidget(layout); if (location == TextLocation.RIGHT) { layout.add(label); } layout.add(firstPage); layout.add(prevPage); if (location == TextLocation.CENTER) { layout.add(label); } layout.add(nextPage); if (showFastForwardButton) { layout.add(fastForward); } if (showLastPageButton) { layout.add(lastPage); } if (location == TextLocation.LEFT) { layout.add(label); } // Add style names to the cells. firstPage.getElement().getParentElement().addClassName(style.button()); prevPage.getElement().getParentElement().addClassName(style.button()); label.getElement().getParentElement().addClassName(style.pageDetails()); nextPage.getElement().getParentElement().addClassName(style.button()); if (showFastForwardButton) { fastForward.getElement().getParentElement().addClassName(style.button()); } if (showLastPageButton) { lastPage.getElement().getParentElement().addClassName(style.button()); } // Disable the buttons by default. setDisplay(null); }
From source file:org.drools.workbench.screens.guided.dtable.client.editor.page.ColumnsPagePresenter.java
License:Apache License
HorizontalPanel makeMetaDataWidget(final GuidedDecisionTableModellerView.Presenter modeller, final MetadataCol52 metaDataColumn) { final HorizontalPanel horizontalPanel = makeHorizontalPanel(); final ColumnLabelWidget label = makeColumnLabel(metaDataColumn); final boolean isEditable = modeller.isActiveDecisionTableEditable(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.add(label);//w ww . j a v a 2 s .com horizontalPanel.add(hideColumnCheckBox(modeller, metaDataColumn)); if (isEditable) { horizontalPanel.add(deleteMetaDataColumnAnchor(modeller, metaDataColumn)); } return horizontalPanel; }