// FIXME: Use constants for the CSS Properties names // FIXME: Use a helper to determine whether the custom styles are computed or forced protected Map<Declaration, Boolean> handleCustomStyle(CustomStyle customStyle, View view) { Map<Declaration, Boolean> declarations = new LinkedHashMap<Declaration, Boolean>(); GMFToCSSConverter converter = GMFToCSSConverter.instance; handleCustomStyle( view, "elementIcon", VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON, declarations, converter.convert(customStyle.showElementIcon())); handleCustomStyle( view, "shadow", VisualInformationPapyrusConstants.SHADOWFIGURE, declarations, converter.convert(customStyle.showShadow())); handleCustomStyle( view, "qualifiedNameDepth", VisualInformationPapyrusConstants.QUALIFIED_NAME, declarations, converter.convert(customStyle.getQualifiedNameDepth())); return declarations; }
protected Declaration handleStyleFeature(Style style, EStructuralFeature feature) { Declaration declaration = CssFactory.eINSTANCE.createDeclaration(); declaration.setProperty(feature.getName()); GMFToCSSConverter converter = GMFToCSSConverter.instance; if (isString(feature)) { declaration.setExpression(converter.convert((String) style.eGet(feature))); } if (isInteger(feature)) { if (feature.getName().endsWith("Color")) { Color color = FigureUtilities.integerToColor((Integer) style.eGet(feature)); declaration.setExpression(converter.convert(color)); color.dispose(); } else { declaration.setExpression(converter.convert((Integer) style.eGet(feature))); } } if (feature.getEType() == NotationPackage.eINSTANCE.getGradientData()) { declaration.setExpression(converter.convert((GradientData) style.eGet(feature))); } if (feature.getEType() instanceof EEnum) { declaration.setExpression(converter.convert((Enumerator) style.eGet(feature))); } if (isBoolean(feature)) { declaration.setExpression(converter.convert((Boolean) style.eGet(feature))); } return declaration; }