Revision 21299 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/LayoutContext.java
LayoutContext.java | ||
---|---|---|
9 | 9 |
import com.iver.andami.PluginServices; |
10 | 10 |
import com.iver.cit.gvsig.project.documents.exceptions.SaveException; |
11 | 11 |
import com.iver.cit.gvsig.project.documents.layout.commands.DefaultEditableFeatureSource; |
12 |
import com.iver.cit.gvsig.project.documents.layout.commands.EditableFeatureSource; |
|
12 |
import com.iver.cit.gvsig.project.documents.layout.commands.FrameCommandsRecord; |
|
13 |
import com.iver.cit.gvsig.project.documents.layout.commands.FrameManager; |
|
13 | 14 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGroup; |
14 | 15 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
15 | 16 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrameUseFMap; |
... | ... | |
25 | 26 |
public class LayoutContext { |
26 | 27 |
private Attributes m_attributes = null; |
27 | 28 |
private IFFrame[] fframes; |
28 |
private DefaultEditableFeatureSource efs;
|
|
29 |
private FrameCommandsRecord fcr;
|
|
29 | 30 |
public static Hashtable nums = new Hashtable(); |
30 | 31 |
public int numBefore = 0; |
31 | 32 |
public int numBehind = 0; |
... | ... | |
42 | 43 |
m_attributes=new Attributes(); |
43 | 44 |
m_MatrizTransf = new AffineTransform(); |
44 | 45 |
m_MatrizTransf.setToIdentity(); |
45 |
efs = new DefaultEditableFeatureSource(); |
|
46 |
FrameManager fm=new FrameManager(); |
|
47 |
fcr = new FrameCommandsRecord(fm); |
|
46 | 48 |
} |
47 | 49 |
/** |
48 | 50 |
* Returns the AffineTransform that is applying in the Layout. |
... | ... | |
104 | 106 |
*/ |
105 | 107 |
public void updateFFrames() { |
106 | 108 |
ArrayList frames = new ArrayList(); |
107 |
IFFrame[] auxfframes = efs.getFFrames();
|
|
109 |
IFFrame[] auxfframes = fcr.getFrameManager().getFFrames();
|
|
108 | 110 |
for (int j = numBehind; j <= numBefore; j++) { |
109 | 111 |
for (int i = 0; i < auxfframes.length; i++) { |
110 | 112 |
if (auxfframes[i].getLevel() == j) { |
... | ... | |
120 | 122 |
* |
121 | 123 |
*/ |
122 | 124 |
public void delFFrameSelected() { |
123 |
efs.startComplexCommand();
|
|
124 |
for (int i = efs.getAllFFrames().length - 1; i >= 0; i--) {
|
|
125 |
IFFrame fframe = efs.getFFrame(i);
|
|
125 |
fcr.startComplex();
|
|
126 |
for (int i = fcr.getFrameManager().getAllFFrames().length - 1; i >= 0; i--) {
|
|
127 |
IFFrame fframe = fcr.getFrameManager().getFFrame(i);
|
|
126 | 128 |
|
127 | 129 |
if (fframe.getSelected() != IFFrame.NOSELECT) { |
128 |
efs.removeFFrame(i);
|
|
130 |
fcr.delete(fframe);
|
|
129 | 131 |
} |
130 | 132 |
} |
131 |
efs.endComplexCommand(PluginServices.getText(this,"remove_elements"));
|
|
133 |
fcr.endComplex(PluginServices.getText(this,"remove_elements"));
|
|
132 | 134 |
updateFFrames(); |
133 | 135 |
} |
134 | 136 |
/** |
... | ... | |
136 | 138 |
* |
137 | 139 |
*/ |
138 | 140 |
public void clearSelection() { |
139 |
for (int i = efs.getAllFFrames().length - 1; i >= 0; i--) {
|
|
140 |
IFFrame fframe = efs.getFFrame(i);
|
|
141 |
for (int i = fcr.getFrameManager().getAllFFrames().length - 1; i >= 0; i--) {
|
|
142 |
IFFrame fframe = fcr.getFrameManager().getFFrame(i);
|
|
141 | 143 |
if (fframe.getSelected() != IFFrame.NOSELECT) { |
142 | 144 |
fframe.setSelected(false); |
143 | 145 |
} |
... | ... | |
148 | 150 |
* |
149 | 151 |
*/ |
150 | 152 |
public void delFFrame(int index) { |
151 |
for (int i = 0; i < getEFS().getAllFFrames().length; i++) { |
|
152 |
if (getEFS().getFFrame(i).equals(getFFrame(index))) { |
|
153 |
getEFS().removeFFrame(i); |
|
153 |
for (int i = 0; i < fcr.getFrameManager().getAllFFrames().length; i++) { |
|
154 |
IFFrame frame=getFFrame(index); |
|
155 |
if (fcr.getFrameManager().getFFrame(i).equals(frame)) { |
|
156 |
fcr.delete(frame); |
|
154 | 157 |
} |
155 | 158 |
} |
156 | 159 |
updateFFrames(); |
... | ... | |
161 | 164 |
* FFrame to remove. |
162 | 165 |
*/ |
163 | 166 |
public void delFFrame(IFFrame frame) { |
164 |
for (int i = 0; i < getEFS().getAllFFrames().length; i++) {
|
|
165 |
if (getEFS().getFFrame(i).equals(frame)) {
|
|
166 |
getEFS().removeFFrame(i);
|
|
167 |
for (int i = 0; i < fcr.getFrameManager().getAllFFrames().length; i++) {
|
|
168 |
if (fcr.getFrameManager().getFFrame(i).equals(frame)) {
|
|
169 |
fcr.delete(frame);
|
|
167 | 170 |
} |
168 | 171 |
} |
169 | 172 |
updateFFrames(); |
... | ... | |
172 | 175 |
* Returns the EditableFeatureSource, is the control of all change in the FFrames of Layout. |
173 | 176 |
* @return EditableFatureSource. |
174 | 177 |
*/ |
175 |
public EditableFeatureSource getEFS() {
|
|
176 |
return efs;
|
|
178 |
public FrameCommandsRecord getEFS() {
|
|
179 |
return fcr;
|
|
177 | 180 |
} |
178 | 181 |
/** |
179 | 182 |
* It adds a fframe to Arraylist of FFrames . |
... | ... | |
202 | 205 |
} |
203 | 206 |
|
204 | 207 |
frame.setNum(Integer.parseInt(nums.get(frame.getClass()).toString())); |
205 |
efs.addFFrame(frame);
|
|
208 |
fcr.insert(frame);
|
|
206 | 209 |
frame.setSelected(select); |
207 | 210 |
frame.setLevel(getNumBefore()); |
208 | 211 |
updateFFrames(); |
... | ... | |
213 | 216 |
* @param frame fframe to add. |
214 | 217 |
*/ |
215 | 218 |
public void addFFrameSameProperties(IFFrame frame){ |
216 |
efs.addFFrame(frame);
|
|
219 |
fcr.insert(frame);
|
|
217 | 220 |
frame.setSelected(true); |
218 | 221 |
frame.setLevel(getNumBefore()); |
219 | 222 |
updateFFrames(); |
Also available in: Unified diff