List of usage examples for com.google.gwt.dom.client Style setFontWeight
public void setFontWeight(FontWeight 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 a v a2 s.c om*/ 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.sciencegadgets.client.ui.LinkPrompt.java
License:Open Source License
public void setColor(String hexColor) { Style labelStyle = colorLabel.getElement().getStyle(); if (hexColor == null || hexColor.length() != 6) { if ("".equals(hexColor)) { labelStyle.clearColor();// ww w. java2 s. com labelStyle.clearFontWeight(); } else { labelStyle.setColor("red"); labelStyle.setFontWeight(FontWeight.BOLD); } HashMap<Parameter, String> pMap = setMapParameters(); pMap.remove(Parameter.color); updateLinks(pMap); return; } try { Integer.valueOf(hexColor.substring(0, 2), 16); Integer.valueOf(hexColor.substring(2, 4), 16); Integer.valueOf(hexColor.substring(4, 6), 16); } catch (NumberFormatException e) { labelStyle.setColor("red"); labelStyle.setFontWeight(FontWeight.BOLD); return; } labelStyle.clearColor(); labelStyle.setFontWeight(FontWeight.BOLD); // HashMap<Parameter, String> algActivityMap = URLParameters // .getParameterMap(); // algActivityMap.put(Parameter.themecolor, hexColor); // URLParameters.setParameters(algActivityMap, false); URLParameters.addParameter(Parameter.color, hexColor, true); initialColor = hexColor; HashMap<Parameter, String> pMap = setMapParameters(); pMap.put(Parameter.color, hexColor); updateLinks(pMap); }
From source file:com.sciencegadgets.client.ui.LinkPrompt.java
License:Open Source License
boolean isValidSpec(Label label, TextBox textBox, ValueListBox<String> listBox) { Style labelStyle = label.getElement().getStyle(); if ("".equals(textBox.getValue()) && listBox.getValue() == null) { labelStyle.clearColor();/*from ww w .j a v a2 s . co m*/ labelStyle.clearFontWeight(); return false; } boolean isValid; try { Double value = Double.parseDouble(textBox.getValue()); if (value > 0 && listBox.getValue() != null) { isValid = true; } else { isValid = false; } } catch (NumberFormatException e) { isValid = false; } if (isValid) { labelStyle.clearColor(); labelStyle.setFontWeight(FontWeight.BOLD); } else { labelStyle.setColor("red"); labelStyle.setFontWeight(FontWeight.BOLD); } return isValid; }
From source file:com.sencha.gxt.chart.client.draw.engine.VML.java
License:sencha.com license
/** * Applies the attributes of the passed {@link TextSprite} to its VML element. * // w w w . j a v a 2s.c o m * @param sprite the sprite whose attributes to use */ private void setTextAttributes(TextSprite sprite, XElement element) { Element textPath = element.childElement("textPath").cast(); Style textStyle = textPath.getStyle(); textBBoxCache.remove(sprite); if (sprite.isFontSizeDirty() || ignoreOptimizations) { if (sprite.getFontSize() > 0) { textStyle.setFontSize(sprite.getFontSize(), Unit.PX); } else { textStyle.clearFontSize(); } } if (sprite.isFontStyleDirty() || ignoreOptimizations) { if (sprite.getFontStyle() != null) { textStyle.setFontStyle(sprite.getFontStyle()); } else { textStyle.clearFontStyle(); } } if (sprite.isFontWeightDirty() || ignoreOptimizations) { if (sprite.getFontWeight() != null) { textStyle.setFontWeight(sprite.getFontWeight()); } else { textStyle.clearFontWeight(); } } if (sprite.isFontDirty() || ignoreOptimizations) { if (sprite.getFont() != null) { textStyle.setProperty("fontFamily", sprite.getFont()); } else { textStyle.clearProperty("fontFamily"); } } // text-anchor emulation if (sprite.isTextAnchorDirty() || ignoreOptimizations) { if (sprite.getTextAnchor() == TextAnchor.MIDDLE) { setTextAlign(textStyle, "center"); } else if (sprite.getTextAnchor() == TextAnchor.END) { setTextAlign(textStyle, "right"); } else { setTextAlign(textStyle, "left"); } } if (sprite.isTextDirty() || ignoreOptimizations) { if (sprite.getText() != null) { textPath.setPropertyString("string", sprite.getText()); } else { textPath.setPropertyString("string", ""); } } if (sprite.isTextBaselineDirty() || sprite.isXDirty() || sprite.isYDirty() || ignoreOptimizations) { double height = sprite.getFontSize(); if (sprite.getTextBaseline() == TextBaseline.MIDDLE) { height = 0; } else if (sprite.getTextBaseline() == TextBaseline.BOTTOM) { height *= -1; } Element path = element.childElement("path").cast(); path.setPropertyString("v", new StringBuilder().append("m").append(Math.round(sprite.getX() * zoom)).append(",") .append(Math.round((sprite.getY() + (height / 2.0)) * zoom)).append(" l") .append(Math.round(sprite.getX() * zoom) + 1).append(",") .append(Math.round((sprite.getY() + (height / 2.0)) * zoom)).toString()); textRenderedPoints.put(sprite, new PrecisePoint(sprite.getX(), sprite.getY())); textRenderedBaseline.put(sprite, sprite.getTextBaseline()); } }
From source file:ilarkesto.gwt.client.desktop.AObjectTableWithGroups.java
License:Open Source License
protected void onUpdate() { if (sortColumnIndex == -1) { sortColumnIndex = getInitialSortColumnIndex(); reverseSort = isInitialSortReverse(); }// w ww .j a va2 s.c o m Collection<O> objects; try { objects = getObjects(); } catch (Exception ex) { throw new RuntimeException(Str.getSimpleName(getClass()) + ".getObjects() failed.", ex); } log.info("Objects loaded:", objects.size()); int rowIndex = -1; if (isColumnTitlesEnabled()) { rowIndex++; for (AColumn column : columns) { String columnTitle; try { columnTitle = column.getTitle(); } catch (Exception ex) { log.error(ex); columnTitle = "ERROR: " + Str.formatException(ex); } Widget titleWidget = Widgets.textFieldlabel(columnTitle, false); if (titleWidget != null && (sortColumnIndex == column.index)) { // Sortierte Spalte hervorheben Style style = titleWidget.getElement().getStyle(); style.setColor("#444"); style.setFontWeight(FontWeight.BOLD); if (reverseSort) style.setFontStyle(FontStyle.ITALIC); } table.setWidget(rowIndex, column.index, Widgets.frame(titleWidget, Widgets.defaultSpacing, 0, Widgets.defaultSpacing, Widgets.defaultSpacing / 2)); if (isCustomSortingEnabled()) { for (int col = 0; col < columns.size(); col++) { table.getCellFormatter().setStyleName(rowIndex, col, "clickable"); } } } } if (isColumnFilteringEnabled()) { rowIndex++; for (AColumn column : columns) { TextBox filterTextbox = column.getFilterWidget(); SimplePanel frame = Widgets.frame(filterTextbox, Widgets.defaultSpacing); table.setWidget(rowIndex, column.index, frame); } } try { rows = createRows(objects, rowIndex); } catch (Exception ex) { throw new RuntimeException(Str.getSimpleName(getClass()) + ".createRows() failed.", ex); } table.setVisible(!rows.isEmpty()); for (Row row : rows) { appendRow(row); rowIndex++; } for (int i = 0; i < getFootRowCount(); i++) { rowIndex++; for (AColumn column : columns) { table.setWidget(rowIndex, column.index, column.getFootCellWidget(i)); } } }
From source file:ilarkesto.gwt.client.desktop.Widgets.java
License:Open Source License
public static Widget notification(Object object) { if (object == null) return null; Label label = new Label(Str.format(object)); Style style = label.getElement().getStyle(); style.setColor(Colors.googlePurple); style.setFontWeight(FontWeight.BOLD); return new BuilderPanel().setStyleCard().addColorMarker(Colors.googleRed).addWithPadding(label).asWidget(); }
From source file:ilarkesto.gwt.client.desktop.Widgets.java
License:Open Source License
public static Label textTitleInverted(Object object) { if (object == null) return null; Label label = new Label(Str.format(object)); Style style = label.getElement().getStyle(); style.setFontWeight(FontWeight.BOLD); style.setFontSize(105, Unit.PCT);/*from w w w . ja va 2 s .c om*/ style.setBackgroundColor(Colors.googleBlue); style.setColor("white"); return label; }
From source file:ilarkesto.gwt.client.desktop.Widgets.java
License:Open Source License
public static Label textTitle(Object object) { if (object == null) return null; Label label = new Label(Str.format(object)); Style style = label.getElement().getStyle(); style.setFontWeight(FontWeight.BOLD); style.setFontSize(105, Unit.PCT);/*from w w w . j a v a 2 s . c o m*/ style.setColor("#666"); return label; }
From source file:net.sf.mmm.client.ui.gwt.widgets.richtext.FeatureBehaviorBold.java
License:Apache License
/** * {@inheritDoc}/*from ww w . j a va2 s . c o m*/ */ @Override protected void updateFontSettings(boolean checked, Style style) { FontWeight weight; if (checked) { weight = FontWeight.BOLD; } else { weight = FontWeight.NORMAL; } style.setFontWeight(weight); }
From source file:org.clevermore.monitor.client.AbstractEntryPoint.java
License:Apache License
private void alertButtonClicked(String attribute, int timeLeft) { Style style = alertImg.getElement().getStyle(); if ("1".equals(attribute)) { alertImg.getElement().setAttribute("state", "2"); style.setColor("red"); style.setFontWeight(FontWeight.BOLDER); alertImg.setTitle("Continue Alerts, time left for auto-enable: " + timeLeft + " min."); alertImg.setResource(resources.continueAlerts()); } else {/*from w w w. jav a 2s . c om*/ alertImg.getElement().setAttribute("state", "1"); style.setColor("black"); style.setFontWeight(FontWeight.NORMAL); alertImg.setTitle("Stop Alerts"); alertImg.setResource(resources.stopAlerts()); } }