Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbateman2007-09-24 23:53:49 +0000
committercbateman2007-09-24 23:53:49 +0000
commited9381894a6e978e868aee564f0b9a93a9b1f7df (patch)
tree9d3d4bf45276353193dcb6e495fa6275b28c1aba /jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter
parentecde452047c7ba8cc405e7e9f7cb05adead8255a (diff)
downloadwebtools.jsf-ed9381894a6e978e868aee564f0b9a93a9b1f7df.tar.gz
webtools.jsf-ed9381894a6e978e868aee564f0b9a93a9b1f7df.tar.xz
webtools.jsf-ed9381894a6e978e868aee564f0b9a93a9b1f7df.zip
Cleanup:
- add javadoc - removed unused methods and parameters. - improved visibility and writability protection.
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter')
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java40
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConvertPosition.java12
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFacRegistryReader.java19
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java25
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterUtil.java5
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DefaultUnknownTagConverter.java1
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java6
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java5
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter2.java4
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IConverterFactory.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/PreferenceReader.java12
11 files changed, 121 insertions, 15 deletions
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java
index 0d34b94fc..8c9054c13 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java
@@ -56,6 +56,7 @@ public abstract class AbstractTagConverter implements ITagConverter,
private boolean _needBorderDecorator;
/**
+ * @param host
*
*/
public AbstractTagConverter(Element host) {
@@ -193,6 +194,10 @@ public abstract class AbstractTagConverter implements ITagConverter,
// need to review this
}
+ /**
+ * @param node
+ * @return true if the node should be ignored for conversion purposes
+ */
protected boolean shouldIgnore(Node node) {
int nodeType = node.getNodeType();
switch (nodeType) {
@@ -209,6 +214,8 @@ public abstract class AbstractTagConverter implements ITagConverter,
/**
* utility method for those converter that only converts the host tag's name
* and directly copy children.
+ * @param src
+ * @param dest
*
*/
protected void copyChildren(Element src, Element dest) {
@@ -223,6 +230,8 @@ public abstract class AbstractTagConverter implements ITagConverter,
/**
* utility method for those converter that directly copy children.
+ * @param src
+ * @param dest
*
*/
protected void dumCopyChildren(Element src, Element dest) {
@@ -271,6 +280,10 @@ public abstract class AbstractTagConverter implements ITagConverter,
return getDestDocument().createTextNode(text);
}
+ /**
+ * @param original
+ * @return the mapped String TODO: currently does nothing
+ */
protected String mapURL(String original) {
// TODO: how to map URL? such as original url look like:
// getContext().getPath()+...
@@ -279,6 +292,10 @@ public abstract class AbstractTagConverter implements ITagConverter,
// TODO: FIXME: XXX:
// if the value is expression, we may want to do something here!!!
+ /**
+ * @param value
+ * @return value mapped based on EL expression
+ */
protected String mapValue(String value) {
if (value == null) {
return null;
@@ -362,6 +379,9 @@ public abstract class AbstractTagConverter implements ITagConverter,
return this._needBorderDecorator;
}
+ /**
+ * @param b
+ */
public void setNeedBorderDecorator(boolean b) {
this._needBorderDecorator = b;
}
@@ -394,14 +414,23 @@ public abstract class AbstractTagConverter implements ITagConverter,
this._mode = mode;
}
+ /**
+ * @return true if the converter mode is preview
+ */
public final boolean isPreviewMode() {
return this._mode == IConverterFactory.MODE_PREVIEW;
}
+ /**
+ * @return true if the converter mode is designer
+ */
public final boolean isDesignerMode() {
return this._mode == IConverterFactory.MODE_DESIGNER;
}
+ /**
+ * @return the converter mode
+ */
public final int getMode() {
return this._mode;
}
@@ -434,6 +463,9 @@ public abstract class AbstractTagConverter implements ITagConverter,
return this._minWidth;
}
+ /**
+ * @param minWidth
+ */
public void setMinWidth(int minWidth) {
this._minWidth = minWidth;
}
@@ -447,10 +479,18 @@ public abstract class AbstractTagConverter implements ITagConverter,
return this._minHeight;
}
+ /**
+ * @param minHeight
+ */
public void setMinHeight(int minHeight) {
this._minHeight = minHeight;
}
+ /**
+ * @param element
+ * @param attrname
+ * @return the attribute on element with the name attrname
+ */
public static boolean hasAttribute(Element element, String attrname) {
return element.hasAttribute(attrname);
}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConvertPosition.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConvertPosition.java
index 97f2ba85b..130ec4074 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConvertPosition.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConvertPosition.java
@@ -20,11 +20,13 @@ import org.w3c.dom.Node;
* @version 1.5
*/
public class ConvertPosition {
- Node _parentNode;
+ private final Node _parentNode;
- int _index;
+ private final int _index;
/**
+ * @param parent \
+ * @param index
*
*/
public ConvertPosition(Node parent, int index) {
@@ -32,10 +34,16 @@ public class ConvertPosition {
this._index = index;
}
+ /**
+ * @return the parent node
+ */
public Node getParentNode() {
return _parentNode;
}
+ /**
+ * @return the index
+ */
public int getIndex() {
return _index;
}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFacRegistryReader.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFacRegistryReader.java
index 21f3d889e..147850ee4 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFacRegistryReader.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFacRegistryReader.java
@@ -12,6 +12,7 @@
package org.eclipse.jst.pagedesigner.converter;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -27,18 +28,22 @@ import org.eclipse.jst.pagedesigner.PDPlugin;
* @version 1.5
*/
public class ConverterFacRegistryReader {
- static IConverterFactory[] _handlers = null;
+ private static List<IConverterFactory> _handlers = null;
- public static synchronized IConverterFactory[] getAllHandlers() {
+ /**
+ * @return the list of handlers. The list is not modifiable and will
+ * throw exceptions if it is attempted.
+ */
+ public static synchronized List<IConverterFactory> getAllHandlers() {
if (_handlers == null) {
_handlers = readAllHandlers();
}
- return _handlers;
+ return Collections.unmodifiableList(_handlers);
}
- private static IConverterFactory[] readAllHandlers() {
- List result = new ArrayList();
+ private static List<IConverterFactory> readAllHandlers() {
+ List result = new ArrayList<IConverterFactory>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
.getExtensionPoint(PDPlugin.getPluginId(),
IJMTConstants.EXTENSION_POINT_PAGEDESIGNER);
@@ -68,9 +73,7 @@ public class ConverterFacRegistryReader {
}
}
}
- IConverterFactory[] ret = new IConverterFactory[result.size()];
- result.toArray(ret);
- return ret;
+ return result;
}
}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java
index 5a54c1bdf..4cbeafe7f 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java
@@ -41,18 +41,27 @@ public class ConverterFactoryRegistry {
_factories.add(new JSPConverterFactory());
_factories.add(new HTMLConverterFactory());
- IConverterFactory facs[] = ConverterFacRegistryReader.getAllHandlers();
+ List<IConverterFactory> facs = ConverterFacRegistryReader.getAllHandlers();
if (facs != null) {
- for (int i = 0; i < facs.length; i++) {
- addFactory(facs[i]);
+ for (IConverterFactory fac : facs) {
+ addFactory(fac);
}
}
}
+ /**
+ * @param fac
+ */
public void addFactory(IConverterFactory fac) {
_factories.add(fac);
}
+ /**
+ * @param ele
+ * @param mode
+ * @param targetDocument
+ * @return the new btag converter
+ */
public ITagConverter createTagConverter(Element ele, int mode,
IDOMDocument targetDocument) {
ITagConverter converter = internalCreateTagConverter(ele, mode);
@@ -62,7 +71,12 @@ public class ConverterFactoryRegistry {
return converter;
}
- public ITagConverter internalCreateTagConverter(Element ele, int mode) {
+ /**
+ * @param ele
+ * @param mode
+ * @return the new tag converter
+ */
+ protected final ITagConverter internalCreateTagConverter(Element ele, int mode) {
String uri = CMUtil.getElementNamespaceURI(ele);
// first round, match uri
for (int i = 0, size = _factories.size(); i < size; i++) {
@@ -118,6 +132,9 @@ public class ConverterFactoryRegistry {
"palette/GENERIC/small/PD_Palette_Default.gif");
}
+ /**
+ * @return the singleton instance of the registry
+ */
public static ConverterFactoryRegistry getInstance() {
if (_instance == null) {
_instance = new ConverterFactoryRegistry();
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterUtil.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterUtil.java
index 2dd26785e..ade2b7988 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterUtil.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterUtil.java
@@ -83,6 +83,11 @@ public class ConverterUtil {
return true;
}
+ /**
+ * @param document
+ * @param text
+ * @return the descripton element in the document containing text
+ */
public static Element createDescriptionElement(IDOMDocument document,
String text) {
if (document == null) {
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DefaultUnknownTagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DefaultUnknownTagConverter.java
index 397fcf7fb..70506851a 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DefaultUnknownTagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DefaultUnknownTagConverter.java
@@ -25,6 +25,7 @@ public class DefaultUnknownTagConverter extends AbstractTagConverter {
/**
* @param host
+ * @param mode
*/
public DefaultUnknownTagConverter(Element host, int mode) {
super(host);
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java
index 43c987e2f..455bc85f5 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java
@@ -20,13 +20,17 @@ import org.w3c.dom.Element;
*/
public class DumTagConverter extends AbstractTagConverter {
/**
- *
+ * @param host
+ * @param needBorder
*/
public DumTagConverter(Element host, boolean needBorder) {
this(host);
this.setNeedBorderDecorator(needBorder);
}
+ /**
+ * @param host
+ */
public DumTagConverter(Element host) {
super(host);
}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java
index 4b4a8a68b..51a6c1dff 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java
@@ -35,6 +35,8 @@ public class HiddenTagConverter implements ITagConverter {
private int _mode;
/**
+ * @param host
+ * @param labelProvider
*
*/
public HiddenTagConverter(Element host, ILabelProvider labelProvider) {
@@ -153,6 +155,9 @@ public class HiddenTagConverter implements ITagConverter {
this._mode = mode;
}
+ /**
+ * @return the mode
+ */
public int getMode() {
return _mode;
}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter2.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter2.java
index cd09809a9..f51af222d 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter2.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter2.java
@@ -33,6 +33,10 @@ public class HiddenTagConverter2 extends AbstractTagConverter {
private Image _image;
+ /**
+ * @param host
+ * @param image
+ */
public HiddenTagConverter2(Element host, Image image) {
super(host);
this._image = image;
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IConverterFactory.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IConverterFactory.java
index 002a7b0e0..f8aebf263 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IConverterFactory.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IConverterFactory.java
@@ -18,13 +18,20 @@ import org.w3c.dom.Element;
* @version 1.5
*/
public interface IConverterFactory {
+ /**
+ * indicates designer mode
+ */
public static final int MODE_DESIGNER = 0;
+ /**
+ * indicates preview mode
+ */
public static final int MODE_PREVIEW = 1;
/**
*
* @param element
+ * @param mode
* @return null if this factory don't support this element
*/
public ITagConverter createConverter(Element element, int mode);
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/PreferenceReader.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/PreferenceReader.java
index 71b2830c3..ea9dc4e06 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/PreferenceReader.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/PreferenceReader.java
@@ -16,12 +16,24 @@ package org.eclipse.jst.pagedesigner.converter;
* @version 1.5
*/
public class PreferenceReader {
+ /**
+ * expression type
+ */
public final static int FULL_EXPRESSION_TYPE = 0;
+ /**
+ * expression type
+ */
public final static int LAST_EXPRESSION_TYPE = 1;
+ /**
+ * expression type
+ */
public final static int REAL_VALUE_TYPE = 2;
+ /**
+ * @return the map value type
+ */
public static int getMapValueType() {
return LAST_EXPRESSION_TYPE;
}

Back to the top