List of usage examples for com.google.gwt.dom.client Style setFontStyle
public void setFontStyle(FontStyle value)
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 a2s. c om*/ * @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(); }//from www . j a va 2 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:net.sf.mmm.client.ui.gwt.widgets.richtext.FeatureBehaviorItalic.java
License:Apache License
/** * {@inheritDoc}/*from w w w . j av a2 s. c o m*/ */ @Override protected void updateFontSettings(boolean checked, Style style) { FontStyle fontStyle; if (checked) { fontStyle = FontStyle.ITALIC; } else { fontStyle = FontStyle.NORMAL; } style.setFontStyle(fontStyle); }
From source file:org.rest.client.ui.desktop.MenuItemViewImpl.java
License:Apache License
@Override public void onClick(ClickEvent event) { event.stopPropagation();/*from w ww. ja v a 2s . c o m*/ event.preventDefault(); Element e = event.getNativeEvent().getCurrentEventTarget().cast(); if (!(e != null && e.equals(getElement()))) return; if (children.size() > 0) { setOpened(!isOpened()); } else { if (place != null && listener != null) { listener.goTo(place); } else { //open and show "empty" info if (emptyLabel == null) { emptyLabel = new Label("empty"); Style labelStyle = emptyLabel.getElement().getStyle(); labelStyle.setColor("#7C7C7C"); labelStyle.setMarginLeft(14, Unit.PX); labelStyle.setMarginTop(14, Unit.PX); labelStyle.setFontStyle(FontStyle.ITALIC); addChild(emptyLabel); } setOpened(true); } } }