Revision 4226 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toolListeners/PointSelectListener.java
PointSelectListener.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.gui.toolListeners; |
42 | 42 |
|
43 |
|
|
44 |
import java.awt.Dimension; |
|
45 |
import java.awt.Point; |
|
46 |
|
|
47 |
import javax.swing.BorderFactory; |
|
48 |
import javax.swing.FocusManager; |
|
49 |
import javax.swing.JPopupMenu; |
|
50 |
import javax.swing.JTextField; |
|
51 |
|
|
52 |
import com.hardcode.driverManager.DriverLoadException; |
|
53 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
54 |
import com.iver.andami.PluginServices; |
|
43 | 55 |
import com.iver.cit.gvsig.fmap.MapControl; |
56 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
|
57 |
import com.iver.cit.gvsig.fmap.core.v02.FTextLayout; |
|
58 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
|
59 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
60 |
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation; |
|
44 | 61 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
62 |
import com.iver.cit.gvsig.fmap.tools.PointSelectionListener; |
|
45 | 63 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
46 |
import com.iver.cit.gvsig.fmap.tools.PointSelectionListener; |
|
64 |
import com.iver.cit.gvsig.gui.View; |
|
65 |
import com.iver.cit.gvsig.gui.Panels.TextFieldEdit; |
|
47 | 66 |
|
48 | 67 |
|
49 | 68 |
/** |
... | ... | |
73 | 92 |
super.point(event); |
74 | 93 |
// PluginServices.getMainFrame().enableControls(); |
75 | 94 |
} |
95 |
public void pointDoubleClick(PointEvent event) throws BehaviorException { |
|
96 |
try { |
|
97 |
FLayer[] actives = mapCtrl.getMapContext() |
|
98 |
.getLayers().getActives(); |
|
99 |
for (int i=0; i < actives.length; i++){ |
|
100 |
if (actives[i] instanceof FLyrAnnotation && actives[i].isEditing()) { |
|
101 |
FLyrAnnotation lyrAnnotation = (FLyrAnnotation) actives[i]; |
|
102 |
|
|
103 |
lyrAnnotation.setSelectedEditing(); |
|
104 |
|
|
105 |
FLabel fl=lyrAnnotation.getLabel(lyrAnnotation.getInEdition()); |
|
106 |
if (fl!=null){ |
|
107 |
lyrAnnotation.setInEdition(lyrAnnotation.getRecordset().getSelection().nextSetBit(0)); |
|
108 |
View vista=(View)PluginServices.getMDIManager().getActiveView(); |
|
109 |
TextFieldEdit tfe=new TextFieldEdit(lyrAnnotation); |
|
110 |
tfe.show((Point)event.getPoint(),vista); |
|
111 |
|
|
112 |
/* JPopupMenu popup=new JPopupMenu(); |
|
113 |
|
|
114 |
JTextField txt=new JTextField(); |
|
115 |
txt.setLocation((Point)event.getPoint()); |
|
116 |
txt.setPreferredSize(new Dimension(100,20)); |
|
117 |
txt.setEditable(true); |
|
118 |
popup.add(txt); |
|
119 |
popup.setBorderPainted(false); |
|
120 |
popup.setBorder(BorderFactory.createEmptyBorder()); |
|
121 |
Point p=(Point)event.getPoint(); |
|
122 |
popup.show(vista,p.x+100,p.y); |
|
123 |
FocusManager fm=FocusManager.getCurrentManager(); |
|
124 |
fm.focusPreviousComponent(txt); |
|
125 |
*/ |
|
126 |
} |
|
127 |
|
|
128 |
|
|
129 |
} |
|
130 |
} |
|
131 |
|
|
132 |
} catch (DriverLoadException e) { |
|
133 |
// TODO Auto-generated catch block |
|
134 |
e.printStackTrace(); |
|
135 |
} |
|
136 |
} |
|
76 | 137 |
} |
Also available in: Unified diff