Re: [JPP-Devel] SVN: [4500] core/trunk/src/com/vividsolutions/jump/workbench/ui

2015-06-17 Thread edgar . soldin
On 17.06.2015 22:52, jump-pilot-...@lists.sourceforge.net wrote:
 @@ -667,7 +668,11 @@
   public void fireSelectionChanged() {
   for (Iterator i = listeners.iterator(); i.hasNext();) {
   LayerViewPanelListener l = (LayerViewPanelListener) 
 i.next();
 - l.selectionChanged();
 +// [mmichaud 2015-06-17] Do not propagate selectionChange if the 
 change
 +// comes from AttributeTablePanel
 +if (getWorkBenchFrame().getActiveInternalFrame() instanceof 
 ViewAttributesPlugIn.ViewAttributesFrame) continue;
 +if (getWorkBenchFrame().getActiveInternalFrame() instanceof 
 InfoFrame) continue;
 +l.selectionChanged();
   }
   }

hey Mike,

sorry, but that's unclean. there may be other listeners (apart form 
Info-,Attrib.Frame) that will need but do not get notified this way.

..ede

--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] SVN: [4500] core/trunk/src/com/vividsolutions/jump/workbench/ui

2015-06-17 Thread jump-pilot-svn
Revision: 4500
  http://sourceforge.net/p/jump-pilot/code/4500
Author:   michaudm
Date: 2015-06-17 20:52:45 + (Wed, 17 Jun 2015)
Log Message:
---
LayerViewPanel : keep from propagating SelectionChange if it originates from an 
AttributeTable

Modified Paths:
--
core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributeTablePanel.java
core/trunk/src/com/vividsolutions/jump/workbench/ui/LayerViewPanel.java

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributeTablePanel.java
===
--- 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributeTablePanel.java
2015-06-17 06:19:43 UTC (rev 4499)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributeTablePanel.java
2015-06-17 20:52:45 UTC (rev 4500)
@@ -575,14 +575,6 @@
 rowset.add(mapIdRow.get(((Feature) obj).getID()));
 }
 
-// return if the set of selected raws spread over too man 
intervals
-// as it will take to much time to update the table
-//Integer[] rows = rowset.toArray(new 
Integer[rowset.size()]);
-//int countRanges = 0;
-//for (int i = 1; i  rowset.size(); i++) {
-//if (rows[i] - rows[i - 1]  1) countRanges++;
-//}
-
 // update the table
 int rowini = -2, rowfin = -2;
 table.setSelectionModel(defaultSelectionModel);

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/LayerViewPanel.java
===
--- core/trunk/src/com/vividsolutions/jump/workbench/ui/LayerViewPanel.java 
2015-06-17 06:19:43 UTC (rev 4499)
+++ core/trunk/src/com/vividsolutions/jump/workbench/ui/LayerViewPanel.java 
2015-06-17 20:52:45 UTC (rev 4500)
@@ -90,6 +90,7 @@
 import com.vividsolutions.jump.workbench.ui.cursortool.DummyTool;
 import com.vividsolutions.jump.workbench.ui.cursortool.LeftClickFilter;
 import com.vividsolutions.jump.workbench.ui.cursortool.QuasimodeTool;
+import com.vividsolutions.jump.workbench.ui.plugin.ViewAttributesPlugIn;
 import com.vividsolutions.jump.workbench.ui.renderer.RenderingManager;
 import com.vividsolutions.jump.workbench.ui.renderer.java2D.Java2DConverter;
 import 
com.vividsolutions.jump.workbench.ui.renderer.style.PinEqualCoordinatesStyle;
@@ -667,7 +668,11 @@
public void fireSelectionChanged() {
for (Iterator i = listeners.iterator(); i.hasNext();) {
LayerViewPanelListener l = (LayerViewPanelListener) 
i.next();
-   l.selectionChanged();
+// [mmichaud 2015-06-17] Do not propagate selectionChange if the 
change
+// comes from AttributeTablePanel
+if (getWorkBenchFrame().getActiveInternalFrame() instanceof 
ViewAttributesPlugIn.ViewAttributesFrame) continue;
+if (getWorkBenchFrame().getActiveInternalFrame() instanceof 
InfoFrame) continue;
+l.selectionChanged();
}
}
 


