Subversion Repositories general

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
240 swalkenh 1
PK
327 swalkenh 2
 
3
 
240 swalkenh 4
Comment: you can set named regions on pictures
5
Transform-To-File: src/plugins/regionEditorPlugin/RegionEditorPluginTr
6
 ansform.xsl
7
Created-By: 1.4.0 (Sun Microsystems Inc.)
8
Description: ...(todo)
9
XMLEditor-Plugin-Name: RegionEditor
10
Class-Path: ImagePlugin.jar
11
Transform-Fro-File: src/plugins/regionEditorPlugin/RegionEditorPluginT
260 swalkenh 12
 ransformBack.xsl
240 swalkenh 13
Main-Class: src.plugins.regionEditorPlugin.RegionEditorPlugin
14
 
15
Name: src/plugins/regionEditorPlugin
16
Specification-Version: 0.4 (05/07/03)
17
Specification-Title: plugin for XMLEditor
18
Implementation-Version: 0.1 (05/07/03)
19
Implementation-Title: src.plugins.regionEditorPlugin
20
Implementation-Vendor: group5, software practice SS_2003, University B
21
 ielefeld, Germany
22
Specification-Vendor: group5, software practice SS_2003, University Bi
23
 elefeld, Germany
24
 
25
PK
327 swalkenh 26
 
27
 
28
 
29
 
30
 
31
 
32
 
33
setVisible(Z)V*+
34
 
35
 
36
 
37
 
38
 
39
 
40
 
41
 
42
 
43
SourceFileRegionEditorPlugin.java!	
44
 
45
 
46
 
47
 
48
 
49
 
50
 
51
 
260 swalkenh 52
53
package src.plugins.regionEditorPlugin;
54
55
import java.awt.*;
56
import javax.swing.*;
57
 
58
import org.w3c.dom.Document;
59
 
327 swalkenh 60
61
import src.gui.*;
260 swalkenh 62
 
327 swalkenh 63
64
/**
65
 
66
 */
67
 
68
 
260 swalkenh 69
	
70
	private GuiInterface gui;
71
	private JLabel label = new JLabel("dummy RegionEditorPlugin");
327 swalkenh 72
73
260 swalkenh 74
 
327 swalkenh 75
		setLayout(new BorderLayout());
76
		add(label, BorderLayout.CENTER);
77
 
78
 
79
		System.out.println("I'm a new instance of the dummy RegionEditorPlugin!");
80
	}
81
	
82
83
 
84
	 * @see src.gui.PluginInterface#init(src.gui.GuiInterface)
260 swalkenh 85
	 */
327 swalkenh 86
 
260 swalkenh 87
 
327 swalkenh 88
		gui.setPluginPanel(this);
89
90
		System.out.println("dummy RegionEditorPlugin initialized");
91
	}
92
93
94
 
95
	 * @see src.gui.PluginInterface#start(org.w3c.dom.Element, org.w3c.dom.Document)
96
	 */
97
 
98
 
99
		setVisible(true);
100
	}
101
102
103
	/* (non-Javadoc)
104
	 * @see src.gui.PluginInterface#stop()
105
	 */
106
 
107
 
108
	}
109
110
111
	/* (non-Javadoc)
112
	 * @see src.gui.PluginInterface#forceStatusReport()
113
	 */
114
 
115
 
116
	}
117
118
}PK
119
]ç.r}‚ÈÈ>src/plugins/regionEditorPlugin/RegionEditorPluginTransform.xsl<!-- status: first working for regioneditor -->
120
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
121
<xsl:output method="xml" indent="yes" />
122
 
240 swalkenh 123
<!-- these parameters can be given from outside -->
260 swalkenh 124
 
125
<xsl:param name="elementnamenew">standardplugin</xsl:param>
126
127
 
128
	<xsl:variable name="levelremaining" select="substring-after($input, '/')" />
129
130
	<xsl:message><xsl:value-of select="concat('outside-parameter input: ', $input)"/></xsl:message>
131
 
132
133
	<xsl:for-each select="node()">
134
 
135
			<xsl:with-param name="levelremaining" select="$levelremaining" />
136
		</xsl:call-template>
137
 
138
</xsl:template>
139
140
<xsl:template name="selecter">
141
	<xsl:param name="levelremaining" />
142
	<xsl:variable name="level" select="substring-before( concat($levelremaining, '/'), '/')" />
143
	<xsl:variable name="nextlevels" select="substring-after($levelremaining, '/')" />
144
 
145
	<!-- if this node belongs to the right path
146
	     then work on childs with the selecter -->
147
	<xsl:if test = "(name() = $level)">
