Updates this context according to the given style. Moreover given Graphics is updated
to this style and used for taking the font metrics.
@param style the style data to be used
@param g Graphics to be updated and used
488732
public void updateForGraphics(NodeData style, Graphics2D g)
    {
        if (style != null) update(style);
        updateGraphics(g);
        fm = g.getFontMetrics();
        
        //update the width units
        //em has been updated in update()
        
        FontRenderContext frc = new FontRenderContext(null, false, false);
        TextLayout layout = new TextLayout("x", font, frc);
        ex = layout.getBounds().getHeight();
        
        ch = fm.charWidth('0');
    }
1356207
private void paint(SeaGlassContext context, Graphics g) {
        String title = frame.getTitle();

        if (title != null) {
            SynthStyle style = context.getStyle();

            Color color = style.getColor(context, ColorType.TEXT_FOREGROUND);

            // TODO style.getColor returns improper color for state? Why?
            if ((context.getComponentState() & 512) != 0) {
                Object obj = style.get(context, "[WindowFocused].textForeground");

                if (obj != null && obj instanceof Color) {
                    color = (Color) obj;
                }

                // FIXME The state *still* doesn't get the color right!!!
                color = Color.WHITE;
            }

            g.setColor(color);
            g.setFont(style.getFont(context));

            // Center text vertically.
            FontMetrics fm         = SwingUtilities2.getFontMetrics(frame, g);
            int         baseline   = (getHeight() + fm.getAscent() - fm.getLeading() - fm.getDescent()) / 2;
            JButton     lastButton = null;

            if (frame.isIconifiable()) {
                lastButton = iconButton;
            } else if (frame.isMaximizable()) {
                lastButton = maxButton;
            } else if (frame.isClosable()) {
                lastButton = closeButton;
            }

            int     maxX;
            int     minX;
            boolean ltr = SeaGlassLookAndFeel.isLeftToRight(frame);

            if (ltr) {

                if (lastButton != null) {
                    maxX = lastButton.getX() - titleSpacing;
                } else {
                    maxX = frame.getWidth() - frame.getInsets().right - titleSpacing;
                }

                minX = menuButton.getX() + menuButton.getWidth() + titleSpacing;
            } else {

                if (lastButton != null) {
                    minX = lastButton.getX() + lastButton.getWidth() + titleSpacing;
                } else {
                    minX = frame.getInsets().left + titleSpacing;
                }

                maxX = menuButton.getX() - titleSpacing;
            }

            String clippedTitle = getTitle(title, fm, maxX - minX);

            if (clippedTitle == title) {
                int width = style.getGraphicsUtils(context).computeStringWidth(context, g.getFont(), fm, title);

                minX = Math.max(minX, (getWidth() - width) / 2);
                minX = Math.min(maxX - width, minX);
            }

            style.getGraphicsUtils(context).paintText(context, g, clippedTitle, minX, baseline - fm.getAscent(), -1);
        }
    }
340096
public final void setFont(Font font) {
        this.font = font;
        textRenderer = new TextRenderer(font.getAWTFont(), true, true);
    }
536030
def setStyle(self, style):
        
        self._style = style
        self.setDirty()
        self.update()
832237
public void styleChannel(String channel, Style style){
    if(this.channelStyles == null){
      this.channelStyles = new HashMap<String,Style>();
    }
    this.channelStyles.put(channel.toLowerCase(),style);
  }
546821
@Override
    public void paint(Graphics g, Shape allocation)
    {
        if (view != null)
        {
            view.paint(g, allocation);
        }
    }
925150
public void setProgressStyle(int style) {
        LoadingDrawable drawable = null;
        if (style == STYLE_CIRCLE) {
            Resources resources = getResources();
            drawable = new LoadingCircleDrawable(resources.getDimensionPixelOffset(R.dimen.g_loading_minSize),
                    resources.getDimensionPixelOffset(R.dimen.g_loading_maxSize));
        } else if (style == STYLE_LINE) {
            drawable = new LoadingLineDrawable();
        }
        setLoadingDrawable(drawable);
    }
1299908
public static function setStyleDefinition($name, Style $style) {
        if (!self::$styles) {
            self::$styles = self::initStyles();
        }

        self::$styles[$name] = $style;
    }
