Revision 34531
tags/tmp_build/frameworks/_fwAndami/schemas/andami-config.xml | ||
---|---|---|
1 |
<andami-config locale-language="es" locale-country="ES" locale-variant="es" pluginsDirectory="c:\tirar"> |
|
2 |
<andami update="yes"/> |
|
3 |
<plugin name="com.iver.cit.gvsig" update="yes"/> |
|
4 |
<plugin name="com.iver.core" update="no"/> |
|
5 |
<andami-options> |
|
6 |
<option name="CustomOption1" value="customValue1"/> |
|
7 |
<icon-theme name="DefaultTheme" resource="iconThemes/default" basedir="iconThemes" /> |
|
8 |
</andami-options> |
|
9 |
</andami-config> |
|
0 | 10 |
tags/tmp_build/frameworks/_fwAndami/schemas/sample-plugins-persistence.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugins-status> |
|
3 |
<plugin name="gvsig" lastUpdate="237628686"> |
|
4 |
<xml-entity name="config"> |
|
5 |
<property name="dataDirectory" value="c:\"/> |
|
6 |
<xml-entity> |
|
7 |
<property name="dataDirectory" value="c:\"/> |
|
8 |
<property name="dataDirectory" value="c:\"/> |
|
9 |
<property name="dataDirectory" value="c:\"/> |
|
10 |
</xml-entity> |
|
11 |
</xml-entity> |
|
12 |
<bookmarks> |
|
13 |
<bookmark text="Recientes/raster"> |
|
14 |
<xml-entity> |
|
15 |
<property name="projection" value="EPSG:3403"/> |
|
16 |
<property name="boundinBox" value="12,12,115,115"/> |
|
17 |
</xml-entity> |
|
18 |
</bookmark> |
|
19 |
</bookmarks> |
|
20 |
<windows> |
|
21 |
<window id="0" rectangle="0,0,150,150"/> |
|
22 |
<window id="2" rectangle="50,50,150,150"/> |
|
23 |
<window id="8" rectangle="100,100,150,150"/> |
|
24 |
<window id="12" rectangle="150,150,150,150"/> |
|
25 |
</windows> |
|
26 |
</plugin> |
|
27 |
<tool-bars> |
|
28 |
<tool-bar name="gvsig.herramientas" x-position="0" y-position="1"/> |
|
29 |
<tool-bar name="gvsig.herramientas" x-position="0" y-position="0"/> |
|
30 |
</tool-bars> |
|
31 |
</plugins-status> |
|
0 | 32 |
tags/tmp_build/frameworks/_fwAndami/schemas/sample-config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<icon src="images/logoGVA.gif" text="gvSIG"/> |
|
4 |
<resourceBundle name="text"/> |
|
5 |
<import plugin-name="com.iver.cit.gvsig" /> |
|
6 |
<labelSet class="com.iver.cit.gvsig.gui.View"> |
|
7 |
<label id="1" size="100"/> |
|
8 |
<label id="2" size="230"/> |
|
9 |
</labelSet> |
|
10 |
<libraries> |
|
11 |
<library file="com.iver.cit.gvsig.jar"/> |
|
12 |
<library file="wmsclient.jar"/> |
|
13 |
</libraries> |
|
14 |
<extensions> |
|
15 |
<extension> |
|
16 |
<class name="com.iver.cit.gvsig.ProjectExtension"/> |
|
17 |
<menu text="Archivo/nuevo_proyecto" |
|
18 |
key="n" mnemonic="n" |
|
19 |
tooltip="nuevo_tooltip" |
|
20 |
action-command="NUEVO" icon="images/new.png"/> |
|
21 |
<menu text="Archivo/abrir_proyecto" |
|
22 |
key="a" mnemonic="a" |
|
23 |
tooltip="abrir_tooltip" |
|
24 |
action-command="ABRIR" icon="images/open.png"/> |
|
25 |
<menu text="Archivo/guardar_proyecto" |
|
26 |
key="g" mnemonic="g" |
|
27 |
tooltip="guardar_tooltip" |
|
28 |
action-command="GUARDAR" icon="images/save.png"/> |
|
29 |
|
|
30 |
<toolBar> |
|
31 |
<tool icon="images/new.png" tooltip="nuevo_tooltip" |
|
32 |
action-command="NUEVO"/> |
|
33 |
<tool icon="images/open.png" tooltip="abrir_tooltip" |
|
34 |
action-command="ABRIR"/> |
|
35 |
<tool icon="images/save.png" tooltip="guardar_tooltip" |
|
36 |
action-command="GUARDAR"/> |
|
37 |
|
|
38 |
<!-- these will be added to the containing toolbar --> |
|
39 |
<combo-scale |
|
40 |
name="JPEG Quality" |
|
41 |
elements="15;30;60;70;80;90;100" |
|
42 |
value="80" |
|
43 |
action-command="JPEG_QUALITY" /> |
|
44 |
|
|
45 |
<combo-button |
|
46 |
name="Copy/paste tools"> |
|
47 |
<combo-button-element icon="images/scissor.png" action-command="CUT" /> |
|
48 |
<combo-button-element icon="images/paste.png" action-command="PASTE" /> |
|
49 |
<combo-button-element icon="images/copy.png" action-command="COPY" /> |
|
50 |
</combo-button> |
|
51 |
</toolBar> |
|
52 |
|
|
53 |
</extension> |
|
54 |
|
|
55 |
<extension> |
|
56 |
<class name="com.iver.cit.gvsig.ZoomPrev"/> |
|
57 |
<menu text="Vista/Zoom_Previo" icon="images/ZoomPrevio.png"/> |
|
58 |
<tool-bar name="Herramientas"> |
|
59 |
<action-tool icon="images/ZoomPrevio.png" action-command="ZOOM_PREV" tooltip="Zoom_Previo" position="11"/> |
|
60 |
</tool-bar> |
|
61 |
|
|
62 |
<!-- these will be added to the status-bar (because they are not contained in any toolbar) --> |
|
63 |
<combo-scale |
|
64 |
name="Scale" |
|
65 |
label="Scale:" |
|
66 |
elements="1000;2000;5000;10000;25000;50000;100000;200000;500000;1000000;2000000;5000000" |
|
67 |
value="10000" |
|
68 |
action-command="CHANGE_SCALE" /> |
|
69 |
|
|
70 |
<combo-button |
|
71 |
name="Tool Mode"> |
|
72 |
<combo-button-element icon="images/once.png" action-command="USE_ONCE" /> |
|
73 |
<combo-button-element icon="images/sticky-tool.png" action-command="UNTIL_CHANGED" /> |
|
74 |
</combo-button> |
|
75 |
</extension> |
|
76 |
<extension processing-position="2"> |
|
77 |
<class name="com.iver.cit.gvsig.ViewControls"/> |
|
78 |
<menus> |
|
79 |
<menu text="Vista/Zoom_Completo" action-command="FULL" icon="images/MapContents.png" tooltip="Zoom completo a la v?sta"/> |
|
80 |
<menu text="Vista/Zoom_Select" action-command="ZOOM_SELECT" icon="image/Select.png"/> |
|
81 |
<menu text="Vista/Encuadre" action-command="ENCUADRE" icon="images/encuadre.png"/> |
|
82 |
<menu text="Vista/Seleccion_por_tema" action-command="SELECTIONBYSHAPE"/> |
|
83 |
<menu text="Vista/configurar_localizador" action-command="CONFIG_LOCATOR"/> |
|
84 |
<menu text="Vista/propiedades" action-command="PROPERTIES"/> |
|
85 |
</menus> |
|
86 |
<tool-bar name="Herramientas" y-position="1"> |
|
87 |
<action-tool icon="images/MapContents.png" action-command="FULL" tooltip="Zoom_Completo" position="1"/> |
|
88 |
<action-tool icon="images/encuadre.png" action-command="ENCUADRE" tooltip="gestion_encuadre" last="true" position="2"/> |
|
89 |
<selectable-tool group="grupo1" default="true" icon="images/ZoomIn.png" action-command="ZOOM_IN" tooltip="Zoom_M?s" position="3"/> |
|
90 |
<selectable-tool group="grupo1" icon="images/ZoomOut.png" action-command="ZOOM_OUT" position="4"/> |
|
91 |
<selectable-tool group="grupo1" icon="images/Pan.png" action-command="PAN" tooltip="Encuadre" position="5"/> |
|
92 |
<selectable-tool group="grupo1" icon="images/Identify.png" action-command="INFO" tooltip="informacion" position="6" /> |
|
93 |
<selectable-tool group="grupo2" icon="images/Distancia.png" action-command="MEDICION" tooltip="medir_distancias" position="7"/> |
|
94 |
<selectable-tool group="grupo2" icon="images/Poligono16.png" action-command="AREA" tooltip="medir_area" position="8"/> |
|
95 |
<selectable-tool group="grupo2" default="true" icon="images/Select.png" action-command="SELPOINT" tooltip="seleccionar_por_punto" position="9"/> |
|
96 |
<selectable-tool group="grupo2" icon="images/SelEspacial2b.png" action-command="SELRECT" tooltip="seleccionar_por_rectangulo" position="10"/> |
|
97 |
</tool-bar> |
|
98 |
</extension> |
|
99 |
<extension> |
|
100 |
<class name="com.iver.cit.gvsig.ThemeControls"/> |
|
101 |
<menu text="Tema/propiedades"/> |
|
102 |
</extension> |
|
103 |
</extensions> |
|
104 |
|
|
105 |
<file-extensions> |
|
106 |
<file-extension description="DGNfiles" ends-with="dgn" dialog="openLayer"> |
|
107 |
<class name="com.iver.cit.gvsig.DGNFileExtension"/> |
|
108 |
</file-extension> |
|
109 |
<file-extension description="Rasterfiles" ends-with="ecw,tif,tiff,jpg,png" dialog="openLayer"> |
|
110 |
<class name="com.iver.cit.gvsig.RasterFileExtension"/> |
|
111 |
</file-extension> |
|
112 |
</file-extensions> |
|
113 |
</plugin-config> |
|
0 | 114 |
tags/tmp_build/frameworks/_fwAndami/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>_fwAndami</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> |
|
15 |
<triggers>full,incremental,</triggers> |
|
16 |
<arguments> |
|
17 |
<dictionary> |
|
18 |
<key>LaunchConfigHandle</key> |
|
19 |
<value><project>/.externalToolBuilders/Ant.launch</value> |
|
20 |
</dictionary> |
|
21 |
</arguments> |
|
22 |
</buildCommand> |
|
23 |
<buildCommand> |
|
24 |
<name>de.loskutov.FileSync.FSBuilder</name> |
|
25 |
<arguments> |
|
26 |
</arguments> |
|
27 |
</buildCommand> |
|
28 |
</buildSpec> |
|
29 |
<natures> |
|
30 |
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> |
|
31 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
32 |
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature> |
|
33 |
</natures> |
|
34 |
</projectDescription> |
|
0 | 35 |
tags/tmp_build/frameworks/_fwAndami/gvSIG.bat | ||
---|---|---|
1 |
SET PATH=C:\Documents and Settings\MyHome\Workspaces\gvsig1.9\binaries3D\w32;%PATH% |
|
2 |
echo %PATH% |
|
3 |
java -cp andami.jar;./lib/castor-0.9.5.3-xml.jar;./lib/log4j-1.2.8.jar;./lib/javaws.jar;./lib/iver-utiles.jar;./lib/tempFileManager.jar;./lib/xml-apis.jar;./lib/xerces_2_5_0.jar;./lib/commons-codec-1.3.jar;./lib/xmlrpc-2.0.1.jar;./lib/gvsig-i18n.jar;./lib/jcalendar.jar;./lib/kxml2.jar;./lib/JWizardComponent.jar;./lib/looks-2.1.4.jar;./lib/org.gvsig.ui.jar;./lib/jcommon-1.0.10.jar;./lib/jfreechart-1.0.6.jar;./lib/jh.jar;./lib/org.gvsig.exceptions.jar;./lib/jai_core.jar -Djava.library.path=../binaries/w32 -Xmx500M com.iver.andami.Launcher gvSIG gvSIG/extensiones %1 |
|
0 | 4 |
tags/tmp_build/frameworks/_fwAndami/castor.properties | ||
---|---|---|
1 |
org.exolab.castor.indent=true |
|
0 | 2 |
tags/tmp_build/frameworks/_fwAndami/src/com/iver/andami/ui/AndamiEventQueue.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.andami.ui; |
|
42 |
|
|
43 |
import java.awt.AWTEvent; |
|
44 |
import java.awt.EventQueue; |
|
45 |
|
|
46 |
import com.iver.andami.messages.Messages; |
|
47 |
import com.iver.andami.messages.NotificationManager; |
|
48 |
|
|
49 |
|
|
50 |
/** |
|
51 |
* DOCUMENT ME! |
|
52 |
* |
|
53 |
* @author Fernando Gonz?lez Cort?s |
|
54 |
*/ |
|
55 |
public class AndamiEventQueue extends EventQueue { |
|
56 |
protected void dispatchEvent(AWTEvent event){ |
|
57 |
try{ |
|
58 |
super.dispatchEvent(event); |
|
59 |
} catch(RuntimeException e){ |
|
60 |
NotificationManager.addError(e);//Messages.getString("PluginServices.Bug en el c?digo"), e); |
|
61 |
} catch (Error e){ |
|
62 |
NotificationManager.addError(Messages.getString("PluginServices.Error grave de la aplicaci?n. \n Es conveniente que salgas de la aplicaci?n"), e); |
|
63 |
} |
|
64 |
} |
|
65 |
} |
|
0 | 66 |
tags/tmp_build/frameworks/_fwAndami/src/com/iver/andami/ui/wizard/WizardPanelWithLogo.java | ||
---|---|---|
1 |
package com.iver.andami.ui.wizard; |
|
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.common.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 |
tags/tmp_build/frameworks/_fwAndami/src/com/iver/andami/ui/wizard/UnsavedDataPanel.java | ||
---|---|---|
1 |
package com.iver.andami.ui.wizard; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Color; |
|
5 |
import java.awt.Dimension; |
|
6 |
import java.awt.FlowLayout; |
|
7 |
import java.awt.GridBagConstraints; |
|
8 |
import java.awt.GridBagLayout; |
|
9 |
import java.awt.Insets; |
|
10 |
import java.awt.event.ActionEvent; |
|
11 |
import java.awt.event.ActionListener; |
|
12 |
import java.awt.event.MouseEvent; |
|
13 |
import java.awt.event.MouseListener; |
|
14 |
import java.awt.image.BufferedImage; |
|
15 |
import java.util.ArrayList; |
|
16 |
import java.util.Iterator; |
|
17 |
|
|
18 |
import javax.swing.ImageIcon; |
|
19 |
import javax.swing.JCheckBox; |
|
20 |
import javax.swing.JLabel; |
|
21 |
import javax.swing.JPanel; |
|
22 |
import javax.swing.JScrollPane; |
|
23 |
|
|
24 |
import org.gvsig.gui.beans.swing.JButton; |
|
25 |
|
|
26 |
import com.iver.andami.PluginServices; |
|
27 |
import com.iver.andami.plugins.status.IUnsavedData; |
|
28 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
29 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
30 |
|
|
31 |
/** |
|
32 |
* Ask for elements to save before application exit |
|
33 |
* |
|
34 |
* |
|
35 |
*/ |
|
36 |
public class UnsavedDataPanel extends JPanel implements IWindow, ActionListener { |
|
37 |
/** |
|
38 |
* |
|
39 |
*/ |
|
40 |
private static final long serialVersionUID = -4745219917358767905L; |
|
41 |
|
|
42 |
|
|
43 |
private static ImageIcon blanckIcon = null; |
|
44 |
private JPanel pResources = null; |
|
45 |
private JPanel pButtons = null; |
|
46 |
private JScrollPane pScrollList = null; |
|
47 |
private myList list = null; |
|
48 |
private JLabel lblDescription = null; |
|
49 |
private JButton botSave = null; |
|
50 |
private JButton botDiscard = null; |
|
51 |
private JButton botDontExit = null; |
|
52 |
private JPanel pActionButtons = null; |
|
53 |
private JPanel pSelectionButtons = null; |
|
54 |
private JButton botSelectAll = null; |
|
55 |
private JButton botDeselectAll = null; |
|
56 |
|
|
57 |
private ArrayList listeners = new ArrayList(); |
|
58 |
private JLabel lblResourceDescription = null; |
|
59 |
private IUnsavedData[] unsavedDataList; |
|
60 |
private String windowTitle = PluginServices.getText(this, "save_resources"); |
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
/** |
|
65 |
* This is the default constructor |
|
66 |
*/ |
|
67 |
public UnsavedDataPanel(IUnsavedData[] unsavedDatalist) { |
|
68 |
super(); |
|
69 |
initialize(); |
|
70 |
this.setUnsavedDataArray(unsavedDatalist); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* This method initializes this |
|
75 |
* |
|
76 |
* @return void |
|
77 |
*/ |
|
78 |
private void initialize() { |
|
79 |
BorderLayout borderLayout = new BorderLayout(); |
|
80 |
borderLayout.setHgap(5); |
|
81 |
borderLayout.setVgap(5); |
|
82 |
lblDescription = new JLabel(); |
|
83 |
lblDescription.setText(PluginServices.getText(this, "select_resources_to_save_before_exit")); |
|
84 |
lblDescription.setPreferredSize(new Dimension(497, 40)); |
|
85 |
lblDescription.setName("lblDescription"); |
|
86 |
this.setLayout(borderLayout); |
|
87 |
this.setSize(396, 272); |
|
88 |
this.add(getPResources(), java.awt.BorderLayout.CENTER); |
|
89 |
this.add(getPButtons(), java.awt.BorderLayout.SOUTH); |
|
90 |
this.add(lblDescription, BorderLayout.NORTH); |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* This method initializes pResources |
|
95 |
* |
|
96 |
* @return javax.swing.JPanel |
|
97 |
*/ |
|
98 |
private JPanel getPResources() { |
|
99 |
if (pResources == null) { |
|
100 |
pResources = new JPanel(); |
|
101 |
pResources.setLayout(new BorderLayout()); |
|
102 |
pResources.add(getPScrollList(), BorderLayout.CENTER); |
|
103 |
pResources.add(getLblResourceDescription(), BorderLayout.SOUTH); |
|
104 |
} |
|
105 |
return pResources; |
|
106 |
} |
|
107 |
|
|
108 |
|
|
109 |
/** |
|
110 |
* This method initializes lblResourceDescription |
|
111 |
* |
|
112 |
* @return javax.swing.JLabel |
|
113 |
*/ |
|
114 |
private JLabel getLblResourceDescription() { |
|
115 |
if (lblResourceDescription == null) { |
|
116 |
lblResourceDescription = new JLabel(); |
|
117 |
lblResourceDescription.setText(""); |
|
118 |
lblResourceDescription.setPreferredSize(new Dimension(38, 50)); |
|
119 |
lblResourceDescription.setName("lblResourceDescription"); |
|
120 |
} |
|
121 |
return lblResourceDescription; |
|
122 |
} |
|
123 |
|
|
124 |
|
|
125 |
/** |
|
126 |
* This method initializes pButtons |
|
127 |
* |
|
128 |
* @return javax.swing.JPanel |
|
129 |
*/ |
|
130 |
private JPanel getPButtons() { |
|
131 |
if (pButtons == null) { |
|
132 |
BorderLayout borderLayout2 = new BorderLayout(); |
|
133 |
borderLayout2.setHgap(5); |
|
134 |
borderLayout2.setVgap(5); |
|
135 |
pButtons = new JPanel(); |
|
136 |
pButtons.setLayout(borderLayout2); |
|
137 |
pButtons.add(getPSelectionButtons(), BorderLayout.NORTH); |
|
138 |
pButtons.add(getPActionButtons(), BorderLayout.SOUTH); |
|
139 |
} |
|
140 |
return pButtons; |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* This method initializes pScrollList |
|
145 |
* |
|
146 |
* @return javax.swing.JScrollPane |
|
147 |
*/ |
|
148 |
private JScrollPane getPScrollList() { |
|
149 |
if (pScrollList == null) { |
|
150 |
pScrollList = new JScrollPane(); |
|
151 |
pScrollList.setPreferredSize(new java.awt.Dimension(350,350)); |
|
152 |
pScrollList.setViewportView(getList()); |
|
153 |
} |
|
154 |
return pScrollList; |
|
155 |
} |
|
156 |
|
|
157 |
/** |
|
158 |
* This method initializes list |
|
159 |
* |
|
160 |
* @return javax.swing.JList |
|
161 |
*/ |
|
162 |
private myList getList() { |
|
163 |
if (list == null) { |
|
164 |
list = new myList(); |
|
165 |
list.setBackground(Color.white); |
|
166 |
} |
|
167 |
return list; |
|
168 |
} |
|
169 |
|
|
170 |
/** |
|
171 |
* This method initializes botSave |
|
172 |
* |
|
173 |
* @return javax.swing.JButton |
|
174 |
*/ |
|
175 |
private JButton getBotSave() { |
|
176 |
if (botSave == null) { |
|
177 |
botSave = new JButton(); |
|
178 |
botSave.setName("botSave"); |
|
179 |
botSave.setToolTipText(PluginServices.getText(this, "save_selected_resources_and_exit")); |
|
180 |
botSave.setText(PluginServices.getText(this, "ok")); |
|
181 |
botSave.setActionCommand("Accept"); |
|
182 |
botSave.addActionListener(this); |
|
183 |
} |
|
184 |
return botSave; |
|
185 |
} |
|
186 |
|
|
187 |
/** |
|
188 |
* This method initializes botDiscard |
|
189 |
* |
|
190 |
* @return javax.swing.JButton |
|
191 |
*/ |
|
192 |
private JButton getBotDiscard() { |
|
193 |
if (botDiscard == null) { |
|
194 |
botDiscard = new JButton(); |
|
195 |
botDiscard.setName("botDiscard"); |
|
196 |
botDiscard.setToolTipText(PluginServices.getText(this, "discard_changes_and_exit")); |
|
197 |
botDiscard.setText(PluginServices.getText(this, "discard_changes")); |
|
198 |
botDiscard.setActionCommand("Discard"); |
|
199 |
botDiscard.addActionListener(this); |
|
200 |
} |
|
201 |
return botDiscard; |
|
202 |
} |
|
203 |
|
|
204 |
/** |
|
205 |
* This method initializes botDontExit |
|
206 |
* |
|
207 |
* @return javax.swing.JButton |
|
208 |
*/ |
|
209 |
private JButton getBotDontExit() { |
|
210 |
if (botDontExit == null) { |
|
211 |
botDontExit = new JButton(); |
|
212 |
botDontExit.setName("botDontExit"); |
|
213 |
botDontExit.setToolTipText(PluginServices.getText(this, "cancel_the_application_termination")); |
|
214 |
botDontExit.setText(PluginServices.getText(this, "cancelar")); |
|
215 |
botDontExit.setActionCommand("Cancel"); |
|
216 |
botDontExit.addActionListener(this); |
|
217 |
} |
|
218 |
return botDontExit; |
|
219 |
} |
|
220 |
|
|
221 |
/** |
|
222 |
* This method initializes pActionButtons |
|
223 |
* |
|
224 |
* @return javax.swing.JPanel |
|
225 |
*/ |
|
226 |
private JPanel getPActionButtons() { |
|
227 |
if (pActionButtons == null) { |
|
228 |
FlowLayout flowLayout = new FlowLayout(); |
|
229 |
flowLayout.setAlignment(FlowLayout.RIGHT); |
|
230 |
pActionButtons = new JPanel(); |
|
231 |
pActionButtons.setLayout(flowLayout); |
|
232 |
pActionButtons.setName("pActionButtons"); |
|
233 |
pActionButtons.add(getBotSave(), null); |
|
234 |
pActionButtons.add(getBotDiscard(), null); |
|
235 |
pActionButtons.add(getBotDontExit(), null); |
|
236 |
} |
|
237 |
return pActionButtons; |
|
238 |
} |
|
239 |
|
|
240 |
/** |
|
241 |
* This method initializes pSelectionButtons |
|
242 |
* |
|
243 |
* @return javax.swing.JPanel |
|
244 |
*/ |
|
245 |
private JPanel getPSelectionButtons() { |
|
246 |
if (pSelectionButtons == null) { |
|
247 |
FlowLayout flowLayout1 = new FlowLayout(); |
|
248 |
flowLayout1.setAlignment(FlowLayout.LEFT); |
|
249 |
pSelectionButtons = new JPanel(); |
|
250 |
pSelectionButtons.setLayout(flowLayout1); |
|
251 |
pSelectionButtons.setName("pSelectionButtons"); |
|
252 |
pSelectionButtons.add(getBotSelectAll(), null); |
|
253 |
pSelectionButtons.add(getBotDeselectAll(), null); |
|
254 |
} |
|
255 |
return pSelectionButtons; |
|
256 |
} |
|
257 |
|
|
258 |
/** |
|
259 |
* This method initializes botSelectAll |
|
260 |
* |
|
261 |
* @return javax.swing.JButton |
|
262 |
*/ |
|
263 |
private JButton getBotSelectAll() { |
|
264 |
if (botSelectAll == null) { |
|
265 |
botSelectAll = new JButton(); |
|
266 |
botSelectAll.setText(PluginServices.getText(this, "select_all")); |
|
267 |
botSelectAll.setName("botSelectAll"); |
|
268 |
botSelectAll.setToolTipText(PluginServices.getText(this, "select_all_resources")); |
|
269 |
botSelectAll.setActionCommand("SelectAll"); |
|
270 |
botSelectAll.addActionListener(this); |
|
271 |
} |
|
272 |
return botSelectAll; |
|
273 |
} |
|
274 |
|
|
275 |
/** |
|
276 |
* This method initializes botDeselectAll |
|
277 |
* |
|
278 |
* @return javax.swing.JButton |
|
279 |
*/ |
|
280 |
private JButton getBotDeselectAll() { |
|
281 |
if (botDeselectAll == null) { |
|
282 |
botDeselectAll = new JButton(); |
|
283 |
botDeselectAll.setName("botDeselectAll"); |
|
284 |
botDeselectAll.setToolTipText(PluginServices.getText(this, "deselect_all_resources")); |
|
285 |
botDeselectAll.setText(PluginServices.getText(this, "deselect_all")); |
|
286 |
botDeselectAll.setActionCommand("DeselectAll"); |
|
287 |
botDeselectAll.addActionListener(this); |
|
288 |
} |
|
289 |
return botDeselectAll; |
|
290 |
} |
|
291 |
|
|
292 |
public WindowInfo getWindowInfo() { |
|
293 |
WindowInfo wi = new WindowInfo(WindowInfo.MODALDIALOG |
|
294 |
| WindowInfo.RESIZABLE |
|
295 |
| WindowInfo.MAXIMIZABLE); |
|
296 |
wi.setTitle(windowTitle); |
|
297 |
wi.setHeight(270); |
|
298 |
wi.setWidth(450); |
|
299 |
return wi; |
|
300 |
} |
|
301 |
|
|
302 |
public void setWindowTitle(String windowTitle) { |
|
303 |
this.windowTitle = windowTitle; |
|
304 |
} |
|
305 |
|
|
306 |
public void setCancelText(String text, String tooltipText) { |
|
307 |
getBotDontExit().setToolTipText(tooltipText); |
|
308 |
getBotDontExit().setText(text); |
|
309 |
} |
|
310 |
|
|
311 |
public void setDiscardText(String text, String tooltipText) { |
|
312 |
getBotDiscard().setToolTipText(tooltipText); |
|
313 |
getBotDiscard().setText(text); |
|
314 |
} |
|
315 |
|
|
316 |
public void setAcceptText(String text, String tooltipText) { |
|
317 |
getBotSave().setToolTipText(tooltipText); |
|
318 |
getBotSave().setText(text); |
|
319 |
} |
|
320 |
|
|
321 |
public void setHeaderText(String text) { |
|
322 |
lblDescription.setText(text); |
|
323 |
} |
|
324 |
|
|
325 |
/** |
|
326 |
* Register a listener to call |
|
327 |
* |
|
328 |
* @param a UnsavedDataPanelListener instance |
|
329 |
*/ |
|
330 |
public void addActionListener(UnsavedDataPanelListener listener){ |
|
331 |
this.listeners.add(listener); |
|
332 |
} |
|
333 |
|
|
334 |
public void removeActionListener(UnsavedDataPanelListener listener){ |
|
335 |
this.listeners.remove(listener); |
|
336 |
} |
|
337 |
|
|
338 |
public class UnsavedDataPanelListener { |
|
339 |
public void cancel(UnsavedDataPanel panel){ |
|
340 |
|
|
341 |
} |
|
342 |
|
|
343 |
public void accept(UnsavedDataPanel panel){ |
|
344 |
|
|
345 |
} |
|
346 |
|
|
347 |
public void discard(UnsavedDataPanel panel) { |
|
348 |
|
|
349 |
} |
|
350 |
} |
|
351 |
|
|
352 |
private class myList extends JPanel{ |
|
353 |
|
|
354 |
/** |
|
355 |
* |
|
356 |
*/ |
|
357 |
private static final long serialVersionUID = 3179254463477354501L; |
|
358 |
|
|
359 |
private GridBagConstraints constraints; |
|
360 |
private GridBagConstraints constraintsLast; |
|
361 |
|
|
362 |
public myList(){ |
|
363 |
super(); |
|
364 |
initialize(); |
|
365 |
} |
|
366 |
|
|
367 |
private void initialize(){ |
|
368 |
this.setLayout(new GridBagLayout()); |
|
369 |
this.constraints = new GridBagConstraints(); |
|
370 |
this.constraints.fill = GridBagConstraints.HORIZONTAL; |
|
371 |
this.constraints.gridwidth = GridBagConstraints.REMAINDER; |
|
372 |
this.constraints.weightx =0; |
|
373 |
this.constraints.gridx =0; |
|
374 |
this.constraints.gridy=0; |
|
375 |
this.constraints.anchor = GridBagConstraints.WEST; |
|
376 |
this.constraints.insets =new Insets(3,3,0,0); |
|
377 |
|
|
378 |
this.constraintsLast = new GridBagConstraints(); |
|
379 |
this.constraintsLast.fill = GridBagConstraints.BOTH; |
|
380 |
this.constraintsLast.gridheight = GridBagConstraints.REMAINDER; |
|
381 |
this.constraintsLast.gridwidth = GridBagConstraints.REMAINDER; |
|
382 |
this.constraintsLast.gridx =0; |
|
383 |
this.constraintsLast.weightx =1; |
|
384 |
this.constraintsLast.weighty =1; |
|
385 |
this.constraintsLast.anchor = GridBagConstraints.FIRST_LINE_START; |
|
386 |
|
|
387 |
|
|
388 |
} |
|
389 |
|
|
390 |
public void addItems(IUnsavedData[] itemList){ |
|
391 |
int i; |
|
392 |
this.removeAll(); |
|
393 |
if (itemList.length == 0){ |
|
394 |
return; |
|
395 |
} |
|
396 |
|
|
397 |
for (i=0;i< itemList.length;i++){ |
|
398 |
this.constraints.gridy = i; |
|
399 |
this.add(newItem(itemList[i]), this.constraints); |
|
400 |
} |
|
401 |
this.constraintsLast.gridy=itemList.length; |
|
402 |
this.add(new JLabel(),this.constraintsLast); |
|
403 |
|
|
404 |
} |
|
405 |
public int getItemsCount(){ |
|
406 |
return this.getComponentCount() -1; |
|
407 |
} |
|
408 |
|
|
409 |
public myUnsavedItem getItem(int i){ |
|
410 |
if (i>= this.getComponentCount()){ |
|
411 |
return null; |
|
412 |
} |
|
413 |
return (myUnsavedItem)this.getComponent(i); |
|
414 |
} |
|
415 |
|
|
416 |
private myUnsavedItem newItem(IUnsavedData itemData){ |
|
417 |
myUnsavedItem item; |
|
418 |
item = new myUnsavedItem(itemData); |
|
419 |
item.addMouseListener(new MouseListener(){ |
|
420 |
public void mouseClicked(MouseEvent e) { |
|
421 |
myUnsavedItem item = (myUnsavedItem)e.getComponent(); |
|
422 |
getLblResourceDescription().setText(item.getDescription()); |
|
423 |
} |
|
424 |
public void mouseEntered(MouseEvent e) { |
|
425 |
} |
|
426 |
|
|
427 |
public void mouseExited(MouseEvent e) { |
|
428 |
} |
|
429 |
|
|
430 |
public void mousePressed(MouseEvent e) { |
|
431 |
} |
|
432 |
|
|
433 |
public void mouseReleased(MouseEvent e) { |
|
434 |
} |
|
435 |
|
|
436 |
}); |
|
437 |
return item; |
|
438 |
} |
|
439 |
|
|
440 |
} |
|
441 |
|
|
442 |
private class myUnsavedItem extends JPanel{ |
|
443 |
/** |
|
444 |
* |
|
445 |
*/ |
|
446 |
private static final long serialVersionUID = -6280057775368437349L; |
|
447 |
private JCheckBox chkChecked; |
|
448 |
private JLabel lblText; |
|
449 |
private IUnsavedData dataItem; |
|
450 |
|
|
451 |
public myUnsavedItem(IUnsavedData dataItem ){ |
|
452 |
super(); |
|
453 |
this.initialize(); |
|
454 |
this.setData(dataItem); |
|
455 |
} |
|
456 |
|
|
457 |
private void initialize(){ |
|
458 |
this.setOpaque(false); |
|
459 |
BorderLayout layout = new BorderLayout(); |
|
460 |
layout.setHgap(5); |
|
461 |
this.setLayout(layout); |
|
462 |
this.add(this.getChkChecked(),BorderLayout.WEST); |
|
463 |
this.add(this.getLblText(),BorderLayout.CENTER); |
|
464 |
} |
|
465 |
|
|
466 |
private JLabel getLblText() { |
|
467 |
if (lblText == null){ |
|
468 |
lblText = new JLabel(); |
|
469 |
lblText.setName("lblText"); |
|
470 |
} |
|
471 |
return lblText; |
|
472 |
} |
|
473 |
|
|
474 |
private JCheckBox getChkChecked() { |
|
475 |
if (chkChecked == null){ |
|
476 |
chkChecked = new JCheckBox(); |
|
477 |
chkChecked.setName("chkChecked"); |
|
478 |
chkChecked.setSelected(true); |
|
479 |
chkChecked.setOpaque(false); |
|
480 |
} |
|
481 |
return chkChecked; |
|
482 |
} |
|
483 |
|
|
484 |
public boolean isSelected(){ |
|
485 |
return getChkChecked().isSelected(); |
|
486 |
} |
|
487 |
|
|
488 |
public void setSelected(boolean selected){ |
|
489 |
getChkChecked().setSelected(selected); |
|
490 |
} |
|
491 |
|
|
492 |
public void setData(IUnsavedData dataItem){ |
|
493 |
this.dataItem = dataItem; |
|
494 |
JLabel lbl = getLblText(); |
|
495 |
if (dataItem.getIcon() != null){ |
|
496 |
lbl.setIcon(dataItem.getIcon()); |
|
497 |
} else{ |
|
498 |
lbl.setIcon(getBlanckIcon()); |
|
499 |
} |
|
500 |
lbl.setText(dataItem.getResourceName()); |
|
501 |
getChkChecked().setSelected(true); |
|
502 |
} |
|
503 |
|
|
504 |
public IUnsavedData getData(){ |
|
505 |
return this.dataItem; |
|
506 |
} |
|
507 |
|
|
508 |
public String getDescription(){ |
|
509 |
return this.dataItem.getDescription(); |
|
510 |
} |
|
511 |
|
|
512 |
private ImageIcon getBlanckIcon(){ |
|
513 |
if (blanckIcon== null){ |
|
514 |
BufferedImage buff =new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); |
|
515 |
blanckIcon = new ImageIcon(buff); |
|
516 |
} |
|
517 |
return blanckIcon; |
|
518 |
} |
|
519 |
|
|
520 |
} |
|
521 |
|
|
522 |
public void actionPerformed(ActionEvent e) { |
|
523 |
if (e.getActionCommand() == "Cancel"){ |
|
524 |
fireDontExitEvent(); |
|
525 |
return; |
|
526 |
} |
|
527 |
if (e.getActionCommand() == "Accept"){ |
|
528 |
fireAcceptEvent(); |
|
529 |
return; |
|
530 |
} |
|
531 |
if (e.getActionCommand() == "Discard") { |
|
532 |
fireDiscardEvent(); |
|
533 |
return; |
|
534 |
} |
|
535 |
if (e.getActionCommand() == "SelectAll"){ |
|
536 |
selectAll(); |
|
537 |
return; |
|
538 |
} |
|
539 |
if (e.getActionCommand() == "DeselectAll"){ |
|
540 |
deselectAll(); |
|
541 |
return; |
|
542 |
} |
|
543 |
} |
|
544 |
|
|
545 |
public void close(){ |
|
546 |
PluginServices.getMDIManager().closeWindow(this); |
|
547 |
|
|
548 |
} |
|
549 |
|
|
550 |
private void fireAcceptEvent() { |
|
551 |
Iterator iter = this.listeners.iterator(); |
|
552 |
while (iter.hasNext()){ |
|
553 |
((UnsavedDataPanelListener)iter.next()).accept(this); |
|
554 |
} |
|
555 |
} |
|
556 |
|
|
557 |
private void fireDiscardEvent() { |
|
558 |
Iterator iter = this.listeners.iterator(); |
|
559 |
while (iter.hasNext()){ |
|
560 |
((UnsavedDataPanelListener)iter.next()).discard(this); |
|
561 |
} |
|
562 |
} |
|
563 |
|
|
564 |
private void fireDontExitEvent() { |
|
565 |
Iterator iter = this.listeners.iterator(); |
|
566 |
while (iter.hasNext()){ |
|
567 |
((UnsavedDataPanelListener)iter.next()).cancel(this); |
|
568 |
} |
|
569 |
} |
|
570 |
|
|
571 |
private void setSelectedsAll( boolean selected){ |
|
572 |
int i; |
|
573 |
myList theList = getList(); |
|
574 |
myUnsavedItem item; |
|
575 |
for (i=0;i < theList.getItemsCount();i++){ |
|
576 |
item = (myUnsavedItem)theList.getItem(i); |
|
577 |
item.setSelected(selected); |
|
578 |
} |
|
579 |
theList.doLayout(); |
|
580 |
} |
|
581 |
|
|
582 |
public void deselectAll() { |
|
583 |
this.setSelectedsAll(false); |
|
584 |
} |
|
585 |
|
|
586 |
public void selectAll() { |
|
587 |
this.setSelectedsAll(true); |
|
588 |
} |
|
589 |
|
|
590 |
|
|
591 |
/** |
|
592 |
* Set the resorces to ask for |
|
593 |
* |
|
594 |
* @param IUnsavedData[] resources pending to save |
|
595 |
*/ |
|
596 |
public void setUnsavedDataArray(IUnsavedData[] unsavedDatalist){ |
|
597 |
this.unsavedDataList = unsavedDatalist; |
|
598 |
myList theList = getList(); |
|
599 |
|
|
600 |
theList.addItems(unsavedDatalist); |
|
601 |
theList.validate(); |
|
602 |
|
|
603 |
} |
|
604 |
|
|
605 |
|
|
606 |
private IUnsavedData[] getUnsavedData(boolean selected){ |
|
607 |
int i; |
|
608 |
myList theList = getList(); |
|
609 |
ArrayList aList = new ArrayList(); |
|
610 |
myUnsavedItem item; |
|
611 |
IUnsavedData[] result; |
|
612 |
|
|
613 |
for (i=0;i < theList.getItemsCount();i++){ |
|
614 |
item = (myUnsavedItem)theList.getItem(i); |
|
615 |
if (item.isSelected() == selected){ |
|
616 |
aList.add(item.getData()); |
|
617 |
} |
|
618 |
} |
|
619 |
result = new IUnsavedData[aList.size()]; |
|
620 |
System.arraycopy(aList.toArray(), 0, result, 0, aList.size()); |
|
621 |
return result; |
|
622 |
} |
|
623 |
|
|
624 |
|
|
625 |
/** |
|
626 |
* Returns the IUnsavedData selecteds for the user to save |
|
627 |
* |
|
628 |
* @return IUnsaveData[] to save |
|
629 |
*/ |
|
630 |
public IUnsavedData[] getSelectedsUnsavedData(){ |
|
631 |
return this.getUnsavedData(true); |
|
632 |
|
|
633 |
} |
|
634 |
|
|
635 |
/** |
|
636 |
* Returns the IUnsavedData not selecteds for the user |
|
637 |
* |
|
638 |
* @return IUnsavedData[] to ignore |
|
639 |
*/ |
|
640 |
public IUnsavedData[] getUnselectedsUnsavedData(){ |
|
641 |
return this.getUnsavedData(false); |
|
642 |
} |
|
643 |
|
|
644 |
public Object getWindowProfile() { |
|
645 |
return WindowInfo.DIALOG_PROFILE; |
|
646 |
} |
|
647 |
|
|
648 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
649 |
|
|
0 | 650 |
tags/tmp_build/frameworks/_fwAndami/src/com/iver/andami/ui/wizard/WizardAndami.java | ||
---|---|---|
1 |
package com.iver.andami.ui.wizard; |
|
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.IWindow; |
|
14 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
15 |
|
|
16 |
public class WizardAndami extends JPanel implements IWindow { |
|
17 |
WindowInfo viewInfo = null; |
|
18 |
WizardPanelWithLogo wizardPanel; |
|
19 |
|
|
20 |
// No deber?an necesitarse un FinishAction y un CancelAction, pero bueno, |
|
21 |
// lo mantengo por ahora. |
|
22 |
private class CloseAction extends FinishAction |
|
23 |
{ |
|
24 |
IWindow v; |
|
25 |
public CloseAction(IWindow view) |
|
26 |
{ |
|
27 |
super(wizardPanel.getWizardComponents()); |
|
28 |
v = view; |
|
29 |
} |
|
30 |
public void performAction() { |
|
31 |
PluginServices.getMDIManager().closeWindow(v); |
|
32 |
} |
|
33 |
|
|
34 |
} |
|
35 |
private class CloseAction2 extends CancelAction |
|
36 |
{ |
|
37 |
|
|
38 |
IWindow v; |
|
39 |
public CloseAction2(IWindow view) |
|
40 |
{ |
|
41 |
super(wizardPanel.getWizardComponents()); |
|
42 |
v = view; |
|
43 |
} |
|
44 |
public void performAction() { |
|
45 |
PluginServices.getMDIManager().closeWindow(v); |
|
46 |
} |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
|
|
51 |
public WizardAndami(ImageIcon logo) |
|
52 |
{ |
|
53 |
wizardPanel = new WizardPanelWithLogo(logo); |
|
54 |
CloseAction closeAction = new CloseAction(this); |
|
55 |
CloseAction2 closeAction2 = new CloseAction2(this); |
|
56 |
wizardPanel.getWizardComponents().setFinishAction(closeAction); |
|
57 |
wizardPanel.getWizardComponents().setCancelAction(closeAction2); |
|
58 |
|
|
59 |
this.setLayout(new BorderLayout()); |
|
60 |
this.add(wizardPanel, BorderLayout.CENTER); |
|
61 |
} |
|
62 |
|
|
63 |
public DefaultJWizardComponents getWizardComponents() |
|
64 |
{ |
|
65 |
return wizardPanel.getWizardComponents(); |
|
66 |
} |
|
67 |
|
|
68 |
|
|
69 |
public WindowInfo getWindowInfo() { |
|
70 |
if (viewInfo == null) |
|
71 |
{ |
|
72 |
viewInfo = new WindowInfo(WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE); |
|
73 |
} |
|
74 |
return viewInfo; |
|
75 |
} |
|
76 |
|
|
77 |
public Object getWindowProfile() { |
|
78 |
// TODO Auto-generated method stub |
|
79 |
return WindowInfo.DIALOG_PROFILE; |
|
80 |
} |
|
81 |
|
|
82 |
} |
|
0 | 83 |
tags/tmp_build/frameworks/_fwAndami/src/com/iver/andami/ui/theme/Theme.java | ||
---|---|---|
1 |
package com.iver.andami.ui.theme; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.Point; |
|
5 |
import java.io.BufferedReader; |
|
6 |
import java.io.File; |
|
7 |
import java.io.FileInputStream; |
|
8 |
import java.io.FileNotFoundException; |
|
9 |
import java.io.FileReader; |
|
10 |
import java.io.IOException; |
|
11 |
import java.util.ArrayList; |
|
12 |
|
|
13 |
import javax.swing.ImageIcon; |
|
14 |
|
|
15 |
import org.kxml2.io.KXmlParser; |
|
16 |
import org.xmlpull.v1.XmlPullParser; |
|
17 |
|
|
18 |
import com.iver.andami.PluginServices; |
|
19 |
import com.iver.andami.messages.NotificationManager; |
|
20 |
|
|
21 |
|
|
22 |
/** |
|
23 |
* Personalization of the program according to the file xml with the necessary information. |
|
24 |
* |
|
25 |
* @author Vicente Caballero Navarro |
|
26 |
*/ |
|
27 |
public class Theme { |
|
28 |
public static final String CENTERED = "CENTERED"; |
|
29 |
public static final String EXPAND = "EXPAND"; |
|
30 |
public static final String MOSAIC = "MOSAIC"; |
|
31 |
|
|
32 |
private static String encoding = "UTF-8"; |
|
33 |
private static final String ANDAMI_PROPERTIES = "AndamiProperties"; |
|
34 |
private static final String APPLICATION_IMAGES = "ApplicationImages"; |
|
35 |
private static final String SPLASH_IMAGES = "SplashImages"; |
|
36 |
private static final String SPLASH = "Splash"; |
|
37 |
private static final String PATH = "path"; |
|
38 |
private static final String TIMER = "timer"; |
|
39 |
private static final String ICON = "Icon"; |
|
40 |
private static final String APPLICATION_NAME = "ApplicationName"; |
|
41 |
private static final String VALUE = "value"; |
|
42 |
private static final String BACKGROUND_IMAGE = "BackgroundImage"; |
|
43 |
private static final String WALLPAPER_TYPE = "WallpaperType"; |
|
44 |
|
|
45 |
private static final String VERSION="version"; |
|
46 |
private static final String FONTPOSITIONX="x"; |
|
47 |
private static final String FONTPOSITIONY="y"; |
|
48 |
|
|
49 |
private static final String FONTSIZE="fontsize"; |
|
50 |
private static final String FONTCOLOR="color"; |
|
51 |
|
|
52 |
private ArrayList<String> images = new ArrayList<String>(); |
|
53 |
private String icon; |
|
54 |
private ArrayList<String> timers = new ArrayList<String>(); |
|
55 |
private ArrayList<String> versions = new ArrayList<String>(); |
|
56 |
private ArrayList<String> fontColors = new ArrayList<String>(); |
|
57 |
private ArrayList<String> fontSizes = new ArrayList<String>(); |
|
58 |
private ArrayList<String> fontpositionsX=new ArrayList<String>(); |
|
59 |
private ArrayList<String> fontpositionsY=new ArrayList<String>(); |
|
60 |
|
|
61 |
private String name = null; |
|
62 |
private String backgroundimage; |
|
63 |
private String wallpaperType=CENTERED; |
|
64 |
|
|
65 |
public static void main(String[] args) { |
|
66 |
Theme theme = new Theme(); |
|
67 |
theme.readTheme(new File( |
|
68 |
"c:/workspace/_fwAndami/theme/andami-theme.xml")); |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* Read the file xml with the personalization. |
|
73 |
* |
|
74 |
* @param file xml |
|
75 |
*/ |
|
76 |
public void readTheme(File file) { |
|
77 |
try { |
|
78 |
FileReader fr; |
|
79 |
|
|
80 |
try { |
|
81 |
fr = new FileReader(file); |
|
82 |
|
|
83 |
BufferedReader br = new BufferedReader(fr); |
|
84 |
char[] buffer = new char[100]; |
|
85 |
br.read(buffer); |
|
86 |
|
|
87 |
StringBuffer st = new StringBuffer(new String(buffer)); |
|
88 |
String searchText = "encoding=\""; |
|
89 |
int index = st.indexOf(searchText); |
|
90 |
|
|
91 |
if (index > -1) { |
|
92 |
st.delete(0, index + searchText.length()); |
|
93 |
encoding = st.substring(0, st.indexOf("\"")); |
|
94 |
} |
|
95 |
} catch (FileNotFoundException ex) { |
|
96 |
ex.printStackTrace(); |
|
97 |
} catch (IOException e) { |
|
98 |
e.printStackTrace(); |
|
99 |
} |
|
100 |
|
|
101 |
fr = new FileReader(file); |
|
102 |
|
|
103 |
KXmlParser parser = new KXmlParser(); |
|
104 |
parser.setInput(new FileInputStream(file), encoding); |
|
105 |
|
|
106 |
int tag = parser.nextTag(); |
|
107 |
|
|
108 |
if (parser.getEventType() != XmlPullParser.END_DOCUMENT) { |
|
109 |
parser.require(XmlPullParser.START_TAG, null, ANDAMI_PROPERTIES); |
|
110 |
|
|
111 |
while (tag != XmlPullParser.END_DOCUMENT) { |
|
112 |
//parser.next(); |
|
113 |
switch (tag) { |
|
114 |
case XmlPullParser.START_TAG: |
|
115 |
|
|
116 |
if (parser.getName().compareTo(ANDAMI_PROPERTIES) == 0) { |
|
117 |
parser.nextTag(); |
|
118 |
if (parser.getName().compareTo(APPLICATION_IMAGES) == 0) { |
|
119 |
int splashtag = parser.nextTag(); |
|
120 |
if (parser.getName().compareTo(SPLASH_IMAGES) == 0) { |
|
121 |
splashtag = parser.nextTag(); |
|
122 |
boolean endSplash = false; |
|
123 |
|
|
124 |
// parser.require(KXmlParser.START_TAG, |
|
125 |
// null, SPLASH); |
|
126 |
while ((splashtag != XmlPullParser.END_DOCUMENT) |
|
127 |
&& !endSplash) { |
|
128 |
if (splashtag == XmlPullParser.END_TAG) { |
|
129 |
splashtag = parser.nextTag(); |
|
130 |
|
|
131 |
continue; |
|
132 |
} |
|
133 |
|
|
134 |
if (parser.getName().compareTo(SPLASH) == 0) { |
|
135 |
images.add(parser |
|
136 |
.getAttributeValue("", |
|
137 |
PATH)); |
|
138 |
timers.add(parser |
|
139 |
.getAttributeValue("", |
|
140 |
TIMER)); |
|
141 |
versions.add(parser |
|
142 |
.getAttributeValue("", |
|
143 |
VERSION)); |
|
144 |
fontpositionsX.add(parser |
|
145 |
.getAttributeValue("", |
|
146 |
FONTPOSITIONX)); |
|
147 |
fontpositionsY.add(parser |
|
148 |
.getAttributeValue("", |
|
149 |
FONTPOSITIONY)); |
|
150 |
fontSizes.add(parser |
|
151 |
.getAttributeValue("", |
|
152 |
FONTSIZE)); |
|
153 |
fontColors.add(parser |
|
154 |
.getAttributeValue("", |
|
155 |
FONTCOLOR)); |
|
156 |
|
|
157 |
splashtag = parser.nextTag(); |
|
158 |
} else { |
|
159 |
endSplash = true; |
|
160 |
} |
|
161 |
} |
|
162 |
} |
|
163 |
int tagOptions = XmlPullParser.START_TAG; |
|
164 |
while ((tagOptions != XmlPullParser.END_TAG)) { |
|
165 |
if (parser.getName().compareTo( |
|
166 |
BACKGROUND_IMAGE) == 0) { |
|
167 |
backgroundimage = parser |
|
168 |
.getAttributeValue("", PATH); |
|
169 |
tag = parser.next(); |
|
170 |
} else if (parser.getName().compareTo(ICON) == 0) { |
|
171 |
icon = parser.getAttributeValue("", |
|
172 |
PATH); |
|
173 |
tag = parser.next(); |
|
174 |
} else if (parser.getName().compareTo( |
|
175 |
WALLPAPER_TYPE) == 0) { |
|
176 |
wallpaperType = parser.getAttributeValue( |
|
177 |
"", VALUE); |
|
178 |
tag = parser.next(); |
|
179 |
} |
|
180 |
tagOptions = parser.nextTag(); |
|
181 |
|
|
182 |
} |
|
183 |
} |
|
184 |
} |
|
185 |
if (parser.getName().compareTo(APPLICATION_NAME) == 0) { |
|
186 |
name = parser.getAttributeValue("", |
|
187 |
VALUE); |
|
188 |
tag = parser.next(); |
|
189 |
} |
|
190 |
break; |
|
191 |
|
|
192 |
case XmlPullParser.END_TAG: |
|
193 |
break; |
|
194 |
|
|
195 |
case XmlPullParser.TEXT: |
|
196 |
|
|
197 |
// System.out.println("[TEXT]["+kxmlParser.getText()+"]"); |
|
198 |
break; |
|
199 |
} |
|
200 |
|
|
201 |
tag = parser.next(); |
|
202 |
} |
|
203 |
} |
|
204 |
|
|
205 |
parser.require(XmlPullParser.END_DOCUMENT, null, null); |
|
206 |
|
|
207 |
// } |
|
208 |
} catch (Exception e) { |
|
209 |
NotificationManager.addError("Error reading theme: "+file.getAbsolutePath(), e); |
|
210 |
} |
|
211 |
} |
|
212 |
|
|
213 |
/** |
|
214 |
* Returns image to the splashwindow. |
|
215 |
* |
|
216 |
* @return ImageIcon[] |
|
217 |
*/ |
|
218 |
public ImageIcon[] getSplashImages() { |
|
219 |
ImageIcon[] imgs = new ImageIcon[images.size()]; |
|
220 |
|
|
221 |
for (int i = 0; i < images.size(); i++) { |
|
222 |
imgs[i] = new ImageIcon(images.get(i)); |
|
223 |
} |
|
224 |
|
|
225 |
return imgs; |
|
226 |
} |
|
227 |
|
|
228 |
public String getTypeDesktop() { |
|
229 |
return wallpaperType; |
|
230 |
} |
|
231 |
/** |
|
232 |
* Return the icon. |
|
233 |
* |
|
234 |
* @return ImageIcon |
|
235 |
*/ |
|
236 |
public ImageIcon getIcon() { |
|
237 |
if (icon == null) { |
|
238 |
return null; |
|
239 |
} |
|
240 |
|
|
241 |
try { |
|
242 |
return new ImageIcon(icon); |
|
243 |
} catch (Exception e) { |
|
244 |
return null; |
|
245 |
} |
|
246 |
} |
|
247 |
/** |
|
248 |
* Return the backgroundimage. |
|
249 |
* |
|
250 |
* @return ImageIcon |
|
251 |
*/ |
|
252 |
public ImageIcon getBackgroundImage() { |
|
253 |
if (backgroundimage == null) { |
|
254 |
return null; |
|
255 |
} |
|
256 |
|
|
257 |
try { |
|
258 |
return new ImageIcon(backgroundimage); |
|
259 |
} catch (Exception e) { |
|
260 |
return null; |
|
261 |
} |
|
262 |
} |
|
263 |
/** |
|
264 |
* Return the time of the splash images. |
|
265 |
* |
|
266 |
* @return long[] |
|
267 |
*/ |
|
268 |
public long[] getTimers() { |
Also available in: Unified diff