svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / expressionevaluator / ViewElement.java @ 44644
History | View | Annotate | Download (2.93 KB)
1 | 44006 | jjdelcerro | package org.gvsig.app.project.documents.view.expressionevaluator; |
---|---|---|---|
2 | |||
3 | import java.util.ArrayList; |
||
4 | 44263 | jjdelcerro | import java.util.Collection; |
5 | 44006 | jjdelcerro | import java.util.Iterator; |
6 | import java.util.List; |
||
7 | 44190 | jjdelcerro | import org.gvsig.app.ApplicationLocator; |
8 | import org.gvsig.app.project.ProjectManager; |
||
9 | import org.gvsig.app.project.documents.Document; |
||
10 | import org.gvsig.app.project.documents.view.ViewDocument; |
||
11 | import org.gvsig.app.project.documents.view.ViewManager; |
||
12 | import org.gvsig.app.project.documents.view.expressionevaluator.viewcapturepoint.ViewCapturePointElement; |
||
13 | import org.gvsig.app.project.documents.view.expressionevaluator.viewcapturerectangle.ViewCaptureRectangleElement; |
||
14 | 44006 | jjdelcerro | import org.gvsig.expressionevaluator.Function; |
15 | import org.gvsig.expressionevaluator.swing.Element; |
||
16 | import org.gvsig.expressionevaluator.swing.Element.GroupElement; |
||
17 | 44262 | jjdelcerro | import org.gvsig.expressionevaluator.swing.ExpressionBuilderConfig; |
18 | 44006 | jjdelcerro | import org.gvsig.expressionevaluator.swing.spi.AbstractElement; |
19 | 44011 | jjdelcerro | import org.gvsig.tools.ToolsLocator; |
20 | 44006 | jjdelcerro | |
21 | /**
|
||
22 | *
|
||
23 | * @author jjdelcerro
|
||
24 | */
|
||
25 | public class ViewElement |
||
26 | extends AbstractElement
|
||
27 | implements GroupElement
|
||
28 | { |
||
29 | |||
30 | 44262 | jjdelcerro | private final List<Element> children; |
31 | 44263 | jjdelcerro | private final List<Element> values; |
32 | 44006 | jjdelcerro | |
33 | 44263 | jjdelcerro | |
34 | 44006 | jjdelcerro | public ViewElement() {
|
35 | 44262 | jjdelcerro | super(
|
36 | "Views",
|
||
37 | ToolsLocator.getI18nManager().getTranslation("Views"),
|
||
38 | "expressionbuilder-element-view"
|
||
39 | ); |
||
40 | this.children = new ArrayList<>(); |
||
41 | 44263 | jjdelcerro | this.values = new ArrayList<>(); |
42 | |||
43 | this.values.add(new ViewCaptureRectangleElement()); |
||
44 | this.values.add(new ViewCapturePointElement()); |
||
45 | this.values.add(new ViewTakeProjectionCodeElement()); |
||
46 | 44190 | jjdelcerro | |
47 | ProjectManager manager = ApplicationLocator.getProjectManager(); |
||
48 | List<Document> views = manager.getCurrentProject().getDocuments(ViewManager.TYPENAME); |
||
49 | for (Document view : views) { |
||
50 | Element e = new ViewLayersElement((ViewDocument) view); |
||
51 | 44262 | jjdelcerro | this.children.add(e);
|
52 | 44190 | jjdelcerro | } |
53 | 44006 | jjdelcerro | } |
54 | 44262 | jjdelcerro | |
55 | @Override
|
||
56 | 44263 | jjdelcerro | public Collection<Element> getValues() { |
57 | return this.values; |
||
58 | } |
||
59 | |||
60 | @Override
|
||
61 | 44262 | jjdelcerro | public Element setConfig(ExpressionBuilderConfig config) { |
62 | super.setConfig(config);
|
||
63 | for (Element child : children) { |
||
64 | child.setConfig(config); |
||
65 | } |
||
66 | return this; |
||
67 | } |
||
68 | 44006 | jjdelcerro | |
69 | @Override
|
||
70 | public Element get(int index) { |
||
71 | 44262 | jjdelcerro | return this.children.get(index); |
72 | 44006 | jjdelcerro | } |
73 | |||
74 | @Override
|
||
75 | public int size() { |
||
76 | 44262 | jjdelcerro | return this.children.size(); |
77 | 44006 | jjdelcerro | } |
78 | |||
79 | @Override
|
||
80 | public Iterator<Element> iterator() { |
||
81 | 44262 | jjdelcerro | return this.children.iterator(); |
82 | 44006 | jjdelcerro | } |
83 | |||
84 | @Override
|
||
85 | public void addElement(Element element) { |
||
86 | 44262 | jjdelcerro | this.children.add(element);
|
87 | 44006 | jjdelcerro | } |
88 | |||
89 | @Override
|
||
90 | public void addElement(Function function) { |
||
91 | throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
||
92 | } |
||
93 | |||
94 | @Override
|
||
95 | public List<Element> getElements() { |
||
96 | 44262 | jjdelcerro | return this.children; |
97 | 44006 | jjdelcerro | } |
98 | |||
99 | } |