root / org.gvsig.toolbox / trunk / org.gvsig.toolbox / org.gvsig.toolbox.gui / src / main / java / es / unex / sextante / gui / algorithm / MultipleInputSelectionPanel.java @ 338
History | View | Annotate | Download (3.73 KB)
1 | 59 | nbrodin | //package es.unex.sextante.gui.algorithm;
|
---|---|---|---|
2 | //
|
||
3 | //import info.clearthought.layout.TableLayout;
|
||
4 | //import info.clearthought.layout.TableLayoutConstants;
|
||
5 | //
|
||
6 | //import java.awt.Frame;
|
||
7 | //import java.awt.event.ActionEvent;
|
||
8 | //import java.awt.event.ActionListener;
|
||
9 | //import java.util.ArrayList;
|
||
10 | //
|
||
11 | //import javax.swing.JButton;
|
||
12 | //import javax.swing.JPanel;
|
||
13 | //import javax.swing.JTextField;
|
||
14 | //
|
||
15 | //import es.unex.sextante.core.Sextante;
|
||
16 | //
|
||
17 | ///**
|
||
18 | // * A panel with a text field and a button. The text field displays a text representation of a multiple selection. Clicking the
|
||
19 | // * button shows a dialog to perform a multiple selection
|
||
20 | // *
|
||
21 | // * @author volaya
|
||
22 | // *
|
||
23 | // */
|
||
24 | //public class MultipleInputSelectionPanel
|
||
25 | // extends
|
||
26 | // JPanel {
|
||
27 | //
|
||
28 | // private final Object[] m_Values;
|
||
29 | // private ArrayList m_SelectedIndices = new ArrayList();
|
||
30 | // private JTextField textField;
|
||
31 | // private JButton button;
|
||
32 | //
|
||
33 | //
|
||
34 | // /**
|
||
35 | // * Creates a new panel
|
||
36 | // *
|
||
37 | // * @param values
|
||
38 | // * an array of values to select from
|
||
39 | // */
|
||
40 | // public MultipleInputSelectionPanel(final Object[] values) {
|
||
41 | //
|
||
42 | // super();
|
||
43 | //
|
||
44 | // m_Values = values;
|
||
45 | //
|
||
46 | // initGUI();
|
||
47 | //
|
||
48 | // }
|
||
49 | //
|
||
50 | //
|
||
51 | // private void initGUI() {
|
||
52 | //
|
||
53 | // button = new JButton("...");
|
||
54 | // textField = new JTextField(Sextante.getText("0_elements_selected"));
|
||
55 | // textField.setEditable(false);
|
||
56 | //
|
||
57 | // button.addActionListener(new ActionListener() {
|
||
58 | // public void actionPerformed(final ActionEvent evt) {
|
||
59 | // btnActionPerformed(evt);
|
||
60 | // }
|
||
61 | // });
|
||
62 | //
|
||
63 | // final TableLayout thisLayout = new TableLayout(new double[][] { { TableLayoutConstants.FILL, 25.0 }, { TableLayoutConstants.FILL } });
|
||
64 | // this.setLayout(thisLayout);
|
||
65 | // this.add(textField, "0, 0");
|
||
66 | // this.add(button, "1, 0");
|
||
67 | // }
|
||
68 | //
|
||
69 | //
|
||
70 | // /**
|
||
71 | // * Returns a list of all the objects selected using this panel
|
||
72 | // *
|
||
73 | // * @return a list of selected objects
|
||
74 | // */
|
||
75 | // public ArrayList getSelectedObjects() {
|
||
76 | //
|
||
77 | // int iIndex;
|
||
78 | // final ArrayList selected = new ArrayList();
|
||
79 | //
|
||
80 | // for (int i = 0; i < m_SelectedIndices.size(); i++) {
|
||
81 | // iIndex = ((Integer) m_SelectedIndices.get(i)).intValue();
|
||
82 | // selected.add(this.m_Values[iIndex]);
|
||
83 | // }
|
||
84 | //
|
||
85 | // return selected;
|
||
86 | //
|
||
87 | // }
|
||
88 | //
|
||
89 | //
|
||
90 | // private void btnActionPerformed(final ActionEvent e) {
|
||
91 | //
|
||
92 | // int iCount;
|
||
93 | // final StringBuffer sText = new StringBuffer();
|
||
94 | //
|
||
95 | // final Frame window = new Frame();
|
||
96 | //
|
||
97 | // final MultipleInputSelectionDialog dialog = new MultipleInputSelectionDialog(window, m_Values, m_SelectedIndices);
|
||
98 | //
|
||
99 | // dialog.pack();
|
||
100 | // dialog.setVisible(true);
|
||
101 | //
|
||
102 | // iCount = m_SelectedIndices.size();
|
||
103 | // sText.append(Integer.toString(iCount));
|
||
104 | // if (iCount == 1) {
|
||
105 | // sText.append(" " + Sextante.getText("element_selected"));
|
||
106 | // }
|
||
107 | // else {
|
||
108 | // sText.append(" " + Sextante.getText("elements_selected"));
|
||
109 | // }
|
||
110 | //
|
||
111 | // textField.setText(sText.toString());
|
||
112 | //
|
||
113 | // }
|
||
114 | //
|
||
115 | //
|
||
116 | // public Object[] getValues() {
|
||
117 | //
|
||
118 | // return m_Values;
|
||
119 | //
|
||
120 | // }
|
||
121 | //
|
||
122 | //
|
||
123 | // public void setSelectedIndices(final ArrayList selectedIndices) {
|
||
124 | //
|
||
125 | // m_SelectedIndices = selectedIndices;
|
||
126 | // final StringBuffer sText = new StringBuffer();
|
||
127 | // final int iCount = m_SelectedIndices.size();
|
||
128 | // sText.append(Integer.toString(iCount));
|
||
129 | // if (iCount == 1) {
|
||
130 | // sText.append(" " + Sextante.getText("element_selected"));
|
||
131 | // }
|
||
132 | // else {
|
||
133 | // sText.append(" " + Sextante.getText("elements_selected"));
|
||
134 | // }
|
||
135 | //
|
||
136 | // textField.setText(sText.toString());
|
||
137 | //
|
||
138 | // }
|
||
139 | //
|
||
140 | //} |