Revision 10437 branches/simbologia/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/ThemeManagerWindow.java
ThemeManagerWindow.java | ||
---|---|---|
72 | 72 |
private static int selectedTabIndex = 0; |
73 | 73 |
private static ArrayList pages = new ArrayList(); |
74 | 74 |
private FLayer layer; |
75 |
private Legend legend; // Le asignaremos la leyenda del primer tema activo.
|
|
76 |
private JTabbedPane tabs = new JTabbedPane(); // @jve:decl-index=0:
|
|
77 |
private JPanel panelButtons;
|
|
75 |
private Legend legend; // Le asignaremos la leyenda del primer tema activo.
|
|
76 |
private JTabbedPane tabs = new JTabbedPane(); // @jve:decl-index=0:
|
|
77 |
private JPanel panelButtons;
|
|
78 | 78 |
|
79 | 79 |
|
80 | 80 |
|
81 |
/**
|
|
82 |
* Sobrecarga del constructor. Este se utiliza cuando se llama a este
|
|
83 |
* di?logo desde la barra de comandos.
|
|
84 |
*
|
|
85 |
*/
|
|
86 |
public ThemeManagerWindow(FLayer l) {
|
|
87 |
this.layer = l;
|
|
81 |
/**
|
|
82 |
* Sobrecarga del constructor. Este se utiliza cuando se llama a este
|
|
83 |
* di?logo desde la barra de comandos.
|
|
84 |
*
|
|
85 |
*/
|
|
86 |
public ThemeManagerWindow(FLayer l) {
|
|
87 |
this.layer = l;
|
|
88 | 88 |
|
89 |
// TODO falta definir leyenda para cualquier tipo de capa
|
|
90 |
// y decidir entonces qu? opciones soporta cada una para
|
|
91 |
// que el di?logo se autorrellene
|
|
92 |
this.legend = ((ClassifiableVectorial) l).getLegend();
|
|
93 |
initialize();
|
|
94 |
}
|
|
89 |
// TODO falta definir leyenda para cualquier tipo de capa
|
|
90 |
// y decidir entonces qu? opciones soporta cada una para
|
|
91 |
// que el di?logo se autorrellene
|
|
92 |
this.legend = ((ClassifiableVectorial) l).getLegend();
|
|
93 |
initialize();
|
|
94 |
}
|
|
95 | 95 |
|
96 | 96 |
private void initialize() { |
97 | 97 |
for (int i = 0; i < pages.size(); i++) { |
98 |
Class pageClass = (Class) pages.get(i);
|
|
99 |
AbstractThemeManagerPage tab;
|
|
98 |
Class pageClass = (Class) pages.get(i);
|
|
99 |
AbstractThemeManagerPage tab;
|
|
100 | 100 |
try { |
101 | 101 |
tab = (AbstractThemeManagerPage) pageClass.newInstance(); |
102 | 102 |
tab.setModel(layer, legend); |
... | ... | |
107 | 107 |
} catch (IllegalAccessException e) { |
108 | 108 |
NotificationManager.addError("IllegalAccessException: does " + |
109 | 109 |
pageClass.getName() + " class have an anonymous" + |
110 |
" constructor?", e);
|
|
110 |
" constructor?", e); |
|
111 | 111 |
} |
112 | 112 |
} |
113 | 113 |
|
... | ... | |
115 | 115 |
tabs.setPreferredSize(new java.awt.Dimension(640,390)); |
116 | 116 |
|
117 | 117 |
|
118 |
setLayout(new BorderLayout());
|
|
118 |
setLayout(new BorderLayout());
|
|
119 | 119 |
add(tabs, java.awt.BorderLayout.CENTER); |
120 | 120 |
|
121 | 121 |
// The listener must be added after the tabs are added to the window |
... | ... | |
123 | 123 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
124 | 124 |
//remember the visible tab |
125 | 125 |
selectedTabIndex = tabs.getSelectedIndex(); |
126 |
if (selectedTabIndex<0)
|
|
127 |
selectedTabIndex = 0;
|
|
126 |
if (selectedTabIndex<0)
|
|
127 |
selectedTabIndex = 0;
|
|
128 | 128 |
}; |
129 | 129 |
}); |
130 | 130 |
add(getPanelButtons(), java.awt.BorderLayout.SOUTH); |
131 |
setSize(new java.awt.Dimension(723,468));
|
|
131 |
setSize(new java.awt.Dimension(723,468));
|
|
132 | 132 |
|
133 | 133 |
|
134 | 134 |
} |
135 | 135 |
|
136 | 136 |
private JPanel getPanelButtons() { |
137 | 137 |
if (panelButtons == null) { |
138 |
panelButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5,5));
|
|
138 |
panelButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5,5));
|
|
139 | 139 |
|
140 |
JButton btnAceptar = new JButton(PluginServices.getText(this,"Aceptar"));
|
|
141 |
btnAceptar.setActionCommand("OK");
|
|
142 |
btnAceptar.addActionListener(this);
|
|
140 |
JButton btnAceptar = new JButton(PluginServices.getText(this,"Aceptar"));
|
|
141 |
btnAceptar.setActionCommand("OK");
|
|
142 |
btnAceptar.addActionListener(this);
|
|
143 | 143 |
|
144 |
JButton btnApply = new JButton(PluginServices.getText(this,"Aplicar"));
|
|
145 |
btnApply.setActionCommand("APPLY");
|
|
146 |
btnApply.addActionListener(this);
|
|
144 |
JButton btnApply = new JButton(PluginServices.getText(this,"Aplicar"));
|
|
145 |
btnApply.setActionCommand("APPLY");
|
|
146 |
btnApply.addActionListener(this);
|
|
147 | 147 |
|
148 | 148 |
|
149 |
JButton btnCancelar = new JButton(PluginServices.getText(this,"Cerrar"));
|
|
150 |
btnCancelar.setActionCommand("CANCEL");
|
|
151 |
btnCancelar.addActionListener(this);
|
|
152 |
panelButtons.setPreferredSize(new java.awt.Dimension(493,33));
|
|
149 |
JButton btnCancelar = new JButton(PluginServices.getText(this,"Cerrar"));
|
|
150 |
btnCancelar.setActionCommand("CANCEL");
|
|
151 |
btnCancelar.addActionListener(this);
|
|
152 |
panelButtons.setPreferredSize(new java.awt.Dimension(493,33));
|
|
153 | 153 |
panelButtons.add(btnCancelar); |
154 | 154 |
panelButtons.add(btnApply); |
155 | 155 |
panelButtons.add(btnAceptar); |
... | ... | |
177 | 177 |
|
178 | 178 |
} else if (e.getActionCommand() == "CANCEL") { |
179 | 179 |
/* Causes all the tabs in the ThemeManagerWindow to perform THEIR cancel-action |
180 |
* then it closes the window.
|
|
180 |
* then closes the window. |
|
181 | 181 |
*/ |
182 | 182 |
for (int i = 0; i < tabs.getTabCount(); i++) { |
183 | 183 |
AbstractThemeManagerPage tab = (AbstractThemeManagerPage) tabs.getComponentAt(i); |
Also available in: Unified diff