1285389
public void applyStyle(Element element, Style style) {
		if (element != null && style != null) {
			switch (namespace) {
				case VML:
					VmlStyleUtil.applyStyle(element, style);
					break;
				case SVG:
					if (style instanceof ShapeStyle) {
						applySvgStyle(element, (ShapeStyle) style);
					} else if (style instanceof FontStyle) {
						applySvgStyle(element, (FontStyle) style);
					} else if (style instanceof PictureStyle) {
						applySvgStyle(element, (PictureStyle) style);
					}
					break;
				case HTML:
					if (style instanceof ShapeStyle) {
						applyHtmlStyle(element, (ShapeStyle) style);
					} else if (style instanceof FontStyle) {
						applyHtmlStyle(element, (FontStyle) style);
					} else if (style instanceof PictureStyle) {
						applyHtmlStyle(element, (PictureStyle) style);
					}
					break;
			}
		}
	}
1167577
public void setStyle(String style) {

        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_style)) {
            m_component.removeStyleName(m_style);
        }
        m_style = style;
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_style)) {
            m_component.addStyleName(m_style);
        }
    }
180478
@Api
	public void setRectangleStyle(ShapeStyle rectangleStyle) {
		this.rectangleStyle = rectangleStyle;
		if (targetRectangle != null) {
			targetRectangle.setStyle(rectangleStyle);
			render(targetRectangle, RenderGroup.SCREEN, RenderStatus.ALL);
		}
	}
1193514
public void addFont(Font font) {
        if (font.getBaseFont() != null) {
            fonts.add(font);
            return;
        }
        BaseFont bf = font.getCalculatedBaseFont(true);
        Font f2 = new Font(bf, font.getSize(), font.getCalculatedStyle(), font.getColor());
        fonts.add(f2);
    }
465287
public void add(SeqPattern style) {
    style.setGenerator(this);
    patterns.put(style.getLevel(), style);
  }
963624
public boolean setStyle(PolygonOptions polygonOptions, StyleRow style) {
        return StyleUtils.setStyle(polygonOptions, style, density);
    }
1215936
public void setStyleClass(java.lang.String styleClass) {
        getStateHelper().put(PropertyKeys.styleClass, styleClass);
    }
1248921
def set_style(self, style):
        
        style = SolarizedStyle  # get_style_by_name(style)
        self._style = style
        self._clear_caches()
869429
public static void updateStyle( ASpatialDb database, Style style ) throws Exception {
        StringBuilder sbIn = new StringBuilder();
        sbIn.append("update ").append(PROPERTIESTABLE);
        sbIn.append(" set ");
        // sbIn.append(NAME).append("='").append(style.name).append("' , ");
        sbIn.append(SIZE).append("=?,");
        sbIn.append(FILLCOLOR).append("=?,");
        sbIn.append(STROKECOLOR).append("=?,");
        sbIn.append(FILLALPHA).append("=?,");
        sbIn.append(STROKEALPHA).append("=?,");
        sbIn.append(SHAPE).append("=?,");
        sbIn.append(WIDTH).append("=?,");
        sbIn.append(LABELSIZE).append("=?,");
        sbIn.append(LABELFIELD).append("=?,");
        sbIn.append(LABELVISIBLE).append("=?,");
        sbIn.append(ENABLED).append("=?,");
        sbIn.append(ORDER).append("=?,");
        sbIn.append(DASH).append("=?,");
        sbIn.append(MINZOOM).append("=?,");
        sbIn.append(MAXZOOM).append("=?,");
        sbIn.append(DECIMATION).append("=?,");
        sbIn.append(THEME).append("=?");
        sbIn.append(" where ");
        sbIn.append(NAME);
        sbIn.append("='");
        sbIn.append(style.name);
        sbIn.append("';");

        Object[] objects = {style.size, style.fillcolor, style.strokecolor, style.fillalpha, style.strokealpha, style.shape,
                style.width, style.labelsize, style.labelfield, style.labelvisible, style.enabled, style.order, style.dashPattern,
                style.minZoom, style.maxZoom, style.decimationFactor, style.getTheme()};

        String updateQuery = sbIn.toString();
        database.executeInsertUpdateDeletePreparedSql(updateQuery, objects);
    }