Revision 11625
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/buttonspanel/TestButtonsPanel.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
import javax.swing.JFrame; |
24 | 24 |
import javax.swing.UIManager; |
25 |
|
|
26 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
27 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
|
28 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
|
29 | 25 |
/** |
30 | 26 |
* <code>TestButtonsPanel</code> es un test para comprobar el funcionamiento de |
31 | 27 |
* la clase <code>ButtonsPanel</code>. |
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/coorddatainput/TestCoordDataInput.java | ||
---|---|---|
6 | 6 |
import javax.swing.JFrame; |
7 | 7 |
import javax.swing.UIManager; |
8 | 8 |
|
9 |
import org.gvsig.gui.beans.coorddatainput.CoordDataInputContainer; |
|
10 |
|
|
11 | 9 |
public class TestCoordDataInput implements ComponentListener{ |
12 | 10 |
private int w = 438, h = 130; |
13 | 11 |
private JFrame frame = new JFrame(); |
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/defaultbuttonspanel/TestDefaultButtonsPanel.java | ||
---|---|---|
27 | 27 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
28 | 28 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
29 | 29 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
30 |
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel; |
|
31 | 30 |
/** |
32 | 31 |
* <code>TestDialogPanel</code>. Test para comprobar el funcionamiento de la |
33 | 32 |
* clase <code>DialogPanel</code> |
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/progresspanel/TestProgressPanel.java | ||
---|---|---|
23 | 23 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
24 | 24 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
25 | 25 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
26 |
import org.gvsig.gui.beans.progresspanel.ProgressPanel; |
|
27 | 26 |
|
28 | 27 |
/** |
29 | 28 |
* <code>TestProgressPanel</code>. Test para comprobar el funcionamiento del |
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/datainput/TestDataInput.java | ||
---|---|---|
7 | 7 |
import javax.swing.JPanel; |
8 | 8 |
import javax.swing.UIManager; |
9 | 9 |
|
10 |
import org.gvsig.gui.beans.datainput.DataInputContainer; |
|
11 |
|
|
12 | 10 |
public class TestDataInput implements ComponentListener { |
13 | 11 |
private int w = 150, h = 50; |
14 | 12 |
private JFrame frame = new JFrame(); |
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/treelist/TestTreeList.java | ||
---|---|---|
4 | 4 |
import javax.swing.UIManager; |
5 | 5 |
|
6 | 6 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
7 |
import org.gvsig.gui.beans.treelist.event.TreeListChangeEvent; |
|
8 |
import org.gvsig.gui.beans.treelist.listeners.TreeListChangeListener; |
|
7 | 9 |
|
8 |
public class TestTreeList { |
|
10 |
public class TestTreeList implements TreeListChangeListener {
|
|
9 | 11 |
private int w = 200, h = 380; |
10 | 12 |
private JFrame frame = new JFrame(); |
11 | 13 |
private TreeListContainer tlist; |
... | ... | |
30 | 32 |
tlist.addEntry("cuatro-seis","cuatro",""); |
31 | 33 |
|
32 | 34 |
tlist.getTree().expandRow(0); |
35 |
tlist.addChangeSelectionListener(this); |
|
33 | 36 |
|
34 | 37 |
frame.getContentPane().add(tlist); |
35 | 38 |
frame.setSize(w, h); |
... | ... | |
49 | 52 |
System.out.println("Tabla no inicializado"); |
50 | 53 |
} |
51 | 54 |
} |
55 |
|
|
56 |
public void actionChangeSelection(TreeListChangeEvent e) { |
|
57 |
System.out.println(e.getItem()); |
|
58 |
} |
|
52 | 59 |
} |
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/incrementabletask/TestIncrementableTask.java | ||
---|---|---|
20 | 20 |
|
21 | 21 |
import javax.swing.UIManager; |
22 | 22 |
|
23 |
import org.gvsig.gui.beans.incrementabletask.IIncrementable; |
|
24 |
import org.gvsig.gui.beans.incrementabletask.IncrementableEvent; |
|
25 |
import org.gvsig.gui.beans.incrementabletask.IncrementableListener; |
|
26 |
import org.gvsig.gui.beans.incrementabletask.IncrementableTask; |
|
27 | 23 |
import org.gvsig.gui.beans.progresspanel.LogControl; |
28 | 24 |
|
29 | 25 |
public class TestIncrementableTask { |
trunk/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/buttonbar/TestButtonBar.java | ||
---|---|---|
3 | 3 |
import javax.swing.JFrame; |
4 | 4 |
import javax.swing.UIManager; |
5 | 5 |
|
6 |
import org.gvsig.gui.beans.buttonbar.ButtonBarContainer; |
|
7 |
|
|
8 | 6 |
public class TestButtonBar { |
9 | 7 |
|
10 | 8 |
private JFrame frame = new JFrame(); |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/treelist/TreeListContainer.java | ||
---|---|---|
24 | 24 |
import java.awt.event.ActionListener; |
25 | 25 |
import java.util.ArrayList; |
26 | 26 |
import java.util.Hashtable; |
27 |
import java.util.Iterator; |
|
27 | 28 |
|
28 | 29 |
import javax.swing.DefaultListModel; |
29 | 30 |
import javax.swing.JButton; |
... | ... | |
33 | 34 |
import javax.swing.JSplitPane; |
34 | 35 |
import javax.swing.JTree; |
35 | 36 |
import javax.swing.ListSelectionModel; |
37 |
import javax.swing.event.ListSelectionEvent; |
|
38 |
import javax.swing.event.ListSelectionListener; |
|
39 |
import javax.swing.event.TreeSelectionEvent; |
|
40 |
import javax.swing.event.TreeSelectionListener; |
|
36 | 41 |
import javax.swing.tree.DefaultMutableTreeNode; |
37 | 42 |
import javax.swing.tree.DefaultTreeModel; |
43 |
import javax.swing.tree.TreePath; |
|
38 | 44 |
|
45 |
import org.gvsig.gui.beans.treelist.event.TreeListChangeEvent; |
|
46 |
import org.gvsig.gui.beans.treelist.listeners.TreeListChangeListener; |
|
39 | 47 |
import org.gvsig.gui.beans.treelist.listeners.TreeListComponentListener; |
40 | 48 |
import org.gvsig.gui.beans.treelist.listeners.TreeListListener; |
41 | 49 |
import org.gvsig.i18n.Messages; |
... | ... | |
49 | 57 |
* Nacho Brodin (brodin_ign@gva.es) |
50 | 58 |
*/ |
51 | 59 |
|
52 |
public class TreeListContainer extends JPanel implements ActionListener { |
|
60 |
public class TreeListContainer extends JPanel implements ActionListener, TreeSelectionListener, ListSelectionListener {
|
|
53 | 61 |
private static final long serialVersionUID = 6665259638830401366L; |
54 | 62 |
private Hashtable map; |
55 | 63 |
|
... | ... | |
75 | 83 |
listener.setList(getList()); |
76 | 84 |
listener.setTree(getTree()); |
77 | 85 |
this.setPreferredSize(new Dimension(160, 0)); |
86 |
getTree().addTreeSelectionListener(this); |
|
87 |
getList().addListSelectionListener(this); |
|
78 | 88 |
} |
79 | 89 |
|
80 | 90 |
/** |
... | ... | |
269 | 279 |
listener.deleteElement(); |
270 | 280 |
} |
271 | 281 |
} |
282 |
|
|
283 |
/** |
|
284 |
* A?adir el disparador de cuando se pulsa un bot?n. |
|
285 |
* @param listener |
|
286 |
*/ |
|
287 |
private ArrayList actionChangeListeners = new ArrayList(); |
|
288 |
|
|
289 |
public void addChangeSelectionListener(TreeListChangeListener listener) { |
|
290 |
if (!actionChangeListeners.contains(listener)) |
|
291 |
actionChangeListeners.add(listener); |
|
292 |
} |
|
293 |
|
|
294 |
/** |
|
295 |
* Borrar el disparador de eventos de los botones. |
|
296 |
* @param listener |
|
297 |
*/ |
|
298 |
public void removeChangeSelectionListener(TreeListChangeListener listener) { |
|
299 |
actionChangeListeners.remove(listener); |
|
300 |
} |
|
301 |
|
|
302 |
private void callActionChangeListeners(String item) { |
|
303 |
Iterator acIterator = actionChangeListeners.iterator(); |
|
304 |
while (acIterator.hasNext()) { |
|
305 |
TreeListChangeListener listener = (TreeListChangeListener) acIterator.next(); |
|
306 |
listener.actionChangeSelection(new TreeListChangeEvent(this, item)); |
|
307 |
} |
|
308 |
} |
|
309 |
|
|
310 |
public void valueChanged(TreeSelectionEvent e) { |
|
311 |
String draggLabel = null; |
|
312 |
if(e.getSource() == tree){ |
|
313 |
TreePath[] tp = tree.getSelectionPaths(); |
|
314 |
if(tp != null){ |
|
315 |
String val = tp[0].toString(); |
|
316 |
//Comprobamos que se haya pinchado sobre una rama |
|
317 |
String[] pathTree = val.split(", "); |
|
318 |
if(pathTree.length > 2) { |
|
319 |
draggLabel = val.substring(val.lastIndexOf(", ") + 2, val.lastIndexOf("]")); |
|
320 |
callActionChangeListeners(draggLabel); |
|
321 |
} |
|
322 |
} |
|
323 |
} |
|
324 |
} |
|
325 |
|
|
326 |
public void valueChanged(ListSelectionEvent e) { |
|
327 |
if (!e.getValueIsAdjusting()) { |
|
328 |
callActionChangeListeners(getList().getSelectedValue().toString()); |
|
329 |
} |
|
330 |
} |
|
272 | 331 |
} |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/treelist/event/TreeListEvent.java | ||
---|---|---|
24 | 24 |
* Nacho Brodin (brodin_ign@gva.es) |
25 | 25 |
*/ |
26 | 26 |
|
27 |
public class TreeListEvent{ |
|
27 |
public class TreeListEvent {
|
|
28 | 28 |
|
29 | 29 |
private String elementAdded = null; |
30 | 30 |
private String elementRemoved = null; |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/treelist/event/TreeListChangeEvent.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 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 |
package org.gvsig.gui.beans.treelist.event; |
|
20 |
|
|
21 |
import java.util.EventObject; |
|
22 |
|
|
23 |
public class TreeListChangeEvent extends EventObject { |
|
24 |
private static final long serialVersionUID = -684281519921935004L; |
|
25 |
String item = null; |
|
26 |
|
|
27 |
public TreeListChangeEvent(Object source, String item) { |
|
28 |
super(source); |
|
29 |
this.item = item; |
|
30 |
} |
|
31 |
|
|
32 |
public String getItem() { |
|
33 |
return item; |
|
34 |
} |
|
35 |
} |
|
0 | 36 |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/treelist/listeners/TreeListListener.java | ||
---|---|---|
285 | 285 |
for(int i = 0; i < listListeners.size(); i++) |
286 | 286 |
((TreeListComponentListener)listListeners.get(i)).elementMoved(e); |
287 | 287 |
} |
288 |
|
|
289 | 288 |
} |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/treelist/listeners/TreeListComponentListener.java | ||
---|---|---|
25 | 25 |
* Nacho Brodin (brodin_ign@gva.es) |
26 | 26 |
*/ |
27 | 27 |
|
28 |
public interface TreeListComponentListener{ |
|
28 |
public interface TreeListComponentListener {
|
|
29 | 29 |
/** |
30 | 30 |
* Este m?todo es ejecutado cuando se inserta un nuevo elemento en la lista |
31 | 31 |
* @param e TreeListEvent |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/treelist/listeners/TreeListChangeListener.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 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 |
package org.gvsig.gui.beans.treelist.listeners; |
|
20 |
|
|
21 |
import java.util.EventListener; |
|
22 |
|
|
23 |
import org.gvsig.gui.beans.treelist.event.TreeListChangeEvent; |
|
24 |
|
|
25 |
public interface TreeListChangeListener extends EventListener { |
|
26 |
public void actionChangeSelection(TreeListChangeEvent e); |
|
27 |
} |
|
0 | 28 |
Also available in: Unified diff