List of usage examples for com.google.gwt.dom.client Style setTextAlign
public void setTextAlign(TextAlign value)
From source file:com.google.gwt.sample.showcase.client.content.cell.AsyncContactProvider.java
private void installLoadingIndicator() { Style style = loadingStatus.getElement().getStyle(); style.setFontSize(2, Unit.EM);// w w w. j ava 2 s. co m style.setFontWeight(FontWeight.BOLD); style.setBackgroundColor("yellow"); style.setTextAlign(TextAlign.CENTER); RootLayoutPanel.get().add(loadingStatus); RootLayoutPanel.get().setWidgetTopHeight(loadingStatus, 0, Unit.PX, 3, Unit.EM); }
From source file:com.googlesource.gerrit.plugins.labelui.client.LabelPanel.java
License:Apache License
public static Label createValueLabel(String formattedValue, String valueText, short value) { Label l = new Label(formattedValue); if (valueText != null) { l.setTitle(valueText);/* w w w . j av a 2 s .c om*/ } Style s = l.getElement().getStyle(); s.setTextAlign(TextAlign.CENTER); s.setCursor(Cursor.DEFAULT); if (value > 0) { s.setColor(COLOR_GREEN); } else if (value < 0) { s.setColor(COLOR_RED); } else { // make label invisible, we cannot omit it since we need the label to show // a tooltip s.setColor("transparent"); } return l; }
From source file:com.vaadin.client.metadata.ConnectorBundleLoader.java
License:Apache License
private void notice(String productName) { if (notice == null) { notice = new HTML(); notice.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { notice.removeFromParent(); }//from w w w. java 2 s . c om }); notice.addTouchStartHandler(new TouchStartHandler() { public void onTouchStart(TouchStartEvent event) { notice.removeFromParent(); } }); } String msg = notice.getText().trim(); msg += msg.isEmpty() ? "Using Evaluation License of: " : ", "; notice.setText(msg + productName); RootPanel.get().add(notice); notice.getElement().setClassName(""); Style s = notice.getElement().getStyle(); s.setPosition(Position.FIXED); s.setTextAlign(TextAlign.CENTER); s.setRight(0, Unit.PX); s.setLeft(0, Unit.PX); s.setBottom(0, Unit.PX); s.setProperty("padding", "0.5em 1em"); s.setProperty("font-family", "sans-serif"); s.setFontSize(12, Unit.PX); s.setLineHeight(1.1, Unit.EM); s.setColor("white"); s.setBackgroundColor("black"); s.setOpacity(0.7); s.setZIndex(2147483646); s.setProperty("top", "auto"); s.setProperty("width", "auto"); s.setDisplay(Display.BLOCK); s.setWhiteSpace(WhiteSpace.NORMAL); s.setVisibility(Visibility.VISIBLE); s.setMargin(0, Unit.PX); }
From source file:com.vaadin.client.SimpleTree.java
License:Apache License
public SimpleTree() { setElement(Document.get().createDivElement()); Style style = getElement().getStyle(); style.setProperty("whiteSpace", "nowrap"); style.setPadding(3, Unit.PX);/*from w w w. j a v a 2s .c o m*/ style.setPaddingLeft(12, Unit.PX); // handle styling style = handle.getStyle(); style.setDisplay(Display.NONE); style.setTextAlign(TextAlign.CENTER); style.setWidth(0.5, Unit.EM); style.setHeight(0.5, Unit.EM); style.setCursor(Cursor.POINTER); style.setBackgroundColor("gray"); style.setColor("white"); style.setPadding(4, Unit.PX); style.setMarginRight(3, Unit.PX); style.setLineHeight(0.5, Unit.EM); handle.setInnerHTML("+"); getElement().appendChild(handle); getElement().appendChild(text); // children styling style = children.getStyle(); style.setPaddingLeft(1.5, Unit.EM); style.setDisplay(Display.NONE); getElement().appendChild(children); addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (event.getNativeEvent().getEventTarget().cast() == handle) { if (children.getStyle().getDisplay().intern() == Display.NONE.getCssName()) { open(event.getNativeEvent().getAltKey()); } else { close(); } } else if (event.getNativeEvent().getEventTarget().cast() == text) { select(event); } } }, ClickEvent.getType()); }
From source file:ilarkesto.gwt.client.desktop.BuilderPanel.java
License:Open Source License
private SimplePanel horizontalWrapper(IsWidget child, String width) { SimplePanel wrapper = new SimplePanel(child.asWidget()); wrapper.setStyleName("goon-horizontalWrapper"); Style style = wrapper.getElement().getStyle(); style.setProperty("display", "table-cell"); if (childTextAlign != null) style.setTextAlign(childTextAlign); if (width != null) wrapper.setWidth(width);/*from w w w . ja v a 2 s . c o m*/ return wrapper; }
From source file:org.cruxframework.crux.widgets.client.uploader.FileButton.java
License:Apache License
public FileButton() { mainPanel = new FlowPanel(); mainPanel.getElement().getStyle().setPosition(Position.RELATIVE); fileInput = new FileInput(); Style style = fileInput.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setTextAlign(TextAlign.RIGHT); style.setOpacity(0);/* ww w. j a va 2s . c o m*/ style.setProperty("cursor", "inherit"); style.setZIndex(2); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); style.setTop(0, Unit.PX); style.setLeft(0, Unit.PX); mainPanel.add(fileInput); visibleButton = new Label(); visibleButton.setStyleName("chooseButton"); style = visibleButton.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setTop(0, Unit.PX); style.setLeft(0, Unit.PX); style.setZIndex(1); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); mainPanel.add(visibleButton); initWidget(mainPanel); setStyleName("crux-FileButton"); }
From source file:org.dashbuilder.renderer.client.metric.MetricViewImpl.java
License:Apache License
public void applySettings(DisplayerSettings displayerSettings) { this.displayerSettings = displayerSettings; int w = displayerSettings.getChartWidth(); int h = displayerSettings.getChartHeight(); int mtop = displayerSettings.getChartMarginTop(); int mbottom = displayerSettings.getChartMarginBottom(); int mleft = displayerSettings.getChartMarginLeft(); int mright = displayerSettings.getChartMarginRight(); // Hero panel (size) Style style = heroPanel.getElement().getStyle(); style.setPadding(0, Style.Unit.PX); style.setWidth(w, Style.Unit.PX); style.setHeight(h, Style.Unit.PX); style.setTextAlign(Style.TextAlign.CENTER); style.setVerticalAlign(Style.VerticalAlign.MIDDLE); if (!StringUtils.isBlank(displayerSettings.getChartBackgroundColor())) { style.setBackgroundColor("#" + displayerSettings.getChartBackgroundColor()); }/*from w w w.j a v a2 s. c o m*/ // Center panel (paddings) style = centerPanel.getElement().getStyle(); style.setPaddingTop(mtop, Style.Unit.PX); style.setPaddingBottom(mbottom, Style.Unit.PX); style.setPaddingLeft(mleft, Style.Unit.PX); style.setPaddingRight(mright, Style.Unit.PX); // Title panel titlePanel.setVisible(displayerSettings.isTitleVisible()); titlePanel.setText(displayerSettings.getTitle()); }
From source file:org.jbpm.dashboard.renderer.client.panel.widgets.MetricViewExt.java
License:Apache License
public void applySettings(DisplayerSettings displayerSettings) { this.displayerSettings = displayerSettings; int w = displayerSettings.getChartWidth(); int h = displayerSettings.getChartHeight(); int mtop = displayerSettings.getChartMarginTop(); int mbottom = displayerSettings.getChartMarginBottom(); int mleft = displayerSettings.getChartMarginLeft(); int mright = displayerSettings.getChartMarginRight(); // Hero panel (size) Style style = centerPanel.getElement().getStyle(); style.setPadding(0, Style.Unit.PX); style.setWidth(w, Style.Unit.PX); style.setHeight(h, Style.Unit.PX); style.setTextAlign(Style.TextAlign.CENTER); style.setVerticalAlign(Style.VerticalAlign.MIDDLE); if (!StringUtils.isBlank(displayerSettings.getChartBackgroundColor())) { style.setBackgroundColor("#" + displayerSettings.getChartBackgroundColor()); }//from w ww .j a va2 s . c o m // Center panel (paddings) style = centerPanel.getElement().getStyle(); style.setPaddingTop(mtop, Style.Unit.PX); style.setPaddingBottom(mbottom, Style.Unit.PX); style.setPaddingLeft(mleft, Style.Unit.PX); style.setPaddingRight(mright, Style.Unit.PX); // Title panel titlePanel.setVisible(displayerSettings.isTitleVisible()); titlePanel.setText(displayerSettings.getTitle()); }
From source file:org.komodo.web.client.panels.vdb.property.panel.NoPropertiesPanel.java
License:Open Source License
/** * Create new instance//from w ww . j av a 2s. c o m * * @param parentWidth parent width * @param parentHeight parent height */ protected NoPropertiesPanel(double parentWidth, double parentHeight) { Style style = getElement().getStyle(); style.setFontWeight(FontWeight.BOLD); style.setTextAlign(TextAlign.CENTER); style.setLineHeight(parentHeight, Unit.EM); add(noPropsLabel); }
From source file:org.komodo.web.client.panels.vdb.VdbEditPanel.java
License:Apache License
private Widget createObjectPropertiesPanel() { Style objPropPanelStyle = objectPropertiesPanel.getElement().getStyle(); /*/*from w ww.ja v a 2 s . co m*/ * Want to position the properties panel so its always to the right * of the diagram panel, even when zoomed in. Float: left fails to * work at this point since zoom in enough and the properties * panel jumps down below. */ /* * Set the position of the properties panel to absolute so that we * are now in charge of its location */ objPropPanelStyle.setPosition(Position.ABSOLUTE); /* * Set its position as being on same level as diagram panel */ objPropPanelStyle.setTop(0, Unit.EM); /* * Move it to the right of the diagram panel which is the * diagram panel width + border width + an extra 2 units * to account for the vertical scrollbar width */ objPropPanelStyle.setLeft(DIAGRAM_PANEL_WIDTH + BORDER_WIDTH + 2, Unit.EM); /* * Set its width and height to appropriate values */ objPropPanelStyle.setWidth((DIAGRAM_PANEL_WIDTH * 3) / 5, Unit.EM); objPropPanelStyle.setHeight(EDIT_PANEL_HEIGHT, Unit.EM); /* * Set its background colour to a subtle shade that just frames the panel */ objPropPanelStyle.setBackgroundColor("#fAfAfA"); //$NON-NLS-1$ /* * Set overflow to use scrollbars if required */ objPropPanelStyle.setOverflow(Overflow.AUTO); /* * Add the title */ Label propertyTitle = new Label("Property Editor"); //$NON-NLS-1$ Style titleStyle = propertyTitle.getElement().getStyle(); /* * Centre the title * Set its font size and make it bold * Set its height as this ensures a value we can know when * passing on the remaining content area to the sub panels, ie. * SUB_PANEL_HEIGHT = DIAGRAM_PANEL_HEIGHT * - PROPERTY_TITLE_HEIGHT + (BORDER_WIDTH * 2) */ titleStyle.setTextAlign(TextAlign.CENTER); titleStyle.setFontSize(1, Unit.EM); titleStyle.setFontWeight(FontWeight.BOLD); titleStyle.setLineHeight(PROPERTY_TITLE_HEIGHT, Unit.EM); titleStyle.setHeight(PROPERTY_TITLE_HEIGHT, Unit.EM); objectPropertiesPanel.add(propertyTitle); return objectPropertiesPanel; }