Revision 4487
trunk/extensions/extCAD/text_en.properties | ||
---|---|---|
1 |
#text_en.properties |
|
2 |
Vista=View |
|
0 | 3 |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/NewTheme.java | ||
---|---|---|
20 | 20 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
21 | 21 |
import com.iver.cit.gvsig.gui.View; |
22 | 22 |
import com.iver.cit.gvsig.gui.cad.MyFinishAction; |
23 |
import com.iver.cit.gvsig.gui.cad.WizardAndami; |
|
23 | 24 |
import com.iver.cit.gvsig.gui.cad.panels.ChooseGeometryType; |
24 | 25 |
import com.iver.cit.gvsig.gui.cad.panels.JPanelFieldDefinition; |
25 | 26 |
import com.iver.cit.gvsig.gui.cad.panels.ShpPanel; |
... | ... | |
52 | 53 |
|
53 | 54 |
LOGO = new javax.swing.ImageIcon(this.getClass().getClassLoader() |
54 | 55 |
.getResource("images/package_graphics.png")); |
55 |
// new |
|
56 |
// ImageIcon(DefaultJWizardComponents.class.getResource("images/logo.jpeg")); |
|
57 | 56 |
|
58 |
SimpleLogoJWizardFrame wizardFrame = new SimpleLogoJWizardFrame( |
|
57 |
/* SimpleLogoJWizardFrame wizardFrame = new SimpleLogoJWizardFrame(
|
|
59 | 58 |
LOGO); |
60 | 59 |
wizardFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
61 | 60 |
|
62 | 61 |
SwingUtilities.updateComponentTreeUI(wizardFrame); |
63 | 62 |
|
64 |
wizardFrame.setTitle("Creaci?n de un nuevo Tema"); |
|
63 |
wizardFrame.setTitle("Creaci?n de un nuevo Tema"); */ |
|
64 |
WizardAndami wizard = new WizardAndami(LOGO); |
|
65 | 65 |
|
66 | 66 |
DriverManager writerManager = LayerFactory.getDM(); |
67 | 67 |
ArrayList spatialDrivers = new ArrayList(); |
... | ... | |
73 | 73 |
spatialDrivers.add(drv.getName()); |
74 | 74 |
} |
75 | 75 |
|
76 |
ChooseGeometryType panelChoose = new ChooseGeometryType(wizardFrame.getWizardComponents());
|
|
77 |
JPanelFieldDefinition panelFields = new JPanelFieldDefinition(wizardFrame.getWizardComponents());
|
|
78 |
wizardFrame.getWizardComponents().addWizardPanel(panelChoose);
|
|
76 |
ChooseGeometryType panelChoose = new ChooseGeometryType(wizard.getWizardComponents()); |
|
77 |
JPanelFieldDefinition panelFields = new JPanelFieldDefinition(wizard.getWizardComponents()); |
|
78 |
wizard.getWizardComponents().addWizardPanel(panelChoose); |
|
79 | 79 |
|
80 |
wizardFrame.getWizardComponents().addWizardPanel(panelFields);
|
|
80 |
wizard.getWizardComponents().addWizardPanel(panelFields); |
|
81 | 81 |
|
82 | 82 |
if (actionCommand.equals("SHP")) |
83 | 83 |
{ |
84 | 84 |
panelChoose.setDriver((ISpatialWriter) writerManager.getDriver("gvSIG shp driver")); |
85 |
wizardFrame.getWizardComponents().addWizardPanel(
|
|
86 |
new ShpPanel(wizardFrame.getWizardComponents()));
|
|
85 |
wizard.getWizardComponents().addWizardPanel( |
|
86 |
new ShpPanel(wizard.getWizardComponents())); |
|
87 | 87 |
|
88 |
wizardFrame.getWizardComponents().setFinishAction(
|
|
89 |
new MyFinishAction(wizardFrame.getWizardComponents(),
|
|
90 |
vista.getMapControl(), actionCommand));
|
|
88 |
wizard.getWizardComponents().setFinishAction( |
|
89 |
new MyFinishAction(wizard.getWizardComponents(), |
|
90 |
vista, actionCommand)); |
|
91 | 91 |
} |
92 | 92 |
if (actionCommand.equals("DXF")) |
93 | 93 |
{ |
94 |
wizardFrame.getWizardComponents().addWizardPanel(
|
|
95 |
new SimpleLabelWizardPanel(wizardFrame
|
|
94 |
wizard.getWizardComponents().addWizardPanel( |
|
95 |
new SimpleLabelWizardPanel(wizard |
|
96 | 96 |
.getWizardComponents(), new JLabel("Done!"))); |
97 | 97 |
} |
98 | 98 |
if (actionCommand.equals("POSTGIS")) |
99 | 99 |
{ |
100 |
wizardFrame.getWizardComponents().addWizardPanel(
|
|
101 |
new SimpleLabelWizardPanel(wizardFrame
|
|
100 |
wizard.getWizardComponents().addWizardPanel( |
|
101 |
new SimpleLabelWizardPanel(wizard |
|
102 | 102 |
.getWizardComponents(), new JLabel("Done!"))); |
103 | 103 |
} |
104 | 104 |
|
105 |
wizardFrame.setSize(540, 350); |
|
106 |
Utilities.centerComponentOnScreen(wizardFrame); |
|
107 |
wizardFrame.show(); |
|
105 |
wizard.getViewInfo().setWidth(540); |
|
106 |
wizard.getViewInfo().setHeight(350); |
|
107 |
wizard.getViewInfo().setTitle(PluginServices.getText(this,"new_theme")); |
|
108 |
// Utilities.centerComponentOnScreen(wizard); |
|
109 |
// wizardFrame.show(); |
|
110 |
PluginServices.getMDIManager().addView(wizard); |
|
108 | 111 |
// System.out.println("Salgo con " + panelChoose.getLayerName()); |
109 | 112 |
} |
110 | 113 |
} |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/EditionManager.java | ||
---|---|---|
97 | 97 |
{ |
98 | 98 |
lyrEdit = FactoryLayerEdited.createLayerEdited(e.getSource()); |
99 | 99 |
editedLayers.add(lyrEdit); |
100 |
System.out.println("NUEVA CAPA EN EDICION: " + lyrEdit.getLayer().getName()); |
|
100 | 101 |
activationChanged(e); |
102 |
|
|
101 | 103 |
} |
104 |
|
|
102 | 105 |
} |
103 | 106 |
|
104 | 107 |
/** |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/WizardAndami.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.cad; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
|
|
5 |
import javax.swing.ImageIcon; |
|
6 |
import javax.swing.JPanel; |
|
7 |
|
|
8 |
import jwizardcomponent.CancelAction; |
|
9 |
import jwizardcomponent.DefaultJWizardComponents; |
|
10 |
import jwizardcomponent.FinishAction; |
|
11 |
|
|
12 |
import com.iver.andami.PluginServices; |
|
13 |
import com.iver.andami.ui.mdiManager.View; |
|
14 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
|
15 |
import com.iver.cit.gvsig.gui.Dialogs.CSSelectionDialog; |
|
16 |
|
|
17 |
public class WizardAndami extends JPanel implements View { |
|
18 |
ViewInfo viewInfo = null; |
|
19 |
WizardPanelWithLogo wizardPanel; |
|
20 |
|
|
21 |
// No deber?an necesitarse un FinishAction y un CancelAction, pero bueno, |
|
22 |
// lo mantengo por ahora. |
|
23 |
private class CloseAction extends FinishAction |
|
24 |
{ |
|
25 |
View v; |
|
26 |
public CloseAction(View view) |
|
27 |
{ |
|
28 |
super(wizardPanel.getWizardComponents()); |
|
29 |
v = view; |
|
30 |
} |
|
31 |
public void performAction() { |
|
32 |
PluginServices.getMDIManager().closeView(v); |
|
33 |
} |
|
34 |
|
|
35 |
} |
|
36 |
private class CloseAction2 extends CancelAction |
|
37 |
{ |
|
38 |
|
|
39 |
View v; |
|
40 |
public CloseAction2(View view) |
|
41 |
{ |
|
42 |
super(wizardPanel.getWizardComponents()); |
|
43 |
v = view; |
|
44 |
} |
|
45 |
public void performAction() { |
|
46 |
PluginServices.getMDIManager().closeView(v); |
|
47 |
} |
|
48 |
|
|
49 |
} |
|
50 |
|
|
51 |
|
|
52 |
public WizardAndami(ImageIcon logo) |
|
53 |
{ |
|
54 |
wizardPanel = new WizardPanelWithLogo(logo); |
|
55 |
CloseAction closeAction = new CloseAction(this); |
|
56 |
CloseAction2 closeAction2 = new CloseAction2(this); |
|
57 |
wizardPanel.getWizardComponents().setFinishAction(closeAction); |
|
58 |
wizardPanel.getWizardComponents().setCancelAction(closeAction2); |
|
59 |
|
|
60 |
this.setLayout(new BorderLayout()); |
|
61 |
this.add(wizardPanel, BorderLayout.CENTER); |
|
62 |
} |
|
63 |
|
|
64 |
public DefaultJWizardComponents getWizardComponents() |
|
65 |
{ |
|
66 |
return wizardPanel.getWizardComponents(); |
|
67 |
} |
|
68 |
|
|
69 |
|
|
70 |
public ViewInfo getViewInfo() { |
|
71 |
if (viewInfo == null) |
|
72 |
{ |
|
73 |
viewInfo = new ViewInfo(ViewInfo.MODALDIALOG|ViewInfo.RESIZABLE); |
|
74 |
} |
|
75 |
return viewInfo; |
|
76 |
} |
|
77 |
|
|
78 |
} |
|
0 | 79 |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/WizardPanelWithLogo.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.cad; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Color; |
|
5 |
|
|
6 |
import javax.swing.ImageIcon; |
|
7 |
import javax.swing.JLabel; |
|
8 |
import javax.swing.JPanel; |
|
9 |
import javax.swing.JSeparator; |
|
10 |
|
|
11 |
import jwizardcomponent.CancelAction; |
|
12 |
import jwizardcomponent.DefaultJWizardComponents; |
|
13 |
import jwizardcomponent.FinishAction; |
|
14 |
import jwizardcomponent.frame.SimpleButtonPanel; |
|
15 |
|
|
16 |
public class WizardPanelWithLogo extends JPanel { |
|
17 |
DefaultJWizardComponents wizardComponents; |
|
18 |
|
|
19 |
JPanel buttonPanel; |
|
20 |
JLabel statusLabel = new JLabel(); |
|
21 |
|
|
22 |
ImageIcon logo; |
|
23 |
|
|
24 |
public WizardPanelWithLogo(ImageIcon logo) { |
|
25 |
this.logo = logo; |
|
26 |
wizardComponents = new DefaultJWizardComponents(); |
|
27 |
init(); |
|
28 |
} |
|
29 |
|
|
30 |
private void init() { |
|
31 |
|
|
32 |
|
|
33 |
JPanel logoPanel = new JPanel(); |
|
34 |
|
|
35 |
String fileString; |
|
36 |
if (logo.toString().indexOf("file:") < 0 && |
|
37 |
logo.toString().indexOf("http:") < 0) { |
|
38 |
fileString = "file:///" +System.getProperty("user.dir") +"/" |
|
39 |
+logo.toString(); |
|
40 |
fileString = fileString.replaceAll("\\\\", "/"); |
|
41 |
} else { |
|
42 |
fileString = logo.toString(); |
|
43 |
} |
|
44 |
logoPanel.add(new JLabel(logo)); |
|
45 |
logoPanel.setBackground(Color.WHITE); |
|
46 |
this.setLayout(new BorderLayout()); |
|
47 |
this.add(logoPanel, BorderLayout.WEST); |
|
48 |
this.add(wizardComponents.getWizardPanelsContainer(), |
|
49 |
BorderLayout.CENTER); |
|
50 |
|
|
51 |
JPanel auxPanel = new JPanel(new BorderLayout()); |
|
52 |
auxPanel.add(new JSeparator(), BorderLayout.NORTH); |
|
53 |
|
|
54 |
buttonPanel = new SimpleButtonPanel(wizardComponents); |
|
55 |
auxPanel.add(buttonPanel); |
|
56 |
this.add(auxPanel, BorderLayout.SOUTH); |
|
57 |
|
|
58 |
|
|
59 |
wizardComponents.setFinishAction(new FinishAction(wizardComponents) { |
|
60 |
public void performAction() { |
|
61 |
// dispose(); |
|
62 |
} |
|
63 |
}); |
|
64 |
wizardComponents.setCancelAction(new CancelAction(wizardComponents) { |
|
65 |
public void performAction() { |
|
66 |
// dispose(); |
|
67 |
} |
|
68 |
}); |
|
69 |
} |
|
70 |
|
|
71 |
public DefaultJWizardComponents getWizardComponents(){ |
|
72 |
return wizardComponents; |
|
73 |
} |
|
74 |
|
|
75 |
public void setWizardComponents(DefaultJWizardComponents aWizardComponents){ |
|
76 |
wizardComponents = aWizardComponents; |
|
77 |
} |
|
78 |
|
|
79 |
public void show() { |
|
80 |
wizardComponents.updateComponents(); |
|
81 |
super.setVisible(true); |
|
82 |
} |
|
83 |
|
|
84 |
} |
|
0 | 85 |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/MyFinishAction.java | ||
---|---|---|
5 | 5 |
import jwizardcomponent.FinishAction; |
6 | 6 |
import jwizardcomponent.JWizardComponents; |
7 | 7 |
|
8 |
import com.iver.andami.PluginServices; |
|
9 | 8 |
import com.iver.cit.gvsig.CADExtension; |
10 |
import com.iver.cit.gvsig.ProjectExtension; |
|
11 | 9 |
import com.iver.cit.gvsig.fmap.MapControl; |
12 | 10 |
import com.iver.cit.gvsig.fmap.drivers.FieldDescription; |
13 | 11 |
import com.iver.cit.gvsig.fmap.drivers.ITableDefinition; |
... | ... | |
19 | 17 |
import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter; |
20 | 18 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
21 | 19 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
20 |
import com.iver.cit.gvsig.gui.View; |
|
22 | 21 |
import com.iver.cit.gvsig.gui.cad.panels.ChooseGeometryType; |
23 | 22 |
import com.iver.cit.gvsig.gui.cad.panels.JPanelFieldDefinition; |
24 | 23 |
import com.iver.cit.gvsig.gui.cad.panels.ShpPanel; |
25 |
import com.iver.cit.gvsig.project.ProjectTable; |
|
26 | 24 |
|
27 | 25 |
public class MyFinishAction extends FinishAction |
28 | 26 |
{ |
29 | 27 |
JWizardComponents myWizardComponents; |
30 | 28 |
FinishAction oldAction; |
31 | 29 |
ITableDefinition lyrDef = null; |
32 |
MapControl mapCtrl;
|
|
30 |
View view;
|
|
33 | 31 |
String actionComand; |
34 |
public MyFinishAction(JWizardComponents wizardComponents, MapControl mapCtrl, String actionComand) {
|
|
32 |
public MyFinishAction(JWizardComponents wizardComponents, View view, String actionComand) {
|
|
35 | 33 |
super(wizardComponents); |
36 | 34 |
oldAction = wizardComponents.getFinishAction(); |
37 | 35 |
myWizardComponents = wizardComponents; |
38 |
this.mapCtrl = mapCtrl;
|
|
36 |
this.view = view;
|
|
39 | 37 |
this.actionComand = actionComand; |
40 | 38 |
// TODO Auto-generated constructor stub |
41 | 39 |
} |
42 | 40 |
|
43 | 41 |
public void performAction() { |
44 |
// TODO Auto-generated method stub |
|
45 |
try { |
|
42 |
FLyrVect lyr = null; |
|
43 |
MapControl mapCtrl = view.getMapControl(); |
|
44 |
try { |
|
46 | 45 |
// ChooseWriteDriver driverPanel = (ChooseWriteDriver) myWizardComponents.getWizardPanel(0); |
47 | 46 |
ChooseGeometryType geometryTypePanel = (ChooseGeometryType) myWizardComponents.getWizardPanel(0); |
48 | 47 |
JPanelFieldDefinition fieldDefinitionPanel = (JPanelFieldDefinition) myWizardComponents.getWizardPanel(1); |
... | ... | |
53 | 52 |
int geometryType = geometryTypePanel.getSelectedGeometryType(); |
54 | 53 |
FieldDescription[] fieldsDesc = fieldDefinitionPanel.getFieldsDescription(); |
55 | 54 |
|
56 |
ISpatialWriter drv = (ISpatialWriter) LayerFactory.getDM().getDriver(selectedDriver); |
|
55 |
ISpatialWriter drv = (ISpatialWriter) LayerFactory.getDM().getDriver(selectedDriver); |
|
56 |
|
|
57 | 57 |
if (actionComand.equals("SHP")) |
58 | 58 |
{ |
59 |
FLyrVect lyr = null; |
|
60 | 59 |
ShpPanel shpPanel = (ShpPanel) myWizardComponents.getWizardPanel(2); |
61 | 60 |
File newFile = new File(shpPanel.getPath()); |
62 | 61 |
SHPLayerDefinition lyrDef = new SHPLayerDefinition(); |
... | ... | |
74 | 73 |
lyr = (FLyrVect) LayerFactory.createLayer(layerName, |
75 | 74 |
(VectorialFileDriver) drv, newFile, mapCtrl.getProjection()); |
76 | 75 |
|
77 |
lyr.setVisible(true); |
|
78 |
mapCtrl.getMapContext().getLayers().addLayer(lyr); |
|
79 |
|
|
80 |
mapCtrl.getMapContext().endAtomicEvent(); |
|
81 |
lyr.setEditing(true); |
|
82 |
VectorialEditableAdapter vea = (VectorialEditableAdapter) lyr.getSource(); |
|
83 |
// TODO: Provisional, para que al poner |
|
84 |
// un tema en edici?n el CADToolAdapter se entere |
|
85 |
CADExtension.getCADToolAdapter().setVectorialAdapter(vea); |
|
86 |
vea.getCommandRecord().addCommandListener(mapCtrl); |
|
87 |
//Si existe una tabla asociada a esta capa se cambia su modelo por el VectorialEditableAdapter. |
|
88 |
ProjectExtension pe=(ProjectExtension)PluginServices.getExtension(ProjectExtension.class); |
|
89 |
ProjectTable pt=pe.getProject().getTable(lyr); |
|
90 |
if (pt!=null) |
|
91 |
pt.setModel(vea); |
|
92 |
|
|
93 |
|
|
94 |
|
|
95 | 76 |
} |
96 | 77 |
else if (drv instanceof VectorialDatabaseDriver) |
97 | 78 |
{ |
... | ... | |
162 | 143 |
// TODO Auto-generated catch block |
163 | 144 |
e.printStackTrace(); |
164 | 145 |
} |
146 |
lyr.setVisible(true); |
|
147 |
mapCtrl.getMapContext().getLayers().addLayer(lyr); |
|
165 | 148 |
|
149 |
mapCtrl.getMapContext().endAtomicEvent(); |
|
150 |
lyr.addLayerListener(CADExtension.getEditionManager()); |
|
151 |
lyr.setActive(true); |
|
152 |
lyr.setEditing(true); |
|
153 |
VectorialEditableAdapter vea = (VectorialEditableAdapter) lyr.getSource(); |
|
154 |
// TODO: Provisional, para que al poner |
|
155 |
// un tema en edici?n el CADToolAdapter se entere |
|
156 |
CADExtension.getCADToolAdapter().setVectorialAdapter(vea); |
|
157 |
vea.getCommandRecord().addCommandListener(mapCtrl); |
|
158 |
view.showConsole(); |
|
159 |
|
|
166 | 160 |
// Para cerrar el cuadro de di?logo. |
167 | 161 |
oldAction.performAction(); |
168 | 162 |
|
Also available in: Unified diff