List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE
VerticalAlignmentConstant ALIGN_MIDDLE
To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.
Click Source Link
From source file:org.gwtlib.client.table.ui.PagingBar.java
License:Apache License
protected Widget createPageSizeWidget() { HorizontalPanel panel = new HorizontalPanel(); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); panel.add(new HTML(_messages.pagesize1())); panel.add(new ListBox()); panel.add(new HTML(_messages.pagesize2())); panel.setStylePrimaryName(STYLE_PAGESIZE); return panel; }
From source file:org.gwtopenmaps.demo.openlayers.client.components.ShowcaseTopPanel.java
License:Apache License
@Inject public ShowcaseTopPanel(Image logo, ShowcaseSearchPanel searchPanel) { super.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); super.setStyleName("top"); super.add(logo); super.add(searchPanel); super.setCellWidth(logo, "1px"); }
From source file:org.gwtportlets.portlet.client.edit.EditorManagerControlDialog.java
License:Open Source License
public EditorManagerControlDialog(PageEditor manager) { super(false, false); this.manager = manager; setText("Layout Editor"); setButtonBarVisible(false);/* ww w. j av a 2 s. c o m*/ setMaximizeVisible(false); addStyleName("portlet-ed-control"); levelPanel.setStyleName("portlet-ed-control-level"); leftPanel.setStyleName("portlet-ed-control-left"); message.setStyleName("portlet-ed-control-message"); rightPanel.setStyleName("portlet-ed-control-right"); Grid g = new Grid(1, 1); g.setCellPadding(0); g.setCellSpacing(0); g.setBorderWidth(0); g.setHeight("100%"); g.setWidget(0, 0, message); g.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_MIDDLE); g.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); restoreMessage(); FlowPanel p = new FlowPanel(); p.add(levelPanel); p.add(leftPanel); p.add(rightPanel); p.add(g); setWidget(p); setPixelSize(WIDTH, HEIGHT); }
From source file:org.idwebmail.client.MainEntryPoint.java
private void logout() { IDRequest res = new IDRequest(new IDFunction() { @Override/*from w w w . j av a 2 s. c o m*/ public void execute(Response response) { JSONObject json = (JSONObject) JSONParser.parse(response.getText()); if (getString(json.get("data")).toLowerCase().compareTo("exito") == 0) { verticalPanel.remove(1); verticalPanel.remove(0); verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(acceso); } } }); res.addParam("import", "users.Users.logOut"); res.send(); }
From source file:org.iplantc.de.pipelineBuilder.client.ui.Button.java
License:Apache License
/** * The constructor will create a Button with the specified title and add the listeners to it. Also if the title is very long it will split it up so no more than 70 characters are on a line. * /*from ww w . j a va2 s . co m*/ * @param name * The title to give this button */ public Button(String name) { title = name; setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); //if the text is greater than 70 characters break it down to ensure that each line is less than 70 chars. if (name.length() > 70) { String[] tempName = name.split(" "); String currentName = ""; VerticalPanel namePanel = new VerticalPanel(); int i = 0; for (String on : tempName) { currentName += " " + on; if (currentName.length() >= 70 || i == tempName.length - 1) { Label title = new Label(currentName); title.setStyleName("button-text"); title.setWordWrap(false); namePanel.add(title); currentName = ""; } i++; } add(namePanel); } else { Label title = new Label(name); title.setStyleName("button-text"); title.setWordWrap(false); title.setWidth("100%"); add(title); } //add the style and all the mouse handlers setStyleName("eta-button"); addDomHandler(this, MouseDownEvent.getType()); addDomHandler(this, MouseUpEvent.getType()); addDomHandler(this, ClickEvent.getType()); addDomHandler(this, MouseOutEvent.getType()); addDomHandler(this, MouseOverEvent.getType()); }
From source file:org.iplantc.de.pipelineBuilder.client.ui.MenuButton.java
License:Apache License
public MenuButton(String name) { temp = new HorizontalPanel(); temp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); temp.addStyleName("eta-button"); title = new Label(name); title.setWordWrap(false);//from ww w. j a va 2 s.c o m Label arrow = new Label(); arrow.setStyleName("gbma"); temp.add(title); temp.add(arrow); add(temp); setWidth("1px"); addDomHandler(this, MouseDownEvent.getType()); addDomHandler(this, MouseUpEvent.getType()); addDomHandler(this, ClickEvent.getType()); addDomHandler(this, MouseOutEvent.getType()); addDomHandler(this, MouseOverEvent.getType()); menu = new VerticalPanel(); menu.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); addStyleName("eta-button-menu"); add(menu); menu.setStyleName("sub-menu"); menu.setVisible(false); }
From source file:org.iplantc.de.pipelineBuilder.client.Window.java
License:Apache License
public Window(String title, Widget content) { this.title = new Label(title); this.title.setWordWrap(false); bar = new HorizontalPanel(); bar.setWidth("100%"); bar.setStyleName("window-bar"); modalMask.setStyleName("modal-mask"); VerticalPanel master = new VerticalPanel(); outside = new FlowPanel() { @Override//from w w w. j ava 2 s . c om protected void onLoad() { getElement().getStyle().setLeft( (com.google.gwt.user.client.Window.getClientWidth() / 2) - (getOffsetWidth() / 2), Unit.PX); getElement().getStyle().setTop( (com.google.gwt.user.client.Window.getClientHeight() / 2) - (getOffsetHeight() / 2), Unit.PX); super.onLoad(); } }; com.google.gwt.user.client.Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { outside.getElement().getStyle().setLeft( (com.google.gwt.user.client.Window.getClientWidth() / 2) - (outside.getOffsetWidth() / 2), Unit.PX); outside.getElement().getStyle().setTop( (com.google.gwt.user.client.Window.getClientHeight() / 2) - (outside.getOffsetHeight() / 2), Unit.PX); } }); outside.setStyleName("eta-window"); HorizontalPanel header = new HorizontalPanel(); this.title.addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { isDraging = true; x_start = event.getX(); y_start = event.getY(); } }); moveHandler = new MouseMoveHandler() { @Override public void onMouseMove(MouseMoveEvent event) { if (!isDraging) return; int left = event.getClientX() - x_start; int top = event.getClientY() - y_start; if (left > 0 && left + outside.getOffsetWidth() < com.google.gwt.user.client.Window.getClientWidth()) outside.getElement().getStyle().setLeft(left - 16, Unit.PX); if (top > 0 && top + outside.getOffsetHeight() < com.google.gwt.user.client.Window.getClientHeight()) outside.getElement().getStyle().setTop(top - 16, Unit.PX); } }; modalMask.addMouseMoveHandler(moveHandler); this.title.addMouseMoveHandler(moveHandler); outside.addDomHandler(moveHandler, MouseMoveEvent.getType()); master.addDomHandler(moveHandler, MouseMoveEvent.getType()); this.title.addMouseUpHandler(new MouseUpHandler() { @Override public void onMouseUp(MouseUpEvent event) { isDraging = false; } }); this.title.getElement().getStyle().setCursor(Cursor.MOVE); header.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); header.setHeight("25px"); master.add(header); header.setStyleName("header"); header.add(this.title); Label close = new Label("x"); close.setStyleName("close"); FlowPanel tempContent = new FlowPanel() { @Override protected void onLoad() { super.onLoad(); if (com.google.gwt.user.client.Window.getClientHeight() < getOffsetHeight()) { setHeight(com.google.gwt.user.client.Window.getClientHeight() - 100 + "px"); getElement().getStyle().setOverflow(Overflow.AUTO); } else if (com.google.gwt.user.client.Window.getClientWidth() < getOffsetWidth()) { setWidth(com.google.gwt.user.client.Window.getClientWidth() - 300 + "px"); getElement().getStyle().setOverflow(Overflow.AUTO); } } }; tempContent.getElement().getStyle().setPadding(10, Unit.PX); tempContent.add(content); content.setWidth("100%"); master.add(bar); master.add(tempContent); header.add(close); header.setCellHorizontalAlignment(close, HasHorizontalAlignment.ALIGN_RIGHT); header.setCellWidth(close, "16px"); header.setCellHeight(close, "16px"); header.setWidth("100%"); master.setWidth("100%"); master.setCellHeight(header, "25px"); master.setStyleName("inside"); outside.add(master); close.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { destroy(); } }); }
From source file:org.jboss.errai.bus.client.util.BusErrorDialog.java
License:Apache License
public BusErrorDialog(final ClientMessageBusImpl clientMessageBus) { hide();/*from ww w.j av a2s . c o m*/ setModal(false); final VerticalPanel panel = new VerticalPanel(); final HorizontalPanel titleBar = new HorizontalPanel(); titleBar.getElement().getStyle().setProperty("backgroundColor", "#A9A9A9"); titleBar.getElement().getStyle().setWidth(100, Style.Unit.PCT); titleBar.getElement().getStyle().setProperty("borderBottom", "1px solid black"); titleBar.getElement().getStyle().setProperty("marginBottom", "5px"); final Label titleBarLabel = new Label("An Error Occurred in the Bus"); titleBarLabel.getElement().getStyle().setFontSize(10, Style.Unit.PT); titleBarLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLDER); titleBarLabel.getElement().getStyle().setColor("white"); titleBar.add(titleBarLabel); titleBar.setCellVerticalAlignment(titleBarLabel, HasVerticalAlignment.ALIGN_MIDDLE); final HorizontalPanel buttonPanel = new HorizontalPanel(); final CheckBox showFurtherErrors = new CheckBox(); showFurtherErrors.setValue(showErrors); showFurtherErrors.setText("Show further errors"); showFurtherErrors.getElement().getStyle().setFontSize(10, Style.Unit.PT); showFurtherErrors.getElement().getStyle().setColor("white"); showFurtherErrors.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(final ValueChangeEvent<Boolean> booleanValueChangeEvent) { showErrors = booleanValueChangeEvent.getValue(); } }); final Button disconnectFromServer = new Button("Disconnect Bus"); disconnectFromServer.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { if (Window.confirm( "Are you sure you want to disconnect and de-federate the local bus from the server bus? " + "This will permanently kill your session. You will need to refresh to reconnect. OK will proceed. Click " + "Cancel to abort this operation")) { clientMessageBus.stop(true); } } }); final Button clearErrors = new Button("Clear Log"); clearErrors.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { contentPanel.clear(); } }); final Button closeButton = new Button("Dismiss Error"); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { BusErrorDialog.this.hide(); } }); buttonPanel.add(showFurtherErrors); buttonPanel.add(disconnectFromServer); buttonPanel.add(clearErrors); buttonPanel.add(closeButton); buttonPanel.setCellVerticalAlignment(showFurtherErrors, HasVerticalAlignment.ALIGN_MIDDLE); titleBar.add(buttonPanel); titleBar.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT); panel.add(titleBar); final Style s = panel.getElement().getStyle(); s.setProperty("border", "1px"); s.setProperty("borderStyle", "solid"); s.setProperty("borderColor", "black"); s.setProperty("backgroundColor", "#ede0c3"); resize(); panel.add(contentPanel); add(panel); getElement().getStyle().setZIndex(16777271); }
From source file:org.jboss.errai.workspaces.client.layout.WorkspaceLayout.java
License:Apache License
private Panel createNavigator() { leftPanel.addStyleName("workspace-LeftNavArea"); final HorizontalPanel topNavPanel = new HorizontalPanel(); topNavPanel.setWidth("100%"); topNavPanel.setHeight("20px"); topNavPanel.setStyleName("workspace-NavHeader"); navigationLabel.setStyleName("workspace-NavHeaderText"); topNavPanel.add(navigationLabel);//from ww w . jav a 2s .com final ImageResource collapseLeft = erraiImageBundle.collapseLeft(); final ImageResource collapseRight = erraiImageBundle.collapseRight(); final Image collapseButton = new Image(collapseLeft); collapseButton.setStyleName("workspace-NavCollapseButton"); collapseButton.addClickHandler(new ClickHandler() { private boolean collapse = false; public void onClick(ClickEvent event) { if (!collapse) { Timer timer = new Timer() { int i = navigation.getOffsetWidth(); int step = 10; public void run() { i -= step; setSize(); if (i <= 12) { cancel(); i = 12; setSize(); navigation.setWidth(i + "px"); leftPanel.setArmed(true); collapseNavPanel(); } } private void setSize() { leftPanel.setWidth(i + "px"); leftPanel.setHeight("100%"); } }; timer.scheduleRepeating(10); navigation.setVisible(false); navigationLabel.setVisible(false); collapseButton.setUrl(collapseRight.getURL()); } else { leftPanel.setArmed(false); Timer timer = new Timer() { int i = 12; int step = 1; public void run() { i += step++; setSize(); if (i >= 175) { cancel(); i = 175; setSize(); openNavPanel(); } } private void setSize() { leftPanel.setWidth(i + "px"); leftPanel.setHeight("0"); } }; if (navigation.getOffsetWidth() == 0) timer.scheduleRepeating(20); collapseButton.setUrl(collapseLeft.getURL()); } collapse = !collapse; } }); topNavPanel.add(collapseButton); topNavPanel.setCellWidth(collapseButton, "21px"); topNavPanel.setCellVerticalAlignment(collapseButton, HasVerticalAlignment.ALIGN_MIDDLE); topNavPanel.setCellVerticalAlignment(navigationLabel, HasVerticalAlignment.ALIGN_MIDDLE); leftPanel.add(topNavPanel); leftPanel.setCellHeight(topNavPanel, "23px"); leftPanel.add(navigation); leftPanel.setCellHeight(navigation, "100%"); navigation.setWidth("175px"); leftPanel.setArmed(false); return leftPanel; }
From source file:org.jbpm.console.ng.gc.client.experimental.pagination.JBPMSimplePager.java
License:Apache License
/** * Construct a {@link SimplePager} with the specified resources. * * @param location the location of the text relative to the buttons * @param resources the {@link Resources} 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 * @param imageButtonConstants Constants that contain the image button names *//*from w w w . j a va2s . c o m*/ public JBPMSimplePager(TextLocation location, Resources resources, boolean showFastForwardButton, final int fastForwardRows, boolean showLastPageButton, ImageButtonsConstants imageButtonConstants) { this.resources = resources; this.fastForwardRows = fastForwardRows; this.style = this.resources.simplePagerStyle(); this.style.ensureInjected(); // Create the buttons. firstPage = new Button(); firstPage.setType(ButtonType.LINK); firstPage.setIcon(IconType.FAST_BACKWARD); firstPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { firstPage(); } }); firstPageTooltip = new Tooltip(imageButtonConstants.firstPage()); firstPageTooltip.setWidget(firstPage); firstPageTooltip.setPlacement(tooltipPlacement); firstPageTooltip.setShowDelay(tooltipDelay); nextPage = new Button(); nextPage.setType(ButtonType.LINK); nextPage.setIcon(IconType.STEP_FORWARD); nextPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { nextPage(); } }); nextPageTooltip = new Tooltip(imageButtonConstants.nextPage()); nextPageTooltip.setWidget(nextPage); nextPageTooltip.setPlacement(tooltipPlacement); nextPageTooltip.setShowDelay(tooltipDelay); prevPage = new Button(); prevPage.setType(ButtonType.LINK); prevPage.setIcon(IconType.STEP_BACKWARD); prevPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { previousPage(); } }); prevPageTooltip = new Tooltip(imageButtonConstants.prevPage()); prevPageTooltip.setWidget(prevPage); prevPageTooltip.setPlacement(tooltipPlacement); prevPageTooltip.setShowDelay(tooltipDelay); if (showLastPageButton) { lastPage = new Button(); lastPage.setType(ButtonType.LINK); lastPage.setIcon(IconType.FAST_FORWARD); lastPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { lastPage(); } }); lastPageTooltip = new Tooltip(imageButtonConstants.lastPage()); lastPageTooltip.setWidget(lastPage); lastPageTooltip.setPlacement(tooltipPlacement); lastPageTooltip.setShowDelay(tooltipDelay); } else { lastPage = null; lastPageTooltip = null; } if (showFastForwardButton) { fastForward = new Button(); fastForward.setType(ButtonType.LINK); fastForward.setIcon(IconType.FORWARD); fastForward.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { setPage(getPage() + getFastForwardPages()); } }); fastForwardTooltip = new Tooltip(imageButtonConstants.fastForward()); fastForwardTooltip.setWidget(fastForward); fastForwardTooltip.setPlacement(tooltipPlacement); fastForwardTooltip.setShowDelay(tooltipDelay); } else { fastForward = null; fastForwardTooltip = null; } // Construct the widget. HorizontalPanel layout = new HorizontalPanel(); layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); initWidget(layout); if (location == TextLocation.LEFT) { 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); } layout.add(firstPageTooltip); layout.add(prevPageTooltip); layout.add(nextPageTooltip); if (showFastForwardButton) { layout.add(fastForwardTooltip); } if (showLastPageButton) { layout.add(lastPageTooltip); } if (location == TextLocation.RIGHT) { 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); }