Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3b504b4effbeba2e525cfd8b5dbb4b7d8f0de100 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*******************************************************************************
 * Copyright (c) 2006 Sybase, Inc. and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Sybase, Inc. - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.pagedesigner.converter;

import java.util.List;

import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
 * ITagConverter is used to convert a custom tag to a HTML tag. Each
 * ITagConverter instance will be dedicated to a single custom tag element.
 * 
 * @author mengbo
 * @version 1.5
 */
public interface ITagConverter {
	/**
	 * Set the target document where the converted node should belong to.
	 * 
	 * @param document
	 */
	public void setDestDocument(IDOMDocument document);

	/**
	 * refresh the internal state of this ITagConverter. This method normally is
	 * called when the host element change.
	 * 
	 * @param context
	 */
	public void convertRefresh(Object context);

	/**
	 * The host element being converted.
	 * 
	 * @return
	 */
	public Element getHostElement();

	/**
	 * for some tags, they don't convert to HTML. In that case, this method
	 * should return false for them. And if this method return false, then
	 * should return an image in <code>getVisualImage()</code> for displaying
	 * in the designer.
	 * 
	 * @return
	 */
	public boolean isVisualByHTML();

	/**
	 * if isVisualByHTML() return false, then this method should return an image
	 * to be displayed in designer.
	 * 
	 * Normally this image will be a shared image for those hidden elements. It
	 * is this class's responsibility to dispose the image if the image is not a
	 * shared one.
	 * 
	 * @return
	 */
	public Image getVisualImage();

	/**
	 * the element after conversion.
	 * 
	 * @return
	 */
	public Element getResultElement();

	/**
	 * get the list of children that should be continuely converted.
	 * 
	 * @return
	 */
	public List getChildModeList();

	/**
	 * For child nodes that need further convert, return their position in the
	 * converted DOM tree.
	 * 
	 * @param childModel
	 * @return
	 */
	public ConvertPosition getChildVisualPosition(Node childModel);

	/**
	 * When the convert result in multi-level element. If this method return
	 * false, then the caller should not use child nodes of
	 * <code>getHostElement()</code>
	 * 
	 * @return
	 */
	public boolean isMultiLevel();

	/**
	 * 
	 * @return
	 */
	public boolean isWidget();

	/**
	 * 
	 * 
	 */
	public void dispose();

	/**
	 * @param mode
	 */
	public void setMode(int mode);
}

Back to the top