List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_BOTTOM
VerticalAlignmentConstant ALIGN_BOTTOM
To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_BOTTOM.
Click Source Link
From source file:app.dnd.drag.DraggableCellDecorator.java
License:Apache License
/** * Get the HTML representation of an image. Visible for testing. * * @param res the {@link ImageResource} to render as HTML * @param valign the vertical alignment * @param isPlaceholder if true, do not include the background image * @return the rendered HTML//from w ww . j a va 2s . com */ SafeHtml getImageHtml(ImageResource res, HasVerticalAlignment.VerticalAlignmentConstant valign, boolean isPlaceholder) { // Get the HTML for the image. SafeHtml image; if (isPlaceholder) { image = SafeHtmlUtils.fromTrustedString("<div></div>"); } else { AbstractImagePrototype proto = AbstractImagePrototype.create(res); image = SafeHtmlUtils.fromTrustedString(proto.getHTML()); } // Create the wrapper based on the vertical alignment. if (HasVerticalAlignment.ALIGN_TOP == valign) { return template.imageWrapperTop(direction, image, dragHandlerClass); } else if (HasVerticalAlignment.ALIGN_BOTTOM == valign) { return template.imageWrapperBottom(direction, image, dragHandlerClass); } else { int halfHeight = (int) Math.round(res.getHeight() / 2.0); return template.imageWrapperMiddle(direction, halfHeight, image, dragHandlerClass); } }
From source file:cc.alcina.framework.gwt.client.objecttree.ObjectTreeGridRenderer.java
License:Apache License
@Override protected void renderToPanel(TreeRenderable renderable, ComplexPanel cp, int depth, boolean soleChild, RenderContext renderContext, TreeRenderer parent) { super.renderToPanel(renderable, cp, depth, soleChild, renderContext, parent); if (depth == 0) { cellFormatter = (FlexCellFormatter) ft.getCellFormatter(); int widgetCount = cp.getWidgetCount(); colCountMax = 0;/*from w w w . j a v a2 s. c o m*/ int level1WidgetIndex = -1; int row = -1; int col = 0; for (int i = 0; i < widgetCount; i++) { Widget w = cp.getWidget(0);// we'll be removing widgets, so // we'll always be looking at (0) if (w.getStyleName().contains("level-1")) { level1WidgetIndex = i; row++; col = 0; level1RendererRows.put(row, level1LabelMap.get(w)); } else { colCountMax = Math.max(colCountMax, i - level1WidgetIndex); } ft.setWidget(row, col, w); cellFormatter.setVerticalAlignment(row, col, HasVerticalAlignment.ALIGN_BOTTOM); if (col == 0) { cellFormatter.setStyleName(row, col, "td0"); } boolean isCustomiser = w.getStyleName().contains("customiser"); if (col == 1) {// && isCustomiser) { if (isCustomiser && !level1RendererRows.get(row).isSingleLineCustomiser()) { cellFormatter.setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_TOP); cellFormatter.addStyleName(row, 0, "multiline-caption"); } level1Rows.put(row, w); } // note, at this point, getWidget(0) is the _next_ widget boolean nextWidgetIsNewRow = i == widgetCount - 1 || cp.getWidget(0).getStyleName().contains("level-1"); if (nextWidgetIsNewRow) { cellFormatter.setColSpan(row, col, colCountMax - col + 1); } col++; } cp.clear(); cp.add(ft); } return; }
From source file:cc.alcina.framework.gwt.client.objecttree.ObjectTreeRenderer.java
License:Apache License
@SuppressWarnings("unchecked") protected void renderToPanel(TreeRenderable renderable, ComplexPanel cp, int depth, boolean soleChild, RenderContext renderContext, TreeRenderer parent) { if (renderable instanceof Permissible) { Permissible permissible = (Permissible) renderable; if (!PermissionsManager.get().isPermissible(permissible)) { return; }/* w w w.j a v a 2 s .com*/ } TreeRenderer node = TreeRenderingInfoProvider.get().getForRenderable(renderable, renderContext); if (parent != null) { parent.childRenderers().add(node); } else { renderContext.setRootRenderer(node); } if (depth == 0 && node.renderCss() != null) { cp.setStyleName(node.renderCss()); } node.parentBinding(op.binding); boolean widgetsAdded = false; Collection<? extends TreeRenderer> children = node.renderableChildren(); // title AbstractBoundWidget customiserWidget = null; RenderInstruction renderInstruction = node.renderInstruction(); IsRenderableFilter renderableFilter = renderContext.getRenderableFilter(); if (renderableFilter != null && !renderableFilter.isRenderable(renderable, node)) { renderInstruction = RenderInstruction.NO_RENDER; } if (renderInstruction != RenderInstruction.NO_RENDER) { customiserWidget = node.renderCustomiser() == null ? null : (AbstractBoundWidget) node.renderCustomiser().get(); } level1ContentRendererMap.put(customiserWidget, node); switch (renderInstruction) { case NO_RENDER: return; case AS_WIDGET_WITH_TITLE_IF_MORE_THAN_ONE_CHILD: if (customiserWidget == null && soleChild) { break; } case AS_TITLE: case AS_WIDGET: String displayName = renderable.getDisplayName(); if (CommonUtils.isNotNullOrEmpty(displayName) && !node.isNoTitle()) { Label label = TextProvider.get() .getInlineLabel(TextProvider.get().getUiObjectText(node.getClass(), TextProvider.DISPLAY_NAME + "-" + displayName, CommonUtils.upperCaseFirstLetterOnly(displayName) + ": ")); label.setStyleName("level-" + ((soleChild) ? Math.max(1, depth - 1) : depth)); cp.add(label); if (depth == 1) { level1LabelMap.put(label, node); } widgetsAdded = true; } default: break; } if (customiserWidget != null) { // note - must be responsible for own detach - cleanup customiserWidget.setModel(renderable); node.setBoundWidget(customiserWidget); if (node.renderCss() != null) { customiserWidget.addStyleName(node.renderCss()); } String customiserStyleName = node.isSingleLineCustomiser() ? "single-line-customiser" : "customiser"; String title = node.title(); if (title != null) { customiserWidget.setTitle(title); title = null; } String hint = node.hint(); if (hint != null) { FlowPanel fp2 = new FlowPanel(); Label label = new Label(hint); label.setStyleName("hint"); fp2.add(customiserWidget); fp2.add(label); fp2.addStyleName(customiserStyleName); cp.add(fp2); } else { customiserWidget.addStyleName(customiserStyleName); cp.add(customiserWidget); } return; } if (node.renderInstruction() == RenderInstruction.AS_WIDGET_WITH_TITLE_IF_MORE_THAN_ONE_CHILD || node.renderInstruction() == RenderInstruction.AS_WIDGET) { AbstractBoundWidget bw = new ObjectTreeBoundWidgetCreator().createBoundWidget(renderable, depth, soleChild, node, op.getBinding()); node.setBoundWidget(bw); cp.add(bw); widgetsAdded = true; } if (children != null && children.size() != 0) { ComplexPanel childPanel = cp; if (depth != 0) { if (node.renderChildrenHorizontally()) { HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); childPanel = hp; } else { childPanel = new FlowPanel(); } } if (childPanel != cp) { level1ContentRendererMap.put(childPanel, node); cp.add(childPanel); } List<? extends TreeRenderable> childRenderables = new ArrayList<TreeRenderable>( node.renderableChildren()); maybeSortChildRenderables(childRenderables, renderContext); for (TreeRenderable child : childRenderables) { renderToPanel(child, childPanel, depth + 1, node.renderableChildren().size() == 1, renderContext, node); } } return; }
From source file:com.audata.client.HomePanel.java
License:Open Source License
/** * Public contructor. Builds the HomePanel *//*from w w w . j a v a2 s .c om*/ public HomePanel() { final VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel); verticalPanel.setSize("100%", "100%"); final Image image = new Image(); verticalPanel.add(image); verticalPanel.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_CENTER); image.setUrl("images/title/welcome.jpg"); final HTML html = new HTML(LANG.homepage_Text()); html.setWidth("100%"); verticalPanel.add(html); html.setStyleName("audoc-welcomeText"); setSize("100%", "100%"); verticalPanel.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_BOTTOM); }
From source file:com.audata.client.widgets.CaptionButton.java
License:Open Source License
public void setOrientation(DockLayoutConstant layout) { DockLayoutConstant capPos = layout;/*w w w . j a va2 s .c om*/ DockLayoutConstant imgPos = DockPanel.WEST; HorizontalAlignmentConstant capHorizAlign = HasHorizontalAlignment.ALIGN_CENTER; VerticalAlignmentConstant capVertAlign = HasVerticalAlignment.ALIGN_MIDDLE; HorizontalAlignmentConstant imgHorizAlign = HasHorizontalAlignment.ALIGN_CENTER; VerticalAlignmentConstant imgVertAlign = HasVerticalAlignment.ALIGN_MIDDLE; if (layout == DockPanel.EAST) { imgPos = DockPanel.WEST; capHorizAlign = HasHorizontalAlignment.ALIGN_LEFT; imgHorizAlign = HasHorizontalAlignment.ALIGN_LEFT; } if (layout == DockPanel.NORTH) { imgPos = DockPanel.SOUTH; capVertAlign = HasVerticalAlignment.ALIGN_BOTTOM; imgVertAlign = HasVerticalAlignment.ALIGN_BOTTOM; } if (layout == DockPanel.WEST) { imgPos = DockPanel.EAST; capHorizAlign = HasHorizontalAlignment.ALIGN_LEFT; imgHorizAlign = HasHorizontalAlignment.ALIGN_LEFT; } if (layout == DockPanel.SOUTH) { imgPos = DockPanel.NORTH; capVertAlign = HasVerticalAlignment.ALIGN_BOTTOM; imgVertAlign = HasVerticalAlignment.ALIGN_BOTTOM; } main.clear(); main.add(caption, capPos); main.setCellHorizontalAlignment(caption, capHorizAlign); main.setCellVerticalAlignment(caption, capVertAlign); main.add(image, imgPos); main.setCellHorizontalAlignment(image, imgHorizAlign); main.setCellVerticalAlignment(image, imgVertAlign); }
From source file:com.edgenius.wiki.gwt.client.login.LoginEntryPoint.java
License:Open Source License
private void showLoginDeck() { main.clear();//from ww w. jav a 2s .co m main.add(logoBar); //get Hidden value from page - this value is redir URL value Element redirDiv = RootPanel.get("redirURLForLogin").getElement(); String redirUrl = DOM.getElementAttribute(redirDiv, "value"); Element regisgerDiv = RootPanel.get("regisgerDiv").getElement(); String regisger = DOM.getElementAttribute(regisgerDiv, "value"); LoginSignupDeck deck = new LoginSignupDeck(redirUrl, null, "true".equalsIgnoreCase(regisger) ? LoginDialog.SINGUP : LoginDialog.LOGIN); deck.addUserCreateListener(this); main.add(deck); DOM.setStyleAttribute(deck.getElement(), "width", "100%"); main.setCellHorizontalAlignment(logoBar, HasHorizontalAlignment.ALIGN_CENTER); main.setCellVerticalAlignment(logoBar, HasVerticalAlignment.ALIGN_BOTTOM); main.setCellHorizontalAlignment(deck, HasHorizontalAlignment.ALIGN_CENTER); }
From source file:com.edgenius.wiki.gwt.client.login.SignupForm.java
License:Open Source License
/** * Used in user signup and system admin adds new user * @param dialog //w w w . jav a 2s . c o m * @param sender * @param redirUrl */ public SignupForm(DialogBox dialog, Button sender, String redirUrl) { this.dialog = dialog; this.sender = sender; this.redirUrl = redirUrl; form.setMethod(FormPanel.METHOD_POST); form.addSubmitHandler(this); FlexTable inputPanel = new FlexTable(); profile.userInfo(inputPanel, form, PersonalProfile.STYLE_SIGNUP); VerticalPanel panel = new VerticalPanel(); panel.add(message); panel.add(inputPanel); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); panel.setSize("450px", "100%"); form.setWidget(panel); this.setWidget(form); }
From source file:com.edgenius.wiki.gwt.client.page.widgets.ExportDialog.java
License:Open Source License
public ExportDialog(PageMain pageMain) { this.pageMain = pageMain; this.setIcon(new Image(IconBundle.I.get().export())); this.setText(Msg.consts.export()); ButtonBar btnPanel = getButtonBar(); btnPanel.add(cancelBtn);/*from ww w . ja v a2s . c o m*/ btnPanel.add(okBtn); okBtn.addClickHandler(this); cancelBtn.addClickHandler(this); Label l1 = new Label(Msg.consts.format()); Label l2 = new Label(Msg.consts.scope()); pdfF.setText("PDF"); //NON-i18n htmlF.setText("HTML"); //NON-i18n scopeS.setText(Msg.consts.whole_space()); scopeP.setText(Msg.consts.current_page()); l1.setStyleName(Css.FORM_LABEL); l2.setStyleName(Css.FORM_LABEL); FlexTable main = new FlexTable(); main.setWidget(0, 0, l1); main.setWidget(0, 1, htmlF); //TODO: temporary comment as PDF is not ready... // main.setWidget(0, 2, pdfF); main.setWidget(1, 0, l2); main.setWidget(1, 1, scopeS); main.setWidget(1, 2, scopeP); main.getFlexCellFormatter().setWidth(0, 0, "130px"); main.getFlexCellFormatter().setWidth(0, 1, "130px"); htmlF.setValue(true); scopeS.setValue(true); HorizontalPanel busy = new HorizontalPanel(); Image busyImg = new Image(IconBundle.I.get().loadingBar()); busy.add(busyImg); busy.setCellHorizontalAlignment(busyImg, HasHorizontalAlignment.ALIGN_CENTER); busy.setCellVerticalAlignment(busyImg, HasVerticalAlignment.ALIGN_BOTTOM); busy.setHeight("200px"); deck.insert(main, MAIN_DECK); deck.insert(busy, BUSY_DECK); deck.setSize("98%", "100%"); deck.showWidget(MAIN_DECK); VerticalPanel panel = new VerticalPanel(); panel.setCellHorizontalAlignment(message, HasHorizontalAlignment.ALIGN_CENTER); panel.setCellHorizontalAlignment(deck, HasHorizontalAlignment.ALIGN_CENTER); panel.setWidth("100%"); panel.add(message); panel.add(deck); this.setWidget(panel); }
From source file:com.edgenius.wiki.gwt.client.page.widgets.LocationButton.java
License:Open Source License
public LocationButton(PageMain main, boolean showText) { this.main = main; HorizontalPanel panel = new HorizontalPanel(); this.showText = showText; if (!showText) { Image tree = new Image(IconBundle.I.get().tree()); tree.addClickHandler(this); panel.add(tree);/*ww w .j ava2 s . c om*/ panel.setCellVerticalAlignment(tree, HasVerticalAlignment.ALIGN_BOTTOM); } else { ClickLink locationBtn = new ClickLink(Msg.consts.view_page_tree()); locationBtn.setStyleName(Css.LARGE_LINK_BTN); locationBtn.addClickHandler(this); panel.add(locationBtn); } pageTreePanel = new PageTreePanel(main); main.setSideMenuPanel(ClientConstants.LEFT, pageTreePanel); main.setSidebarButtonVisible(ClientConstants.LEFT, true); this.setWidget(panel); }
From source file:com.edgenius.wiki.gwt.client.page.widgets.PrintButton.java
License:Open Source License
public PrintButton(PageMain pageMain, boolean showText) { this.main = pageMain; HorizontalPanel panel = new HorizontalPanel(); if (showText) { ClickLink locationBtn = new ClickLink(Msg.consts.print()); locationBtn.addClickHandler(this); panel.add(locationBtn);/*w w w . j a va 2s. co m*/ } Image print = new Image(IconBundle.I.get().printer()); print.addClickHandler(this); panel.add(print); panel.setCellVerticalAlignment(print, HasVerticalAlignment.ALIGN_BOTTOM); this.setWidget(panel); }