--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] LayerView/AttributeTable selection synchronization

2015-06-17 Thread Michaël Michaud
Hi,

with r4500, I stop event propagation a bit earlier.
We now should have the previous behaviour while selecting in AttributeTable.

Michaël

Le 17/06/2015 10:33, edgar.sol...@web.de a écrit :
 On 17.06.2015 06:38, Michaël Michaud wrote:
 Hi Ede,

 btw. i noticed that our AttributWindow only supports it for selection, but 
 not for unselection.
 Seems that when the LayerView is active, Ctrl D can be used to unselect,
 while Shift A is the way to unselect the Attributetable.
 I admit this is not very consistent. LayerView seems too complex to
 change. Maybe JTable default behaviour can be changed. Any hint ?
 let's keep shortcuts aside for now. what Jukka and me talked about is the 
 mouse click select behaviour.

 try a version before your commit and after. before you could select ranges via
 1. Click one (one selected)
 2. holding Shift+Click another one (now the range from 1. to this row are 
 selected)
 3. thereafter Ctrl+Click another unselected one (now the prev. range and this 
 one are selected)
 4. Ctrl+Shift+Click another unselected one (now the prev. range plus a new 
 range are selected)

 ranges work analogue for unselection when your starting cell is unselected 
 but your end cell or cells in the range are.
 points 3. and 4. for unselection do not work anymore after your synch commit, 
 but did before

 ok, dug in a bit further and versions before the synchronization supported 
 Ctrl+Shift+Click deselection.

 as far as i can see this is prevented now because table row selection does 
 not actually only select rows anymore but
 - selects in table
 - fires an event to the layerview selectionchange event
 - which in turn updates the table agn. because its registered as a 
 layerviewchange listener
 - which involves a selection clearing and reselecting the table entries agn.

 Mike: afaics selection events coming from the table should only update the 
 layerview but skip reupdating the table selection
 Sorry, I did not understand how the new event propagation is related to
 Ctrl+Shift+Click deselection.
 Here is how the new LayerView listener is supposed to prevent selection
 events to enter an infinite loop,
 starting from your example :
 - selects in table
 - fires an event to the layerview SelectionChange event (updates the
 layerView)
 - which in turn fires the new LayerView listener registered in
 AttributeTable
 - this LayerView Listener does not know where the events come from
 (layerView or attributePanel), so it will update back the AttributeTable
 - but to break the loop, this update will not fire the SelectionChange
 again.

 I you know a better way to handle such synchronization, let me know, I
 found only a few examples.

 i would have to fiddle as well, but the whole loop does not feel correct. 
 ideally both (layerview, attrib.table) would register themselves to the other 
 as listeners, but not throw any more events when they receive the change 
 event.

 maybe ill find some time to look at it more closely.

 ..ede

 --
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel



--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] SVN: [4501] core/trunk/src/com/vividsolutions/jump/workbench/ui

2015-06-17 Thread jump-pilot-svn
Revision: 4501
  http://sourceforge.net/p/jump-pilot/code/4501
Author:   michaudm
Date: 2015-06-18 05:53:25 + (Thu, 18 Jun 2015)
Log Message:
---
New attempt to fix selection event dispatching between AttributeTable and 
LayerView

Modified Paths:
--
core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributeTablePanel.java
core/trunk/src/com/vividsolutions/jump/workbench/ui/LayerViewPanel.java

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributeTablePanel.java
===
--- 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributeTablePanel.java
2015-06-17 20:52:45 UTC (rev 4500)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributeTablePanel.java
2015-06-18 05:53:25 UTC (rev 4501)
@@ -43,6 +43,7 @@
 import javax.swing.table.TableCellRenderer;
 import javax.swing.table.TableColumnModel;
 
