List of usage examples for com.google.gwt.dom.client Style setVerticalAlign
public void setVerticalAlign(VerticalAlign value)
From source file:com.sciencegadgets.client.algebra.EquationWrapper.java
License:Open Source License
private void fillSelectionDetails() { LinkedList<Widget> detailsList = new LinkedList<Widget>(); TypeSGET type = node.getType();/* w w w.j a va2s .co m*/ TypeSGET operationType = null; // FitParentHTML typeLabel = new FitParentHTML(type.getIcon()); HTML typeLabel = new HTML(type.toString()); detailsList.add(typeLabel); switch (type) { case Number: String fullValue = node.getAttribute(MathAttribute.Value); if ("".equals(fullValue)) { fullValue = node.getAttribute(MathAttribute.Randomness); } else { try { new BigDecimal(fullValue); // FitParentHTML valueHTML = new // FitParentHTML(fullValue); final TextBox valueHTML = new TextBox(); valueHTML.setText(fullValue); valueHTML.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { valueHTML.selectAll(); } }); valueHTML.addStyleName(CSS.SELECTION_DETAILS_Value); valueHTML.getElement().getStyle().setProperty("textShadow", "inherit"); detailsList.add(valueHTML); } catch (NumberFormatException ex) { } } UnitAttribute unit = node.getUnitAttribute(); if (!"".equals(unit.toString())) { HTML unitHTML = new HTML(); unitHTML.getElement().appendChild(UnitHTML.create(unit, false)); detailsList.add(unitHTML); } break; case Variable: UnitAttribute qKind = node.getUnitAttribute(); if (!"".equals(qKind.toString())) { // FitParentHTML qKindHTML = new FitParentHTML(); HTML qKindHTML = new HTML(); qKindHTML.getElement().appendChild(UnitHTML.create(qKind, false)); detailsList.add(qKindHTML); } break; case Operation: operationType = node.getParentType(); String[] parts = { node.getPrevSibling().getType().toString(), node.getSymbol(), node.getNextSibling().getType().toString() }; typeLabel.setHTML(""); Element typeEl = typeLabel.getElement(); for (String part : parts) { Element partEl = new HTML(part).getElement(); Style partSt = partEl.getStyle(); partSt.setMargin(2, Unit.PX); partSt.setDisplay(Display.INLINE_BLOCK); partSt.setVerticalAlign(VerticalAlign.MIDDLE); typeEl.appendChild(partEl); } default: break; } FlowPanel detailsPanel = new FlowPanel(); detailsPanel.addStyleName(CSS.SELECTION_DETAILS); for (Widget s : detailsList) { detailsPanel.add(s); } algebraActivity.detailsArea.clear(); algebraActivity.detailsArea.add(detailsPanel); Widget typeParent = typeLabel.getParent(); if (typeParent != null) { // typeParent.addStyleName(type.getCSSClassName()); // typeParent.addStyleName(CSS.PARENT_WRAPPER); if (operationType != null) { typeParent.addStyleName(operationType.getCSSClassName()); } } }
From source file:net.sf.mmm.client.ui.gwt.widgets.richtext.FeatureBehaviorSubscript.java
License:Apache License
/** * {@inheritDoc}//from w ww. j a va2 s .co m */ @Override protected void updateFontSettings(boolean checked, Style style) { VerticalAlign align; if (checked) { align = VerticalAlign.SUB; } else { align = VerticalAlign.BASELINE; } // small, sub, sup { font-size: .83em } // sub { vertical-align: sub } // sup { vertical-align: super } style.setVerticalAlign(align); style.setFontSize(0.83, Unit.EM); }
From source file:net.sf.mmm.client.ui.gwt.widgets.richtext.FeatureBehaviorSuperscript.java
License:Apache License
/** * {@inheritDoc}/*from w w w .j a v a 2s . c o m*/ */ @Override protected void updateFontSettings(boolean checked, Style style) { VerticalAlign align; if (checked) { align = VerticalAlign.SUPER; style.setFontSize(0.83, Unit.EM); } else { align = VerticalAlign.BASELINE; style.setFontSize(1.0, Unit.EM); } style.setVerticalAlign(align); }
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()); }/* ww w . j a v a 2 s .co 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()); }/*ww w.j a va2 s .co 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.rstudio.studio.client.workbench.views.source.editors.text.ui.TemplateMenuItem.java
License:Open Source License
public void addIcon(ImageResource icon) { Image iconImage = new Image(icon); wrapper_.insert(iconImage, 0);//w w w . java 2 s.c o m Style imageStyle = iconImage.getElement().getStyle(); imageStyle.setVerticalAlign(VerticalAlign.MIDDLE); imageStyle.setMarginRight(5, Unit.PX); imageStyle.setMarginBottom(2, Unit.PX); }