Revision 8782
branches/v10+Piloto/libraries/libUIComponent_praster/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>libUIComponents</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>de.loskutov.FileSync.FSBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
</buildSpec> |
|
19 |
<natures> |
|
20 |
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> |
|
21 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
22 |
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature> |
|
23 |
</natures> |
|
24 |
</projectDescription> |
|
0 | 25 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/slidertext/TestSliderTextTable.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.slidertext; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
|
|
8 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
9 |
|
|
10 |
public class TestSliderTextTable implements ComponentListener{ |
|
11 |
private int w = 350, h = 150; |
|
12 |
private JFrame frame=new JFrame(); |
|
13 |
private SliderTextContainer slider = null; |
|
14 |
|
|
15 |
public TestSliderTextTable() throws NotInitializeException{ |
|
16 |
slider = new SliderTextContainer(w - 12, h - 45, 0, 255, 255); |
|
17 |
|
|
18 |
frame.addComponentListener(this); |
|
19 |
|
|
20 |
frame.getContentPane().add(slider); |
|
21 |
frame.setSize(w, h); |
|
22 |
frame.setVisible(true); |
|
23 |
} |
|
24 |
|
|
25 |
public static void main(String[] args) { |
|
26 |
try{ |
|
27 |
TestSliderTextTable slider = new TestSliderTextTable(); |
|
28 |
}catch(NotInitializeException ex){ |
|
29 |
System.out.println("Tabla no inicializada"); |
|
30 |
} |
|
31 |
} |
|
32 |
|
|
33 |
public void componentHidden(ComponentEvent e) { |
|
34 |
// TODO Auto-generated method stub |
|
35 |
|
|
36 |
} |
|
37 |
|
|
38 |
public void componentMoved(ComponentEvent e) { |
|
39 |
// TODO Auto-generated method stub |
|
40 |
|
|
41 |
} |
|
42 |
|
|
43 |
public void componentResized(ComponentEvent e) { |
|
44 |
slider.setComponentSize(frame.getWidth() - 12, frame.getHeight() - 45); |
|
45 |
} |
|
46 |
|
|
47 |
public void componentShown(ComponentEvent e) { |
|
48 |
// TODO Auto-generated method stub |
|
49 |
|
|
50 |
} |
|
51 |
} |
|
0 | 52 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/table/TestTableButtonModelTable.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.table; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.event.ActionEvent; |
|
5 |
import java.awt.event.ActionListener; |
|
6 |
import java.awt.event.ComponentEvent; |
|
7 |
import java.awt.event.ComponentListener; |
|
8 |
|
|
9 |
import javax.swing.JButton; |
|
10 |
import javax.swing.JFrame; |
|
11 |
|
|
12 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
13 |
import org.gvsig.gui.beans.table.models.TableButtonModel; |
|
14 |
|
|
15 |
public class TestTableButtonModelTable implements ComponentListener, ActionListener{ |
|
16 |
private int w = 460, h = 200; |
|
17 |
private JFrame frame = new JFrame(); |
|
18 |
private TableContainer table = null; |
|
19 |
|
|
20 |
public TestTableButtonModelTable() throws NotInitializeException{ |
|
21 |
String[] columnNames = {"Bot?n", "columna2", "columna3", "columna 4", "col5"}; |
|
22 |
int[] columnWidths = {54, 114, 94, 114, 60}; |
|
23 |
table = new TableContainer(w - 12, h - 45, columnNames, columnWidths); |
|
24 |
table.setModel("TableButtonModel"); |
|
25 |
table.initialize(); |
|
26 |
|
|
27 |
Object[] row = {Color.GREEN, "texto 0", "texto 0", "texto 0", "125"}; |
|
28 |
Object[] row1 = {Color.BLUE, "texto 1", "texto 1", "texto 1", "255"}; |
|
29 |
Object[] row2 = {Color.RED, "texto 2", "texto 2", "texto 2", "80"}; |
|
30 |
table.addRow(row); |
|
31 |
|
|
32 |
/*JButton b7 = new JButton(); |
|
33 |
b7.setBackground(Color.RED); |
|
34 |
b7.addActionListener(this); |
|
35 |
((TableButtonModel)table.getModel()).setValueAt(b7, 0, 0);*/ |
|
36 |
table.addRow(row1); |
|
37 |
table.addRow(row2); |
|
38 |
|
|
39 |
frame.addComponentListener(this); |
|
40 |
|
|
41 |
frame.getContentPane().add(table); |
|
42 |
frame.setSize(w, h); |
|
43 |
frame.setVisible(true); |
|
44 |
} |
|
45 |
|
|
46 |
public static void main(String[] args) { |
|
47 |
try{ |
|
48 |
TestTableButtonModelTable tabla = new TestTableButtonModelTable(); |
|
49 |
}catch(NotInitializeException ex){ |
|
50 |
System.out.println("Tabla no inicializada"); |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
public void componentHidden(ComponentEvent e) { |
|
55 |
// TODO Auto-generated method stub |
|
56 |
|
|
57 |
} |
|
58 |
|
|
59 |
public void componentMoved(ComponentEvent e) { |
|
60 |
// TODO Auto-generated method stub |
|
61 |
|
|
62 |
} |
|
63 |
|
|
64 |
public void componentResized(ComponentEvent e) { |
|
65 |
table.setComponentSize(frame.getWidth() - 12, frame.getHeight() - 45); |
|
66 |
} |
|
67 |
|
|
68 |
public void componentShown(ComponentEvent e) { |
|
69 |
// TODO Auto-generated method stub |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
public void actionPerformed(ActionEvent e) { |
|
74 |
System.out.println("Evento de bot?n!!"); |
|
75 |
|
|
76 |
} |
|
77 |
} |
|
0 | 78 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/table/CheckBoxModelTable.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.table; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
|
|
8 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
9 |
|
|
10 |
public class CheckBoxModelTable implements ComponentListener{ |
|
11 |
private int w = 400, h = 200; |
|
12 |
private JFrame frame=new JFrame(); |
|
13 |
private TableContainer table = null; |
|
14 |
|
|
15 |
public CheckBoxModelTable() throws NotInitializeException{ |
|
16 |
String[] columnNames = {"Cb", "columna"}; |
|
17 |
int[] columnWidths = {22, 334}; |
|
18 |
table = new TableContainer(w - 12, h - 45, columnNames, columnWidths); |
|
19 |
table.setModel("CheckBoxModel"); |
|
20 |
table.initialize(); |
|
21 |
|
|
22 |
Object[] row = {new Boolean(true), "texto 0"}; |
|
23 |
Object[] row1 = {new Boolean(false), "texto 1"}; |
|
24 |
Object[] row2 = {new Boolean(false), "texto 2"}; |
|
25 |
table.addRow(row); |
|
26 |
table.addRow(row1); |
|
27 |
table.addRow(row2); |
|
28 |
table.delRow(1); |
|
29 |
|
|
30 |
frame.addComponentListener(this); |
|
31 |
|
|
32 |
frame.getContentPane().add(table); |
|
33 |
frame.setSize(w, h); |
|
34 |
frame.setVisible(true); |
|
35 |
} |
|
36 |
|
|
37 |
public static void main(String[] args) { |
|
38 |
try{ |
|
39 |
CheckBoxModelTable tabla = new CheckBoxModelTable(); |
|
40 |
}catch(NotInitializeException ex){ |
|
41 |
System.out.println("Tabla no inicializada"); |
|
42 |
} |
|
43 |
} |
|
44 |
|
|
45 |
public void componentHidden(ComponentEvent e) { |
|
46 |
// TODO Auto-generated method stub |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public void componentMoved(ComponentEvent e) { |
|
51 |
// TODO Auto-generated method stub |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
public void componentResized(ComponentEvent e) { |
|
56 |
table.setComponentSize(frame.getWidth() - 12, frame.getHeight() - 45); |
|
57 |
} |
|
58 |
|
|
59 |
public void componentShown(ComponentEvent e) { |
|
60 |
// TODO Auto-generated method stub |
|
61 |
|
|
62 |
} |
|
63 |
} |
|
0 | 64 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/table/TestTreeRadioButtonModelTable.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.table; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
|
|
8 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
9 |
|
|
10 |
public class TestTreeRadioButtonModelTable implements ComponentListener{ |
|
11 |
private int w = 400, h = 200; |
|
12 |
private JFrame frame=new JFrame(); |
|
13 |
private TableContainer table = null; |
|
14 |
|
|
15 |
public TestTreeRadioButtonModelTable() throws NotInitializeException{ |
|
16 |
String[] columnNames = {"R", "G", "B", "columna 4"}; |
|
17 |
int[] columnWidths = {22, 22, 22, 334}; |
|
18 |
table = new TableContainer(w - 12, h - 45, columnNames, columnWidths); |
|
19 |
table.setModel("TreeRadioButtonModel"); |
|
20 |
table.initialize(); |
|
21 |
|
|
22 |
Object[] row = {new Boolean(true), new Boolean(false), new Boolean(false), "texto 0"}; |
|
23 |
Object[] row1 = {new Boolean(false), new Boolean(true), new Boolean(false), "texto 1"}; |
|
24 |
Object[] row2 = {new Boolean(false), new Boolean(false), new Boolean(true), "texto 2"}; |
|
25 |
table.addRow(row); |
|
26 |
table.addRow(row1); |
|
27 |
table.addRow(row2); |
|
28 |
table.delRow(1); |
|
29 |
|
|
30 |
frame.addComponentListener(this); |
|
31 |
|
|
32 |
frame.getContentPane().add(table); |
|
33 |
frame.setSize(w, h); |
|
34 |
frame.setVisible(true); |
|
35 |
} |
|
36 |
|
|
37 |
public static void main(String[] args) { |
|
38 |
try{ |
|
39 |
TestTreeRadioButtonModelTable tabla = new TestTreeRadioButtonModelTable(); |
|
40 |
}catch(NotInitializeException ex){ |
|
41 |
System.out.println("Tabla no inicializada"); |
|
42 |
} |
|
43 |
} |
|
44 |
|
|
45 |
public void componentHidden(ComponentEvent e) { |
|
46 |
// TODO Auto-generated method stub |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public void componentMoved(ComponentEvent e) { |
|
51 |
// TODO Auto-generated method stub |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
public void componentResized(ComponentEvent e) { |
|
56 |
table.setComponentSize(frame.getWidth() - 12, frame.getHeight() - 45); |
|
57 |
} |
|
58 |
|
|
59 |
public void componentShown(ComponentEvent e) { |
|
60 |
// TODO Auto-generated method stub |
|
61 |
|
|
62 |
} |
|
63 |
} |
|
0 | 64 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/table/TestTable.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.table; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
import javax.swing.UIManager; |
|
8 |
|
|
9 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
10 |
|
|
11 |
public class TestTable extends JFrame implements ComponentListener{ |
|
12 |
private int w = 400, h = 200; |
|
13 |
|
|
14 |
private TableContainer table = null; |
|
15 |
|
|
16 |
public TestTable() throws NotInitializeException{ |
|
17 |
String[] columnNames = {"columna 1", "columna 2", "columna 3", "columna 4"}; |
|
18 |
int[] columnWidths = {70, 90, 110, 130}; |
|
19 |
table = new TableContainer(w - 12, h - 45, columnNames, columnWidths); |
|
20 |
table.initialize(); |
|
21 |
table.setControlVisible(true); |
|
22 |
table.setEditable(false); |
|
23 |
|
|
24 |
String[] row = {"uno 0", "dos 0", "tres 0", "cuatro 0"}; |
|
25 |
String[] row1 = {"uno 1", "dos 1", "tres 1", "cuatro 1"}; |
|
26 |
String[] row2 = {"uno 2", "dos 2", "tres 2", "cuatro 2"}; |
|
27 |
table.addRow(row); |
|
28 |
table.addRow(row1); |
|
29 |
table.addRow(row2); |
|
30 |
table.delRow(1); |
|
31 |
|
|
32 |
addComponentListener(this); |
|
33 |
|
|
34 |
getContentPane().add(table); |
|
35 |
setSize(w, h); |
|
36 |
setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
try { |
|
41 |
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); |
|
42 |
UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); |
|
43 |
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); |
|
44 |
} catch( Exception e ) { |
|
45 |
System.err.println( "No se puede cambiar al LookAndFeel"); |
|
46 |
} |
|
47 |
try{ |
|
48 |
TestTable tabla = new TestTable(); |
|
49 |
}catch(NotInitializeException ex){ |
|
50 |
System.out.println("Tabla no inicializada"); |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
public void componentHidden(ComponentEvent e) { |
|
55 |
// TODO Auto-generated method stub |
|
56 |
|
|
57 |
} |
|
58 |
|
|
59 |
public void componentMoved(ComponentEvent e) { |
|
60 |
// TODO Auto-generated method stub |
|
61 |
|
|
62 |
} |
|
63 |
|
|
64 |
public void componentResized(ComponentEvent e) { |
|
65 |
table.setComponentSize(getWidth() - 12, getHeight() - 45); |
|
66 |
} |
|
67 |
|
|
68 |
public void componentShown(ComponentEvent e) { |
|
69 |
// TODO Auto-generated method stub |
|
70 |
|
|
71 |
} |
|
72 |
} |
|
0 | 73 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/dataInput/TestDataInput.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.dataInput; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
import javax.swing.JPanel; |
|
8 |
import javax.swing.UIManager; |
|
9 |
|
|
10 |
public class TestDataInput implements ComponentListener { |
|
11 |
private int w = 150, h = 50; |
|
12 |
private JFrame frame = new JFrame(); |
|
13 |
private DataInputContainer data = null; |
|
14 |
|
|
15 |
public TestDataInput(){ |
|
16 |
JPanel p = new JPanel(); |
|
17 |
p.setSize(w, h); |
|
18 |
|
|
19 |
data = new DataInputContainer(50); |
|
20 |
frame.addComponentListener(this); |
|
21 |
p.add(data, null); |
|
22 |
|
|
23 |
frame.getContentPane().add(p); |
|
24 |
frame.setSize(w, h); |
|
25 |
frame.setVisible(true); |
|
26 |
|
|
27 |
} |
|
28 |
|
|
29 |
public static void main(String[] args){ |
|
30 |
try { |
|
31 |
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); |
|
32 |
//UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); |
|
33 |
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); |
|
34 |
} catch( Exception e ) { |
|
35 |
System.err.println( "No se puede cambiar al LookAndFeel"); |
|
36 |
} |
|
37 |
TestDataInput tof = new TestDataInput(); |
|
38 |
} |
|
39 |
|
|
40 |
public void componentHidden(ComponentEvent e) { |
|
41 |
// TODO Auto-generated method stub |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
public void componentMoved(ComponentEvent e) { |
|
46 |
// TODO Auto-generated method stub |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public void componentResized(ComponentEvent e) { |
|
51 |
data.setComponentSize(frame.getWidth() - 10, frame.getHeight() - 30); |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
public void componentShown(ComponentEvent e) { |
|
56 |
// TODO Auto-generated method stub |
|
57 |
|
|
58 |
} |
|
59 |
} |
|
0 | 60 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/treelist/TestTreeList.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.treelist; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
|
|
8 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
9 |
|
|
10 |
public class TestTreeList implements ComponentListener{ |
|
11 |
private int w = 200, h = 380; |
|
12 |
private JFrame frame = new JFrame(); |
|
13 |
private TreeListContainer tlist; |
|
14 |
|
|
15 |
public TestTreeList() throws NotInitializeException{ |
|
16 |
tlist = new TreeListContainer(); |
|
17 |
|
|
18 |
tlist.addClass("uno", 0); |
|
19 |
tlist.addClass("dos", 1); |
|
20 |
tlist.addClass("tres", 2); |
|
21 |
tlist.addClass("cuatro", 3); |
|
22 |
tlist.addEntry("uno-uno","uno",""); |
|
23 |
tlist.addEntry("uno-dos","uno",""); |
|
24 |
tlist.addEntry("uno-tres","uno",""); |
|
25 |
tlist.addEntry("tres-uno","tres",""); |
|
26 |
tlist.addEntry("tres-dos","tres",""); |
|
27 |
tlist.addEntry("cuatro-uno","cuatro",""); |
|
28 |
tlist.addEntry("cuatro-dos","cuatro",""); |
|
29 |
tlist.addEntry("cuatro-tres","cuatro",""); |
|
30 |
tlist.addEntry("cuatro-cuatro","cuatro",""); |
|
31 |
tlist.addEntry("cuatro-cinco","cuatro",""); |
|
32 |
tlist.addEntry("cuatro-seis","cuatro",""); |
|
33 |
|
|
34 |
tlist.getTree().expandRow(0); |
|
35 |
|
|
36 |
frame.getContentPane().add(tlist); |
|
37 |
frame.setSize(w, h); |
|
38 |
frame.addComponentListener(this); |
|
39 |
frame.setVisible(true); |
|
40 |
} |
|
41 |
|
|
42 |
public static void main(String[] args) { |
|
43 |
try{ |
|
44 |
TestTreeList tl = new TestTreeList(); |
|
45 |
}catch(NotInitializeException ex){ |
|
46 |
System.out.println("Tabla no inicializado"); |
|
47 |
} |
|
48 |
} |
|
49 |
|
|
50 |
public void componentHidden(ComponentEvent e) { |
|
51 |
// TODO Auto-generated method stub |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
public void componentMoved(ComponentEvent e) { |
|
56 |
// TODO Auto-generated method stub |
|
57 |
|
|
58 |
} |
|
59 |
|
|
60 |
public void componentResized(ComponentEvent e) { |
|
61 |
tlist.setComponentSize(frame.getWidth() - 10, frame.getHeight() - 20); |
|
62 |
} |
|
63 |
|
|
64 |
public void componentShown(ComponentEvent e) { |
|
65 |
// TODO Auto-generated method stub |
|
66 |
|
|
67 |
} |
|
68 |
|
|
69 |
} |
|
0 | 70 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/graphic/TestGraphic.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.graphic; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
import java.awt.event.MouseEvent; |
|
6 |
import java.awt.event.MouseListener; |
|
7 |
|
|
8 |
import javax.swing.JFrame; |
|
9 |
|
|
10 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
11 |
|
|
12 |
public class TestGraphic implements ComponentListener{ |
|
13 |
private int w = 500, h = 300; |
|
14 |
private JFrame frame=new JFrame(); |
|
15 |
private GraphicContainer graphic = null; |
|
16 |
|
|
17 |
public TestGraphic() throws NotInitializeException{ |
|
18 |
graphic = new GraphicContainer(w - 12, h - 30, false); |
|
19 |
|
|
20 |
frame.addComponentListener(this); |
|
21 |
|
|
22 |
frame.getContentPane().add(graphic); |
|
23 |
frame.setSize(w, h); |
|
24 |
frame.setVisible(true); |
|
25 |
} |
|
26 |
|
|
27 |
public static void main(String[] args) { |
|
28 |
try{ |
|
29 |
TestGraphic tabla = new TestGraphic(); |
|
30 |
}catch(NotInitializeException ex){ |
|
31 |
System.out.println("Tabla no inicializada"); |
|
32 |
} |
|
33 |
} |
|
34 |
|
|
35 |
public void componentHidden(ComponentEvent e) { |
|
36 |
// TODO Auto-generated method stub |
|
37 |
|
|
38 |
} |
|
39 |
|
|
40 |
public void componentMoved(ComponentEvent e) { |
|
41 |
// TODO Auto-generated method stub |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
public void componentResized(ComponentEvent e) { |
|
46 |
graphic.setComponentSize(frame.getWidth() - 12, frame.getHeight() - 30); |
|
47 |
} |
|
48 |
|
|
49 |
public void componentShown(ComponentEvent e) { |
|
50 |
// TODO Auto-generated method stub |
|
51 |
|
|
52 |
} |
|
53 |
|
|
54 |
} |
|
0 | 55 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/buttonBar/TestButtonBar.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.buttonBar; |
|
2 |
|
|
3 |
import javax.swing.JFrame; |
|
4 |
|
|
5 |
public class TestButtonBar { |
|
6 |
|
|
7 |
private JFrame frame = new JFrame(); |
|
8 |
|
|
9 |
public TestButtonBar(){ |
|
10 |
ButtonBarContainer cont = new ButtonBarContainer(); |
|
11 |
frame.setSize(410, 45); |
|
12 |
cont.setButtonAlignment("right"); |
|
13 |
cont.addButton("down.png", "hola",0); |
|
14 |
cont.addButton(null, "que",1); |
|
15 |
cont.addButton(null, "tal",2); |
|
16 |
cont.addButton(null, "estas?",3); |
|
17 |
cont.addButton(null, "adios", 4); |
|
18 |
cont.getButton(2).setEnabled(false); |
|
19 |
cont.disableAllControls(); |
|
20 |
cont.restoreControlsValue(); |
|
21 |
cont.setComponentBorder(true); |
|
22 |
//cont.delButton(0); |
|
23 |
cont.delButton(3); |
|
24 |
frame.getContentPane().add(cont); |
|
25 |
frame.show(); |
|
26 |
} |
|
27 |
|
|
28 |
public static void main(String[] args){ |
|
29 |
TestButtonBar test = new TestButtonBar(); |
|
30 |
} |
|
31 |
|
|
32 |
} |
|
0 | 33 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/coordDataInput/TestCoordDataInput.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.coordDataInput; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
import javax.swing.UIManager; |
|
8 |
|
|
9 |
import org.gvsig.gui.beans.openFile.TestOpenFile; |
|
10 |
|
|
11 |
public class TestCoordDataInput implements ComponentListener{ |
|
12 |
private int w = 438, h = 130; |
|
13 |
private JFrame frame = new JFrame(); |
|
14 |
private CoordDataInputContainer coord = null; |
|
15 |
|
|
16 |
public TestCoordDataInput(){ |
|
17 |
coord = new CoordDataInputContainer(w - 10, h - 30); |
|
18 |
coord.addComponentListener(this); |
|
19 |
//coord.setComponentSize(w - 10, h - 30); |
|
20 |
coord.setParameters("Coordenadas pixel", "Sup.Izq", "X","Y","Inf.Der","X","Y"); |
|
21 |
coord.setDecimalValues(true); |
|
22 |
coord.setCaracterValues(false); |
|
23 |
frame.getContentPane().add(coord); |
|
24 |
frame.setSize(w, h); |
|
25 |
frame.setVisible(true); |
|
26 |
|
|
27 |
} |
|
28 |
|
|
29 |
public static void main(String[] args){ |
|
30 |
try { |
|
31 |
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); |
|
32 |
//UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); |
|
33 |
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); |
|
34 |
} catch( Exception e ) { |
|
35 |
System.err.println( "No se puede cambiar al LookAndFeel"); |
|
36 |
} |
|
37 |
TestCoordDataInput tof = new TestCoordDataInput(); |
|
38 |
} |
|
39 |
|
|
40 |
public void componentHidden(ComponentEvent e) { |
|
41 |
// TODO Auto-generated method stub |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
public void componentMoved(ComponentEvent e) { |
|
46 |
// TODO Auto-generated method stub |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public void componentResized(ComponentEvent e) { |
|
51 |
coord.setComponentSize(frame.getWidth() - 10, frame.getWidth() - 30); |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
public void componentShown(ComponentEvent e) { |
|
56 |
// TODO Auto-generated method stub |
|
57 |
|
|
58 |
} |
|
59 |
} |
|
0 | 60 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/textincreaser/TestTextIncreaser.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.textincreaser; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
|
|
8 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
9 |
|
|
10 |
public class TestTextIncreaser{ |
|
11 |
private int w = 200, h = 200; |
|
12 |
private JFrame frame=new JFrame(); |
|
13 |
private TextIncreaserContainer tic1; |
|
14 |
|
|
15 |
public TestTextIncreaser() throws NotInitializeException{ |
|
16 |
tic1 = new TextIncreaserContainer(70, 0, 10, 0, true); |
|
17 |
|
|
18 |
frame.getContentPane().add(tic1); |
|
19 |
frame.setSize(w, h); |
|
20 |
frame.setVisible(true); |
|
21 |
} |
|
22 |
|
|
23 |
public static void main(String[] args) { |
|
24 |
try{ |
|
25 |
TestTextIncreaser tti = new TestTextIncreaser(); |
|
26 |
}catch(NotInitializeException ex){ |
|
27 |
System.out.println("Tabla no inicializado"); |
|
28 |
} |
|
29 |
} |
|
30 |
|
|
31 |
} |
|
0 | 32 |
branches/v10+Piloto/libraries/libUIComponent_praster/src-test/org/gvsig/gui/beans/openFile/TestOpenFile.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.openFile; |
|
2 |
|
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
5 |
|
|
6 |
import javax.swing.JFrame; |
|
7 |
|
|
8 |
import org.gvsig.gui.beans.coordDataInput.CoordDataInputContainer; |
|
9 |
import org.gvsig.gui.beans.dataInput.DataInputContainer; |
|
10 |
|
|
11 |
public class TestOpenFile implements ComponentListener{ |
|
12 |
private int w = 510, h = 90; |
|
13 |
private JFrame frame = new JFrame(); |
|
14 |
private OpenFileContainer open = null; |
|
15 |
|
|
16 |
public TestOpenFile(){ |
|
17 |
open = new OpenFileContainer(); |
|
18 |
open.setComponentSize(w,h); |
|
19 |
open.addComponentListener(this); |
|
20 |
frame.getContentPane().add(open); |
|
21 |
frame.setSize(w, h); |
|
22 |
frame.setVisible(true); |
|
23 |
|
|
24 |
} |
|
25 |
|
|
26 |
public static void main(String[] args){ |
|
27 |
TestOpenFile tof = new TestOpenFile(); |
|
28 |
} |
|
29 |
|
|
30 |
public void componentHidden(ComponentEvent e) { |
|
31 |
// TODO Auto-generated method stub |
|
32 |
|
|
33 |
} |
|
34 |
|
|
35 |
public void componentMoved(ComponentEvent e) { |
|
36 |
// TODO Auto-generated method stub |
|
37 |
|
|
38 |
} |
|
39 |
|
|
40 |
public void componentResized(ComponentEvent e) { |
|
41 |
this.open.setComponentSize(this.frame.getWidth() - 10, this.frame.getHeight() -50); |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
public void componentShown(ComponentEvent e) { |
|
46 |
// TODO Auto-generated method stub |
|
47 |
|
|
48 |
} |
|
49 |
} |
|
0 | 50 |
branches/v10+Piloto/libraries/libUIComponent_praster/doc/contents.html | ||
---|---|---|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
|
2 |
<HTML> |
|
3 |
<HEAD> |
|
4 |
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-15"> |
|
5 |
<TITLE></TITLE> |
|
6 |
<META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
|
7 |
<META NAME="CREATED" CONTENT="20060322;9174300"> |
|
8 |
<META NAME="CHANGED" CONTENT="20060322;10202100"> |
|
9 |
<STYLE> |
|
10 |
<!-- |
|
11 |
@page { size: 21cm 29.7cm; margin: 2cm } |
|
12 |
P { margin-bottom: 0.21cm } |
|
13 |
A:link { color: #000080; text-decoration: underline } |
|
14 |
A:visited { color: #800000; text-decoration: underline } |
|
15 |
--> |
|
16 |
</STYLE> |
|
17 |
</HEAD> |
|
18 |
<BODY LANG="en-US" LINK="#000080" VLINK="#800000" DIR="LTR"> |
|
19 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Monospace"><FONT SIZE=3 STYLE="font-size: 13pt"><B>PRESENT |
|
20 |
BEANS.</B></FONT></FONT></P> |
|
21 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
22 |
</P> |
|
23 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Times, serif"><FONT SIZE=2><B>DefaultBean.java |
|
24 |
(extends JPanel (standard in Swing)):</B><SPAN STYLE="font-weight: medium"> |
|
25 |
Just a JPanel with addListener(BeanListener l), |
|
26 |
removeListener(BeanListener l), and callValueChange(Object value) |
|
27 |
methods for adding listeners, removing listeners, and firing |
|
28 |
BeanValueChange events.</SPAN></FONT></FONT></P> |
|
29 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
30 |
</P> |
|
31 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Times, serif"><FONT SIZE=2><B>Pager.java |
|
32 |
(extends DefaultBean.java)</B>: this is an |
|
33 |
AcrobatReader-page-browser-like bean that allows you to easy browse a |
|
34 |
list of values. Each time you drag the slider, click a button or type |
|
35 |
a number an Integer value is produced and a BeanValueChanged event is |
|
36 |
fired returning an Object value. Catch this event and cast the value |
|
37 |
produced to a Integer (or even an int) and use it to move your list |
|
38 |
pointer to this position. An example of use can be found in |
|
39 |
<B>SamplePanel.java</B></FONT></FONT></P> |
|
40 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
41 |
</P> |
|
42 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
43 |
</P> |
|
44 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Monospace"><FONT SIZE=3 STYLE="font-size: 13pt"><B>PRESENT |
|
45 |
CONTROLS.</B></FONT></FONT></P> |
|
46 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
47 |
</P> |
|
48 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Monospace"><FONT SIZE=2><B>package |
|
49 |
org.gvsig.gui.beans.controls</B></FONT></FONT></P> |
|
50 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
51 |
</P> |
|
52 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Times, serif"><FONT SIZE=2><B>MultilineTooltip.java |
|
53 |
(extends JToolTip (standard in Swing)): </B><SPAN STYLE="font-weight: medium">Allows |
|
54 |
using more than one line length tooltips. It also automatically |
|
55 |
calculates the size of the screen rectangle used and the preferred |
|
56 |
sized up on the contained text. It does NOT format the text to fit |
|
57 |
within a given size. The user must provide the text as she/he wishes |
|
58 |
to show it. It means that new line characters must be placed in the |
|
59 |
string as well as it was a System.out.println statement.</SPAN></FONT></FONT></P> |
|
60 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
61 |
</P> |
|
62 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Monospace"><FONT SIZE=2><B>package |
|
63 |
org.gvsig.gui.beans.controls.dnd</B></FONT></FONT></P> |
|
64 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
65 |
</P> |
|
66 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Times, serif"><FONT SIZE=2><B>JDnDList |
|
67 |
(extends JList (standard in Swing)): </B><SPAN STYLE="font-weight: medium">A |
|
68 |
JList that allows drag'n'drop elements. It accepts changing position |
|
69 |
of one or more elements within the list, adding other from other |
|
70 |
JDnDList's, removing sets of selected items, and other features. In |
|
71 |
order to use this features you have to use a JDnDListModel as the |
|
72 |
list's model.</SPAN></FONT></FONT></P> |
|
73 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
74 |
</P> |
|
75 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Times, serif"><FONT SIZE=2><B>JDnDListModel |
|
76 |
(extends AbstractListModel (standard in Swing)): </B><SPAN STYLE="font-weight: medium">List |
|
77 |
model to use in junction the JDnDList. Contains some useful tools.</SPAN></FONT></FONT></P> |
|
78 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
79 |
</P> |
|
80 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Monospace"><FONT SIZE=2><B>package |
|
81 |
org.gvsig.gui.geans.listeners</B></FONT></FONT></P> |
|
82 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
83 |
</P> |
|
84 |
<P STYLE="margin-bottom: 0cm"><FONT FACE="Times, serif"><FONT SIZE=2><B>BeanListener.java: |
|
85 |
</B><SPAN STYLE="font-weight: medium">Defines an object which listens |
|
86 |
for changes in the value produced by a bean. It is used, for example, |
|
87 |
in</SPAN><B> DefaultBean.java.</B></FONT></FONT></P> |
|
88 |
<P STYLE="margin-bottom: 0cm"><BR> |
|
89 |
</P> |
|
90 |
<P STYLE="margin-bottom: 0cm; font-weight: medium"><BR> |
|
91 |
</P> |
|
92 |
<P STYLE="margin-bottom: 0cm; font-weight: medium"><FONT FACE="Courier, monospace"><FONT SIZE=2>by |
|
93 |
Jaume Domínguez Faus (:S)</FONT></FONT></P> |
|
94 |
</BODY> |
|
95 |
</HTML> |
|
0 | 96 |
branches/v10+Piloto/libraries/libUIComponent_praster/src/org/gvsig/gui/beans/slidertext/listeners/SliderTextListener.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.slidertext.listeners; |
|
20 |
|
|
21 |
import java.awt.event.ActionEvent; |
|
22 |
import java.awt.event.ActionListener; |
|
23 |
import java.awt.event.FocusEvent; |
|
24 |
import java.awt.event.FocusListener; |
|
25 |
import java.awt.event.KeyEvent; |
|
26 |
import java.awt.event.KeyListener; |
|
27 |
|
|
28 |
import javax.swing.event.ChangeEvent; |
|
29 |
import javax.swing.event.ChangeListener; |
|
30 |
|
|
31 |
import org.gvsig.gui.beans.slidertext.SliderTextContainer; |
|
32 |
|
|
33 |
/** |
|
34 |
* |
|
35 |
* @author Nacho Brodin <brodin_ign@gva.es> |
|
36 |
* |
|
37 |
*/ |
|
38 |
public class SliderTextListener implements ChangeListener, ActionListener, KeyListener, FocusListener{ |
|
39 |
|
|
40 |
private SliderTextContainer sliderTextContainer = null; |
|
41 |
private String lastText = ""; |
|
42 |
|
|
43 |
public SliderTextListener(SliderTextContainer panel){ |
|
44 |
this.sliderTextContainer = panel; |
|
45 |
} |
|
46 |
|
|
47 |
private void initialize(){ |
|
48 |
|
|
49 |
} |
|
50 |
|
|
51 |
public void actionPerformed(ActionEvent e) { |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
public void stateChanged(ChangeEvent e) { |
|
56 |
//Modificamos la caja de texto con el valor de la posici?n del slider |
|
57 |
sliderTextContainer.getText().setText(sliderTextContainer.getSlider().getValue()+""); |
|
58 |
} |
|
59 |
|
|
60 |
public void keyPressed(KeyEvent e) { |
|
61 |
lastText = sliderTextContainer.getText().getText(); |
|
62 |
} |
|
63 |
|
|
64 |
public void keyReleased(KeyEvent e) { |
|
65 |
validateTextField(); |
|
66 |
|
|
67 |
//Asignamos la nueva posici?n de la barra cuando se modifica el texto |
|
68 |
if(e.getKeyCode() == 10){ |
|
69 |
sliderTextContainer.getSlider().setValue(Double.valueOf(sliderTextContainer.getText().getText()).intValue()); |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
public void keyTyped(KeyEvent e) { |
|
74 |
// TODO Auto-generated method stub |
|
75 |
|
|
76 |
} |
|
77 |
|
|
78 |
public void focusGained(FocusEvent e) { |
|
79 |
// TODO Auto-generated method stub |
|
80 |
|
|
81 |
} |
|
82 |
|
|
83 |
public void focusLost(FocusEvent e) { |
|
84 |
validateTextField(); |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Comprobamos que los datos introducidos por el texto sean correctos sino |
|
89 |
* borramos el ?ltimo caracter |
|
90 |
*/ |
|
91 |
private void validateTextField(){ |
|
92 |
try{ |
|
93 |
Double.valueOf(sliderTextContainer.getText().getText()); |
|
94 |
}catch(NumberFormatException exc){ |
|
95 |
if(!sliderTextContainer.getText().getText().equals("")) |
|
96 |
sliderTextContainer.getText().setText(lastText); |
|
97 |
else |
|
98 |
sliderTextContainer.getText().setText("0"); |
|
99 |
} |
|
100 |
} |
|
101 |
} |
|
0 | 102 |
branches/v10+Piloto/libraries/libUIComponent_praster/src/org/gvsig/gui/beans/slidertext/SliderTextContainer.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.slidertext; |
|
20 |
|
|
21 |
import java.awt.GridBagConstraints; |
|
22 |
import java.awt.GridBagLayout; |
|
23 |
|
|
24 |
import javax.swing.JPanel; |
|
25 |
import javax.swing.JSlider; |
|
26 |
import javax.swing.JTextField; |
|
27 |
|
|
28 |
import org.gvsig.gui.beans.BaseComponent; |
|
29 |
import org.gvsig.gui.beans.slidertext.listeners.SliderTextListener; |
|
30 |
|
|
31 |
/** |
|
32 |
* Barra de deslizamiento con una ventana de texto que tiene el valor de la posici?n de |
|
33 |
* la barra. En este control podr? controlarse mediante la entrada de datos por la caja de |
|
34 |
* texto la posibilidad de introducir valores decimales. |
|
35 |
* |
|
36 |
* Nacho Brodin (brodin_ign@gva.es) |
|
37 |
*/ |
|
38 |
|
|
39 |
public class SliderTextContainer extends BaseComponent{ |
|
40 |
|
|
41 |
private int MARGIN = 8; |
|
42 |
private int WTEXT = 50; |
|
43 |
private JPanel pSlider = null; |
|
44 |
private JPanel pText = null; |
|
45 |
private JSlider slider = null; |
|
46 |
private JTextField text = null; |
|
47 |
private int width = 260; |
|
48 |
private int height = 35; |
|
49 |
private int min = 0; |
|
50 |
private int max = 255; |
|
51 |
private int defaultPos = 0; |
|
52 |
private SliderTextListener listener = null; |
|
53 |
|
|
54 |
/** |
|
55 |
* Contructor |
|
56 |
* @param width Ancho del componente |
|
57 |
* @param height Alto del componente |
|
58 |
* @param min Valor m?nimo de la barra |
|
59 |
* @param max Valor m?ximo de la barra |
|
60 |
* @param defaultPos Posici?n por defecto |
|
61 |
*/ |
|
62 |
public SliderTextContainer(int width, int height, int min, int max, int defaultPos) { |
|
63 |
super(); |
|
64 |
this.width = width; |
|
65 |
this.height = height; |
|
66 |
this.min = min; |
|
67 |
this.max = max; |
|
68 |
this.defaultPos = defaultPos; |
|
69 |
|
|
70 |
initialize(); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* This method initializes this |
|
75 |
* |
|
76 |
*/ |
|
77 |
private void initialize() { |
|
78 |
listener = new SliderTextListener(this); |
|
79 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
80 |
gridBagConstraints1.gridx = 1; |
|
81 |
gridBagConstraints1.gridy = 0; |
|
82 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
|
83 |
gridBagConstraints.gridx = 0; |
|
84 |
gridBagConstraints.gridy = 0; |
|
85 |
this.setLayout(new GridBagLayout()); |
|
86 |
this.add(getPSlider(), gridBagConstraints); |
|
87 |
this.add(getPText(), gridBagConstraints1); |
|
88 |
this.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1)); |
|
89 |
setComponentSize(width, height); |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* This method initializes jPanel |
|
94 |
* |
|
95 |
* @return javax.swing.JPanel |
|
96 |
*/ |
|
97 |
private JPanel getPSlider() { |
|
98 |
if (pSlider == null) { |
|
99 |
pSlider = new JPanel(); |
|
100 |
pSlider.add(getSlider(), null); |
|
101 |
} |
|
102 |
return pSlider; |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* This method initializes jPanel1 |
|
107 |
* |
|
108 |
* @return javax.swing.JPanel |
|
109 |
*/ |
|
110 |
private JPanel getPText() { |
|
111 |
if (pText == null) { |
|
112 |
pText = new JPanel(); |
|
113 |
pText.setPreferredSize(new java.awt.Dimension(WTEXT,35)); |
|
114 |
pText.add(getText(), null); |
|
115 |
} |
|
116 |
return pText; |
|
117 |
} |
|
118 |
|
|
119 |
/** |
|
120 |
* This method initializes jSlider |
|
121 |
* |
|
122 |
* @return javax.swing.JSlider |
|
123 |
*/ |
|
124 |
public JSlider getSlider() { |
|
125 |
if (slider == null) { |
|
126 |
slider = new JSlider(); |
|
127 |
slider.setMajorTickSpacing(50); |
|
128 |
slider.setPaintTicks(true); |
|
129 |
slider.setMinorTickSpacing(10); |
|
130 |
slider.setMinimum(min); |
|
131 |
slider.setMaximum(max); |
|
132 |
slider.setValue(defaultPos); |
|
133 |
slider.addChangeListener(listener); |
|
134 |
} |
|
135 |
return slider; |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* This method initializes jTextField |
|
140 |
* |
|
141 |
* @return javax.swing.JTextField |
|
142 |
*/ |
|
143 |
public JTextField getText() { |
|
144 |
if (text == null) { |
|
145 |
text = new JTextField(); |
|
146 |
text.setText(defaultPos+""); |
|
147 |
text.addFocusListener(listener); |
|
148 |
text.addKeyListener(listener); |
|
149 |
} |
|
150 |
return text; |
|
151 |
} |
|
152 |
|
|
153 |
public void setComponentSize(int w, int h){ |
|
154 |
this.width = w; |
|
155 |
this.height = h; |
|
156 |
this.setPreferredSize(new java.awt.Dimension(width, height)); |
|
157 |
pSlider.setPreferredSize(new java.awt.Dimension(width - MARGIN - WTEXT, 27)); |
|
158 |
pText.setPreferredSize(new java.awt.Dimension(WTEXT,35)); |
|
159 |
slider.setPreferredSize(new java.awt.Dimension(width - WTEXT - MARGIN,27)); |
|
160 |
text.setPreferredSize(new java.awt.Dimension(WTEXT - 10, 19)); |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* Obtiene el valor del control. |
|
165 |
* @return Valor del control en formato double. |
|
166 |
*/ |
|
167 |
public double getValue(){ |
|
168 |
return Double.valueOf(getText().getText()).doubleValue(); |
|
169 |
} |
|
170 |
|
|
171 |
/** |
|
172 |
* Asigna el valor del control. |
|
173 |
* @return Valor del control en formato double. |
|
174 |
*/ |
|
175 |
public void setValue(double value){ |
|
176 |
getText().setText(String.valueOf(value)); |
|
177 |
getSlider().setValue((int)value); |
|
178 |
} |
|
179 |
} |
|
0 | 180 |
branches/v10+Piloto/libraries/libUIComponent_praster/src/org/gvsig/gui/beans/table/exceptions/NotInitializeException.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.table.exceptions; |
|
20 |
|
|
21 |
/** |
|
22 |
* Excepci?n que indica que una tabla no ha sido inicializada. |
|
23 |
* |
|
24 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
25 |
*/ |
|
26 |
public class NotInitializeException extends Exception { |
|
27 |
/** |
|
28 |
* |
|
29 |
*/ |
|
30 |
public NotInitializeException() { |
|
31 |
super(); |
|
32 |
|
|
33 |
// TODO Auto-generated constructor stub |
|
34 |
} |
|
35 |
|
|
36 |
/** |
|
37 |
* DOCUMENT ME! |
|
38 |
* |
|
39 |
* @param message |
|
40 |
*/ |
|
41 |
public NotInitializeException(String message) { |
|
42 |
super(message); |
|
43 |
|
|
44 |
// TODO Auto-generated constructor stub |
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* DOCUMENT ME! |
|
49 |
* |
|
50 |
* @param message |
|
51 |
* @param cause |
|
52 |
*/ |
|
53 |
public NotInitializeException(String message, Throwable cause) { |
|
54 |
super(message, cause); |
|
55 |
|
|
56 |
// TODO Auto-generated constructor stub |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* DOCUMENT ME! |
|
61 |
* |
|
62 |
* @param cause |
|
63 |
*/ |
|
64 |
public NotInitializeException(Throwable cause) { |
|
65 |
super(cause); |
|
66 |
|
|
67 |
// TODO Auto-generated constructor stub |
|
68 |
} |
|
69 |
} |
|
0 | 70 |
branches/v10+Piloto/libraries/libUIComponent_praster/src/org/gvsig/gui/beans/table/models/JValueSelector.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.table.models; |
|
20 |
|
|
21 |
import java.awt.Component; |
|
22 |
import java.awt.Container; |
|
23 |
import java.awt.FlowLayout; |
|
24 |
import java.awt.GridBagConstraints; |
|
25 |
import java.awt.GridBagLayout; |
|
26 |
import java.awt.HeadlessException; |
|
27 |
import java.awt.event.ActionEvent; |
|
28 |
import java.awt.event.ActionListener; |
|
29 |
|
|
30 |
import javax.swing.JButton; |
|
31 |
import javax.swing.JComponent; |
|
32 |
import javax.swing.JDialog; |
|
33 |
import javax.swing.JOptionPane; |
|
34 |
import javax.swing.JPanel; |
|
35 |
|
|
36 |
import org.gvsig.gui.beans.slidertext.SliderTextContainer; |
|
37 |
|
|
38 |
/** |
|
39 |
* Ventana con el slider para la selecci?n de Alpha en una entrada de la tabla que representa |
|
40 |
* a la paleta de color. |
|
41 |
* |
|
42 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
43 |
* |
|
44 |
*/ |
|
45 |
|
|
46 |
public class JValueSelector extends JComponent { |
|
47 |
/** |
|
48 |
* Creates and returns a new dialog containing the specified |
|
49 |
* <code>ColorChooser</code> pane along with "OK", "Cancel", and "Reset" |
|
50 |
* buttons. If the "OK" or "Cancel" buttons are pressed, the dialog is |
|
51 |
* automatically hidden (but not disposed). If the "Reset" |
|
52 |
* button is pressed, the color-chooser's color will be reset to the |
|
53 |
* color which was set the last time <code>show</code> was invoked on the |
|
54 |
* dialog and the dialog will remain showing. |
|
55 |
* |
|
56 |
* @param c the parent component for the dialog |
|
57 |
* @param title the title for the dialog |
|
58 |
* @param modal a boolean. When true, the remainder of the program |
|
59 |
* is inactive until the dialog is closed. |
|
60 |
* @param valueSelector the value-selector to be placed inside the dialog |
|
61 |
* @param okListener the ActionListener invoked when "OK" is pressed |
|
62 |
* @param cancelListener the ActionListener invoked when "Cancel" is pressed |
|
63 |
* @return a new dialog containing the color-chooser pane |
|
64 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
65 |
* returns true. |
|
66 |
* @see java.awt.GraphicsEnvironment#isHeadless |
Also available in: Unified diff