/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { NamedStyle style = (NamedStyle) super.parse(instance, node, value); if (node.hasChild("Description")) { Description desc = (Description) node.getChildValue("Description"); style.getDescription().setAbstract(desc.getAbstract()); style.getDescription().setTitle(desc.getTitle()); } return style; } }
public DescriptionBuilder reset(Description original) { unset = false; title = original.getTitle(); description = original.getAbstract(); return this; }
} else if (childName.equalsIgnoreCase("Title")) { style.getDescription().setTitle(parseInternationalString(child)); } else if (childName.equalsIgnoreCase("Abstract")) { style.getDescription().setAbstract(parseInternationalString(child)); } else if (childName.equalsIgnoreCase("IsDefault")) { if ("1".equals(firstChildValue)) {
assertEquals( "A orange generic style", style.getDescription().getTitle().toString()); assertEquals(1, style.featureTypeStyles().size()); FeatureTypeStyle fts = style.featureTypeStyles().get(0); assertEquals( "raster", fts.rules().get(0).getDescription().getTitle().toString()); assertEquals( "orange polygon", fts.rules().get(1).getDescription().getTitle().toString()); assertEquals( "orange line", fts.rules().get(2).getDescription().getTitle().toString()); assertEquals( "orange point", fts.rules().get(3).getDescription().getTitle().toString());
@Override public void visit(Rule rule) { super.visit(rule); Rule copy = (Rule) pages.peek(); Description description = new DescriptionImpl( new SimpleInternationalString(targetLabel), copy.getDescription() != null ? copy.getDescription().getAbstract() : null); copy.setDescription(description); } }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { StyledLayerDescriptor sld = (StyledLayerDescriptor) super.parse(instance, node, value); if (node.hasChild("Description")) { Description desc = (Description) node.getChildValue("Description"); if (desc.getAbstract() != null) { sld.setAbstract(desc.getAbstract().toString()); } if (desc.getTitle() != null) { sld.setTitle(desc.getTitle().toString()); } } return sld; } }
rule.setName(getFirstChildValue(child)); } else if (childName.equalsIgnoreCase("Title")) { rule.getDescription().setTitle(parseInternationalString(child)); } else if (childName.equalsIgnoreCase("Abstract")) { rule.getDescription().setAbstract(parseInternationalString(child)); } else if (childName.equalsIgnoreCase("MinScaleDenominator")) { rule.setMinScaleDenominator(Double.parseDouble(getFirstChildValue(child)));
@Override public Void answer() throws Throwable { Object[] args = getCurrentArguments(); InputStream is = (InputStream) args[1]; byte[] input = IOUtils.toByteArray(is); SLDParser parser = new SLDParser(CommonFactoryFinder.getStyleFactory()); parser.setInput(new ByteArrayInputStream(input)); StyledLayerDescriptor sld = parser.parseSLD(); NamedLayer nl = (NamedLayer) sld.getStyledLayers()[0]; assertEquals("foo", nl.getName()); Style style = nl.getStyles()[0]; assertEquals( "A raster style", style.getDescription().getTitle().toString()); assertEquals(1, style.featureTypeStyles().size()); FeatureTypeStyle fts = style.featureTypeStyles().get(0); assertEquals(1, fts.rules().size()); assertThat( fts.rules().get(0).symbolizers().get(0), instanceOf(RasterSymbolizer.class)); // make sure it's valid SLDValidator validator = new SLDValidator(); List errors = validator.validateSLD(new ByteArrayInputStream(input)); assertEquals(0, errors.size()); return null; } });
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Style style = (Style) super.parse(instance, node, value); if (node.hasChild("Description")) { Description desc = (Description) node.getChildValue("Description"); style.getDescription().setAbstract(desc.getAbstract()); style.getDescription().setTitle(desc.getTitle()); } // TODO: OnlineResource return style; } }
public void visit(Style style) { if (style instanceof NamedStyle) { start("NamedStyle"); element("Name", style.getName()); end("NamedStyle"); } else { start("UserStyle"); element("Name", style.getName()); if (style.getDescription() != null && style.getDescription().getTitle() != null) element("Title", style.getDescription().getTitle()); if (style.isDefault()) { element("IsDefault", "1"); } if (style.getDescription() != null && style.getDescription().getAbstract() != null) element("Abstract", style.getDescription().getAbstract()); FeatureTypeStyle[] fts = style.getFeatureTypeStyles(); for (int i = 0; i < fts.length; i++) { visit(fts[i]); } end("UserStyle"); } }
ft.setName(getFirstChildValue(child)); } else if (childName.equalsIgnoreCase("Title")) { ft.getDescription().setTitle(parseInternationalString(child)); } else if (childName.equalsIgnoreCase("Abstract")) { ft.getDescription().setAbstract(parseInternationalString(child)); } else if (childName.equalsIgnoreCase("FeatureTypeName")) { ft.setFeatureTypeName(getFirstChildValue(child));
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); String text = null; if (value != null) { Style style = (Style) value; InternationalString title = style.getDescription().getTitle(); if (title != null) { text = title.toString(); }else { text = "Default Styler"; } } label.setText(text); return label; } }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { FeatureTypeStyle fts = (FeatureTypeStyle) super.parse(instance, node, value); if (node.hasChild("Description")) { Description d = (Description) node.getChildValue("Description"); fts.getDescription().setTitle(d.getTitle()); fts.getDescription().setAbstract(d.getAbstract()); } return fts; } }
public void visit(FeatureTypeStyle fts) { start("FeatureTypeStyle"); if ((fts.getName() != null) && (fts.getName().length() > 0)) { element("Name", fts.getName()); } if (fts.getDescription() != null && fts.getDescription().getTitle() != null) element("Title", fts.getDescription().getTitle()); if (fts.getDescription() != null && fts.getDescription().getAbstract() != null) element("Abstract", fts.getDescription().getAbstract()); if ((fts.featureTypeNames() != null) && (fts.featureTypeNames().size() > 0)) { element("FeatureTypeName", fts.featureTypeNames().iterator().next().toString()); } if (fts.getTransformation() != null) { element("Transformation", fts.getTransformation()); } String[] sti = fts.getSemanticTypeIdentifiers(); if (sti.length != 1 || !sti[0].equals(SemanticType.ANY.toString())) { for (int i = 0; i < sti.length; i++) { element("SemanticTypeIdentifier", sti[i]); } } Rule[] rules = fts.getRules(); for (int i = 0; i < rules.length; i++) { rules[i].accept(this); } encodeVendorOptions(fts.getOptions()); end("FeatureTypeStyle"); }
public Style build() { if (unset) { return null; } Style s; if (fts.size() == 0) { s = sf.createNamedStyle(); s.setName(name); } else { s = sf.createStyle(); s.setName(name); if (styleAbstract != null) s.getDescription().setAbstract(new SimpleInternationalString(styleAbstract)); if (title != null) s.getDescription().setTitle(new SimpleInternationalString(title)); for (FeatureTypeStyleBuilder builder : fts) { s.featureTypeStyles().add(builder.build()); } s.setDefault(isDefault); } reset(); return s; }
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); String text = null; if (value != null) { Style style = (Style) value; InternationalString title = style.getDescription().getTitle(); if (title != null) { text = title.toString(); }else { text = "Default Styler"; } } label.setText(text); return label; } }
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Style style = (Style) super.parse(instance, node, value); if (node.hasChild("Description")) { Description desc = (Description) node.getChildValue("Description"); style.getDescription().setAbstract(desc.getAbstract()); style.getDescription().setTitle(desc.getTitle()); } //TODO: OnlineResource return style; }
public void visit(Rule rule) { start("Rule"); if (rule.getName() != null) element("Name", rule.getName()); if (rule.getDescription() != null && rule.getDescription().getTitle() != null) element("Title", rule.getDescription().getTitle()); if (rule.getDescription() != null && rule.getDescription().getAbstract() != null) element("Abstract", rule.getDescription().getAbstract());
featureTypeStyle .getDescription() .setTitle((InternationalString) node.getChildValue("Title")); featureTypeStyle .getDescription() .setAbstract((InternationalString) node.getChildValue("Abstract"));
static String getRuleLabel(Rule rule, GetLegendGraphicRequest req) { // What's the label on this rule? We prefer to use // the 'title' if it's available, but fall-back to 'name' final Description description = rule.getDescription(); String label = ""; if (description != null && description.getTitle() != null) { final InternationalString title = description.getTitle(); if (req.getLocale() != null) { label = title.toString(req.getLocale()); } else { label = title.toString(); } } else if (rule.getName() != null) { label = rule.getName(); } return label; } }