148
		<xsl:message>selecter-case: belongs to right path</xsl:message>
149
 
150
		
151
			<!-- if this is the last level this is the node which must be converted
152
			     then convert the node -->
153
			<xsl:if test = "( ('' = $nextlevels) 
154
		    	              and not('' = name()) )"><!-- avoid too many tags from matcher -->
155
 
156
				<xsl:apply-templates select="self::node()">
157
				</xsl:apply-templates>
158
			</xsl:if>
159
			<!-- else (if there are levels left) work on childs -->
160
			<xsl:if test = "not('' = $nextlevels)">
161
				<xsl:message>selecter-case: levels left</xsl:message>
162
				<xsl:copy>
163
					<xsl:for-each select="attribute::*">
164
						<xsl:attribute name="{name(.)}">
165
							<xsl:value-of select="self::node()" />
166
						</xsl:attribute>
167
					</xsl:for-each>
168
					<xsl:for-each select="node()">
169
						<xsl:call-template name="selecter">
170
							<xsl:with-param name="levelremaining" select="$nextlevels" />
171
						</xsl:call-template>
172
					</xsl:for-each>
173
				</xsl:copy>
174
			</xsl:if>
175
		</xsl:element>
176
	</xsl:if>
177
	<!-- else simply copy the node with childs -->
178
	<xsl:if test = "not(name() = $level)">
179
		<xsl:message>selecter-case: must only be copied and never touched in future</xsl:message>
180
		<xsl:copy-of select="self::node()" />
181
	</xsl:if>
182
</xsl:template>
183
184
<xsl:template match="Regionensatz"><!-- element-plugin association -->
185
	<xsl:element name="REGIONSET">
186
187
		<!-- work on attributes -->
188
 
189
			<xsl:value-of select="@Bild" />
190
		</xsl:attribute>
191
 
192
			<xsl:if test = "not(name(.) = ('Bild'))">
193
				<xsl:attribute name="{name(.)}">
194
					<xsl:value-of select="self::node()" />
195
				</xsl:attribute>
196
			</xsl:if>
197
		</xsl:for-each>
198
199
		<!-- work on childs -->
200
		<xsl:for-each select="Bereich">
201
			<xsl:element name="RECT">
202
				<xsl:attribute name="x">
203
 
204
				</xsl:attribute>
205
				<xsl:attribute name="y">
206
					<xsl:value-of select="@y" />
207
				</xsl:attribute>
208
				<xsl:attribute name="b">
209
					<xsl:value-of select="@Breite" />
210
				</xsl:attribute>
211
				<xsl:attribute name="h">
212
					<xsl:value-of select="@Hoehe" />
213
				</xsl:attribute>
214
				<xsl:for-each select="attribute::*">
215
					<xsl:if test = "not(name(.) = 'x')">
216
					<xsl:if test = "not(name(.) = 'y')">
217
					<xsl:if test = "not(name(.) = 'Breite')">
218
					<xsl:if test = "not(name(.) = 'Hoehe')">
219
						<xsl:attribute name="{name(.)}">
220
							<xsl:value-of select="self::node()" />
221
						</xsl:attribute>
222
					</xsl:if></xsl:if></xsl:if></xsl:if>
223
				</xsl:for-each>
224
				<xsl:for-each select="node()">
225
					<xsl:copy-of select="self::node()" />
226
				</xsl:for-each>
227
			</xsl:element>
228
		</xsl:for-each>
229
		<xsl:for-each select="node()">
230
			<xsl:if test = "not(name(.) = 'Bereich')">
231
				<xsl:copy-of select="self::node()" />
232
			</xsl:if>
233
		</xsl:for-each>
234
235
	</xsl:element>
236
</xsl:template>
237
238
<xsl:template match="REGIONSET"><!-- element-plugin association -->
239
 
240
</xsl:template>
241
242
 
