Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 04643bda

Přidáno uživatelem Martin Matas před téměř 6 roky(ů)

Added required fields, changed field name to be valid

- implemented necessary fields that graph must contains otherwise wont be valid
- archetype index in class BaseVertex had wrong field name and caused that graph was not valid, field was renamed to be valid

Zobrazit rozdíly:

sources/imiger-dot-converter/src/main/java/cz/zcu/kiv/imiger/plugin/dot/BaseGraphFactory.java
44 44
	 */
45 45
	protected List<EdgeDTO> edges;
46 46

  
47
    /**
48
     * Map of possible enum values that must factory initialize.
49
     */
50
	protected Map<Integer, List<String>> possibleEnumValues;
51

  
52
    /**
53
     * List of groups that must factory initialize.
54
     */
55
	protected List<Group> groups;
56

  
57
    /**
58
     * List of sidebars that must factory initialize.
59
     */
60
	protected List<SideBar> sideBar;
61

  
62
    /**
63
     * Edge that will be highlighted when graph loads. GraphFactory must initialize.
64
     */
65
	protected String highlightedEdge;
66

  
67
    /**
68
     * Vertex that will be highlighted when graph loads. GraphFactory must initialize.
69
     */
70
	protected String highlightedVertex;
71

  
47 72
	/**
48 73
	 * Constructor initialize data that can be retrieved from {@link BaseDOTLoader}, the rest of
49 74
	 * necessary attributes for creating graph must be initialized in children of this abstract class.
sources/imiger-dot-converter/src/main/java/cz/zcu/kiv/imiger/plugin/dot/GraphFactory.java
45 45
		super(dotLoader);
46 46
		prepareEdgeArchetypes();
47 47
		prepareVertexArchetypes();
48
		preparePossibleEnumValues();
49
		prepareGroups();
50
		prepareSideBar();
51
		defineHighlightedVertex();
52
        defineHighlightedEdge();
48 53
	}
49 54

  
50 55
	/**
......
84 89
		graph.setEdgeArchetypes(edgeArchetypes);
85 90
		graph.setVertexArchetypes(vertexArchetypes);
86 91
		graph.setAttributeTypes(attributeTypes);
92
		graph.setPossibleEnumValues(possibleEnumValues);
93
		graph.setGroups(groups);
94
		graph.setSideBar(sideBar);
95
		graph.setHighlightedEdge(highlightedEdge);
96
		graph.setHighlightedVertex(highlightedVertex);
87 97
		addEdgesToGraph(graph, edges);
88 98
		addVerticesToGraph(graph, vertices);
89 99

  
......
157 167
	 * Defines default edge archetype for edges.
158 168
	 */
159 169
	private void prepareEdgeArchetypes() {
160
		edgeArchetypes= new ArrayList<>();
170
		edgeArchetypes = new ArrayList<>();
161 171
		edgeArchetypes.add(new EdgeArchetype(EDGE_ARCHETYPE_NAME, ARCHETYPE_TEXT));
162 172
	}
163 173

  
......
169 179
		vertexArchetypes.add(new VertexArchetype(VERTEX_ARCHETYPE_NAME, ARCHETYPE_TEXT));
170 180
	}
171 181

  
182
    /**
183
     * Defines default map of possible enum values.
184
     */
185
	private void preparePossibleEnumValues() {
186
		possibleEnumValues = new HashMap<>();
187
	}
188

  
189

  
190
    /**
191
     * Defines default list fo groups.
192
     */
193
	private void prepareGroups() {
194
		groups = new ArrayList<>();
195
	}
196

  
197

  
198
    /**
199
     * Defines default list of sidebars.
200
     */
201
	private void prepareSideBar() {
202
		sideBar = new ArrayList<>();
203
	}
204

  
205

  
206
    /**
207
     * Defines default highlighted edge. Empty string means that no edge will be highlighted
208
     * when graph loads.
209
     */
210
	private void defineHighlightedEdge() {
211
		highlightedEdge = "";
212
	}
213

  
214
    /**
215
     * Defines default highlighted vertex. Empty string means that no vertex will be highlighted
216
     * when graph loads.
217
     */
218
	private void defineHighlightedVertex() {
219
		highlightedVertex = "";
220
	}
221

  
172 222
}
sources/imiger-module/src/main/java/cz/zcu/kiv/imiger/vo/BaseVertex.java
11 11
    /** Name of vertex. */
12 12
    private String name;
13 13
    /** Index of vertex archetype. */
14
    private int archetypeIndex;
14
    private int archetype;
15 15
    /** Additional info. */
16 16
    private String text;
17 17

  
18
    public BaseVertex(int id, String name, int archetypeIndex, String text) {
18
    public BaseVertex(int id, String name, int archetype, String text) {
19 19
        this.id = id;
20 20
        this.name = name;
21
        this.archetypeIndex = archetypeIndex;
21
        this.archetype = archetype;
22 22
        this.text = text;
23 23
    }
24 24

  
......
39 39
    }
40 40

  
41 41
    public int getArchetype() {
42
        return archetypeIndex;
42
        return archetype;
43 43
    }
44 44

  
45 45
    public void setArchetype(int archetypeIndex) {
46
        this.archetypeIndex = archetypeIndex;
46
        this.archetype = archetypeIndex;
47 47
    }
48 48

  
49 49
    public String getText() {

Také k dispozici: Unified diff