Revision: 4557
          http://sourceforge.net/p/jump-pilot/code/4557
Author:   michaudm
Date:     2015-12-03 12:43:38 +0000 (Thu, 03 Dec 2015)
Log Message:
-----------
Initial commit of a new extension "ViewSetManager"

Added Paths:
-----------
    plug-ins/ViewManagerPlugin/
    plug-ins/ViewManagerPlugin/trunk/
    plug-ins/ViewManagerPlugin/trunk/build.xml
    plug-ins/ViewManagerPlugin/trunk/resources/
    plug-ins/ViewManagerPlugin/trunk/resources/view_manager/
    plug-ins/ViewManagerPlugin/trunk/resources/view_manager/language/
    
plug-ins/ViewManagerPlugin/trunk/resources/view_manager/language/jump.properties
    
plug-ins/ViewManagerPlugin/trunk/resources/view_manager/language/jump_fr.properties
    plug-ins/ViewManagerPlugin/trunk/src/
    plug-ins/ViewManagerPlugin/trunk/src/org/
    plug-ins/ViewManagerPlugin/trunk/src/org/openjump/
    plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/
    plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/StyledLayer.java
    plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/View.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewManagerExtension.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewManagerPlugIn.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewSet.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewSetPanel.java
    plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/AbstractPStyle.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/ColorUtil.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyle.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyleFill.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyleLine.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PColorThemingStyle.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PDecorationStyle.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PLabelStyle.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PScale.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PStyle.java
    
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PVertexStyle.java

Added: plug-ins/ViewManagerPlugin/trunk/build.xml
===================================================================
--- plug-ins/ViewManagerPlugin/trunk/build.xml                          (rev 0)
+++ plug-ins/ViewManagerPlugin/trunk/build.xml  2015-12-03 12:43:38 UTC (rev 
4557)
@@ -0,0 +1,96 @@
+<project name="kml-driver" default="compile-all" basedir=".">
+
+    
<!--*************************************************************************
+      
*****************************************************************************
+      **                                  PROPERTIES                           
  **
+      
*****************************************************************************
+      
**************************************************************************-->
+
+    <!-- PROPERTIES : MAIN ARCHITECTURE -->
+    <property name="src" value="src" />
+    <property name="bin" value="bin" />
+    <property name="lib" value="lib" />
+    <property name="build" value="build" />
+    <property name="dist" value="dist" />
+    <property name="doc-api" value="doc-api" />
+    <property name="resources" value="resources" />
+    <!--property name="openjump-ext"  
value="../OpenJUMP-2012/dist/openjump-1.6.0alpha/lib/ext" /-->
+
+    <!-- plugins -->
+    <!-- drivers -->
+    <property name="view-manager" value="ViewManager" />
+    <property name="view-manager-version" value="0.2.0" />
+
+
+    <!-- =================================================================== 
-->
+    <!-- Defines the classpath used for compilation and test.                
-->
+    <!-- =================================================================== 
-->
+    <path id="classpath">
+        <fileset dir="${lib}">
+            <include name="**/*.jar" />
+        </fileset>
+    </path>
+
+    <target name="clean" id="clean">
+        <delete dir="${build}" />
+        <delete dir="${dist}" />
+    </target>
+
+    <target name="compile-all" id="compile-all" depends="clean">
+        <tstamp />
+        <mkdir dir="${build}" />
+        <javac srcdir="${src}" destdir="${build}"
+               debug="on" deprecation="false" verbose="no" 
includeantruntime="false"
+               source="1.5" target="1.5">
+            <classpath refid="classpath" />
+        </javac>
+        <copy todir="${build}">
+            <fileset dir="${src}" casesensitive="false" includes="**/*.gif, 
**/*.jpg, **/*.png" />
+            <fileset dir="${src}" casesensitive="false" 
includes="**/*.properties" />
+            <fileset dir="${resources}" casesensitive="false" 
includes="**/*.properties" />
+            <fileset dir="${src}" casesensitive="false" includes="**/*.html" />
+            <fileset dir="${src}" casesensitive="false" includes="**/*.txt" />
+            <fileset dir="${src}" casesensitive="false" 
includes="**/*.java2xml" />
+        </copy>
+        <tstamp>
+            <format property="build-date" pattern="yyyy-MM-dd" locale="en,GB"/>
+        </tstamp>
+        <!--replace dir="${build}">
+            <include name="**/*.properties"/>
+            <replacefilter token="@name@" value="${kml-driver-name}"/>
+            <replacefilter token="@version@" value="${kml-driver-version}" />
+            <replacefilter token="@date@" value="${build-date}" />
+        </replace-->
+    </target>
+
+    <!-- =================================================================== 
-->
+    <!-- kml driver                                                          
-->
+    <!-- =================================================================== 
-->
+    <target name="jar-ViewManager" id="jar-ViewManager" depends="compile-all">
+        <jar basedir="${build}" 
jarfile="${dist}/${view-manager}-${view-manager-version}.jar">
+            <!--include name="org/openjump/ext/setattributes/**/*" /-->
+            <!--fileset dir="${build}"/-->
+        </jar>
+        <!--copy todir="${dist}">
+            <fileset dir="${resources}" />
+        </copy-->
+        <copy file="${dist}/${view-manager}-${view-manager-version}.jar"
+              
todir="D:/LOGICIELS/OpenJUMP-Portable-20150328-r4357-PLUS/OpenJUMP-20150328-r4357-PLUS/lib/ext"
 />
+    </target>
+
+    <target name="zip-ViewManager-src" id="zip-ViewManager-src" 
depends="jar-ViewManager">
+        <zip basedir="." 
destfile="${dist}/${view-manager}-src-${view-manager-version}.zip">
+            <include name="${dist}/*.jar" />
+            <include name="${src}/org/openjump/ext/**/*.java" />
+            <include name="${resources}/**/*.properties" />
+            <include name="build.xml" />
+            <include name="ChangeLog" />
+        </zip>
+    </target>
+
+    <target name="copy-oj-maison" depends="jar-ViewManager">
+        <copy file="${dist}/${view-manager}-${view-manager-version}.jar"
+              
tofile="D:\\LOGICIELS\\OpenJUMP\\OpenJUMP-Portable-20150518-r4453-PLUS-IGN\\OpenJUMP-20150518-r4453-PLUS\\lib\\ext\\${view-manager}-${view-manager-version}.jar"/>
+    </target>
+
+</project>
\ No newline at end of file

Added: 
plug-ins/ViewManagerPlugin/trunk/resources/view_manager/language/jump.properties
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/resources/view_manager/language/jump.properties
                            (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/resources/view_manager/language/jump.properties
    2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,24 @@
+ViewManagerPlugIn = View Manager
+ViewManagerPlugIn.Menu.File = File
+ViewManagerPlugIn.Menu.File.New = Nouveau
+ViewManagerPlugIn.Menu.File.Open = Open
+ViewManagerPlugIn.Menu.File.Save = Save
+ViewManagerPlugIn.Menu.File.SaveAs = SaveAs
+ViewManagerPlugIn.Toolbar = Toolbar
+ViewManagerPlugIn.Toolbar.New.Tooltip = Create a New View Set
+ViewManagerPlugIn.Toolbar.Open.Tooltip = Open a View Set
+ViewManagerPlugIn.Toolbar.Save.Tooltip = Save current view Set
+ViewManagerPlugIn.Toolbar.SaveAs.Tooltip = Save current View Set in a New File
+ViewManagerPlugIn.ViewSetName = View Set Name
+ViewManagerPlugIn.add-view-from-project = Add View From Current Project
+ViewManagerPlugIn.add-view-from-selected-layers = Add View From Selected Layers
+ViewManagerPlugIn.add = Add
+ViewManagerPlugIn.-new-viewset = \ New ViewSet
+ViewManagerPlugIn.ChooseViewSet = Choose a View Set
+
+ViewSetPanel.apply = Apply
+ViewSetPanel.delete = Delete
+ViewSetPanel.move-to-top = Move to top
+ViewSetPanel.move-up = Move up
+ViewSetPanel.move-down = Move down
+ViewSetPanel.move-to-bottom = Move to bottom

Added: 
plug-ins/ViewManagerPlugin/trunk/resources/view_manager/language/jump_fr.properties
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/resources/view_manager/language/jump_fr.properties
                         (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/resources/view_manager/language/jump_fr.properties
 2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,24 @@
+ViewManagerPlugIn = Gestionnaire de vues
+ViewManagerPlugIn.Menu.File = Fichier
+ViewManagerPlugIn.Menu.File.New = Nouveau
+ViewManagerPlugIn.Menu.File.Open = Ouvrir
+ViewManagerPlugIn.Menu.File.Save = Sauvegarder
+ViewManagerPlugIn.Menu.File.SaveAs = Sauvegarder sous
+ViewManagerPlugIn.Toolbar = Barre d'outils
+ViewManagerPlugIn.Toolbar.New.Tooltip = Cr\xE9er un nouveau jeu de vues
+ViewManagerPlugIn.Toolbar.Open.Tooltip = Ouvrir un jeu de vues existant
+ViewManagerPlugIn.Toolbar.Save.Tooltip = Sauvegarder le jeu de vues courant
+ViewManagerPlugIn.Toolbar.SaveAs.Tooltip = Sauvegarder le jeu de vues dans un 
fichier
+ViewManagerPlugIn.ViewSetName = Nom du jeu de vues
+ViewManagerPlugIn.add-view-from-project = Ajouter la vue courante
+ViewManagerPlugIn.add-view-from-selected-layers = Ajouter les couches 
s\xE9lectionn\xE9es
+ViewManagerPlugIn.add = Ajouter
+ViewManagerPlugIn.-new-viewset = \ -\ Nouveau jeu de vues
+ViewManagerPlugIn.ChooseViewSet = Choisir un jeu de vues
+
+ViewSetPanel.apply = Appliquer
+ViewSetPanel.delete = Supprimer
+ViewSetPanel.move-to-top = D\xE9placer tout en haut
+ViewSetPanel.move-up = D\xE9placer vers le haut
+ViewSetPanel.move-down = D\xE9pacer vers le bas
+ViewSetPanel.move-to-bottom = D\xE9placer tout en bas
\ No newline at end of file

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/StyledLayer.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/StyledLayer.java
                          (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/StyledLayer.java
  2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,219 @@
+package org.openjump.ext.viewmanager;
+
+import com.vividsolutions.jump.workbench.model.Category;
+import com.vividsolutions.jump.workbench.model.Layer;
+import com.vividsolutions.jump.workbench.model.LayerManager;
+import com.vividsolutions.jump.workbench.model.Layerable;
+import com.vividsolutions.jump.workbench.ui.renderer.style.*;
+import org.apache.log4j.Logger;
+import org.openjump.ext.viewmanager.style.*;
+
+import javax.xml.bind.annotation.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+@XmlRootElement
+public class StyledLayer {
+
+    final Logger LOG = Logger.getLogger(StyledLayer.class);
+
+    @XmlAttribute
+    String category;
+
+    @XmlAttribute
+    String layer;
+
+    @XmlAttribute
+    boolean visible = true;
+
+    @XmlAttribute
+    boolean editable = false;
+
+    @XmlAttribute
+    boolean selectable = true;
+
+    @XmlElement
+    PScale scale;
+
+    @XmlElementWrapper
+    @XmlAnyElement (lax=true)
+    List<PStyle> styles;
+
+    public StyledLayer() {
+        addStyle(new PBasicStyle(new BasicStyle()));
+        addStyle(new PLabelStyle(new LabelStyle()));
+        //addStyle(new PColorThemingStyle(new ColorThemingStyle()));
+    }
+
+    public void addStyle(PStyle style) {
+        if(styles == null) styles = new ArrayList<PStyle>();
+        styles.add(style);
+    }
+
+    public void setBasicStyle(BasicStyle style) {
+        if (styles != null) {
+            List<PStyle> stylesToBeRemoved = new ArrayList<PStyle>();
+            for (PStyle pstyle : this.styles) {
+                if (pstyle instanceof PBasicStyle) {
+                    stylesToBeRemoved.add(pstyle);
+                }
+            }
+            styles.removeAll(stylesToBeRemoved);
+        }
+        addStyle(new PBasicStyle(style));
+    }
+
+    public void setVertexStyle(BasicStyle bStyle, VertexStyle vStyle) {
+        if (styles != null) {
+            List<PStyle> stylesToBeRemoved = new ArrayList<PStyle>();
+            for (PStyle pstyle : this.styles) {
+                if (pstyle instanceof PVertexStyle) {
+                    stylesToBeRemoved.add(pstyle);
+                }
+            }
+            styles.removeAll(stylesToBeRemoved);
+        }
+        addStyle(new PVertexStyle(bStyle, vStyle));
+    }
+
+    public void setLabelStyle(LabelStyle style) {
+        if (styles != null) {
+            List<PStyle> stylesToBeRemoved = new ArrayList<PStyle>();
+            for (PStyle pstyle : this.styles) {
+                if (pstyle instanceof PLabelStyle) {
+                    stylesToBeRemoved.add(pstyle);
+                }
+            }
+            styles.removeAll(stylesToBeRemoved);
+        }
+        addStyle(new PLabelStyle(style));
+    }
+
+    public void setColorThemingStyle(ColorThemingStyle style) {
+        if (styles != null) {
+            List<PStyle> stylesToBeRemoved = new ArrayList<PStyle>();
+            for (PStyle pstyle : this.styles) {
+                if (pstyle instanceof PColorThemingStyle) {
+                    stylesToBeRemoved.add(pstyle);
+                }
+            }
+            styles.removeAll(stylesToBeRemoved);
+        }
+        addStyle(new PColorThemingStyle(style));
+        if (style.isEnabled()) {
+            PStyle basicStyle = getStyle(PBasicStyle.class);
+            if (basicStyle != null) {
+                ((PBasicStyle)basicStyle).setEnabled(false);
+            }
+        }
+    }
+
+    public PStyle getStyle(Class clazz) {
+        for (PStyle style : styles) {
+            if (clazz.isInstance(style)) return style;
+        }
+        return null;
+    }
+
+    /**
+     * Apply styles on layers matching the category/layer attributes
+     * @param layerManager
+     */
+    public void applyStyles(LayerManager layerManager) {
+        List<Category> categories = layerManager.getCategories();
+        for (Category cat : categories) {
+            List<Layerable> layerables = cat.getLayerables();
+            for (Layerable lyr : layerables) {
+                LOG.info(cat + "/" + lyr);
+                if (accept(category, layer, cat, lyr)) {
+                    LOG.info("accepted : apply styles");
+                    applyStyles(lyr);
+                }
+            }
+        }
+    }
+
+    /**
+     * Remove all old styles of lyr and apply new styles.
+     * @param lyr
+     */
+    public void applyStyles(Layerable lyr) {
+        LOG.info("Apply styles to " + lyr);
+        lyr.setVisible(visible);
+        if (scale != null) {
+            lyr.setScaleDependentRenderingEnabled(scale.scaleDependent);
+            lyr.setMaxScale(scale.maxScale);
+            lyr.setMinScale(scale.minScale);
+        }
+        if (lyr instanceof Layer) {
+            Layer layer = (Layer) lyr;
+            layer.setSelectable(selectable);
+            layer.setEditable(editable);
+            if (styles != null) {
+                LOG.info("Nombre de styles enregistrés : " + styles.size());
+                LOG.info("Styles : " + styles);
+                for (PStyle pstyle : styles) {
+                    LOG.info("  - transform " + pstyle + " to");
+                    try {
+                        Style newStyle = pstyle.getStyle(lyr);
+                        LOG.info("  - apply " + 
newStyle.getClass().getSimpleName());
+                        Style rm = layer.getStyle(newStyle.getClass());
+                        if (rm != null) layer.removeStyle(rm);
+                        layer.addStyle(newStyle);
+                    } catch (Exception e) {
+                        LOG.warn(pstyle, e);
+                    }
+                }
+            }
+        }
+    }
+
+    boolean accept(String categoryFilter, String layerFilter, Category 
category, Layerable layer) {
+        Pattern categoryPattern = null;
+        Pattern layerPattern = null;
+        try {
+            categoryPattern = getPattern(categoryFilter);
+            layerPattern = getPattern(layerFilter);
+        } catch (PatternSyntaxException pse) {
+                pse.printStackTrace();
+            LOG.warn("", pse);
+        }
+        return categoryPattern.matcher(category.getName()).matches() &&
+                layerPattern.matcher(layer.getName()).matches();
+    }
+
+    /**
+     * Transform the category or layer attribute into a Pattern.
+     * If the attribute starts and ends with a /, it IS already a regex
+     * Else if the attribute contains a *, the * is interpreted as a glob
+     * Else, the category or layer name must match exactly the attribute
+     */
+    private Pattern getPattern(String filter) throws PatternSyntaxException {
+        Pattern pattern;
+        if(filter == null) {
+            pattern = Pattern.compile(".*");
+        } else {
+            // create a pattern to read this specific name
+            pattern = Pattern.compile(Pattern.quote(filter));
+            // then try to interpret * as glob
+            if (filter.contains("*")) {
+                pattern = Pattern.compile(filter.replaceAll("\\*", ".*"));
+            }
+            // and finally, try to read layer name as a regex if it starts and 
ends with a /
+            if (filter.startsWith("/") && filter.endsWith("/")) {
+                pattern = Pattern.compile(filter.substring(1, filter.length() 
- 1));
+            }
+        }
+        return pattern;
+    }
+
+    public String toString() {
+        return category + " / " + layer + " (" + visible + "/" + editable + 
"/" + selectable + ") : " + styles;
+    }
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/View.java
===================================================================
--- plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/View.java 
                        (rev 0)
+++ plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/View.java 
2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,80 @@
+package org.openjump.ext.viewmanager;
+
+import com.vividsolutions.jump.workbench.model.Layer;
+import com.vividsolutions.jump.workbench.model.LayerManager;
+import com.vividsolutions.jump.workbench.model.Layerable;
+import com.vividsolutions.jump.workbench.plugin.PlugInContext;
+import com.vividsolutions.jump.workbench.ui.renderer.style.ColorThemingStyle;
+import org.apache.log4j.Logger;
+import org.openjump.ext.viewmanager.style.PBasicStyle;
+import org.openjump.ext.viewmanager.style.PColorThemingStyle;
+import org.openjump.ext.viewmanager.style.PScale;
+import org.openjump.ext.viewmanager.style.PStyle;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A view is a set of styles applied on specified layers.
+ *
+ */
+@XmlRootElement
+public class View {
+
+    @XmlAttribute
+    String name;
+
+    @XmlElement(name="styledLayer")
+    List<StyledLayer> styledLayers;
+
+    public View(){}
+
+    public View(PlugInContext context, boolean selectedOnly) {
+        System.out.println("new View");
+        LayerManager layerManager = context.getLayerManager();
+        List<Layerable> layerables = 
layerManager.getLayerables(Layerable.class);
+        name = context.getTask().getName();
+        for (Layerable layerable : layerables) {
+            System.out.println("    layerable " + layerable);
+            if ((!selectedOnly) || (selectedOnly && 
context.getSelectedLayerables().contains(layerable))) {
+                System.out.println("    styledLayer");
+                StyledLayer styledLayer = new StyledLayer();
+                styledLayer.layer = layerable.getName();
+                styledLayer.visible = layerable.isVisible();
+                System.out.println("    styledLayer : " + styledLayer);
+                if (layerable.isScaleDependentRenderingEnabled()) {
+                    System.out.println("    isScaleDependentRenderingEnabled");
+                    PScale scale = new PScale();
+                    scale.scaleDependent = true;
+                    scale.minScale = layerable.getMinScale();
+                    scale.maxScale = layerable.getMaxScale();
+                    styledLayer.scale = scale;
+                }
+                if (layerable instanceof Layer) {
+                    System.out.println("layerable instanceof Layer");
+                    styledLayer.selectable = ((Layer)layerable).isSelectable();
+                    styledLayer.editable = ((Layer)layerable).isEditable();
+                    
styledLayer.setBasicStyle(((Layer)layerable).getBasicStyle());
+                    styledLayer.setVertexStyle(((Layer) 
layerable).getBasicStyle(), ((Layer) layerable).getVertexStyle());
+                    
styledLayer.setLabelStyle(((Layer)layerable).getLabelStyle());
+                    
styledLayer.setColorThemingStyle((ColorThemingStyle)((Layer) 
layerable).getStyle(ColorThemingStyle.class));
+                    System.out.println("end layerable instanceof Layer");
+                }
+                addStyledLayer(styledLayer);
+            }
+        }
+    }
+
+    public void addStyledLayer(StyledLayer styledLayer) {
+        if (styledLayers == null) styledLayers = new ArrayList<StyledLayer>();
+        styledLayers.add(styledLayer);
+    }
+
+    public String toString() {
+        return name;
+    }
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewManagerExtension.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewManagerExtension.java
                         (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewManagerExtension.java
 2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,22 @@
+package org.openjump.ext.viewmanager;
+
+import com.vividsolutions.jump.workbench.plugin.Extension;
+import com.vividsolutions.jump.workbench.plugin.PlugInContext;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+public class ViewManagerExtension extends Extension {
+
+    public String getName() {
+        return "View Manager Extension (Micha\u00EBl Michaud)";
+    }
+
+    public String getVersion() {
+        return "0.2.0 (2015-12-02)";
+    }
+
+    public void configure(PlugInContext context) throws Exception {
+        new ViewManagerPlugIn().initialize(context);
+    }
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewManagerPlugIn.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewManagerPlugIn.java
                            (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewManagerPlugIn.java
    2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,388 @@
+package org.openjump.ext.viewmanager;
+
+import com.vividsolutions.jump.I18N;
+import com.vividsolutions.jump.util.Range;
+import com.vividsolutions.jump.workbench.WorkbenchContext;
+import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
+import com.vividsolutions.jump.workbench.plugin.PlugInContext;
+import com.vividsolutions.jump.workbench.ui.GUIUtil;
+import com.vividsolutions.jump.workbench.ui.MenuNames;
+import com.vividsolutions.jump.workbench.ui.images.IconLoader;
+import com.vividsolutions.jump.workbench.ui.plugin.FeatureInstaller;
+import org.apache.log4j.Logger;
+import org.openjump.ext.viewmanager.style.*;
+
+import javax.swing.*;
+import javax.swing.filechooser.FileFilter;
+import javax.xml.bind.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.*;
+import java.util.List;
+
+/**
+ * A plugin to apply a "view" to the project (specific styles on defined 
layers)
+ */
+public class ViewManagerPlugIn extends AbstractPlugIn implements 
ActionListener {
+
+    static Logger LOG = Logger.getLogger(ViewManagerPlugIn.class);
+    I18N I18N_ = I18N.getInstance("view_manager");
+
+    final JLabel viewSetNameLabel = new JLabel();
+
+    File viewDir;
+    ViewSetPanel viewSetPanel;
+    PlugInContext context;
+    ViewSet currentViewSet;
+    JDialog dialog;
+    JAXBContext jaxbContext;
+
+    public void initialize(PlugInContext context) throws Exception {
+        WorkbenchContext workbenchContext = context.getWorkbenchContext();
+        FeatureInstaller featureInstaller = new 
FeatureInstaller(workbenchContext);
+        featureInstaller.addMainMenuPlugin(this, new 
String[]{MenuNames.PLUGINS});
+        jaxbContext = JAXBContext.newInstance(
+                ViewSet.class,
+                PBasicStyle.class,
+                PVertexStyle.class,
+                PLabelStyle.class,
+                PScale.class,
+                PColorThemingStyle.class,
+                Range.NegativeInfinity.class,
+                Range.PositiveInfinity.class);
+    }
+
+    public String getName() {
+        return I18N_.getText("view_manager","ViewManagerPlugIn");
+    }
+
+    //public ImageIcon getIcon(){
+    //    return new ImageIcon(this.getClass().getResource("world.png"));
+    //}
+
+    public boolean execute(final PlugInContext context) throws Exception {
+        this.context = context;
+        File pluginDir = 
context.getWorkbenchContext().getWorkbench().getPlugInManager().getPlugInDirectory();
+        viewDir = new File(pluginDir, "views");
+        if (currentViewSet == null) currentViewSet = new ViewSet();
+        JDialog dialog = createDialog(viewDir);
+        GUIUtil.centreOnWindow(dialog);
+        dialog.setVisible(true);
+        return false;
+    }
+
+    JDialog createDialog(final File viewDir) throws IOException {
+        dialog = new JDialog(context.getWorkbenchFrame(), getName(), false);
+
+        // Menu bar definition
+        JMenuBar menuBar = new JMenuBar();
+        JMenu fileMenu = new 
JMenu(I18N_.getText("view_manager","ViewManagerPlugIn.Menu.File"));
+
+        JMenuItem newViewSetMenuItem = new 
JMenuItem(I18N_.getText("view_manager","ViewManagerPlugIn.Menu.File.New"), 
KeyEvent.VK_T);
+        newViewSetMenuItem.setActionCommand("newViewSet");
+        newViewSetMenuItem.addActionListener(this);
+
+        JMenuItem openViewSetMenuItem = new 
JMenuItem(I18N_.getText("view_manager","ViewManagerPlugIn.Menu.File.Open"), 
KeyEvent.VK_O);
+        openViewSetMenuItem.setActionCommand("openViewSet");
+        openViewSetMenuItem.addActionListener(this);
+
+        JMenuItem saveViewSetMenuItem = new 
JMenuItem(I18N_.getText("view_manager","ViewManagerPlugIn.Menu.File.Save"), 
KeyEvent.VK_S);
+        saveViewSetMenuItem.setActionCommand("saveViewSet");
+        saveViewSetMenuItem.addActionListener(this);
+
+        JMenuItem saveAsViewSetMenuItem = new 
JMenuItem(I18N_.getText("view_manager","ViewManagerPlugIn.Menu.File.SaveAs")+"...");
+        saveAsViewSetMenuItem.setActionCommand("saveViewSetAs");
+        saveAsViewSetMenuItem.addActionListener(this);
+
+        menuBar.add(fileMenu);
+        fileMenu.add(newViewSetMenuItem);
+        fileMenu.add(openViewSetMenuItem);
+        fileMenu.add(saveViewSetMenuItem);
+        fileMenu.add(saveAsViewSetMenuItem);
+        dialog.setJMenuBar(menuBar);
+
+        // toolbar definition
+        JToolBar toolBar = new 
JToolBar(I18N_.getText("view_manager","ViewManagerPlugIn.Toolbar"));
+
+        JButton newViewSetButton = new JButton();
+        newViewSetButton.setIcon(IconLoader.icon("fugue/folder.png"));
+        newViewSetButton.setActionCommand("newViewSet");
+        
newViewSetButton.setToolTipText(I18N_.getText("view_manager","ViewManagerPlugIn.Toolbar.New.Tooltip"));
+        newViewSetButton.addActionListener(this);
+        toolBar.add(newViewSetButton);
+
+        JButton openViewSetButton = new JButton();
+        
openViewSetButton.setIcon(IconLoader.icon("fugue/folder-horizontal-open_16.png"));
+        openViewSetButton.setActionCommand("openViewSet");
+        
openViewSetButton.setToolTipText(I18N_.getText("view_manager","ViewManagerPlugIn.Toolbar.Open.Tooltip"));
+        openViewSetButton.addActionListener(this);
+        toolBar.add(openViewSetButton);
+
+        JButton saveViewSetButton = new JButton();
+        saveViewSetButton.setIcon(IconLoader.icon("disk.png"));
+        saveViewSetButton.setActionCommand("saveViewSet");
+        
saveViewSetButton.setToolTipText(I18N_.getText("view_manager","ViewManagerPlugIn.Toolbar.Save.Tooltip"));
+        saveViewSetButton.addActionListener(this);
+        toolBar.add(saveViewSetButton);
+
+        JButton saveViewSetAsButton = new JButton();
+        saveViewSetAsButton.setIcon(IconLoader.icon("disk_dots.png"));
+        saveViewSetAsButton.setActionCommand("saveViewSetAs");
+        
saveViewSetAsButton.setToolTipText(I18N_.getText("view_manager","ViewManagerPlugIn.Toolbar.SaveAs.Tooltip"));
+        saveViewSetAsButton.addActionListener(this);
+        toolBar.add(saveViewSetAsButton);
+
+        dialog.add(toolBar, BorderLayout.PAGE_START);
+        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+        dialog.add(toolBar, BorderLayout.NORTH);
+
+        JPanel mainPanel = new JPanel();
+        mainPanel.setLayout(new GridBagLayout());
+        dialog.add(mainPanel, BorderLayout.CENTER);
+        final GridBagConstraints constraints = new GridBagConstraints();
+
+        constraints.gridx = 0;
+        constraints.gridy = 0;
+        constraints.gridwidth = 2;
+        constraints.fill = GridBagConstraints.HORIZONTAL;
+        constraints.anchor = GridBagConstraints.WEST;
+        constraints.insets = new Insets(2,2,2,2);
+
+        JPanel viewSetNamePanel = new JPanel(new FlowLayout());
+        
viewSetNamePanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
+        viewSetNamePanel.add(new 
JLabel(I18N_.getText("view_manager","ViewManagerPlugIn.ViewSetName") + ":"));
+        viewSetNameLabel.setText(createNewViewSetName());
+        viewSetNameLabel.setForeground(Color.RED);
+        viewSetNamePanel.add(viewSetNameLabel);
+        mainPanel.add(viewSetNamePanel, constraints);
+
+        constraints.gridx = 0;
+        constraints.gridy++;
+        constraints.gridwidth = 1;
+        mainPanel.add(new 
JLabel(I18N_.getText("view_manager","ViewManagerPlugIn.add-view-from-project")),
 constraints);
+        constraints.gridx++;
+        JButton jbAddFromProject = new 
JButton(I18N_.getText("view_manager","ViewManagerPlugIn.add"));
+        jbAddFromProject.addActionListener(this);
+        jbAddFromProject.setActionCommand("addFromProject");
+        mainPanel.add(jbAddFromProject, constraints);
+
+        constraints.gridx = 0;
+        constraints.gridy++;
+        mainPanel.add(new 
JLabel(I18N_.getText("view_manager","ViewManagerPlugIn.add-view-from-selected-layers")),
 constraints);
+        constraints.gridx++;
+        JButton jbAddFromSelectedLayers = new 
JButton(I18N_.getText("view_manager","ViewManagerPlugIn.add"));
+        jbAddFromSelectedLayers.addActionListener(this);
+        jbAddFromSelectedLayers.setActionCommand("addFromSelectedLayers");
+        mainPanel.add(jbAddFromSelectedLayers, constraints);
+
+        constraints.gridx = 0;
+        constraints.gridy++;
+        constraints.gridwidth = 2;
+        mainPanel.add(new JSeparator(), constraints);
+
+        constraints.gridx = 0;
+        constraints.gridy++;
+        constraints.gridwidth = 2;
+        constraints.fill = GridBagConstraints.HORIZONTAL;
+        viewSetPanel = new ViewSetPanel(context, currentViewSet);
+        //addNewViewSet();
+        mainPanel.add(viewSetPanel, constraints);
+
+        return dialog;
+    }
+
+    //FilenameFilter xmlFileFilter = new FilenameFilter() {
+    //    public boolean accept(File dir, String name) {
+    //        return name.toLowerCase().endsWith(".xml");
+    //    }
+    //};
+
+    FileFilter xmlFileFilter = new FileFilter() {
+        public boolean accept(File file) {
+            return file.getName().toLowerCase().endsWith(".xml");
+        }
+        public String getDescription() {
+            return "Filter xml files";
+        }
+    };
+
+    String createNewViewSetName() throws IOException {
+        String newViewSetName = context.getTask().getName() + 
I18N_.getText("view_manager","ViewManagerPlugIn.-new-viewset");
+        if (viewSetNameExists(newViewSetName)) {
+            int count = 2;
+            while (viewSetNameExists(newViewSetName + " (" + count++ + ")")) {}
+            newViewSetName = newViewSetName + " (" + (count-1) + ")";
+        }
+        return newViewSetName;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        String action = e.getActionCommand();
+        if (action.equals("newViewSet")) {
+            newViewSet();
+        } else if (action.equals("openViewSet")) {
+            openViewSet();
+        } else if (action.equals("saveViewSet")) {
+            saveViewSet();
+        } else if (action.equals("saveViewSetAs")) {
+            saveViewSetAs();
+        } else if (action.equals("addFromProject")) {
+            addFromProject(false);
+        } else if (action.equals("addFromSelectedLayers")) {
+            addFromProject(true);
+        }
+    }
+
+    // new method
+    public void newViewSet() {
+        try {
+            String newViewSetName = createNewViewSetName();
+            viewSetNameLabel.setText(newViewSetName);
+            viewSetNameLabel.setForeground(Color.RED);
+            currentViewSet = new ViewSet();
+            currentViewSet.setName(newViewSetName);
+            viewSetPanel.reset(context, currentViewSet);
+            dialog.pack();
+            LOG.info("Add new ViewSet");
+        } catch(Exception e) {
+            LOG.warn("Add new ViewSet", e);
+        }
+    }
+
+    // new method
+    public void openViewSet() {
+        JFileChooser jfc = new JFileChooser(viewDir);
+        
jfc.setDialogTitle(I18N_.getText("view_manager","ViewManagerPlugIn.ChooseViewSet"));
+        jfc.setFileFilter(xmlFileFilter);
+        int r = jfc.showDialog(dialog, "OK");
+        if (r == JFileChooser.APPROVE_OPTION) {
+            File viewSetFile = jfc.getSelectedFile();
+            LOG.info(viewSetFile);
+            try {
+                if (viewSetFile.exists()) {
+                    LOG.info("Unmarshall " + viewSetFile);
+                    Unmarshaller unmarshaller = 
jaxbContext.createUnmarshaller();
+                    currentViewSet = (ViewSet) 
unmarshaller.unmarshal(viewSetFile);
+                    viewSetNameLabel.setText(viewSetFile.getName());
+                    viewSetNameLabel.setForeground(Color.BLACK);
+                    viewSetPanel.reset(context, currentViewSet);
+                }
+                dialog.pack();
+            } catch (UnmarshalException ex) {
+                ex.printStackTrace();
+                LOG.warn(viewSetFile, ex);
+            } catch (JAXBException ex) {
+                ex.printStackTrace();
+                LOG.warn(viewSetFile, ex);
+            }
+        }
+    }
+
+    public void saveViewSet() {
+        try {
+            if (!new File(viewDir, viewSetNameLabel.getText()).exists()) {
+                LOG.error("" + viewSetNameLabel.getName() + " does not 
exists");
+                return;
+            }
+            if (currentViewSet == null) {
+                currentViewSet = new ViewSet();
+            }
+            currentViewSet.setName(viewSetNameLabel.getText());
+            Marshaller marshaller = jaxbContext.createMarshaller();
+            marshaller.marshal(currentViewSet, 
viewSetNameToFile(viewSetNameLabel.getText()));
+            viewSetNameLabel.setForeground(Color.BLACK);
+            dialog.pack();
+            LOG.info("Save ViewSet " + currentViewSet);
+        } catch(JAXBException ex) {
+            ex.printStackTrace();
+            LOG.warn("saveViewSet", ex);
+        }
+    }
+
+    // new
+    public void saveViewSetAs() {
+        JFileChooser jfc = new JFileChooser(viewDir);
+        jfc.setDialogType(JFileChooser.SAVE_DIALOG);
+        //jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
+        jfc.setFileFilter(xmlFileFilter);
+        int r = jfc.showSaveDialog(dialog);
+        if (r == JFileChooser.APPROVE_OPTION) {
+            File viewSetFile = jfc.getSelectedFile();
+            try {
+                if (currentViewSet == null) {
+                    System.out.println("No current view set");
+                    return;
+                }
+                currentViewSet.setName(viewSetFile.getName());
+                Marshaller marshaller = jaxbContext.createMarshaller();
+                marshaller.marshal(currentViewSet, 
viewSetNameToFile(currentViewSet.getName()));
+                viewSetNameLabel.setText(viewSetFile.getName());
+                viewSetNameLabel.setForeground(Color.BLACK);
+                dialog.pack();
+                LOG.info("Save ViewSet " + currentViewSet);
+            } catch(JAXBException ex) {
+                ex.printStackTrace();
+                LOG.warn("saveViewSet", ex);
+            }
+        }
+    }
+
+
+    // new method using file system
+    private boolean viewSetNameExists(String name) throws IOException {
+        if (viewDir != null && viewDir.exists()) {
+            for (File file : viewDir.listFiles()) {
+                if (file.getName().toLowerCase().replaceAll("\\.xml$","")
+                        
.equalsIgnoreCase(name.toLowerCase().replaceAll("\\.xml$", ""))) {
+                    return true;
+                }
+            }
+            return false;
+        } else if (viewDir != null) {
+            if (viewDir.mkdirs()) {
+                return false;
+            }
+            throw new IOException("" + viewDir + " has not been created");
+        } else {
+            throw new IOException("No directory defined to store views");
+        }
+    }
+
+    public void addFromProject(boolean selectedLayersOnly) {
+        try {
+            System.out.println("Create view");
+            View view = new View(context, selectedLayersOnly);
+            if (view.name.equals(context.getTask().getName())) {
+                view.name = context.getTask().getName() + " (" + 
currentViewSet.views.size() + ")";
+            }
+            System.out.println("Add project's view to ViewSet");
+            currentViewSet.addView(view);
+            viewSetNameLabel.setForeground(Color.RED);
+            dialog.repaint();
+            LOG.info("Add project's view to ViewSet");
+        } catch(Exception e) {
+            LOG.warn("addFromProject", e);
+        }
+    }
+
+    private String fileToViewSetName(File file) {
+        String fileName = file.getName();
+        int dotIndex = fileName.indexOf(".");
+        return dotIndex < 0 ? fileName : fileName.substring(0, dotIndex);
+    }
+
+    private File viewSetNameToFile(String name) {
+        if (name.toLowerCase().endsWith(".xml")) {
+            return new File(viewDir, name);
+        } else {
+            return new File(viewDir, name + ".xml");
+        }
+    }
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewSet.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewSet.java  
                            (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewSet.java  
    2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,127 @@
+package org.openjump.ext.viewmanager;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Created by UMichael on 14/06/2015.
+ */
+@XmlRootElement
+public class ViewSet {
+
+    public static int REMOVE = -1;
+    public static int MOVMOD =  0;
+    public static int ADD    =  1;
+
+    List<Listener> listeners = new ArrayList<Listener>();
+
+    private String name;
+
+    @XmlElement (name="view")
+    List<View> views = new ArrayList<View>();
+
+    public ViewSet() {}
+
+    public ViewSet(String name) {
+        this.name = name;
+    }
+
+    public void addView(View view) {
+        System.out.println("addView");
+        views.add(view);
+        fireAddView(view);
+    }
+
+    public void removeView(View view) {
+        views.remove(view);
+        fireRemoveView(view);
+    }
+
+    public void moveViewToTop(View view) {
+        int pos = views.indexOf(view);
+        if (pos < views.size()-1) {
+            views.remove(view);
+            views.add(view);
+            fireMoveView(view);
+        }
+    }
+
+    public void moveViewUp(View view) {
+        int pos = views.indexOf(view);
+        if (pos < views.size()-1) {
+            views.remove(pos);
+            views.add(pos + 1, view);
+            fireMoveView(view);
+        }
+    }
+
+    public void moveViewDown(View view) {
+        int pos = views.indexOf(view);
+        if (pos>0) {
+            views.remove(pos);
+            views.add(pos-1, view);
+            fireMoveView(view);
+        }
+    }
+
+    public void moveViewToBottom(View view) {
+        int pos = views.indexOf(view);
+        if (pos>0) {
+            views.remove(pos);
+            views.add(0, view);
+            fireMoveView(view);
+        }
+    }
+
+    public void fireAddView(View view) {
+        for (Listener listener : listeners) {
+            listener.actionPerformed(this, ADD, view);
+        }
+    }
+
+    public void fireRemoveView(View view) {
+        for (Listener listener : listeners) {
+            listener.actionPerformed(this, REMOVE, view);
+        }
+    }
+
+    public void fireMoveView(View view) {
+        for (Listener listener : listeners) {
+            listener.actionPerformed(this, MOVMOD, view);
+        }
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public boolean isEmpty() {
+        return views.isEmpty();
+    }
+
+    public void addListener(Listener listener) {
+        listeners.add(listener);
+    }
+
+    public void removeListener(Listener listener) {
+        listeners.remove(listener);
+    }
+
+    public String toString() {
+        return name;
+    }
+
+    public static interface Listener {
+        public void actionPerformed(ViewSet viewSet, int mod, View view);
+    }
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewSetPanel.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewSetPanel.java
                         (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/ViewSetPanel.java
 2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,203 @@
+package org.openjump.ext.viewmanager;
+
+import com.vividsolutions.jump.I18N;
+import com.vividsolutions.jump.workbench.plugin.PlugInContext;
+import org.apache.log4j.Logger;
+
+import javax.swing.*;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * Created by UMichael on 14/06/2015.
+ */
+public class ViewSetPanel extends JPanel {
+
+    I18N I18N_ = I18N.getInstance("view_manager");
+
+    ViewSet viewSet;
+
+    public ViewSetPanel(final PlugInContext context, final ViewSet viewSet) {
+        super(new GridBagLayout());
+        setBorder(BorderFactory.createLineBorder(Color.black));
+        initToolBar();
+        if (viewSet != null) {
+            init(context, viewSet);
+            viewSet.addListener(new ViewSet.Listener() {
+                public void actionPerformed(ViewSet viewSet, int mod, View 
view) {
+                    removeAll();
+                    initToolBar();
+                    init(context, viewSet);
+                    Window window = 
SwingUtilities.getWindowAncestor(ViewSetPanel.this);
+                    if (window != null) window.pack();
+                }
+            });
+        }
+    }
+
+    void reset(final PlugInContext context, final ViewSet viewSet) {
+        init(context, viewSet);
+        viewSet.addListener(new ViewSet.Listener(){
+            public void actionPerformed(ViewSet viewSet, int mod, View view) {
+                removeAll();
+                initToolBar();
+                init(context, viewSet);
+                Window window = 
SwingUtilities.getWindowAncestor(ViewSetPanel.this);
+                if (window != null) window.pack();
+            }
+        });
+    }
+
+    private void initToolBar() {
+
+    }
+
+    private void init(PlugInContext context, ViewSet viewSet) {
+        this.viewSet = viewSet;
+        GridBagConstraints constraints = new GridBagConstraints();
+        constraints.gridx = 0;
+        constraints.gridy = 0;
+        constraints.anchor = GridBagConstraints.CENTER;
+        constraints.insets = new Insets(2,2,2,2);
+        if (viewSet != null) {
+            constraints.gridy = viewSet.views.size();
+            for (View view : viewSet.views) {
+                constraints.gridx = 0;
+                constraints.gridy--;
+                add(new ViewPanel(context, view), constraints);
+            }
+        }
+    }
+
+    class ViewPanel extends JPanel implements ActionListener {
+
+        private JMenuItem deleteMenuItem = new 
JMenuItem(I18N_.getText("view_manager","ViewSetPanel.delete"));
+        private JMenuItem topMenuItem = new 
JMenuItem(I18N_.getText("view_manager","ViewSetPanel.move-to-top"));
+        private JMenuItem upMenuItem = new 
JMenuItem(I18N_.getText("view_manager","ViewSetPanel.move-up"));
+        private JMenuItem downMenuItem = new 
JMenuItem(I18N_.getText("view_manager","ViewSetPanel.move-down"));
+        private JMenuItem bottomMenuItem = new 
JMenuItem(I18N_.getText("view_manager","ViewSetPanel.move-to-bottom"));
+        private JPopupMenu popupMenu = new JPopupMenu();
+
+        final private PlugInContext context;
+        final private View view;
+        final private JTextField viewTextField = new JTextField(24);
+        final private JButton apply = new 
JButton(I18N_.getText("view_manager","ViewSetPanel.apply"));
+
+        public ViewPanel(PlugInContext context, View view) {
+            super(new GridBagLayout());
+            this.context = context;
+            this.view = view;
+            init();
+
+            popupMenu.add(deleteMenuItem);
+            deleteMenuItem.addActionListener(this);
+            deleteMenuItem.setActionCommand("delete");
+
+            popupMenu.add(topMenuItem);
+            topMenuItem.addActionListener(this);
+            topMenuItem.setActionCommand("moveToTop");
+
+            popupMenu.add(upMenuItem);
+            upMenuItem.addActionListener(this);
+            upMenuItem.setActionCommand("moveUp");
+
+            popupMenu.add(downMenuItem);
+            downMenuItem.addActionListener(this);
+            downMenuItem.setActionCommand("moveDown");
+
+            popupMenu.add(bottomMenuItem);
+            bottomMenuItem.addActionListener(this);
+            bottomMenuItem.setActionCommand("moveToBottom");
+
+            viewTextField.addActionListener(this);
+            viewTextField.setActionCommand("changeName");
+            apply.addActionListener(this);
+            apply.setActionCommand("apply");
+            apply.setComponentPopupMenu(popupMenu);
+            viewTextField.getDocument().addDocumentListener(new 
DocumentListener() {
+                @Override
+                public void insertUpdate(DocumentEvent e) {
+                    changeName();
+                }
+
+                @Override
+                public void removeUpdate(DocumentEvent e) {
+                    changeName();
+                }
+
+                @Override
+                public void changedUpdate(DocumentEvent e) {
+                    changeName();
+                }
+            });
+        }
+
+        public void init() {
+            GridBagConstraints constraints = new GridBagConstraints();
+            constraints.gridx = 0;
+            constraints.gridy = 0;
+            constraints.insets = new Insets(0,2,0,2);
+            constraints.anchor = GridBagConstraints.WEST;
+            viewTextField.setText(view.name);
+            add(viewTextField, constraints);
+            constraints.gridx = 1;
+            add(apply, constraints);
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent ae) {
+            String action = ae.getActionCommand();
+            if (action.equals("changeName")) {
+                changeName();
+            } else if (action.equals("apply")) {
+                apply();
+            } else if (action.equals("delete")) {
+                delete();
+            } else if (action.equals("moveToTop")) {
+                moveToTop();
+            } else if (action.equals("moveUp")) {
+                moveUp();
+            } else if (action.equals("moveDown")) {
+                moveDown();
+            } else if (action.equals("moveToBottom")) {
+                moveToBottom();
+            }
+        }
+
+        private void changeName() {
+            view.name = viewTextField.getText();
+        }
+
+        private void delete() {
+            viewSet.removeView(view);
+        }
+
+        private void moveToTop() {
+            viewSet.moveViewToTop(view);
+        }
+
+        private void moveUp() {
+            viewSet.moveViewUp(view);
+        }
+
+        private void moveDown() {
+            viewSet.moveViewDown(view);
+        }
+
+        private void moveToBottom() {
+            viewSet.moveViewToBottom(view);
+        }
+
+        private void apply() {
+            for (StyledLayer styledLayer : view.styledLayers) {
+                styledLayer.applyStyles(context.getLayerManager());
+            }
+        }
+
+    }
+
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/AbstractPStyle.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/AbstractPStyle.java
                         (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/AbstractPStyle.java
 2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,27 @@
+package org.openjump.ext.viewmanager.style;
+
+import com.vividsolutions.jump.workbench.model.Layerable;
+import com.vividsolutions.jump.workbench.ui.renderer.style.Style;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Partial implementation of PStyle defining only the common enabled property
+ */
+public abstract class AbstractPStyle implements PStyle {
+
+    private boolean enabled;
+
+    abstract public Style getStyle(Layerable layerable);
+
+    @XmlAttribute
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/ColorUtil.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/ColorUtil.java
                              (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/ColorUtil.java
      2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,17 @@
+package org.openjump.ext.viewmanager.style;
+
+import java.awt.*;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+public class ColorUtil {
+
+    public static Color decode(String color) throws NumberFormatException {
+        return color == null ? null : Color.decode(color);
+    }
+
+    public static String encode(Color color) {
+        return "#" + String.format("%08x", color.getRGB()).substring(2);
+    }
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyle.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyle.java
                            (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyle.java
    2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,50 @@
+package org.openjump.ext.viewmanager.style;
+
+import com.vividsolutions.jump.workbench.model.Layerable;
+import com.vividsolutions.jump.workbench.ui.renderer.style.BasicStyle;
+import com.vividsolutions.jump.workbench.ui.renderer.style.Style;
+import org.apache.log4j.Logger;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+@XmlRootElement (name="basicStyle")
+public class PBasicStyle extends AbstractPStyle {
+
+    @XmlAttribute
+    float opacity = 0.5f;
+
+    @XmlElement
+    PBasicStyleLine line;
+
+    @XmlElement
+    PBasicStyleFill fill;
+
+    public PBasicStyle() {}
+
+    public PBasicStyle(BasicStyle style) {
+        setEnabled(style.isEnabled());
+        line = new PBasicStyleLine().setLineStyle(style);
+        fill = new PBasicStyleFill().setFillStyle(style);
+        opacity = (float) (style).getAlpha() / 255f;
+    }
+
+    public Style getStyle(Layerable layerable) {
+        BasicStyle style = new BasicStyle();
+        style.setEnabled(isEnabled());
+        style.setRenderingFill(fill.enabled);
+        style.setRenderingLine(line.enabled);
+        style.setFillColor(ColorUtil.decode(fill.color));
+        style.setLineColor(ColorUtil.decode(line.color));
+        style.setFractionalLineWidth(line.width);
+        style.setRenderingLinePattern(line.renderingLinePattern);
+        style.setLinePattern(line.pattern);
+        style.setAlpha((int) (opacity * 255));
+        return style;
+    }
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyleFill.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyleFill.java
                                (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyleFill.java
        2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,29 @@
+package org.openjump.ext.viewmanager.style;
+
+import com.vividsolutions.jump.workbench.ui.renderer.style.BasicStyle;
+import org.apache.log4j.Logger;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+public class PBasicStyleFill {
+
+    @XmlAttribute
+    boolean enabled = true;
+
+    @XmlAttribute
+    String color;
+
+    //@XmlAttribute
+    //float pattern = 1;
+
+    PBasicStyleFill() {}
+
+    public PBasicStyleFill setFillStyle(BasicStyle style) {
+        enabled = style.isRenderingFill();
+        color = ColorUtil.encode(style.getFillColor());
+        return this;
+    }
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyleLine.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyleLine.java
                                (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PBasicStyleLine.java
        2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,38 @@
+package org.openjump.ext.viewmanager.style;
+
+import com.vividsolutions.jump.workbench.ui.renderer.style.BasicStyle;
+import org.apache.log4j.Logger;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+public class PBasicStyleLine {
+
+    @XmlAttribute
+    boolean enabled = true;
+
+    @XmlAttribute
+    String color;
+
+    @XmlAttribute
+    float width = 1f;
+
+    @XmlAttribute
+    boolean renderingLinePattern = false;
+
+    @XmlAttribute
+    String pattern;
+
+    PBasicStyleLine() {}
+
+    public PBasicStyleLine setLineStyle(BasicStyle style) {
+        enabled = style.isRenderingLine();
+        color = ColorUtil.encode(style.getLineColor());
+        width = style.getLineWidth();
+        renderingLinePattern = style.isRenderingLinePattern();
+        pattern = style.getLinePattern();
+        return this;
+    }
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PColorThemingStyle.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PColorThemingStyle.java
                             (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PColorThemingStyle.java
     2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,161 @@
+package org.openjump.ext.viewmanager.style;
+
+import com.vividsolutions.jump.util.Range;
+import com.vividsolutions.jump.workbench.model.Layerable;
+import com.vividsolutions.jump.workbench.ui.renderer.style.*;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+@XmlRootElement(name="colorThemingStyle")
+public class PColorThemingStyle extends AbstractPStyle {
+
+    @XmlAttribute
+    boolean vertexStyleEnabled = false;
+
+    @XmlAttribute
+    String attribute = "";
+
+    @XmlElement
+    PBasicStyle defaultStyle = new PBasicStyle();
+
+    @XmlElement (name="theme")
+    Set<Theme> themes = new TreeSet<Theme>();
+
+    public PColorThemingStyle() {}
+
+    public PColorThemingStyle(ColorThemingStyle style) {
+        super();
+        System.out.println("    new PColorThemingStyle");
+        setEnabled(style.isEnabled());
+        attribute = style.getAttributeName();
+        vertexStyleEnabled = style.isVertexStyleEnabled();
+        defaultStyle = new PBasicStyle(style.getDefaultStyle());
+        //Map map = style.getAttributeValueToBasicStyleMap();
+        System.out.println("    PColorThemingStyle initialization");
+        for (Map.Entry entry : 
(Set<Map.Entry>)style.getAttributeValueToBasicStyleMap().entrySet()) {
+            if (entry.getKey() instanceof com.vividsolutions.jump.util.Range) {
+                //System.out.println("      range : " + new RangeKey(
+                //        ((Range)entry.getKey()).getMin(),
+                //        ((Range)entry.getKey()).getMax()));
+                themes.add(new Theme(new RangeKey(
+                        ((Range)entry.getKey()).getMin(),
+                        ((Range)entry.getKey()).getMax()),
+                        new PBasicStyle((BasicStyle)entry.getValue()),
+                        
(String)style.getAttributeValueToLabelMap().get(entry.getKey())));
+            } else {
+                themes.add(new Theme(new ValueKey(entry.getKey()),
+                        new PBasicStyle((BasicStyle)entry.getValue()),
+                        
(String)style.getAttributeValueToLabelMap().get(entry.getKey())));
+            }
+        }
+    }
+
+    public Style getStyle(Layerable layerable) {
+        ColorThemingStyle colorThemingStyle = new ColorThemingStyle();
+        colorThemingStyle.setEnabled(isEnabled());
+        colorThemingStyle.setVertexStyleEnabled(vertexStyleEnabled);
+        colorThemingStyle.setAttributeName(attribute);
+        
colorThemingStyle.setDefaultStyle((BasicStyle)defaultStyle.getStyle(layerable));
+        Map<Object,BasicStyle> mapStyles = new HashMap<Object, BasicStyle>();
+        Map<Object,String> mapLabels = new HashMap<Object, String>();
+        if (themes != null && themes.size()>0 && themes.iterator().next().key 
instanceof Range) {
+            mapStyles = new 
com.vividsolutions.jump.util.Range.RangeTreeMap<Object, BasicStyle>();
+            for (Theme theme : themes) {
+                Object min = ((RangeKey)theme.key).getMin();
+                Object max = ((RangeKey)theme.key).getMax();
+                com.vividsolutions.jump.util.Range range =
+                        new com.vividsolutions.jump.util.Range(min, true, max, 
false);
+                mapStyles.put(range, 
(BasicStyle)theme.style.getStyle(layerable));
+                mapLabels.put(range, theme.label);
+            }
+        } else {
+            mapStyles = new HashMap<Object, BasicStyle>();
+            for (Theme theme : themes) {
+                mapStyles.put(((ValueKey)theme.key).value, 
(BasicStyle)theme.style.getStyle(layerable));
+                mapLabels.put(((ValueKey)theme.key).value, theme.label);
+            }
+        }
+        colorThemingStyle.setAttributeValueToBasicStyleMap(mapStyles);
+        colorThemingStyle.setAttributeValueToLabelMap(mapLabels);
+        return colorThemingStyle;
+    }
+
+
+    @XmlRootElement(name="theme")
+    public static class Theme implements Comparable<Theme> {
+
+        //@XmlElement
+        @XmlElements(value = {
+            @XmlElement(name="value", type=ValueKey.class),
+            @XmlElement(name="range", type=RangeKey.class),
+        })
+        Key key;
+
+        @XmlElement
+        PBasicStyle style;
+
+        @XmlElement
+        String label;
+
+        Theme() {}
+
+        Theme(Key key, PBasicStyle style, String label) {
+            this.key = key;
+            this.style = style;
+            this.label = label;
+        }
+
+        public int compareTo(Theme theme) {
+            return key.compareTo(theme.key);
+        }
+    }
+
+    @XmlRootElement(name="value")
+    public static class ValueKey implements Key {
+
+        @XmlElement
+        String value;
+
+        ValueKey() {}
+
+        ValueKey(Object object) {
+            this.value = object.toString();
+        }
+
+        public int compareTo(Key key) {
+            if (key instanceof ValueKey)
+                return this.value.compareTo(((ValueKey)key).value);
+            return getClass().getName().compareTo(key.getClass().getName());
+        }
+
+    }
+
+    @XmlRootElement(name="range")
+    @XmlAccessorType(XmlAccessType.FIELD)
+    public static class RangeKey extends com.vividsolutions.jump.util.Range 
implements Key {
+
+        RangeKey() {}
+
+        RangeKey(Object min, Object max) {
+            super(min, true, max, false);
+        }
+
+        public int compareTo(Key key) {
+            if (key instanceof Range)
+                return RANGE_COMPARATOR.compare(this, (RangeKey)key);
+            return getClass().getName().compareTo(key.getClass().getName());
+        }
+
+    }
+
+    public interface Key extends Comparable<Key> {}
+
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PDecorationStyle.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PDecorationStyle.java
                               (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PDecorationStyle.java
       2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,16 @@
+package org.openjump.ext.viewmanager.style;
+
+import com.vividsolutions.jump.workbench.model.Layerable;
+import com.vividsolutions.jump.workbench.ui.renderer.style.ColorThemingStyle;
+import com.vividsolutions.jump.workbench.ui.renderer.style.Style;
+import org.openjump.core.ui.style.decoration.ArrowLineStringMiddlepointStyle;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+public class PDecorationStyle extends AbstractPStyle {
+
+    public Style getStyle(Layerable layerable) {
+        return null;
+    }
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PLabelStyle.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PLabelStyle.java
                            (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PLabelStyle.java
    2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,184 @@
+package org.openjump.ext.viewmanager.style;
+
+import com.vividsolutions.jump.workbench.model.Layer;
+import com.vividsolutions.jump.workbench.model.Layerable;
+import com.vividsolutions.jump.workbench.ui.renderer.style.ColorThemingStyle;
+import com.vividsolutions.jump.workbench.ui.renderer.style.LabelStyle;
+import com.vividsolutions.jump.workbench.ui.renderer.style.Style;
+import org.apache.log4j.Logger;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.awt.*;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+@XmlRootElement(name="labelStyle")
+public class PLabelStyle extends AbstractPStyle {
+
+    final Logger LOG = Logger.getLogger(PLabelStyle.class);
+
+    @XmlAttribute
+    String attribute = LabelStyle.FID_COLUMN;
+
+    @XmlAttribute
+    boolean hideOverlaps = true;
+
+    @XmlAttribute
+    boolean scaling = false;
+
+    @XmlAttribute
+    boolean hideAtScale = false;
+
+    @XmlAttribute
+    double maxScale;
+
+    @XmlElement
+    Font font = new Font();
+
+    @XmlElement
+    Outline outline;
+
+    @XmlElement
+    Alignment alignment;
+
+    public PLabelStyle() {}
+
+    public PLabelStyle(LabelStyle labelStyle) {
+        super();
+        setEnabled(labelStyle.isEnabled());
+        this.attribute = labelStyle.getAttribute();
+        this.hideOverlaps = labelStyle.isHidingOverlappingLabels();
+        this.scaling = labelStyle.isScaling();
+        this.hideAtScale = labelStyle.getHideAtScale();
+        this.maxScale = labelStyle.getScaleToHideAt();
+
+        this.font.name = labelStyle.getFont().getName();
+        this.font.bold = (labelStyle.getFont().getStyle() & 1) == 1;
+        this.font.italic = (labelStyle.getFont().getStyle() & 2) == 2;
+        this.font.height = labelStyle.getHeight();
+        this.font.heightAttribute = labelStyle.getHeightAttribute();
+        this.font.color = ColorUtil.encode(labelStyle.getColor());
+
+        if (labelStyle.getOutlineShowing()) {
+            this.outline = new Outline();
+            this.outline.enabled = labelStyle.getOutlineShowing();
+            this.outline.color = 
ColorUtil.encode(labelStyle.getOutlineColor());
+            this.outline.width = labelStyle.getOutlineWidth();
+            this.outline.opacity = labelStyle.getOutlineColor().getAlpha() / 
255f;
+        }
+
+        if(labelStyle.getHorizontalAlignment() != LabelStyle.JUSTIFY_CENTER ||
+                !labelStyle.getHorizontalPosition().equals(LabelStyle.CENTER) 
||
+                !labelStyle.getVerticalAlignment().equals(LabelStyle.DEFAULT)) 
{
+            this.alignment = new Alignment();
+            this.alignment.angleAttribute = labelStyle.getAngleAttribute();
+            this.alignment.horizontalAlignment.alignment = 
labelStyle.getHorizontalAlignment();
+            this.alignment.horizontalAlignment.position = 
labelStyle.getHorizontalPosition();
+            this.alignment.verticalAlignment.alignment = 
labelStyle.getVerticalAlignment();
+        }
+    }
+
+    public Style getStyle(Layerable layerable) {
+        LabelStyle labelStyle = new LabelStyle();
+        LOG.info("    getLabelStyle");
+        if (layerable instanceof Layer) {
+            labelStyle.initialize((Layer) layerable);
+            labelStyle.setEnabled(isEnabled());
+            labelStyle.setAttribute(attribute);
+            labelStyle.setHidingOverlappingLabels(hideOverlaps);
+            labelStyle.setScaling(scaling);
+            labelStyle.setHideAtScale(hideAtScale);
+            labelStyle.setScaleToHideAt(maxScale);
+
+            LOG.info("    getLabelStyle 1");
+
+            int s = 0;
+            s += font.bold ? java.awt.Font.BOLD : 0;
+            s += font.italic ? java.awt.Font.ITALIC : 0;
+            labelStyle.setFont(new java.awt.Font(font.name, s, 
(int)font.height));
+            labelStyle.setHeight(font.height);
+            labelStyle.setColor(ColorUtil.decode(font.color));
+            labelStyle.setHeightAttribute(font.heightAttribute);
+
+            LOG.info("    getLabelStyle 2");
+
+            if (outline != null) {
+                labelStyle.setOutlineShowing(outline.enabled);
+                labelStyle.setOutlineColor(ColorUtil.decode(outline.color), 
(int)(outline.opacity * 255f));
+                labelStyle.setOutlineWidth(outline.width);
+            } else labelStyle.setOutlineShowing(false);
+
+            LOG.info("    getLabelStyle 3");
+
+            if (alignment != null) {
+                
labelStyle.setHorizontalAlignment(alignment.horizontalAlignment.alignment);
+                
labelStyle.setHorizontalPosition(alignment.horizontalAlignment.position);
+                
labelStyle.setVerticalAlignment(alignment.verticalAlignment.alignment);
+                labelStyle.setAngleAttribute(alignment.angleAttribute);
+            }
+        }
+        LOG.info(labelStyle);
+        LOG.info("    " + labelStyle.getAttribute());
+        LOG.info("    " + labelStyle.isEnabled());
+        LOG.info("    " + labelStyle.isScaling());
+        LOG.info("    " + labelStyle.getHeight());
+        return labelStyle;
+    }
+
+
+    @XmlRootElement(name="font")
+    public static class Font {
+        @XmlAttribute
+        String name = "Dialog";
+        @XmlAttribute
+        boolean bold=false;
+        @XmlAttribute
+        boolean italic=false;
+        @XmlAttribute
+        String color = "#000000";
+        @XmlAttribute
+        double height = 12;
+        @XmlAttribute
+        String heightAttribute = "";
+    }
+
+    @XmlRootElement (name="outline")
+    public static class Outline {
+        @XmlAttribute
+        boolean enabled = false;
+        @XmlAttribute
+        String color = "#FFFFFF";
+        @XmlAttribute
+        double width = 1;
+        @XmlAttribute
+        float opacity = 1f;
+    }
+
+    @XmlRootElement (name="alignment")
+    public static class Alignment {
+        @XmlAttribute
+        String angleAttribute = "";
+        @XmlElement
+        HAlignment horizontalAlignment = new HAlignment();
+        @XmlElement
+        VAlignment verticalAlignment = new VAlignment();
+    }
+
+    @XmlRootElement(name="horizontal")
+    public static class HAlignment {
+        @XmlAttribute
+        int alignment = LabelStyle.JUSTIFY_CENTER;
+        @XmlAttribute
+        String position = LabelStyle.CENTER;
+    }
+
+    @XmlRootElement(name="vertical")
+    public static class VAlignment {
+        @XmlAttribute
+        String alignment = LabelStyle.DEFAULT;
+    }
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PScale.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PScale.java
                         (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PScale.java
 2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,21 @@
+package org.openjump.ext.viewmanager.style;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Created by UMichael on 21/06/2015.
+ */
+@XmlRootElement (name="scale")
+public class PScale {
+
+    @XmlAttribute
+    public boolean scaleDependent = false;
+
+    @XmlAttribute
+    public Double minScale = Double.valueOf(1000000);
+
+    @XmlAttribute
+    public Double maxScale = Double.valueOf(1);
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PStyle.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PStyle.java
                         (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PStyle.java
 2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,20 @@
+package org.openjump.ext.viewmanager.style;
+
+import com.vividsolutions.jump.workbench.model.Layerable;
+import com.vividsolutions.jump.workbench.ui.renderer.style.Style;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Persistent style
+ */
+@XmlRootElement(name="style")
+public interface PStyle {
+
+    Style getStyle(Layerable layerable);
+
+    boolean isEnabled();
+
+    void setEnabled(boolean enabled);
+
+}

Added: 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PVertexStyle.java
===================================================================
--- 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PVertexStyle.java
                           (rev 0)
+++ 
plug-ins/ViewManagerPlugin/trunk/src/org/openjump/ext/viewmanager/style/PVertexStyle.java
   2015-12-03 12:43:38 UTC (rev 4557)
@@ -0,0 +1,79 @@
+package org.openjump.ext.viewmanager.style;
+
+import com.vividsolutions.jump.workbench.model.Layerable;
+import com.vividsolutions.jump.workbench.ui.renderer.style.*;
+import de.latlon.deejump.plugin.style.CircleVertexStyle;
+import de.latlon.deejump.plugin.style.CrossVertexStyle;
+import de.latlon.deejump.plugin.style.StarVertexStyle;
+import de.latlon.deejump.plugin.style.TriangleVertexStyle;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.awt.*;
+
+/**
+ * Created by UMichael on 13/06/2015.
+ */
+@XmlRootElement(name="vertexStyle")
+public class PVertexStyle extends AbstractPStyle {
+
+    @XmlAttribute
+    float opacity = 0.5f;
+
+    @XmlElement
+    PBasicStyleLine line;
+
+    @XmlElement
+    PBasicStyleFill fill;
+
+    @XmlElement
+    int size;
+
+    @XmlElement
+    String shape;
+
+    public PVertexStyle() {}
+
+    public PVertexStyle(BasicStyle basic, VertexStyle vertexStyle) {
+        setEnabled(vertexStyle.isEnabled());
+        line = new PBasicStyleLine().setLineStyle(basic);
+        fill = new PBasicStyleFill().setFillStyle(basic);
+        opacity = (float) basic.getAlpha() / 255f;
+        size = vertexStyle.getSize();
+        shape = 
vertexStyle.getClass().getSimpleName().replaceAll("VertexStyle","");
+    }
+
+    public Style getStyle(Layerable layerable) {
+        //BasicStyle style = new BasicStyle();
+        VertexStyle vStyle;
+        if (shape.equals("Circle")) {
+            vStyle = new CircleVertexStyle();
+        } else if (shape.equals("Cross")) {
+            vStyle = new CrossVertexStyle();
+        } else if (shape.equals("Ring")) {
+            vStyle = new RingVertexStyle();
+        } else if (shape.equals("Star")) {
+            vStyle = new StarVertexStyle();
+        } else if (shape.equals("Triangle")) {
+            vStyle = new TriangleVertexStyle();
+        } else {
+            vStyle = new SquareVertexStyle();
+        }
+        vStyle.setEnabled(isEnabled());
+        vStyle.setFillColor(ColorUtil.decode(fill.color));
+        vStyle.setLineColor(ColorUtil.decode(line.color));
+        vStyle.setAlpha((int) (opacity * 255));
+        vStyle.setSize(size);
+        return vStyle;
+    }
+
+    //public Style getStyle(Layerable layerable) {
+    //    return new VertexStyle() {
+    //        @Override
+    //        public void setEnabled(boolean enabled) {
+    //            super.setEnabled(enabled);
+    //        }
+    //    };
+    //}
+}


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to