+import com.vividsolutions.jump.workbench.ui.plugin.ViewAttributesPlugIn;
 import org.openjump.core.ui.plugin.view.ViewOptionsPlugIn;
 
 import com.vividsolutions.jts.geom.Geometry;
@@ -527,6 +528,12 @@
 @Override
 public void selectionChanged() {
 try {
+
+if 
(workbenchContext.getWorkbench().getFrame().getActiveInternalFrame()
+.isAncestorOf(AttributeTablePanel.this)) return;
+if 
(workbenchContext.getWorkbench().getFrame().getActiveInternalFrame()
+.isAncestorOf(AttributeTablePanel.this)) return;
+
 // Get selected features :
 // For AttributeTable, selected features are highlighted
 // For InfoModel, selected features may be added to the 
model

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/LayerViewPanel.java
===
--- core/trunk/src/com/vividsolutions/jump/workbench/ui/LayerViewPanel.java 
2015-06-17 20:52:45 UTC (rev 4500)
+++ core/trunk/src/com/vividsolutions/jump/workbench/ui/LayerViewPanel.java 
2015-06-18 05:53:25 UTC (rev 4501)
@@ -668,10 +668,6 @@
public void fireSelectionChanged() {
for (Iterator i = listeners.iterator(); i.hasNext();) {
LayerViewPanelListener l = (LayerViewPanelListener) 
i.next();
-// [mmichaud 2015-06-17] Do not propagate selectionChange if the 
change
-// comes from AttributeTablePanel
-if (getWorkBenchFrame().getActiveInternalFrame() instanceof 
ViewAttributesPlugIn.ViewAttributesFrame) continue;
-if (getWorkBenchFrame().getActiveInternalFrame() instanceof 
InfoFrame) continue;
 l.selectionChanged();
}
}


--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] SVN: [4500] core/trunk/src/com/vividsolutions/jump/workbench/ui

2015-06-17 Thread Michaël Michaud

 @@ -667,7 +668,11 @@
  public void fireSelectionChanged() {
  for (Iterator i = listeners.iterator(); i.hasNext();) {
  LayerViewPanelListener l = (LayerViewPanelListener) 
 i.next();
 -l.selectionChanged();
 +// [mmichaud 2015-06-17] Do not propagate selectionChange if 
 the change
 +// comes from AttributeTablePanel
 +if (getWorkBenchFrame().getActiveInternalFrame() instanceof 
 ViewAttributesPlugIn.ViewAttributesFrame) continue;
 +if (getWorkBenchFrame().getActiveInternalFrame() instanceof 
 InfoFrame) continue;
 +l.selectionChanged();
  }
  }
 hey Mike,

 sorry, but that's unclean. there may be other listeners (apart form 
 Info-,Attrib.Frame) that will need but do not get notified this way.

Right,

What about r4501 ?

Michaël

 ..ede

 --
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel



--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] LayerView/AttributeTable selection synchronization

2015-06-17 Thread edgar . soldin
On 17.06.2015 06:38, Michaël Michaud wrote:
 Hi Ede,
 
 btw. i noticed that our AttributWindow only supports it for selection, but 
 not for unselection.
 Seems that when the LayerView is active, Ctrl D can be used to unselect, 
 while Shift A is the way to unselect the Attributetable.
 I admit this is not very consistent. LayerView seems too complex to 
 change. Maybe JTable default behaviour can be changed. Any hint ?

let's keep shortcuts aside for now. what Jukka and me talked about is the mouse 
click select behaviour.

try a version before your commit and after. before you could select ranges via 
1. Click one (one selected)
2. holding Shift+Click another one (now the range from 1. to this row are 
selected)
3. thereafter Ctrl+Click another unselected one (now the prev. range and this 
one are selected)
4. Ctrl+Shift+Click another unselected one (now the prev. range plus a new 
range are selected)

