arcgissamples\cartography\propertypage\ValenceRendererPropertyPage.java
/* Copyright 2010 ESRI * * All rights reserved under the copyright laws of the United States * and applicable international laws, treaties, and conventions. * * You may freely redistribute and use this sample code, with or * without modification, provided you include the original copyright * notice and use restrictions. * * See the use restrictions. * */ package arcgissamples.cartography.propertypage; import java.awt.Color; import java.io.IOException; import javax.swing.JFrame; import arcgissamples.cartography.ValenceRenderer; import com.esri.arcgis.carto.IFeatureRenderer; import com.esri.arcgis.cartoUI.BaseCustomRendererPropertyPage; import com.esri.arcgis.display.IRgbColor; import com.esri.arcgis.display.RgbColor; import com.esri.arcgis.interop.AutomationException; import com.esri.arcgis.interop.extn.ArcGISCategories; import com.esri.arcgis.interop.extn.ArcGISExtension; @ArcGISExtension(categories = { ArcGISCategories.ESRIRendererPropertyPages }) public class ValenceRendererPropertyPage extends BaseCustomRendererPropertyPage { ValenceRendererPropertyPageUI valencepropertyUI; @Override public void apply(IFeatureRenderer arg0) { try { Color color0 = valencepropertyUI.bgColor0; Color color1 = valencepropertyUI.bgColor1; Color color2 = valencepropertyUI.bgColor2; Color color3 = valencepropertyUI.bgColor3; if (color0 != null) { IRgbColor rgbcolor0 = new RgbColor(); rgbcolor0.setRed(color0.getRed()); rgbcolor0.setGreen(color0.getGreen()); rgbcolor0.setBlue(color0.getBlue()); ((ValenceRenderer) arg0).setColor0(rgbcolor0); ((ValenceRenderer) arg0).setLabel0(valencepropertyUI.jLabel3.getText()); } if (color1 != null) { IRgbColor rgbcolor1 = new RgbColor(); rgbcolor1.setRed(color1.getRed()); rgbcolor1.setGreen(color1.getGreen()); rgbcolor1.setBlue(color1.getBlue()); ((ValenceRenderer) arg0).setColor1(rgbcolor1); ((ValenceRenderer) arg0).setLabel1(valencepropertyUI.jLabel4.getText()); } if (color2 != null) { IRgbColor rgbcolor2 = new RgbColor(); rgbcolor2.setRed(color2.getRed()); rgbcolor2.setGreen(color2.getGreen()); rgbcolor2.setBlue(color2.getBlue()); ((ValenceRenderer) arg0).setColor2(rgbcolor2); ((ValenceRenderer) arg0).setLabel2(valencepropertyUI.jLabel5.getText()); } if (color3 != null) { IRgbColor rgbcolor3 = new RgbColor(); rgbcolor3.setRed(color3.getRed()); rgbcolor3.setGreen(color3.getGreen()); rgbcolor3.setBlue(color3.getBlue()); ((ValenceRenderer) arg0).setColor3(rgbcolor3); ((ValenceRenderer) arg0).setLabel3(valencepropertyUI.jLabel6.getText()); } } catch (Exception e) { e.printStackTrace(); } } @Override public Class getCustomRendererDef() { return ValenceRenderer.class; } @Override public String getDescription() throws IOException, AutomationException { return "Valence Renderer Property Page"; } @Override public String getName() throws IOException, AutomationException { return "Valence"; } @Override public int getPreviewImage() throws IOException, AutomationException { return 0; } @Override public String getType() throws IOException, AutomationException { return "Network Renderer"; } @Override public JFrame initGUI(IFeatureRenderer arg0) { try { valencepropertyUI = new ValenceRendererPropertyPageUI(); } catch (Exception e) { e.printStackTrace(); } return valencepropertyUI; } @Override public int getPriority() throws IOException, AutomationException { return 0; } }