243
]ç.ÕÚq{¹¹Bsrc/plugins/regionEditorPlugin/RegionEditorPluginTransformBack.xsl<!-- status: first try for regioneditor -->
244
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
245
<xsl:output method="xml" indent="yes" />
246
 
240 swalkenh 247
<!-- these parameters can be given from outside -->
260 swalkenh 248
 
249
<xsl:param name="elementnamenew">standardplugin</xsl:param>
250
251
 
252
	<xsl:variable name="levelremaining" select="substring-after($input, '/')" />
253
254
	<xsl:message><xsl:value-of select="concat('outside-parameter input: ', $input)"/></xsl:message>
255
 
256
257
	<xsl:for-each select="node()">
258
 
259
			<xsl:with-param name="levelremaining" select="$levelremaining" />
260
		</xsl:call-template>
261
 
262
</xsl:template>
263
264
<xsl:template name="selecter">
265
	<xsl:param name="levelremaining" />
266
	<xsl:variable name="level" select="substring-before( concat($levelremaining, '/'), '/')" />
267
	<xsl:variable name="nextlevels" select="substring-after($levelremaining, '/')" />
268
 
269
	<!-- if this node belongs to the right path
270
	     then work on childs with the selecter -->
271
	<xsl:if test = "(name() = $level)">
272
		<xsl:message>selecter-case: belongs to right path</xsl:message>
273
 
274
		
275
			<!-- if this is the last level this is the node which must be converted
276
			     then convert the node -->
277
			<xsl:if test = "( ('' = $nextlevels) 
278
		    	              and not('' = name()) )"><!-- avoid too many tags from matcher -->
279
 
280
				<xsl:apply-templates select="self::node()">
281
				</xsl:apply-templates>
282
			</xsl:if>
283
			<!-- else (if there are levels left) work on childs -->
284
			<xsl:if test = "not('' = $nextlevels)">
285
				<xsl:message>selecter-case: levels left</xsl:message>
286
				<xsl:copy>
287
					<xsl:for-each select="attribute::*">
288
						<xsl:attribute name="{name(.)}">
289
							<xsl:value-of select="self::node()" />
290
						</xsl:attribute>
291
					</xsl:for-each>
292
					<xsl:for-each select="node()">
293
						<xsl:call-template name="selecter">
294
							<xsl:with-param name="levelremaining" select="$nextlevels" />
295
						</xsl:call-template>
296
					</xsl:for-each>
297
				</xsl:copy>
298
			</xsl:if>
299
		</xsl:element>
300
	</xsl:if>
301
	<!-- else simply copy the node with childs -->
302
	<xsl:if test = "not(name() = $level)">
303
		<xsl:message>selecter-case: must only be copied and never touched in future</xsl:message>
304
		<xsl:copy-of select="self::node()" />
305
	</xsl:if>
306
</xsl:template>
307
308
<xsl:template match="REGIONSET"><!-- element-plugin association -->
309
	<xsl:element name="Regionensatz">
310
311
		<!-- work on attributes -->
312
 
313
			<xsl:value-of select="@image" />
314
		</xsl:attribute>
315
 
316
			<xsl:if test = "not(name(.) = ('image'))">
317
				<xsl:attribute name="{name(.)}">
318
					<xsl:value-of select="self::node()" />
319
				</xsl:attribute>
320
			</xsl:if>
321
		</xsl:for-each>
322
323
		<!-- work on childs -->
324
		<xsl:for-each select="RECT">
325
			<xsl:element name="Bereich">
326
				<xsl:attribute name="x">
327
 
328
				</xsl:attribute>
329
				<xsl:attribute name="y">
330
					<xsl:value-of select="@y" />
331
				</xsl:attribute>
332
				<xsl:attribute name="Breite">
333
					<xsl:value-of select="@b" />
334
				</xsl:attribute>
335
				<xsl:attribute name="Hoehe">
336
					<xsl:value-of select="@h" />
337
				</xsl:attribute>
338
				<xsl:for-each select="attribute::*">
339
					<xsl:if test = "not(name(.) = 'x')">
340
					<xsl:if test = "not(name(.) = 'y')">
341
					<xsl:if test = "not(name(.) = 'b')">
342
					<xsl:if test = "not(name(.) = 'h')">
343
						<xsl:attribute name="{name(.)}">
344
							<xsl:value-of select="self::node()" />
345
						</xsl:attribute>
346
					</xsl:if></xsl:if></xsl:if></xsl:if>
347
				</xsl:for-each>
348
				<xsl:for-each select="node()">
349
					<xsl:copy-of select="self::node()" />
350
				</xsl:for-each>
351
			</xsl:element>
352
		</xsl:for-each>
353
		<xsl:for-each select="node()">
354
			<xsl:if test = "not(name(.) = 'RECT')">
355
				<xsl:copy-of select="self::node()" />
356
			</xsl:if>
357
		</xsl:for-each>
358
359
	</xsl:element>
360
</xsl:template>
361
362
<xsl:template match="REGIONSET"><!-- element-plugin association -->
363
 
364
</xsl:template>
365
366
 
367
368
Âfê.	META-INF/þÊPK
369
370
 
240 swalkenh 371
372
 
327 swalkenh 373
 
240 swalkenh 374
 
327 swalkenh 375
 
240 swalkenh 376
 
327 swalkenh 377
 
240 swalkenh 378