/** * Returns the value for key in dictionary as an int or 0 if no value is * defined for the key. * * @param dict * Dictionary that contains the key, value pairs. * @param key * Key whose value should be returned. * @return Returns the integer value for key in dict. */ public static int getInt(Map<String, Object> dict, String key) { return getInt(dict, key, 0); }
/** * Returns the value for key in dictionary as an int or 0 if no value is * defined for the key. * * @param dict * Dictionary that contains the key, value pairs. * @param key * Key whose value should be returned. * @return Returns the integer value for key in dict. */ public static int getInt(Map<String, Object> dict, String key) { return getInt(dict, key, 0); }
/** * */ public static Font getFont(Map<String, Object> style, double scale) { String fontFamily = getString(style, mxConstants.STYLE_FONTFAMILY, mxConstants.DEFAULT_FONTFAMILY); int fontSize = getInt(style, mxConstants.STYLE_FONTSIZE, mxConstants.DEFAULT_FONTSIZE); int fontStyle = getInt(style, mxConstants.STYLE_FONTSTYLE); int swingFontStyle = ((fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD) ? Font.BOLD : Font.PLAIN; swingFontStyle += ((fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC) ? Font.ITALIC : Font.PLAIN; return new Font(fontFamily, swingFontStyle, (int) (fontSize * scale)); }
/** * */ public static Font getFont(Map<String, Object> style, double scale) { String fontFamily = getString(style, mxConstants.STYLE_FONTFAMILY, mxConstants.DEFAULT_FONTFAMILY); int fontSize = getInt(style, mxConstants.STYLE_FONTSIZE, mxConstants.DEFAULT_FONTSIZE); int fontStyle = getInt(style, mxConstants.STYLE_FONTSTYLE); int swingFontStyle = ((fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD) ? Font.BOLD : Font.PLAIN; swingFontStyle += ((fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC) ? Font.ITALIC : Font.PLAIN; Map<TextAttribute, Integer> fontAttributes = (fontStyle & mxConstants.FONT_UNDERLINE) == mxConstants.FONT_UNDERLINE ? Collections.singletonMap(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON) : null; return new Font(fontFamily, swingFontStyle, (int) (fontSize * scale)).deriveFont(fontAttributes); }
.equals(mxConstants.SHAPE_SWIMLANE)) int start = mxUtils.getInt(state.getStyle(), mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE);
.equals(mxConstants.SHAPE_SWIMLANE)) int start = mxUtils.getInt(state.getStyle(), mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE);
/** * Draws the given lines as segments between all points of the given list * of mxPoints. * * @param pts List of points that define the line. * @param style Style to be used for painting the line. */ public void drawLine(List<mxPoint> pts, Map<String, Object> style) { String strokeColor = mxUtils.getString(style, mxConstants.STYLE_STROKECOLOR); int strokeWidth = (int) (mxUtils.getInt(style, mxConstants.STYLE_STROKEWIDTH, 1) * scale); if (strokeColor != null && strokeWidth > 0) { mxPoint last = pts.get(0); for (int i = 1; i < pts.size(); i++) { mxPoint pt = pts.get(i); drawSegment((int) last.getX(), (int) last.getY(), (int) pt .getX(), (int) pt.getY(), strokeColor, strokeWidth); last = pt; } } }
/** * Draws the given lines as segments between all points of the given list * of mxPoints. * * @param pts List of points that define the line. * @param style Style to be used for painting the line. */ public void drawLine(List<mxPoint> pts, Map<String, Object> style) { String strokeColor = mxUtils.getString(style, mxConstants.STYLE_STROKECOLOR); int strokeWidth = (int) (mxUtils.getInt(style, mxConstants.STYLE_STROKEWIDTH, 1) * scale); if (strokeColor != null && strokeWidth > 0) { mxPoint last = pts.get(0); for (int i = 1; i < pts.size(); i++) { mxPoint pt = pts.get(i); drawSegment((int) last.getX(), (int) last.getY(), (int) pt .getX(), (int) pt.getY(), strokeColor, strokeWidth); last = pt; } } }
int start = (int) Math.max(2, Math.round(mxUtils.getInt( swimlane.getStyle(), mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE)
int start = (int) Math.max(2, Math.round(mxUtils.getInt( swimlane.getStyle(), mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE)
int start = (int) Math.round(mxUtils.getInt(state.getStyle(), mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE)
int current = mxUtils.getInt(style, key); value = !((current & flag) == flag);
int current = mxUtils.getInt(style, key); value = !((current & flag) == flag);
int start = (int) Math.round(mxUtils.getInt(style, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE)
mxConstants.STYLE_IMAGE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE); int imgWidth = (int) (mxUtils.getInt(style, mxConstants.STYLE_IMAGE_WIDTH, mxConstants.DEFAULT_IMAGESIZE) * scale); int imgHeight = (int) (mxUtils.getInt(style, mxConstants.STYLE_IMAGE_HEIGHT, mxConstants.DEFAULT_IMAGESIZE) * scale); int spacing = (int) (mxUtils .getInt(style, mxConstants.STYLE_SPACING, 2) * scale);
int start = (int) Math.round(mxUtils.getInt(style, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE)
c.setStrokeColor(mxUtils.getString(state.getStyle(), mxConstants.STYLE_STROKECOLOR, mxConstants.NONE)); c.setStrokeWidth(mxUtils.getInt(state.getStyle(), mxConstants.STYLE_STROKEWIDTH, 1)); c.setDashed(mxUtils.isTrue(state.getStyle(), mxConstants.STYLE_DASHED,
c.setStrokeColor(mxUtils.getString(state.getStyle(), mxConstants.STYLE_STROKECOLOR, mxConstants.NONE)); c.setStrokeWidth(mxUtils.getInt(state.getStyle(), mxConstants.STYLE_STROKEWIDTH, 1)); c.setDashed(mxUtils.isTrue(state.getStyle(), mxConstants.STYLE_DASHED,