Hei Ole,

thanx for the fix. I´ve done a bug report so i won`t forget to include it

stefan


Ole Rahn schrieb:
> Our users recently had a problem: When you use ColorTheming for 
> attribute "A" values and then change the attribute type of attribute "A" 
> (edit schema, e.g. double to string, ...) the whole layer disappears, 
> because the ColorTheming is messed up (a bunch of exceptions is thrown, 
> etc.)
> 
> A quick solution would be to check if an attribute's type was changed 
> and if so, if there is a ColorTheming for that attribute in the layer 
> and if so, remove the ColorTheming.
> 
> Code for that can be found in 
> com.vividsolutions.jump.workbench.ui.plugin.ViewSchemaPlugIn#applyChanges(final
>  
> Layer layer, final SchemaPanel panel) and could like this:
> 
> private void applyChanges(final Layer layer, final SchemaPanel panel)
>         throws Exception {
>         if (!panel.isModified()) {
>             //User just pressed the Apply button even though he made no 
> edits.
>             //Don't truncate the undo history; instead, exit. [Jon Aquino]
>             return;
>         }
> 
>         if (panel.validateInput() != null) {
>             throw new Exception(panel.validateInput());
>         }
> 
>         panel.getModel().removeBlankRows();
> 
>         FeatureSchema newSchema = new FeatureSchema();
>        
>         // START: added by Ole
>         FeatureSchema oldSchema = 
> layer.getFeatureCollectionWrapper().getFeatureSchema();
>         String attributeName = null;
>         // END: added by Ole
> 
>         for (int i = 0; i < panel.getModel().getRowCount(); i++) {
>             // START: added/modyfied by Ole
>             attributeName = panel.getModel().get(i).getName();
>            
>             newSchema.addAttribute(attributeName,
>                 panel.getModel().get(i).getType());
>            
>             if ( oldSchema.hasAttribute(attributeName) &&
>                     
> !newSchema.getAttributeType(attributeName).equals(oldSchema.getAttributeType(attributeName))
>  
> ){
>                 if (ColorThemingStyle.get(layer) != null){
>                     layer.removeStyle(ColorThemingStyle.get(layer));
>                     layer.getBasicStyle().setEnabled(true);
>                     layer.fireAppearanceChanged();
>                 }
>             }
>             // END: added/modyfied by Ole
>            
>         }
> 
> (...)
> 
> If this code is used, there is still a ClassCastException thrown, but 
> the layer stays visible and OJ stays functional.
> 
> 
> Best regards
> Ole
> 
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Ole Rahn
> FH Osnabrück
> Forschungsschwerpunkt PIROL
> 
> Raum   SD-107
> Tel.:  0541 969 3617
> mail.: [EMAIL PROTECTED]
> web:   www.projekt-pirol.de/pirol-datenmanagement.html
> 
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> 
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to