Revision 28915 trunk/extensions/extDataLocator/src/com/iver/gvsig/datalocator/DataLocatorExtension.java
DataLocatorExtension.java | ||
---|---|---|
48 | 48 |
import com.hardcode.gdbms.engine.data.DataSource; |
49 | 49 |
import com.iver.andami.PluginServices; |
50 | 50 |
import com.iver.andami.plugins.Extension; |
51 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
51 | 52 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
52 | 53 |
import com.iver.cit.gvsig.fmap.MapContext; |
53 | 54 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
... | ... | |
66 | 67 |
*/ |
67 | 68 |
public class DataLocatorExtension extends Extension { |
68 | 69 |
|
69 |
boolean bFirstTimeOpened = false; |
|
70 |
IWindow iWDataSelection = null; |
|
71 |
IWindow previousView = null; |
|
70 | 72 |
|
71 | 73 |
/* (non-Javadoc) |
72 | 74 |
* @see com.iver.andami.plugins.Extension#inicializar() |
73 | 75 |
*/ |
74 | 76 |
public void initialize() { |
75 |
bFirstTimeOpened = false; |
|
76 | 77 |
registerIcons(); |
77 | 78 |
|
78 | 79 |
} |
... | ... | |
99 | 100 |
// vi.setHeight(Preferences.userRoot().getInt("gvSIG.DataLocator.h", vi.getHeight())); |
100 | 101 |
|
101 | 102 |
PluginServices.getMDIManager().addWindow(dataSelectionPanel); |
102 |
|
|
103 |
bFirstTimeOpened = true;
|
|
103 |
iWDataSelection = dataSelectionPanel; |
|
104 |
iWDataSelection.getWindowInfo();
|
|
104 | 105 |
} |
105 | 106 |
|
106 | 107 |
/* (non-Javadoc) |
... | ... | |
119 | 120 |
MapContext mapContext = model.getMapContext(); |
120 | 121 |
if (mapContext.getLayers().getLayersCount() > 0) { |
121 | 122 |
LayersIterator iter = newValidLayersIterator(mapContext.getLayers()); |
122 |
if (!iter.hasNext()) |
|
123 |
if (!iter.hasNext()){
|
|
123 | 124 |
return false; |
125 |
} |
|
124 | 126 |
} else { |
125 | 127 |
return false; |
126 | 128 |
} |
... | ... | |
128 | 130 |
// Si la vista tiene el tema con el que est? configurado |
129 | 131 |
// el DataLocator y el usuario ha decidido que se abra |
130 | 132 |
// autom?ticamente, la abrimos inmediatamente. |
131 |
if (!bFirstTimeOpened)
|
|
132 |
{
|
|
133 |
int userOpen = Preferences.userRoot().getInt("gvSIG.DataLocator.open_first_time", -1);
|
|
134 |
if (userOpen == 1)
|
|
135 |
{
|
|
136 |
String layerName = Preferences.userRoot().get("LAYERNAME_FOR_DATA_LOCATION", "");
|
|
137 |
FLayer lyr = mapContext.getLayers().getLayer(layerName);
|
|
138 |
if (lyr != null)
|
|
139 |
{
|
|
140 |
DataSelectionPanel dataSelectionPanel = new DataSelectionPanel(mapContext);
|
|
141 |
WindowInfo vi = dataSelectionPanel.getWindowInfo();
|
|
142 |
vi.setX(Preferences.userRoot().getInt("gvSIG.DataLocator.x", vi.getX()));
|
|
143 |
vi.setY(Preferences.userRoot().getInt("gvSIG.DataLocator.y", vi.getY()));
|
|
144 |
// vi.setWidth(Preferences.userRoot().getInt("gvSIG.DataLocator.w", vi.getWidth()));
|
|
145 |
// vi.setHeight(Preferences.userRoot().getInt("gvSIG.DataLocator.h", vi.getHeight()));
|
|
133 |
if (iWDataSelection == null || (PluginServices.getMDIManager()
|
|
134 |
.getWindowInfo(iWDataSelection).isClosed() && f!=previousView)) {
|
|
135 |
int userOpen = Preferences.userRoot().getInt("gvSIG.DataLocator.open_first_time", -1);
|
|
136 |
if (userOpen == 1)
|
|
137 |
{
|
|
138 |
String layerName = Preferences.userRoot().get("LAYERNAME_FOR_DATA_LOCATION", "");
|
|
139 |
FLayer lyr = mapContext.getLayers().getLayer(layerName);
|
|
140 |
if (lyr != null)
|
|
141 |
{
|
|
142 |
DataSelectionPanel dataSelectionPanel = new DataSelectionPanel(mapContext);
|
|
143 |
WindowInfo vi = dataSelectionPanel.getWindowInfo();
|
|
144 |
vi.setX(Preferences.userRoot().getInt("gvSIG.DataLocator.x", vi.getX()));
|
|
145 |
vi.setY(Preferences.userRoot().getInt("gvSIG.DataLocator.y", vi.getY()));
|
|
146 |
// vi.setWidth(Preferences.userRoot().getInt("gvSIG.DataLocator.w", vi.getWidth()));
|
|
147 |
// vi.setHeight(Preferences.userRoot().getInt("gvSIG.DataLocator.h", vi.getHeight()));
|
|
146 | 148 |
|
147 |
PluginServices.getMDIManager().addWindow(dataSelectionPanel); |
|
148 |
bFirstTimeOpened = true; |
|
149 |
} |
|
150 |
} |
|
151 |
} |
|
149 |
PluginServices.getMDIManager().addWindow(dataSelectionPanel); |
|
150 |
iWDataSelection = dataSelectionPanel; |
|
151 |
iWDataSelection.getWindowInfo(); |
|
152 |
} |
|
153 |
} |
|
154 |
} |
|
155 |
previousView = f; |
|
152 | 156 |
} |
153 | 157 |
return true; |
154 | 158 |
} |
Also available in: Unified diff