Revision 41657 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/dal/expresionPanel/ExpresionPanel.java
ExpresionPanel.java | ||
---|---|---|
8 | 8 |
import javax.swing.event.ListDataListener; |
9 | 9 |
import javax.swing.event.ListSelectionEvent; |
10 | 10 |
import javax.swing.event.ListSelectionListener; |
11 |
import org.apache.commons.lang3.StringUtils; |
|
11 | 12 |
import org.gvsig.fmap.dal.exception.DataException; |
13 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
12 | 14 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
13 | 15 |
import org.gvsig.fmap.dal.feature.FeatureType; |
14 | 16 |
import org.slf4j.Logger; |
... | ... | |
21 | 23 |
|
22 | 24 |
private FeatureStore store; |
23 | 25 |
private Map values; |
24 |
private boolean acceptVisible = true; |
|
25 |
|
|
26 |
private boolean okCancelVisible = true; |
|
27 |
private boolean isCanceled; |
|
28 |
|
|
26 | 29 |
private static class FeatureTypeListModel implements ListModel { |
27 | 30 |
private final FeatureType featureType; |
28 | 31 |
|
... | ... | |
48 | 51 |
} |
49 | 52 |
|
50 | 53 |
public ExpresionPanel(FeatureStore store) { |
54 |
this.isCanceled = false; |
|
51 | 55 |
this.initComponents(); |
52 | 56 |
} |
53 | 57 |
|
... | ... | |
60 | 64 |
} |
61 | 65 |
} |
62 | 66 |
|
63 |
public void setAcceptVisible(boolean acceptVisible) {
|
|
64 |
this.acceptVisible = acceptVisible;
|
|
67 |
public void setOkCancelVisible(boolean acceptVisible) {
|
|
68 |
this.okCancelVisible = acceptVisible;
|
|
65 | 69 |
} |
66 | 70 |
|
67 |
public boolean getAcceptVisible() {
|
|
68 |
return this.acceptVisible;
|
|
71 |
public boolean getOkCancelVisible() {
|
|
72 |
return this.okCancelVisible;
|
|
69 | 73 |
} |
70 | 74 |
|
71 | 75 |
private void initComponents() { |
72 |
this.butAccept.setVisible(this.acceptVisible);
|
|
76 |
this.butAccept.setVisible(this.okCancelVisible);
|
|
73 | 77 |
|
74 | 78 |
this.lstFields.addListSelectionListener(new ListSelectionListener() { |
75 | 79 |
public void valueChanged(ListSelectionEvent e) { |
... | ... | |
102 | 106 |
} |
103 | 107 |
}); |
104 | 108 |
|
105 |
this.butClear.addActionListener(new ActionListener() {
|
|
109 |
this.butAccept.addActionListener(new ActionListener() {
|
|
106 | 110 |
public void actionPerformed(ActionEvent e) { |
107 | 111 |
doAcept(); |
108 | 112 |
} |
109 | 113 |
}); |
110 | 114 |
|
115 |
this.butCancel.addActionListener(new ActionListener() { |
|
116 |
public void actionPerformed(ActionEvent e) { |
|
117 |
doCancel(); |
|
118 |
} |
|
119 |
}); |
|
120 |
|
|
111 | 121 |
} |
112 | 122 |
|
123 |
public boolean isCanceled() { |
|
124 |
return this.isCanceled; |
|
125 |
} |
|
126 |
|
|
127 |
public String getExpresion() { |
|
128 |
return StringUtils.defaultIfBlank(this.txtExpresion.getText(), null); |
|
129 |
} |
|
130 |
|
|
113 | 131 |
private void doAcept() { |
114 |
|
|
132 |
this.isCanceled=false; |
|
133 |
this.setVisible(false); |
|
115 | 134 |
} |
116 | 135 |
|
136 |
private void doCancel() { |
|
137 |
this.isCanceled=true; |
|
138 |
this.setVisible(false); |
|
139 |
} |
|
140 |
|
|
117 | 141 |
private void doSelectField() { |
118 |
|
|
142 |
FeatureAttributeDescriptor x = (FeatureAttributeDescriptor) this.lstFields.getSelectedValue(); |
|
143 |
if( x == null ) { |
|
144 |
return; |
|
145 |
} |
|
146 |
this.doInsert(x.getName()); |
|
147 |
this.doInsert(" "); |
|
148 |
this.fillValuesList(x.getName()); |
|
119 | 149 |
} |
120 | 150 |
|
121 | 151 |
private void doClear() { |
122 |
|
|
152 |
this.txtExpresion.setText(""); |
|
123 | 153 |
} |
124 | 154 |
|
125 | 155 |
private void doSelectValue() { |
126 |
|
|
156 |
// TODO: falta por implemetar doSelectValue |
|
127 | 157 |
} |
128 | 158 |
|
129 | 159 |
private void doInsert(String s) { |
130 |
|
|
160 |
this.txtExpresion.insert(s, this.txtExpresion.getCaretPosition()); |
|
131 | 161 |
} |
162 |
|
|
163 |
private void fillValuesList(String name) { |
|
164 |
// TODO: falta por implemetar fillValuesList |
|
165 |
} |
|
166 |
|
|
167 |
|
|
132 | 168 |
} |
Also available in: Unified diff