ranges work analogue for unselection when your starting cell is unselected but 
your end cell or cells in the range are.
points 3. and 4. for unselection do not work anymore after your synch commit, 
but did before

 ok, dug in a bit further and versions before the synchronization supported 
 Ctrl+Shift+Click deselection.

 as far as i can see this is prevented now because table row selection does 
 not actually only select rows anymore but
 - selects in table
 - fires an event to the layerview selectionchange event
 - which in turn updates the table agn. because its registered as a 
 layerviewchange listener
 - which involves a selection clearing and reselecting the table entries agn.

 Mike: afaics selection events coming from the table should only update the 
 layerview but skip reupdating the table selection
 Sorry, I did not understand how the new event propagation is related to 
 Ctrl+Shift+Click deselection.
 Here is how the new LayerView listener is supposed to prevent selection 
 events to enter an infinite loop,
 starting from your example :
 - selects in table
 - fires an event to the layerview SelectionChange event (updates the 
 layerView)
 - which in turn fires the new LayerView listener registered in 
 AttributeTable
 - this LayerView Listener does not know where the events come from 
 (layerView or attributePanel), so it will update back the AttributeTable
 - but to break the loop, this update will not fire the SelectionChange 
 again.
 
 I you know a better way to handle such synchronization, let me know, I 
 found only a few examples.
 

i would have to fiddle as well, but the whole loop does not feel correct. 
ideally both (layerview, attrib.table) would register themselves to the other 
as listeners, but not throw any more events when they receive the change event.

maybe ill find some time to look at it more closely.

..ede

--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] SVN: [4499] core/trunk

2015-06-17 Thread jump-pilot-svn
Revision: 4499
  http://sourceforge.net/p/jump-pilot/code/4499
Author:   michaudm
Date: 2015-06-17 06:19:43 + (Wed, 17 Jun 2015)
Log Message:
---
read/write cpg file (codepage for shp/dbf)

Modified Paths:
--
core/trunk/ChangeLog
core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java

Modified: core/trunk/ChangeLog
===
--- core/trunk/ChangeLog2015-06-17 05:27:35 UTC (rev 4498)
+++ core/trunk/ChangeLog2015-06-17 06:19:43 UTC (rev 4499)
@@ -3,7 +3,7 @@
 2015-06-17 mmichaud m.michael.mich...@orange.fr
   * fix bug in dbf writer described in
 http://sourceforge.net/p/jump-pilot/mailman/message/34210973/
-  * read and use cpg file (codepage for shp/dbf) if it exists
+  * read/write cpg file (codepage for shp/dbf)
 
 2015-06-13 mmichaud m.michael.mich...@orange.fr
   * LayerView / AttributePanel selection synchronization

Modified: core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java
===
--- core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java  
2015-06-17 05:27:35 UTC (rev 4498)
+++ core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java  
2015-06-17 06:19:43 UTC (rev 4499)
@@ -45,9 +45,7 @@
 import org.geotools.shapefile.Shapefile;
 
 import javax.swing.*;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
+import java.io.*;
 import java.net.URL;
 import java.nio.charset.Charset;
 import java.util.*;
@@ -246,6 +244,7 @@
 String shpfileName;
 String dbffname;
 String shxfname;
+String cpgfname;
 
 String path;
 String fname;
@@ -293,6 +292,14 @@
String charsetName = dp.getProperty(charset);
if (charsetName == null) charsetName = 
Charset.defaultCharset().name();
 writeDbf(featureCollection, dbffname, Charset.forName(charsetName));
+PrintWriter pw = null;
+try {
+cpgfname = path + fname_withoutextention + .cpg;
+pw = new PrintWriter(new FileOutputStream(cpgfname));
+pw.write(Charset.forName(charsetName).name());
+} finally {
+if (pw != null) pw.close();
+}
 
 // this gc will be a collection of either multi-points, 
multi-polygons, or multi-linestrings
 // polygons will have the rings in the correct order


--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel