JBoss Tools SVN: r12650 - branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-12-17 13:50:07 -0500 (Wed, 17 Dec 2008)
New Revision: 12650
Modified:
branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
Log:
JBIDE-3417 showstopper NPE
Modified: branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
--- branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-12-17 18:44:16 UTC (rev 12649)
+++ branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-12-17 18:50:07 UTC (rev 12650)
@@ -112,7 +112,7 @@
if( result.size() > 0 )
return true;
- return getScanner().couldBeIncluded(path.toString(), inWorkspace);
+ return getScanner() == null ? false : getScanner().couldBeIncluded(path.toString(), inWorkspace);
}
public FileWrapper[] getMatches(IPath path) {
17 years
JBoss Tools SVN: r12649 - branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.ui.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-12-17 13:44:16 -0500 (Wed, 17 Dec 2008)
New Revision: 12649
Modified:
branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
Log:
no jira, missing label provider details
Modified: branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-12-17 18:42:04 UTC (rev 12648)
+++ branches/jbosstools-3.0.0.CR1/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-12-17 18:44:16 UTC (rev 12649)
@@ -143,6 +143,9 @@
<instanceof
value="org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate$DelayProxy">
</instanceof>
+ <instanceof
+ value="org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate$WrappedProject">
+ </instanceof>
</or>
</possibleChildren>
</navigatorContent>
17 years
JBoss Tools SVN: r12648 - trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-12-17 13:42:04 -0500 (Wed, 17 Dec 2008)
New Revision: 12648
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
Log:
no-jira, missing label provider details
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-12-17 18:38:31 UTC (rev 12647)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-12-17 18:42:04 UTC (rev 12648)
@@ -143,6 +143,9 @@
<instanceof
value="org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate$DelayProxy">
</instanceof>
+ <instanceof
+ value="org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate$WrappedProject">
+ </instanceof>
</or>
</possibleChildren>
</navigatorContent>
17 years
JBoss Tools SVN: r12647 - trunk/jmx/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-12-17 13:38:31 -0500 (Wed, 17 Dec 2008)
New Revision: 12647
Modified:
trunk/jmx/docs/reference/en/modules/introduction.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-528 text from wiki is converted to xml (not structured yet)
Modified: trunk/jmx/docs/reference/en/modules/introduction.xml
===================================================================
--- trunk/jmx/docs/reference/en/modules/introduction.xml 2008-12-17 18:22:54 UTC (rev 12646)
+++ trunk/jmx/docs/reference/en/modules/introduction.xml 2008-12-17 18:38:31 UTC (rev 12647)
@@ -21,10 +21,15 @@
<section id="Connection">
<title>Connection</title>
- <para>To connect to a MBean Server - click on the Connect... icon () in the MBean Explorer menu bar, then set the name Host and port and click on OK.</para>
- <para>The default JMX URL is service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi </para>
- <para> Also you can alternatively type a complete JMX URL in the Advanced Tab of the JMX Connection window</para>
-
+ <para> There are two ways to connect to an application with remote management enabled:</para>
+ <para> The first step is the same for both - to connect to a MBean Server - click on the Connect... icon () in the MBean Explorer menu bar,
+ </para>
+ <para>Then to follow the simple one you just need to specify host, port (and optionally user name & password) and click OK</para>
+ <para>The default JMX URL is service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi </para>
+
+ <para> In case you need to connect to an application which has not used the "standard" JMX URL (e.g. Eclipse Equinox), you need chose more advance way, where it's necessary to specify explicitly a JMX URL in the Advanced Tab of the JMX Connection window </para>
+
+
<note><title>Note</title>
<para>only JMX URL based on RMI are supported </para></note>
</section>
17 years
JBoss Tools SVN: r12646 - trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-12-17 13:22:54 -0500 (Wed, 17 Dec 2008)
New Revision: 12646
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
Log:
JBIDE-3417 NPE
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-12-17 17:56:32 UTC (rev 12645)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-12-17 18:22:54 UTC (rev 12646)
@@ -112,7 +112,7 @@
if( result.size() > 0 )
return true;
- return getScanner().couldBeIncluded(path.toString(), inWorkspace);
+ return getScanner() == null ? false : getScanner().couldBeIncluded(path.toString(), inWorkspace);
}
public FileWrapper[] getMatches(IPath path) {
17 years
JBoss Tools SVN: r12645 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-12-17 12:56:32 -0500 (Wed, 17 Dec 2008)
New Revision: 12645
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractTreeTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodesAdaptorTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-883, code adjustment.
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractTreeTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractTreeTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractTreeTemplate.java 2008-12-17 17:56:32 UTC (rev 12645)
@@ -0,0 +1,689 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import java.util.List;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.RichFacesTemplatesActivator;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public abstract class RichFacesAbstractTreeTemplate extends VpeAbstractTemplate {
+
+ public static final String TREE = "tree"; //$NON-NLS-1$
+ public static final String TREE_NODE = "treeNode"; //$NON-NLS-1$
+ public static final String TREE_NODES_ADAPTOR = "treeNodesAdaptor"; //$NON-NLS-1$
+ public static final String RECURSIVE_TREE_NODES_ADAPTOR = "recursiveTreeNodesAdaptor"; //$NON-NLS-1$
+ public static final String SHOW_LINES_ATTR_NAME = "showConnectingLines"; //$NON-NLS-1$
+
+ public static final String DEFAULT_ICON_PARAM_VALUE = "DEFAULT_ICON_PARAM"; //$NON-NLS-1$
+ public static final String ICON_PARAM_NAME = "richFacesTreeNodeParam"; //$NON-NLS-1$
+ public static final String DEFAULT_ICON_EXPANDED_PARAM_VALUE = "DEFAULT_ICON_EXPANDED_PARAM"; //$NON-NLS-1$
+ public static final String UNDEFINED_ICON = "/tree/unresolved.gif"; //$NON-NLS-1$
+ public static final String NODE_ICON_LEAF_ATTR_NAME = "iconLeaf"; //$NON-NLS-1$
+ public static final String ICON_NODE_WITH_LINES = "/tree/iconNodeWithLines.gif"; //$NON-NLS-1$
+ public static final String ICON_NODE_WITH_LINE = "/tree/iconNodeWithLine.gif"; //$NON-NLS-1$
+ public static final String ICON_EXPANDED_WITH_LINES = "/tree/iconCollapsedWithLines.gif"; //$NON-NLS-1$
+ public static final String ICON_NODE_WITHOUT_LINES = "/tree/iconNode.gif"; //$NON-NLS-1$
+ public static final String ICON_EXPANDED_WITHOUT_LINES = "/tree/iconCollapsed.gif"; //$NON-NLS-1$
+ public static final String ICON_NOT_EXPANDED_WITH_LINES = "/tree/iconNotCollapsedWithLines.gif"; //$NON-NLS-1$
+ public static final String ICON_NOT_EXPANDED_WITH_ALL_LINES = "/tree/iconNotCollapsedWithAllLines.gif"; //$NON-NLS-1$
+ public static final String ICON_NOT_EXPANDED_WITHOUT_LINES = "/tree/iconNotCollapsed.gif"; //$NON-NLS-1$
+ public static final String ICON_EXPANDED_ADAPTER_WITH_LINES = "/tree/iconClosedNodeWithLines.gif"; //$NON-NLS-1$
+ public static final String ICON_EXPANDED_ADAPTER_WITHOUT_LINES = "/tree/iconClosedNode.gif"; //$NON-NLS-1$
+ public static final String ICON_LEAF_WITH_LINES = "/tree/iconLeafWithLines.gif"; //$NON-NLS-1$
+ public static final String ICON_RIGHT_LINE = "/tree/rightLine.gif"; //$NON-NLS-1$
+ public static final String ICON_LEFT_LINE = "/tree/leftLine.gif"; //$NON-NLS-1$
+ public static final String ICON_LINE = "/tree/line.gif"; //$NON-NLS-1$
+ public static final String ICON_LEAF_WITHOUT_LINES = "/tree/iconLeaf.gif"; //$NON-NLS-1$
+ protected static final String TREE_TABLE_PICTURE_STYLE_CLASS_NAME = "treePictureStyle"; //$NON-NLS-1$
+ protected static final String STYLE_CLASS_FOR_NODE_TITLE = "treeNodeNameStyle"; //$NON-NLS-1$
+ protected static final String NODE_TITLE_STYLE_CLASS_ATTR_NAME = "nodeClass"; //$NON-NLS-1$
+ protected static final String NODE_ICON_EXPANDED_ATTR_NAME = "iconExpanded"; //$NON-NLS-1$
+ protected static final String NODE_ICON_ATTR_NAME = "icon"; //$NON-NLS-1$
+ protected static final String TREE_TABLE_ATR_CELLSPACING_VALUE = "0px"; //$NON-NLS-1$
+ protected static final String TREE_TABLE_ATR_CELLPADDING_VALUE = "0px"; //$NON-NLS-1$
+ protected static final String TREE_TABLE_ATR_BORDER_VALUE = "0px"; //$NON-NLS-1$
+ protected static final String NODE_LINES_STYLE = "background-position: center; background-repeat: repeat-y;"; //$NON-NLS-1$
+
+ /**
+ * Get showConnectingLines attribute
+ *
+ * @param sourceNode
+ * @return
+ */
+ protected boolean getShowLinesAttr(Node sourceNode) {
+ String treeName = sourceNode.getPrefix() + Constants.COLON + TREE;
+ do {
+ sourceNode = sourceNode.getParentNode();
+ if (!(sourceNode instanceof Element)) {
+ return true;
+ }
+ } while (!sourceNode.getNodeName().equals(treeName));
+
+ String showLinesParam = ((Element) sourceNode)
+ .getAttribute(SHOW_LINES_ATTR_NAME);
+
+ boolean showLinesValue = true;
+ if (showLinesParam != null
+ && Constants.FALSE.equalsIgnoreCase(showLinesParam)) {
+ showLinesValue = false;
+ }
+ return showLinesValue;
+ }
+
+ /**
+ * Is adapter between treeNodes
+ *
+ * @param sourceNode
+ * @return
+ */
+ protected boolean isAdapterBetweenNodes(Node sourceNode) {
+ Node parentNode = sourceNode.getParentNode();
+ NodeList childs = parentNode.getChildNodes();
+ Node beforeAdapterNode = null;
+ Node afterAdapterNode = null;
+ Node adapterNode = null;
+ String treeNodeName = sourceNode.getPrefix() + Constants.COLON
+ + TREE_NODE;
+ for (int i = 0; i < childs.getLength(); i++) {
+ Node el = childs.item(i);
+ if (!(el instanceof Element)) {
+ continue;
+ }
+ if (el.equals(sourceNode)) {
+ adapterNode = el;
+ } else {
+ if (el.getNodeName().equals(treeNodeName)) {
+ if (adapterNode == null) {
+ beforeAdapterNode = el;
+ } else {
+ afterAdapterNode = el;
+ }
+ }
+
+ }
+
+ }
+
+ if (beforeAdapterNode != null && afterAdapterNode != null) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Next element is Adaptor
+ *
+ * @param sourceNode
+ * @return
+ */
+ protected boolean isHasNextAdaptorElement(Node sourceNode) {
+ Node parentTree = sourceNode.getParentNode();
+ if (!(parentTree instanceof Element)) {
+ return true;
+ }
+ NodeList childs = parentTree.getChildNodes();
+ String treeNodesAdaptorName = parentTree.getPrefix() + Constants.COLON
+ + TREE_NODES_ADAPTOR;
+ String treeRecursiveNodesAdaptorName = parentTree.getPrefix()
+ + Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
+ Node lastElement = null;
+ Node el = null;
+
+ for (int i = 0; i < childs.getLength(); i++) {
+ el = childs.item(i);
+ if (!(el instanceof Element)) {
+ continue;
+ }
+
+ if (lastElement != null) {
+ break;
+ }
+
+ if (sourceNode.equals(el)) {
+ lastElement = el;
+ }
+ }
+ if (el.getNodeName().equals(treeNodesAdaptorName)
+ || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Has Next element
+ *
+ * @param sourceNode
+ * @return
+ */
+ protected boolean isHasNextParentAdaptorElement(Node sourceNode) {
+ Node tree = sourceNode.getParentNode();
+ if (!(tree instanceof Element)) {
+ return true;
+ }
+ Node parentTree = tree.getParentNode();
+ if (!(parentTree instanceof Element)) {
+ return true;
+ }
+ NodeList childs = parentTree.getChildNodes();
+ String treeNodeName = parentTree.getPrefix() + Constants.COLON
+ + TREE_NODE;
+ String treeNodesAdaptorName = parentTree.getPrefix() + Constants.COLON
+ + TREE_NODES_ADAPTOR;
+ String treeRecursiveNodesAdaptorName = parentTree.getPrefix()
+ + Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
+ Node lastElement = null;
+ Node el = null;
+
+ for (int i = 0; i < childs.getLength(); i++) {
+ el = childs.item(i);
+ if (!(el instanceof Element)) {
+ continue;
+ }
+
+ if (lastElement != null) {
+ break;
+ }
+ if (el.equals(tree)) {
+ lastElement = el;
+ }
+ }
+
+ if (el.getNodeName().equals(treeNodeName)
+ || el.getNodeName().equals(treeNodesAdaptorName)
+ || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @param sourceNode
+ * @return
+ */
+ protected boolean isHasParentAdapter(Node sourceNode) {
+ String treeNodesAdaptorName = sourceNode.getPrefix() + Constants.COLON
+ + TREE_NODES_ADAPTOR;
+ String recursiveTreeNodesAdaptorName = sourceNode.getPrefix()
+ + Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
+ Node node = sourceNode.getParentNode();
+ if (node.getNodeName().equals(treeNodesAdaptorName)
+ || node.getNodeName().equals(recursiveTreeNodesAdaptorName)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * Function for parsing tree by tree nodes;
+ *
+ * @param pageContext
+ * @param sourceNode
+ * @param visualDocument
+ * @return
+ */
+ protected void parseTree(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument, VpeCreationData vpeCreationData,
+ nsIDOMElement parentElement) {
+ NodeList nodeList = sourceNode.getChildNodes();
+ Element element = null;
+ int lenght = nodeList.getLength();
+ String treeNodeName = sourceNode.getPrefix() + Constants.COLON
+ + TREE_NODE;
+ String treeNodesAdaptorName = sourceNode.getPrefix() + Constants.COLON
+ + TREE_NODES_ADAPTOR;
+ String recursiveTreeNodesAdaptorName = sourceNode.getPrefix()
+ + Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
+ VpeChildrenInfo vpeChildrenInfo = null;
+ for (int i = 0; i < lenght; i++) {
+ if (!(nodeList.item(i) instanceof Element)) {
+ continue;
+ }
+ element = (Element) nodeList.item(i);
+ if (element.getNodeName().equals(treeNodeName)
+ || element.getNodeName().equals(
+ recursiveTreeNodesAdaptorName)) {
+ vpeChildrenInfo = new VpeChildrenInfo(parentElement);
+ vpeCreationData.addChildrenInfo(vpeChildrenInfo);
+ vpeChildrenInfo.addSourceChild(element);
+ } else if (element.getNodeName().equals(treeNodesAdaptorName)) {
+ vpeChildrenInfo = new VpeChildrenInfo(parentElement);
+ vpeCreationData.addChildrenInfo(vpeChildrenInfo);
+ vpeChildrenInfo.addSourceChild(element);
+ }
+ }
+ }
+
+ /**
+ * Create simple tree node attribute.Used for creating more complex trees.
+ *
+ * @param treeNodeTitle
+ * @param visualDocument
+ * @return tree
+ */
+ protected void createBasicTree(VpePageContext pageContext,
+ nsIDOMDocument visualDocument, nsIDOMElement treeRow,
+ Node sourceNode, VpeCreationData vpeCreationData) {
+ // creates icon node
+ String backgroundLinePath = null;
+
+ boolean showLinesValue = getShowLinesAttr((Element) sourceNode);
+ nsIDOMElement iconNode = visualDocument.createElement(HTML.TAG_TD);
+ // creates icon with status of node(collapsed or not) node
+ nsIDOMElement td1 = visualDocument.createElement(HTML.TAG_TD);
+ // sets icon node
+ if (!isLastElement(sourceNode) && isAdaptorChild(sourceNode)
+ && !isHasNextAdaptorElement(sourceNode)) {
+ backgroundLinePath = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_LINE;
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, td1, NODE_ICON_EXPANDED_ATTR_NAME,
+ showLinesValue == true ? ICON_EXPANDED_ADAPTER_WITH_LINES
+ : ICON_EXPANDED_ADAPTER_WITHOUT_LINES);
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, iconNode, NODE_ICON_ATTR_NAME,
+ showLinesValue == true ? ICON_NODE_WITH_LINE
+ : ICON_NODE_WITHOUT_LINES);
+ } else if (!isLastElement(sourceNode) && isAdaptorChild(sourceNode)
+ && isHasNextAdaptorElement(sourceNode)) {
+ backgroundLinePath = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_LINE;
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, td1, NODE_ICON_EXPANDED_ATTR_NAME,
+ showLinesValue == true ? ICON_EXPANDED_ADAPTER_WITH_LINES
+ : ICON_EXPANDED_ADAPTER_WITHOUT_LINES);
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, iconNode, NODE_ICON_ATTR_NAME,
+ showLinesValue == true ? ICON_NODE_WITH_LINES
+ : ICON_NODE_WITHOUT_LINES);
+ if (showLinesValue) {
+ String path = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_LEFT_LINE;
+ iconNode.setAttribute(HTML.ATTR_STYLE,
+ "background-image: url(file://" + path + "); " //$NON-NLS-1$ //$NON-NLS-2$
+ + NODE_LINES_STYLE);
+ }
+ } else if ((isAdaptorChild(sourceNode) && isLastElement(sourceNode) && (isLastElementAfterAdaptor(sourceNode) == isAdaptorInTree(sourceNode)))
+ || (!isAdaptorChild(sourceNode) && isLastElement(sourceNode))
+ || (isAdaptorChild(sourceNode) && isOnlyOneNodeInAdaptor(sourceNode))) {
+
+ if (isAdaptorChild(sourceNode)
+ && isOnlyOneNodeInAdaptor(sourceNode)
+ && !isLastElementAfterAdaptor(sourceNode)
+ && isHasNextParentAdaptorElement(sourceNode)) {
+ backgroundLinePath = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_LINE;
+ setAttributeForPictureNode(
+ pageContext,
+ visualDocument,
+ (Element) sourceNode,
+ td1,
+ NODE_ICON_EXPANDED_ATTR_NAME,
+ showLinesValue == true ? ICON_NOT_EXPANDED_WITH_ALL_LINES
+ : ICON_NOT_EXPANDED_WITHOUT_LINES);
+ } else {
+ backgroundLinePath = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_RIGHT_LINE;
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, td1,
+ NODE_ICON_EXPANDED_ATTR_NAME,
+ showLinesValue == true ? ICON_NOT_EXPANDED_WITH_LINES
+ : ICON_NOT_EXPANDED_WITHOUT_LINES);
+ }
+
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, iconNode, NODE_ICON_LEAF_ATTR_NAME,
+ showLinesValue == true ? ICON_LEAF_WITH_LINES
+ : ICON_LEAF_WITHOUT_LINES);
+ } else {
+ backgroundLinePath = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_RIGHT_LINE;
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, td1, NODE_ICON_EXPANDED_ATTR_NAME,
+ showLinesValue == true ? ICON_EXPANDED_WITH_LINES
+ : ICON_EXPANDED_WITHOUT_LINES);
+
+ if (showLinesValue) {
+ String path = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_LEFT_LINE;
+ iconNode.setAttribute(HTML.ATTR_STYLE,
+ "background-image: url(file://" + path + "); " //$NON-NLS-1$ //$NON-NLS-2$
+ + NODE_LINES_STYLE);
+ }
+
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, iconNode, NODE_ICON_ATTR_NAME,
+ showLinesValue == true ? ICON_NODE_WITH_LINES
+ : ICON_NODE_WITHOUT_LINES);
+ }
+
+ if (showLinesValue) {
+ td1.setAttribute(HTML.ATTR_STYLE,
+ "background-image: url(file://" + backgroundLinePath //$NON-NLS-1$
+ + "); " + NODE_LINES_STYLE); //$NON-NLS-1$
+ }
+ treeRow.appendChild(td1);
+ treeRow.appendChild(iconNode);
+ // creates Tree Node Name Message
+ nsIDOMElement nodeTitle = visualDocument.createElement(HTML.TAG_TD);
+ addBasicNodeTitleAttributes(nodeTitle);
+ // Create mapping to Encode body
+ String treeRecursiveNodesAdaptorName = sourceNode.getPrefix()
+ + Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
+ if (sourceNode.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
+ Element sourceElement = (Element) sourceNode;
+ String nodes = sourceElement
+ .getAttribute(RichFacesRecursiveTreeNodesAdaptorTemplate.NODES_NAME);
+ nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
+ nsIDOMText text = visualDocument
+ .createTextNode((nodes == null) ? Constants.EMPTY : nodes);
+ span.appendChild(text);
+ nodeTitle.appendChild(span);
+ } else {
+ VpeChildrenInfo tdInfo = new VpeChildrenInfo(nodeTitle);
+
+ // Create mapping to Encode body
+ List<Node> children = ComponentUtil.getChildren(
+ (Element) sourceNode, false);
+ for (Node child : children) {
+ tdInfo.addSourceChild(child);
+ }
+ vpeCreationData.addChildrenInfo(tdInfo);
+ }
+ treeRow.appendChild(nodeTitle);
+
+ }
+
+ /**
+ *
+ * @param parentTree
+ * @param sourceNode
+ * @return
+ */
+ protected boolean isLastElement(nsIDOMNode sourceNode) {
+ nsIDOMNode parentTree = sourceNode.getParentNode();
+ if (!(parentTree instanceof Element)) {
+ return true;
+ }
+ nsIDOMNodeList childs = parentTree.getChildNodes();
+ String treeNodeName = parentTree.getPrefix() + Constants.COLON
+ + TREE_NODE;
+ String treeNodesAdaptorName = parentTree.getPrefix() + Constants.COLON
+ + TREE_NODES_ADAPTOR;
+ String treeRecursiveNodesAdaptorName = parentTree.getPrefix()
+ + Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
+ nsIDOMNode lastElement = null;
+ nsIDOMNode el = null;
+ for (int i = 0; i < childs.getLength(); i++) {
+ el = childs.item(i);
+ if (el.getNodeName().equals(treeNodeName)
+ || el.getNodeName().equals(treeNodesAdaptorName)
+ || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
+ lastElement = el;
+ }
+ }
+ return sourceNode.equals(lastElement);
+ }
+
+ /**
+ * Node is Adaptor child
+ *
+ * @param sourceNode
+ * @return
+ */
+ private boolean isAdaptorChild(Node sourceNode) {
+ Node parentNode = sourceNode.getParentNode();
+ if (!(parentNode instanceof Element)) {
+ return true;
+ }
+
+ String treeNodesAdaptorName = sourceNode.getPrefix() + Constants.COLON
+ + TREE_NODES_ADAPTOR;
+ String treeRecursiveNodesAdaptorName = sourceNode.getPrefix()
+ + Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
+ if (parentNode.getNodeName().equals(treeNodesAdaptorName)
+ || parentNode.getNodeName().equals(
+ treeRecursiveNodesAdaptorName)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Node is last element
+ *
+ * @param parentTree
+ * @param sourceNode
+ * @return
+ */
+ protected boolean isLastElement(Node sourceNode) {
+ Node parentTree = sourceNode.getParentNode();
+ if (!(parentTree instanceof Element)) {
+ return true;
+ }
+ NodeList childs = parentTree.getChildNodes();
+ String treeNodeName = parentTree.getPrefix() + Constants.COLON
+ + TREE_NODE;
+ String treeNodesAdaptorName = parentTree.getPrefix() + Constants.COLON
+ + TREE_NODES_ADAPTOR;
+ String treeRecursiveNodesAdaptorName = parentTree.getPrefix()
+ + Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
+ Node lastElement = null;
+ Node el = null;
+ for (int i = 0; i < childs.getLength(); i++) {
+ el = childs.item(i);
+ if (el.getNodeName().equals(treeNodeName)
+ || el.getNodeName().equals(treeNodesAdaptorName)
+ || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
+ lastElement = el;
+ }
+ }
+ return sourceNode.equals(lastElement);
+ }
+
+ /**
+ * Adds basic attributes to tree
+ *
+ * @param img
+ */
+
+ private void addBasicAttributesToPicture(nsIDOMElement img) {
+ img.setAttribute(HTML.ATTR_CLASS, TREE_TABLE_PICTURE_STYLE_CLASS_NAME);
+ }
+
+ /**
+ * Sets attributes for no node title name
+ *
+ * @param nodeTitle
+ */
+ private void addBasicNodeTitleAttributes(nsIDOMElement nodeTitle) {
+ nodeTitle.setAttribute(HTML.ATTR_CLASS, STYLE_CLASS_FOR_NODE_TITLE);
+ }
+
+ /**
+ * Used for setting images into tree nodes
+ *
+ * @param pageContext
+ * page context
+ * @param visualDocument
+ * visual document
+ * @param sourceNode
+ * treeNode element
+ * @param iconCell
+ * cell were image should be setted
+ * @param nodeAttrName
+ * image attr name( icon, iconExpanded, ...)
+ * @param defaultImage
+ * (image by default)
+ */
+ private void setAttributeForPictureNode(VpePageContext pageContext,
+ nsIDOMDocument visualDocument, Element sourceNode,
+ nsIDOMElement iconCell, String nodeAttrName, String defaultImage) {
+ if (RichFacesTemplatesActivator.getDefault().isDebugging()) {
+ System.out.println("call setAttributeForPictureNode"); //$NON-NLS-1$
+ }
+ nsIDOMElement img = visualDocument.createElement(HTML.TAG_IMG);
+ addBasicAttributesToPicture(img);
+ iconCell.appendChild(img);
+ // get image from treeNode
+ String imgName = sourceNode.getAttribute(nodeAttrName);
+ // if in tree node image doesn't exist we get image attr from tree
+ if (imgName == null || imgName.length() == 0) {
+ Node parentElement = sourceNode.getParentNode();
+ if (parentElement instanceof Element) {
+ imgName = ((Element) parentElement).getAttribute(nodeAttrName);
+ }
+ } else {
+ img.setAttribute(ICON_PARAM_NAME, Constants.EMPTY);
+ }
+ // if we can't get attribute from parent we use default attribute
+ addBasicAttributesToPicture(img);
+ iconCell.appendChild(img);
+ if (imgName == null || imgName.length() == 0) {
+ ComponentUtil.setImg(img, defaultImage);
+ } else {
+ ComponentUtil.setImgFromResources(pageContext, img, imgName,
+ UNDEFINED_ICON);
+ }
+ if (nodeAttrName.equals(NODE_ICON_EXPANDED_ATTR_NAME)) {
+ img
+ .setAttribute(ICON_PARAM_NAME,
+ DEFAULT_ICON_EXPANDED_PARAM_VALUE);
+ } else if (nodeAttrName.equals(NODE_ICON_ATTR_NAME)) {
+ img.setAttribute(ICON_PARAM_NAME, DEFAULT_ICON_PARAM_VALUE);
+ } else if (nodeAttrName.equals(NODE_ICON_LEAF_ATTR_NAME)) {
+ img.setAttribute(ICON_PARAM_NAME, NODE_ICON_LEAF_ATTR_NAME);
+ }
+ }
+
+ private boolean isOnlyOneNodeInAdaptor(Node sourceNode) {
+ Node parent = sourceNode.getParentNode();
+ NodeList list = parent.getChildNodes();
+ Node currentNode = null;
+ String treeNodeName = sourceNode.getPrefix() + Constants.COLON
+ + RichFacesTreeTemplate.TREE_NODE_NAME;
+ for (int i = 0; i < list.getLength(); i++) {
+ Node el = list.item(i);
+ if (!(el instanceof Element)) {
+ continue;
+ }
+ if (el.getNodeName().equals(treeNodeName)) {
+ if (currentNode == null) {
+ currentNode = el;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Node has element after adaptor
+ *
+ * @param sourceNode
+ * @return
+ */
+ private boolean isLastElementAfterAdaptor(Node sourceNode) {
+ Node nodeAdaptor = sourceNode.getParentNode();
+ if (!(nodeAdaptor instanceof Element)) {
+ return true;
+ }
+ return isLastElement(nodeAdaptor);
+ }
+
+ /**
+ *
+ * @param sourceNode
+ * @return
+ */
+ private boolean isAdaptorInTree(Node sourceNode) {
+ Node adaptorNode = sourceNode.getParentNode();
+ if (!(adaptorNode instanceof Element)) {
+ return true;
+ }
+ String treeNodesAdaptorName = adaptorNode.getPrefix() + Constants.COLON
+ + TREE_NODES_ADAPTOR;
+ String treeRecursiveNodesAdaptorName = adaptorNode.getPrefix()
+ + Constants.COLON + RECURSIVE_TREE_NODES_ADAPTOR;
+ if (adaptorNode.getNodeName().equals(treeNodesAdaptorName)
+ || adaptorNode.getNodeName().equals(
+ treeRecursiveNodesAdaptorName)) {
+ Node treeNode = adaptorNode.getParentNode();
+ String treeName = treeNode.getPrefix() + Constants.COLON + TREE;
+ if (treeNode.getNodeName().equals(treeName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Set attributes for treeNode
+ *
+ * @param table
+ */
+ protected void addBasicTreeNodeAttributes(nsIDOMElement table) {
+ if (table == null) {
+ return;
+ }
+ table.setAttribute(HTML.ATTR_CELLPADDING,
+ TREE_TABLE_ATR_CELLPADDING_VALUE);
+ table.setAttribute(HTML.ATTR_CELLSPACING,
+ TREE_TABLE_ATR_CELLSPACING_VALUE);
+ table.setAttribute(HTML.ATTR_BORDER, TREE_TABLE_ATR_BORDER_VALUE);
+ table.setAttribute(HTML.ATTR_CLASS, "dr-tree-full-width"); //$NON-NLS-1$
+ }
+
+ /**
+ * Checks for attributes for node and if such exist convert it's to html
+ * atributes.
+ *
+ * @param sourceNode
+ * @param tableRow
+ */
+ protected void addAttributeToTableNode(Element sourceNode,
+ nsIDOMElement tableRow) {
+
+ String attrValue = sourceNode
+ .getAttribute(NODE_TITLE_STYLE_CLASS_ATTR_NAME);
+ if ((attrValue != null) && (attrValue.length() > 0)) {
+ tableRow.setAttribute(HTML.ATTR_CLASS, attrValue);
+ }
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractTreeTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java 2008-12-17 16:30:18 UTC (rev 12644)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java 2008-12-17 17:56:32 UTC (rev 12645)
@@ -13,7 +13,6 @@
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.RichFacesTemplatesActivator;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -30,36 +29,39 @@
*
*/
public class RichFacesRecursiveTreeNodesAdaptorTemplate extends
- RichFacesTreeNodeTemplate {
+ RichFacesAbstractTreeTemplate {
- private static final String TREE_NAME = "tree"; //$NON-NLS-1$
-
- private final static String TREE_NODE_NAME = "treeNode"; //$NON-NLS-1$
-
- public final static String TREE_NODES_ADAPTOR_NAME = "treeNodesAdaptor"; //$NON-NLS-1$
-
- public final static String RECURSIVE_TREE_NODES_ADAPTOR_NAME = "recursiveTreeNodesAdaptor"; //$NON-NLS-1$
-
private static final String STYLE_PATH = "/tree/tree.css"; //$NON-NLS-1$
-
public static final String ICON_DIV_LINE = "/tree/divLine.gif"; //$NON-NLS-1$
-
private static final String ADAPTER_LINES_STYLE = "background-position: left center; background-repeat: repeat-y;"; //$NON-NLS-1$
-
public static final String ID_ATTR_NAME = "ID"; //$NON-NLS-1$
-
public static final String NODES_NAME = "nodes"; //$NON-NLS-1$
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
if (isEmptyNode(sourceNode)) {
- return super.create(pageContext, sourceNode, visualDocument);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ nsIDOMElement visualElement = visualDocument
+ .createElement(HTML.TAG_TABLE);
+ addBasicTreeNodeAttributes(visualElement);
+ div.appendChild(visualElement);
+ nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
+
+ nsIDOMElement tableRow = visualDocument.createElement(HTML.TAG_TR);
+ addAttributeToTableNode((Element) sourceNode, tableRow);
+ visualElement.appendChild(tbody);
+ tbody.appendChild(tableRow);
+
+ VpeCreationData vpeCreationData = new VpeCreationData(div);
+ createBasicTree(pageContext, visualDocument, tableRow, sourceNode,
+ vpeCreationData);
+ return vpeCreationData;
} else {
ComponentUtil.setCSSLink(pageContext, STYLE_PATH,
- "treeNodesAdaptor"); //$NON-NLS-1$
+ TREE_NODES_ADAPTOR);
nsIDOMElement visualElement = visualDocument
.createElement(HTML.TAG_DIV);
- visualElement.setAttribute(ID_ATTR_NAME, TREE_NODES_ADAPTOR_NAME);
+ visualElement.setAttribute(ID_ATTR_NAME, TREE_NODES_ADAPTOR);
if (isHasParentAdapter(sourceNode)) {
visualElement.setAttribute(HTML.ATTR_CLASS,
"dr-tree-h-ic-div"); //$NON-NLS-1$
@@ -83,176 +85,6 @@
/**
*
- * Function for parsing tree by tree nodes;
- *
- * @param pageContext
- * @param sourceNode
- * @param visualDocument
- * @return
- */
- public void parseTree(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument, VpeCreationData vpeCreationData,
- nsIDOMElement parentElement) {
- NodeList nodeList = sourceNode.getChildNodes();
- Element element = null;
- int lenght = nodeList.getLength();
- String treeNodeName = sourceNode.getPrefix() + ":" + TREE_NODE_NAME; //$NON-NLS-1$
- String treeNodesAdaptorName = sourceNode.getPrefix() + ":" //$NON-NLS-1$
- + TREE_NODES_ADAPTOR_NAME;
- String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":" //$NON-NLS-1$
- + RECURSIVE_TREE_NODES_ADAPTOR_NAME;
- VpeChildrenInfo vpeChildrenInfo = null;
- for (int i = 0; i < lenght; i++) {
- if (!(nodeList.item(i) instanceof Element)) {
- continue;
- }
- element = (Element) nodeList.item(i);
- if (element.getNodeName().equals(treeNodeName)
- || element.getNodeName().equals(
- recursiveTreeNodesAdaptorName)) {
- vpeChildrenInfo = new VpeChildrenInfo(parentElement);
- vpeCreationData.addChildrenInfo(vpeChildrenInfo);
- vpeChildrenInfo.addSourceChild(element);
- } else if (element.getNodeName().equals(treeNodesAdaptorName)) {
- vpeChildrenInfo = new VpeChildrenInfo(parentElement);
- vpeCreationData.addChildrenInfo(vpeChildrenInfo);
- vpeChildrenInfo.addSourceChild(element);
- }
- }
- }
-
- /**
- *
- * @param sourceNode
- * @return
- */
- public boolean isHasParentAdapter(Node sourceNode) {
- String treeNodesAdaptorName = sourceNode.getPrefix() + ":" //$NON-NLS-1$
- + TREE_NODES_ADAPTOR_NAME;
- String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":" //$NON-NLS-1$
- + RECURSIVE_TREE_NODES_ADAPTOR_NAME;
- Node node = sourceNode.getParentNode();
- if (node.getNodeName().equals(treeNodesAdaptorName)
- || node.getNodeName().equals(recursiveTreeNodesAdaptorName)) {
- return true;
- }
- return false;
- }
-
- /**
- * Get showConnectingLines attribute
- *
- * @param sourceNode
- * @return
- */
- private boolean getShowLinesAttr(Node sourceNode) {
- String treeName = sourceNode.getPrefix() + ":" + TREE_NAME; //$NON-NLS-1$
- do {
- sourceNode = sourceNode.getParentNode();
- if (!(sourceNode instanceof Element)) {
- return true;
- }
- } while (!sourceNode.getNodeName().equals(treeName));
-
- String showLinesParam = ((Element) sourceNode)
- .getAttribute(RichFacesTreeTemplate.SHOW_LINES_ATTR_NAME);
-
- boolean showLinesValue = true;
- if (showLinesParam != null && showLinesParam.equalsIgnoreCase("false")) { //$NON-NLS-1$
- showLinesValue = false;
- }
- return showLinesValue;
- }
-
- /**
- * Has Next element
- *
- * @param sourceNode
- * @return
- */
- private boolean isHasNextParentAdaptorElement(Node sourceNode) {
- Node tree = sourceNode.getParentNode();
- if (!(tree instanceof Element)) {
- return true;
- }
- Node parentTree = tree.getParentNode();
- if (!(parentTree instanceof Element)) {
- return true;
- }
- NodeList childs = parentTree.getChildNodes();
- String treeNodeName = parentTree.getPrefix() + ":" //$NON-NLS-1$
- + RichFacesTreeTemplate.TREE_NODE_NAME;
- String treeNodesAdaptorName = parentTree.getPrefix() + ":" //$NON-NLS-1$
- + RichFacesTreeTemplate.TREE_NODES_ADAPTOR;
- String treeRecursiveNodesAdaptorName = parentTree.getPrefix() + ":" //$NON-NLS-1$
- + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
- Node lastElement = null;
- Node el = null;
-
- for (int i = 0; i < childs.getLength(); i++) {
- el = childs.item(i);
- if (!(el instanceof Element)) {
- continue;
- }
-
- if (lastElement != null) {
- break;
- }
- if (el.equals(tree)) {
- lastElement = el;
- }
- }
-
- if (el.getNodeName().equals(treeNodeName)
- || el.getNodeName().equals(treeNodesAdaptorName)
- || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
- return true;
- }
- return false;
- }
-
- /**
- * Is adapter between treeNodes
- *
- * @param sourceNode
- * @return
- */
- private boolean isAdapterBetweenNodes(Node sourceNode) {
- Node parentNode = sourceNode.getParentNode();
- NodeList childs = parentNode.getChildNodes();
- Node beforeAdapterNode = null;
- Node afterAdapterNode = null;
- Node adapterNode = null;
- String treeNodeName = sourceNode.getPrefix() + ":" //$NON-NLS-1$
- + RichFacesTreeTemplate.TREE_NODE_NAME;
- for (int i = 0; i < childs.getLength(); i++) {
- Node el = childs.item(i);
- if (!(el instanceof Element)) {
- continue;
- }
- if (el.equals(sourceNode)) {
- adapterNode = el;
- } else {
- if (el.getNodeName().equals(treeNodeName)) {
- if (adapterNode == null) {
- beforeAdapterNode = el;
- } else {
- afterAdapterNode = el;
- }
- }
-
- }
-
- }
-
- if (beforeAdapterNode != null && afterAdapterNode != null) {
- return true;
- }
- return false;
- }
-
- /**
- *
* @param sourceElement
* @return
*/
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java 2008-12-17 16:30:18 UTC (rev 12644)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java 2008-12-17 17:56:32 UTC (rev 12645)
@@ -10,23 +10,16 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
-import java.util.List;
-
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.RichFacesTemplatesActivator;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
-import org.mozilla.interfaces.nsIDOMNodeList;
-import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* Create template for rich:treeNodes element
@@ -34,68 +27,8 @@
* @author dsakovich(a)exadel.com
*
*/
-public class RichFacesTreeNodeTemplate extends VpeAbstractTemplate {
+public class RichFacesTreeNodeTemplate extends RichFacesAbstractTreeTemplate {
- public static final String DEFAULT_ICON_PARAM_VALUE = "DEFAULT_ICON_PARAM";
-
- public static final String ICON_PARAM_NAME = "richFacesTreeNodeParam";
-
- public static final String DEFAULT_ICON_EXPANDED_PARAM_VALUE = "DEFAULT_ICON_EXPANDED_PARAM";
-
- public static final String UNDEFINED_ICON = "/tree/unresolved.gif";
-
- public static final String NODE_ICON_LEAF_ATTR_NAME = "iconLeaf";
-
- public static final String ICON_NODE_WITH_LINES = "/tree/iconNodeWithLines.gif";
-
- public static final String ICON_NODE_WITH_LINE = "/tree/iconNodeWithLine.gif";
-
- public static final String ICON_EXPANDED_WITH_LINES = "/tree/iconCollapsedWithLines.gif";
-
- public static final String ICON_NODE_WITHOUT_LINES = "/tree/iconNode.gif";
-
- public static final String ICON_EXPANDED_WITHOUT_LINES = "/tree/iconCollapsed.gif";
-
- public static final String ICON_NOT_EXPANDED_WITH_LINES = "/tree/iconNotCollapsedWithLines.gif";
-
- public static final String ICON_NOT_EXPANDED_WITH_ALL_LINES = "/tree/iconNotCollapsedWithAllLines.gif";
-
- public static final String ICON_NOT_EXPANDED_WITHOUT_LINES = "/tree/iconNotCollapsed.gif";
-
- public static final String ICON_EXPANDED_ADAPTER_WITH_LINES = "/tree/iconClosedNodeWithLines.gif";
-
- public static final String ICON_EXPANDED_ADAPTER_WITHOUT_LINES = "/tree/iconClosedNode.gif";
-
- public static final String ICON_LEAF_WITH_LINES = "/tree/iconLeafWithLines.gif";
-
- public static final String ICON_RIGHT_LINE = "/tree/rightLine.gif";
-
- public static final String ICON_LEFT_LINE = "/tree/leftLine.gif";
-
- public static final String ICON_LINE = "/tree/line.gif";
-
- public static final String ICON_LEAF_WITHOUT_LINES = "/tree/iconLeaf.gif";
-
- private static final String TREE_TABLE_PICTURE_STYLE_CLASS_NAME = "treePictureStyle";
-
- private static final String STYLE_CLASS_FOR_NODE_TITLE = "treeNodeNameStyle";
-
- private static final String NODE_TITLE_STYLE_CLASS_ATTR_NAME = "nodeClass";
-
- private static final String NODE_ICON_EXPANDED_ATTR_NAME = "iconExpanded";
-
- private static final String NODE_ICON_ATTR_NAME = "icon";
-
- private static final String TREE_TABLE_ATR_CELLSPACING_VALUE = "0px";
-
- private static final String TREE_TABLE_ATR_CELLPADDING_VALUE = "0px";
-
- private static final String TREE_TABLE_ATR_BORDER_VALUE = "0px";
-
- private static final String TREE_NAME = "tree";
-
- private static final String NODE_LINES_STYLE = "background-position: center; background-repeat: repeat-y;";
-
/**
* Creates a node of the visual tree on the node of the source tree. This
* visual node should not have the parent node This visual node can have
@@ -112,17 +45,14 @@
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- nsIDOMElement div = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
nsIDOMElement visualElement = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ .createElement(HTML.TAG_TABLE);
addBasicTreeNodeAttributes(visualElement);
div.appendChild(visualElement);
- nsIDOMElement tbody = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
- nsIDOMElement tableRow = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement tableRow = visualDocument.createElement(HTML.TAG_TR);
addAttributeToTableNode((Element) sourceNode, tableRow);
visualElement.appendChild(tbody);
tbody.appendChild(tableRow);
@@ -133,241 +63,6 @@
return vpeCreationData;
}
- /**
- * Checks for attributes for node and if such exist convert it's to html
- * atributes.
- *
- * @param sourceNode
- * @param tableRow
- */
- private void addAttributeToTableNode(Element sourceNode,
- nsIDOMElement tableRow) {
-
- String attrValue = sourceNode
- .getAttribute(NODE_TITLE_STYLE_CLASS_ATTR_NAME);
- if ((attrValue != null) && (attrValue.length() > 0)) {
- tableRow.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, attrValue);
- }
- }
-
- /**
- * Used for setting images into tree nodes
- *
- * @param pageContext
- * page context
- * @param visualDocument
- * visual document
- * @param sourceNode
- * treeNode element
- * @param iconCell
- * cell were image should be setted
- * @param nodeAttrName
- * image attr name( icon, iconExpanded, ...)
- * @param defaultImage
- * (image by default)
- */
- private void setAttributeForPictureNode(VpePageContext pageContext,
- nsIDOMDocument visualDocument, Element sourceNode,
- nsIDOMElement iconCell, String nodeAttrName, String defaultImage) {
- if (RichFacesTemplatesActivator.getDefault().isDebugging()) {
- System.out.println("call setAttributeForPictureNode");
- }
- nsIDOMElement img = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_IMG);
- addBasicAttributesToPicture(img);
- iconCell.appendChild(img);
- // get image from treeNode
- String imgName = sourceNode.getAttribute(nodeAttrName);
- // if in tree node image doesn't exist we get image attr from tree
- if (imgName == null || imgName.length() == 0) {
- Node parentElement = sourceNode.getParentNode();
- if (parentElement instanceof Element) {
- imgName = ((Element) parentElement).getAttribute(nodeAttrName);
- }
- } else {
- img.setAttribute(ICON_PARAM_NAME, "");
- }
- // if we can't get attribute from parent we use default attribute
- addBasicAttributesToPicture(img);
- iconCell.appendChild(img);
- if (imgName == null || imgName.length() == 0) {
- ComponentUtil.setImg(img, defaultImage);
- } else {
- ComponentUtil.setImgFromResources(pageContext, img, imgName,
- UNDEFINED_ICON);
- }
- if (nodeAttrName.equals(NODE_ICON_EXPANDED_ATTR_NAME)) {
- img
- .setAttribute(ICON_PARAM_NAME,
- DEFAULT_ICON_EXPANDED_PARAM_VALUE);
- } else if (nodeAttrName.equals(NODE_ICON_ATTR_NAME)) {
- img.setAttribute(ICON_PARAM_NAME, DEFAULT_ICON_PARAM_VALUE);
- } else if (nodeAttrName.equals(NODE_ICON_LEAF_ATTR_NAME)) {
- img.setAttribute(ICON_PARAM_NAME, NODE_ICON_LEAF_ATTR_NAME);
- }
- }
-
- /**
- * Create simple tree node attribute.Used for creating more complex trees.
- *
- * @param treeNodeTitle
- * @param visualDocument
- * @return tree
- */
- private void createBasicTree(VpePageContext pageContext,
- nsIDOMDocument visualDocument, nsIDOMElement treeRow,
- Node sourceNode, VpeCreationData vpeCreationData) {
- // creates icon node
- String backgroundLinePath = null;
-
- boolean showLinesValue = getShowLinesAttr((Element) sourceNode);
- nsIDOMElement iconNode = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- // creates icon with status of node(collapsed or not) node
- nsIDOMElement td1 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- // sets icon node
- if (!isLastElement(sourceNode) && isAdaptorChild(sourceNode)
- && !isHasNextAdaptorElement(sourceNode)) {
- backgroundLinePath = RichFacesTemplatesActivator
- .getPluginResourcePath()
- + ICON_LINE;
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, td1, NODE_ICON_EXPANDED_ATTR_NAME,
- showLinesValue == true ? ICON_EXPANDED_ADAPTER_WITH_LINES
- : ICON_EXPANDED_ADAPTER_WITHOUT_LINES);
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, iconNode, NODE_ICON_ATTR_NAME,
- showLinesValue == true ? ICON_NODE_WITH_LINE
- : ICON_NODE_WITHOUT_LINES);
- } else if (!isLastElement(sourceNode) && isAdaptorChild(sourceNode)
- && isHasNextAdaptorElement(sourceNode)) {
- backgroundLinePath = RichFacesTemplatesActivator
- .getPluginResourcePath()
- + ICON_LINE;
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, td1, NODE_ICON_EXPANDED_ATTR_NAME,
- showLinesValue == true ? ICON_EXPANDED_ADAPTER_WITH_LINES
- : ICON_EXPANDED_ADAPTER_WITHOUT_LINES);
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, iconNode, NODE_ICON_ATTR_NAME,
- showLinesValue == true ? ICON_NODE_WITH_LINES
- : ICON_NODE_WITHOUT_LINES);
- if (showLinesValue) {
- String path = RichFacesTemplatesActivator
- .getPluginResourcePath()
- + ICON_LEFT_LINE;
- iconNode.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
- "background-image: url(file://" + path + "); "
- + NODE_LINES_STYLE);
- }
- } else if ((isAdaptorChild(sourceNode) && isLastElement(sourceNode) && (isLastElementAfterAdaptor(sourceNode) == isAdaptorInTree(sourceNode)))
- || (!isAdaptorChild(sourceNode) && isLastElement(sourceNode))
- || (isAdaptorChild(sourceNode) && isOnlyOneNodeInAdaptor(sourceNode))) {
-
- if (isAdaptorChild(sourceNode)
- && isOnlyOneNodeInAdaptor(sourceNode)
- && !isLastElementAfterAdaptor(sourceNode)
- && isHasNextParentAdaptorElement(sourceNode)) {
- backgroundLinePath = RichFacesTemplatesActivator
- .getPluginResourcePath()
- + ICON_LINE;
- setAttributeForPictureNode(
- pageContext,
- visualDocument,
- (Element) sourceNode,
- td1,
- NODE_ICON_EXPANDED_ATTR_NAME,
- showLinesValue == true ? ICON_NOT_EXPANDED_WITH_ALL_LINES
- : ICON_NOT_EXPANDED_WITHOUT_LINES);
- } else {
- backgroundLinePath = RichFacesTemplatesActivator
- .getPluginResourcePath()
- + ICON_RIGHT_LINE;
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, td1,
- NODE_ICON_EXPANDED_ATTR_NAME,
- showLinesValue == true ? ICON_NOT_EXPANDED_WITH_LINES
- : ICON_NOT_EXPANDED_WITHOUT_LINES);
- }
-
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, iconNode, NODE_ICON_LEAF_ATTR_NAME,
- showLinesValue == true ? ICON_LEAF_WITH_LINES
- : ICON_LEAF_WITHOUT_LINES);
- } else {
- backgroundLinePath = RichFacesTemplatesActivator
- .getPluginResourcePath()
- + ICON_RIGHT_LINE;
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, td1, NODE_ICON_EXPANDED_ATTR_NAME,
- showLinesValue == true ? ICON_EXPANDED_WITH_LINES
- : ICON_EXPANDED_WITHOUT_LINES);
-
- if (showLinesValue) {
- String path = RichFacesTemplatesActivator
- .getPluginResourcePath()
- + ICON_LEFT_LINE;
- iconNode.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
- "background-image: url(file://" + path + "); "
- + NODE_LINES_STYLE);
- }
-
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, iconNode, NODE_ICON_ATTR_NAME,
- showLinesValue == true ? ICON_NODE_WITH_LINES
- : ICON_NODE_WITHOUT_LINES);
- }
-
- if (showLinesValue) {
- td1.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
- "background-image: url(file://" + backgroundLinePath
- + "); " + NODE_LINES_STYLE);
- }
- treeRow.appendChild(td1);
- treeRow.appendChild(iconNode);
- // creates Tree Node Name Message
- nsIDOMElement nodeTitle = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- addBasicNodeTitleAttributes(nodeTitle);
- // Create mapping to Encode body
- String treeRecursiveNodesAdaptorName = sourceNode.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
- if (sourceNode.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
- Element sourceElement = (Element) sourceNode;
- String nodes = sourceElement
- .getAttribute(RichFacesRecursiveTreeNodesAdaptorTemplate.NODES_NAME);
- nsIDOMElement span = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- nsIDOMText text = visualDocument
- .createTextNode((nodes == null) ? "" : nodes);
- span.appendChild(text);
- nodeTitle.appendChild(span);
- } else {
- VpeChildrenInfo tdInfo = new VpeChildrenInfo(nodeTitle);
-
- // Create mapping to Encode body
- List<Node> children = ComponentUtil.getChildren(
- (Element) sourceNode, false);
- for (Node child : children) {
- tdInfo.addSourceChild(child);
- }
- vpeCreationData.addChildrenInfo(tdInfo);
- }
- treeRow.appendChild(nodeTitle);
-
- }
-
- /**
- * Sets attributes for no node title name
- *
- * @param nodeTitle
- */
- private void addBasicNodeTitleAttributes(nsIDOMElement nodeTitle) {
- nodeTitle.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- STYLE_CLASS_FOR_NODE_TITLE);
- }
-
@Override
public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data,
@@ -386,7 +81,7 @@
nsIDOMElement.NS_IDOMELEMENT_IID);
ComponentUtil.setImgFromResources(pageContext, img, value,
UNDEFINED_ICON);
- img.setAttribute(ICON_PARAM_NAME, "");
+ img.setAttribute(ICON_PARAM_NAME, Constants.EMPTY);
} else if (NODE_ICON_ATTR_NAME.equals(name)
&& !isLastElement(visualNode)) {
nsIDOMElement iconCell = (nsIDOMElement) visualNode.getChildNodes()
@@ -395,7 +90,7 @@
.item(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
ComponentUtil.setImgFromResources(pageContext, img, value,
UNDEFINED_ICON);
- img.setAttribute(ICON_PARAM_NAME, "");
+ img.setAttribute(ICON_PARAM_NAME, Constants.EMPTY);
} else if (NODE_ICON_LEAF_ATTR_NAME.equals(name)
&& isLastElement(sourceElement)) {
nsIDOMElement iconCell = (nsIDOMElement) visualNode.getChildNodes()
@@ -404,7 +99,7 @@
.item(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
ComponentUtil.setImgFromResources(pageContext, img, value,
UNDEFINED_ICON);
- img.setAttribute(ICON_PARAM_NAME, "");
+ img.setAttribute(ICON_PARAM_NAME, Constants.EMPTY);
}
}
@@ -478,294 +173,4 @@
}
}
- /**
- *
- * @param parentTree
- * @param sourceNode
- * @return
- */
- private boolean isLastElement(nsIDOMNode sourceNode) {
- nsIDOMNode parentTree = sourceNode.getParentNode();
- if (!(parentTree instanceof Element)) {
- return true;
- }
- nsIDOMNodeList childs = parentTree.getChildNodes();
- String treeNodeName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODE_NAME;
- String treeNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODES_ADAPTOR;
- String treeRecursiveNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
- nsIDOMNode lastElement = null;
- nsIDOMNode el = null;
- for (int i = 0; i < childs.getLength(); i++) {
- el = childs.item(i);
- if (el.getNodeName().equals(treeNodeName)
- || el.getNodeName().equals(treeNodesAdaptorName)
- || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
- lastElement = el;
- }
- }
- return sourceNode.equals(lastElement);
- }
-
- /**
- * Node is Adaptor child
- *
- * @param sourceNode
- * @return
- */
- private boolean isAdaptorChild(Node sourceNode) {
- Node parentNode = sourceNode.getParentNode();
- if (!(parentNode instanceof Element)) {
- return true;
- }
-
- String treeNodesAdaptorName = sourceNode.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODES_ADAPTOR;
- String treeRecursiveNodesAdaptorName = sourceNode.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
- if (parentNode.getNodeName().equals(treeNodesAdaptorName)
- || parentNode.getNodeName().equals(
- treeRecursiveNodesAdaptorName)) {
- return true;
- }
- return false;
- }
-
- /**
- * Node is last element
- *
- * @param parentTree
- * @param sourceNode
- * @return
- */
- private boolean isLastElement(Node sourceNode) {
- Node parentTree = sourceNode.getParentNode();
- if (!(parentTree instanceof Element)) {
- return true;
- }
- NodeList childs = parentTree.getChildNodes();
- String treeNodeName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODE_NAME;
- String treeNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODES_ADAPTOR;
- String treeRecursiveNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
- Node lastElement = null;
- Node el = null;
- for (int i = 0; i < childs.getLength(); i++) {
- el = childs.item(i);
- if (el.getNodeName().equals(treeNodeName)
- || el.getNodeName().equals(treeNodesAdaptorName)
- || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
- lastElement = el;
- }
- }
- return sourceNode.equals(lastElement);
- }
-
- /**
- * Next element is Adaptor
- *
- * @param sourceNode
- * @return
- */
- private boolean isHasNextAdaptorElement(Node sourceNode) {
- Node parentTree = sourceNode.getParentNode();
- if (!(parentTree instanceof Element)) {
- return true;
- }
- NodeList childs = parentTree.getChildNodes();
- String treeNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODES_ADAPTOR;
- String treeRecursiveNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
- Node lastElement = null;
- Node el = null;
-
- for (int i = 0; i < childs.getLength(); i++) {
- el = childs.item(i);
- if (!(el instanceof Element)) {
- continue;
- }
-
- if (lastElement != null) {
- break;
- }
-
- if (sourceNode.equals(el)) {
- lastElement = el;
- }
- }
- if (el.getNodeName().equals(treeNodesAdaptorName)
- || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
- return true;
- }
- return false;
- }
-
- /**
- * Adds basic attributes to tree
- *
- * @param img
- */
-
- private void addBasicAttributesToPicture(nsIDOMElement img) {
- img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- TREE_TABLE_PICTURE_STYLE_CLASS_NAME);
- }
-
- /**
- * Set attributes for treeNode
- *
- * @param table
- */
- private void addBasicTreeNodeAttributes(nsIDOMElement table) {
- if (table == null) {
- return;
- }
- table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR,
- TREE_TABLE_ATR_CELLPADDING_VALUE);
- table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR,
- TREE_TABLE_ATR_CELLSPACING_VALUE);
- table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR,
- TREE_TABLE_ATR_BORDER_VALUE);
- table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-tree-full-width");
- }
-
- /**
- * Get showConnectingLines attribute
- *
- * @param sourceNode
- * @return
- */
- private boolean getShowLinesAttr(Node sourceNode) {
- String treeName = sourceNode.getPrefix() + ":" + TREE_NAME;
- do {
- sourceNode = sourceNode.getParentNode();
- if (!(sourceNode instanceof Element)) {
- return true;
- }
- } while (!sourceNode.getNodeName().equals(treeName));
-
- String showLinesParam = ((Element) sourceNode)
- .getAttribute(RichFacesTreeTemplate.SHOW_LINES_ATTR_NAME);
-
- boolean showLinesValue = true;
- if (showLinesParam != null && showLinesParam.equalsIgnoreCase("false")) {
- showLinesValue = false;
- }
- return showLinesValue;
- }
-
- /**
- * Node has element after adaptor
- *
- * @param sourceNode
- * @return
- */
- private boolean isLastElementAfterAdaptor(Node sourceNode) {
- Node nodeAdaptor = sourceNode.getParentNode();
- if (!(nodeAdaptor instanceof Element)) {
- return true;
- }
- return isLastElement(nodeAdaptor);
- }
-
- /**
- *
- * @param sourceNode
- * @return
- */
- private boolean isAdaptorInTree(Node sourceNode) {
- Node adaptorNode = sourceNode.getParentNode();
- if (!(adaptorNode instanceof Element)) {
- return true;
- }
- String treeNodesAdaptorName = adaptorNode.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODES_ADAPTOR;
- String treeRecursiveNodesAdaptorName = adaptorNode.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
- if (adaptorNode.getNodeName().equals(treeNodesAdaptorName)
- || adaptorNode.getNodeName().equals(
- treeRecursiveNodesAdaptorName)) {
- Node treeNode = adaptorNode.getParentNode();
- String treeName = treeNode.getPrefix() + ":" + TREE_NAME;
- if (treeNode.getNodeName().equals(treeName)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isOnlyOneNodeInAdaptor(Node sourceNode) {
- Node parent = sourceNode.getParentNode();
- NodeList list = parent.getChildNodes();
- Node currentNode = null;
- String treeNodeName = sourceNode.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODE_NAME;
- for (int i = 0; i < list.getLength(); i++) {
- Node el = list.item(i);
- if (!(el instanceof Element)) {
- continue;
- }
- if (el.getNodeName().equals(treeNodeName)) {
- if (currentNode == null) {
- currentNode = el;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Has Next element
- *
- * @param sourceNode
- * @return
- */
- private boolean isHasNextParentAdaptorElement(Node sourceNode) {
- Node tree = sourceNode.getParentNode();
- if (!(tree instanceof Element)) {
- return true;
- }
- Node parentTree = tree.getParentNode();
- if (!(parentTree instanceof Element)) {
- return true;
- }
- NodeList childs = parentTree.getChildNodes();
- String treeNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODES_ADAPTOR;
- String treeRecursiveNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
- Node lastElement = null;
- Node el = null;
-
- for (int i = 0; i < childs.getLength(); i++) {
- el = childs.item(i);
- if (!(el instanceof Element)) {
- continue;
- }
-
- if (lastElement != null) {
- break;
- }
- if (el.equals(tree)) {
- lastElement = el;
- }
- }
-
- if (el.getNodeName().equals(treeNodesAdaptorName)
- || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
- return true;
- }
- return false;
- }
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodesAdaptorTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodesAdaptorTemplate.java 2008-12-17 16:30:18 UTC (rev 12644)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodesAdaptorTemplate.java 2008-12-17 17:56:32 UTC (rev 12645)
@@ -11,17 +11,13 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.RichFacesTemplatesActivator;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* Create template for rich:treeNodesAdaptor element
@@ -29,40 +25,29 @@
* @author dsakovich(a)exadel.com
*
*/
-public class RichFacesTreeNodesAdaptorTemplate extends VpeAbstractTemplate {
+public class RichFacesTreeNodesAdaptorTemplate extends RichFacesAbstractTreeTemplate {
- private static final String TREE_NAME = "tree";
+ private static final String STYLE_PATH = "/tree/tree.css"; //$NON-NLS-1$
+ public static final String ICON_DIV_LINE = "/tree/divLine.gif"; //$NON-NLS-1$
+ private static final String ADAPTER_LINES_STYLE = "background-position: left center; background-repeat: repeat-y;"; //$NON-NLS-1$
+ public static final String ID_ATTR_NAME = "ID"; //$NON-NLS-1$
- private final static String TREE_NODE_NAME = "treeNode";
-
- public final static String TREE_NODES_ADAPTOR_NAME = "treeNodesAdaptor";
-
- public final static String RECURSIVE_TREE_NODES_ADAPTOR_NAME = "recursiveTreeNodesAdaptor";
-
- private static final String STYLE_PATH = "/tree/tree.css";
-
- public static final String ICON_DIV_LINE = "/tree/divLine.gif";
-
- private static final String ADAPTER_LINES_STYLE = "background-position: left center; background-repeat: repeat-y;";
-
- public static final String ID_ATTR_NAME = "ID";
-
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "treeNodesAdaptor");
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, TREE_NODES_ADAPTOR);
nsIDOMElement visualElement = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- visualElement.setAttribute(ID_ATTR_NAME, TREE_NODES_ADAPTOR_NAME);
+ .createElement(HTML .TAG_DIV);
+ visualElement.setAttribute(ID_ATTR_NAME, TREE_NODES_ADAPTOR);
if (isHasParentAdapter(sourceNode)) {
- visualElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-tree-h-ic-div");
+ visualElement.setAttribute(HTML.ATTR_CLASS,
+ "dr-tree-h-ic-div"); //$NON-NLS-1$
if (getShowLinesAttr(sourceNode)
&& (isAdapterBetweenNodes(sourceNode) || isHasNextParentAdaptorElement(sourceNode))) {
String path = RichFacesTemplatesActivator
.getPluginResourcePath()
+ ICON_DIV_LINE;
- visualElement.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
- "background-image: url(file://" + path + "); "
+ visualElement.setAttribute(HTML.ATTR_STYLE,
+ "background-image: url(file://" + path + "); " //$NON-NLS-1$ //$NON-NLS-2$
+ ADAPTER_LINES_STYLE);
}
}
@@ -71,175 +56,4 @@
visualElement);
return vpeCreationData;
}
-
- /**
- *
- * Function for parsing tree by tree nodes;
- *
- * @param pageContext
- * @param sourceNode
- * @param visualDocument
- * @return
- */
- public void parseTree(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument, VpeCreationData vpeCreationData,
- nsIDOMElement parentElement) {
- NodeList nodeList = sourceNode.getChildNodes();
- Element element = null;
- int lenght = nodeList.getLength();
- String treeNodeName = sourceNode.getPrefix() + ":" + TREE_NODE_NAME;
- String treeNodesAdaptorName = sourceNode.getPrefix() + ":"
- + TREE_NODES_ADAPTOR_NAME;
- String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":"
- + RECURSIVE_TREE_NODES_ADAPTOR_NAME;
- VpeChildrenInfo vpeChildrenInfo = null;
- for (int i = 0; i < lenght; i++) {
- if (!(nodeList.item(i) instanceof Element)) {
- continue;
- }
- element = (Element) nodeList.item(i);
- if (element.getNodeName().equals(treeNodeName)
- || element.getNodeName().equals(
- recursiveTreeNodesAdaptorName)) {
- vpeChildrenInfo = new VpeChildrenInfo(parentElement);
- vpeCreationData.addChildrenInfo(vpeChildrenInfo);
- vpeChildrenInfo.addSourceChild(element);
- } else if (element.getNodeName().equals(treeNodesAdaptorName)) {
- vpeChildrenInfo = new VpeChildrenInfo(parentElement);
- vpeCreationData.addChildrenInfo(vpeChildrenInfo);
- vpeChildrenInfo.addSourceChild(element);
- }
- }
- }
-
- /**
- *
- * @param sourceNode
- * @return
- */
- public boolean isHasParentAdapter(Node sourceNode) {
- String treeNodesAdaptorName = sourceNode.getPrefix() + ":"
- + TREE_NODES_ADAPTOR_NAME;
- String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":"
- + RECURSIVE_TREE_NODES_ADAPTOR_NAME;
- Node node = sourceNode.getParentNode();
- if (node.getNodeName().equals(treeNodesAdaptorName)
- || node.getNodeName().equals(recursiveTreeNodesAdaptorName)) {
- return true;
- }
- return false;
- }
-
- /**
- * Get showConnectingLines attribute
- *
- * @param sourceNode
- * @return
- */
- private boolean getShowLinesAttr(Node sourceNode) {
- String treeName = sourceNode.getPrefix() + ":" + TREE_NAME;
- do {
- sourceNode = sourceNode.getParentNode();
- if (!(sourceNode instanceof Element)) {
- return true;
- }
- } while (!sourceNode.getNodeName().equals(treeName));
-
- String showLinesParam = ((Element) sourceNode)
- .getAttribute(RichFacesTreeTemplate.SHOW_LINES_ATTR_NAME);
-
- boolean showLinesValue = true;
- if (showLinesParam != null && showLinesParam.equalsIgnoreCase("false")) {
- showLinesValue = false;
- }
- return showLinesValue;
- }
-
- /**
- * Has Next element
- *
- * @param sourceNode
- * @return
- */
- private boolean isHasNextParentAdaptorElement(Node sourceNode) {
- Node tree = sourceNode.getParentNode();
- if (!(tree instanceof Element)) {
- return true;
- }
- Node parentTree = tree.getParentNode();
- if (!(parentTree instanceof Element)) {
- return true;
- }
- NodeList childs = parentTree.getChildNodes();
- String treeNodeName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODE_NAME;
- String treeNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODES_ADAPTOR;
- String treeRecursiveNodesAdaptorName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
- Node lastElement = null;
- Node el = null;
-
- for (int i = 0; i < childs.getLength(); i++) {
- el = childs.item(i);
- if (!(el instanceof Element)) {
- continue;
- }
-
- if (lastElement != null) {
- break;
- }
- if (el.equals(tree)) {
- lastElement = el;
- }
- }
-
- if (el.getNodeName().equals(treeNodeName)
- || el.getNodeName().equals(treeNodesAdaptorName)
- || el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
- return true;
- }
- return false;
- }
-
- /**
- * Is adapter between treeNodes
- *
- * @param sourceNode
- * @return
- */
- private boolean isAdapterBetweenNodes(Node sourceNode) {
- Node parentNode = sourceNode.getParentNode();
- NodeList childs = parentNode.getChildNodes();
- Node beforeAdapterNode = null;
- Node afterAdapterNode = null;
- Node adapterNode = null;
- String treeNodeName = sourceNode.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODE_NAME;
- for (int i = 0; i < childs.getLength(); i++) {
- Node el = childs.item(i);
- if (!(el instanceof Element)) {
- continue;
- }
- if (el.equals(sourceNode)) {
- adapterNode = el;
- } else {
- if (el.getNodeName().equals(treeNodeName)) {
- if (adapterNode == null) {
- beforeAdapterNode = el;
- } else {
- afterAdapterNode = el;
- }
- }
-
- }
-
- }
-
- if (beforeAdapterNode != null && afterAdapterNode != null) {
- return true;
- }
- return false;
- }
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2008-12-17 16:30:18 UTC (rev 12644)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2008-12-17 17:56:32 UTC (rev 12645)
@@ -11,11 +11,12 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -35,22 +36,16 @@
/** Resurces */
- public static final String TREE_NODE_NAME = "treeNode";
+ public static final String TREE= "tree"; //$NON-NLS-1$
+ public static final String TREE_NODE_NAME = "treeNode"; //$NON-NLS-1$
+ public static final String TREE_NODES_ADAPTOR = "treeNodesAdaptor"; //$NON-NLS-1$
+ public static final String RECURSIVE_TREE_NODES_ADAPTOR = "recursiveTreeNodesAdaptor"; //$NON-NLS-1$
+ public static final String SHOW_LINES_ATTR_NAME = "showConnectingLines"; //$NON-NLS-1$
+ private static final String STYLE_PATH = "/tree/tree.css"; //$NON-NLS-1$
+ private static final String ICON_ATTR = "icon"; //$NON-NLS-1$
+ private static final String TREE_STYLE_CLASS_ATR_NAME = "styleClass"; //$NON-NLS-1$
+ private static final String ICON_COLLAPSED_ATTR_NAME = "iconExpanded"; //$NON-NLS-1$
- public static final String TREE_NODES_ADAPTOR = "treeNodesAdaptor";
-
- public static final String TREE_RECURSIVE_NODES_ADAPTOR = "recursiveTreeNodesAdaptor";
-
- public static final String SHOW_LINES_ATTR_NAME = "showConnectingLines";
-
- private static final String STYLE_PATH = "/tree/tree.css";
-
- private static final String ICON_ATTR = "icon";
-
- private static final String TREE_STYLE_CLASS_ATR_NAME = "styleClass";
-
- private static final String ICON_COLLAPSED_ATTR_NAME = "iconExpanded";
-
/**
* Creates a node of the visual tree on the node of the source tree. This
* visual node should not have the parent node This visual node can have
@@ -67,20 +62,20 @@
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
// sets css for tree on page
- ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "tree");
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, TREE);
nsIDOMElement visualElement = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ .createElement(HTML.TAG_DIV);
Element sourceElement = (Element) sourceNode;
String style = sourceElement
- .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ .getAttribute(HTML.ATTR_STYLE);
if (style != null) {
visualElement
- .setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+ .setAttribute(HTML.ATTR_STYLE, style);
}
String styleClass = sourceElement
- .getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
+ .getAttribute(HTML.ATTR_CLASS);
if (styleClass != null) {
- visualElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ visualElement.setAttribute(HTML.ATTR_CLASS,
styleClass);
}
VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
@@ -101,17 +96,17 @@
private void setStylesAttributesToTree(nsIDOMElement treeTable,
Element sourceNode) {
String styleAttr = sourceNode
- .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ .getAttribute(HTML.ATTR_STYLE);
if (styleAttr != null && styleAttr.length() != 0) {
- setAttributeToTree(treeTable, HtmlComponentUtil.HTML_STYLE_ATTR,
+ setAttributeToTree(treeTable, HTML.ATTR_STYLE,
removeFromStyleWithAndHeight(styleAttr));
treeTable
- .setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, styleAttr);
+ .setAttribute(HTML.ATTR_STYLE, styleAttr);
}
String styleClassAttr = sourceNode
.getAttribute(TREE_STYLE_CLASS_ATR_NAME);
if ((styleClassAttr != null) && (styleClassAttr.length() != 0)) {
- setAttributeToTree(treeTable, HtmlComponentUtil.HTML_CLASS_ATTR,
+ setAttributeToTree(treeTable, HTML.ATTR_CLASS,
styleClassAttr);
}
}
@@ -123,13 +118,13 @@
*/
private String removeFromStyleWithAndHeight(String styleArgs) {
StringBuffer result = new StringBuffer();
- String[] mas = styleArgs.split(";");
+ String[] mas = styleArgs.split(Constants.SEMICOLON);
for (String styleAttr : mas) {
- if ((styleAttr.indexOf(HtmlComponentUtil.HTML_ATR_WIDTH) != -1)
- || (styleAttr.indexOf(HtmlComponentUtil.HTML_ATR_HEIGHT) != -1)) {
+ if ((styleAttr.indexOf(HTML.ATTR_WIDTH) != -1)
+ || (styleAttr.indexOf(HTML.ATTR_HEIGHT) != -1)) {
continue;
}
- result.append(styleAttr + ";");
+ result.append(styleAttr + Constants.SEMICOLON);
}
return result.toString();
}
@@ -147,7 +142,7 @@
nsIDOMElement element = (nsIDOMElement) node
.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
if (node.getNodeName().equalsIgnoreCase(
- HtmlComponentUtil.HTML_TAG_TABLE)) {
+ HTML.TAG_TABLE)) {
element.setAttribute(attrName, attrValue);
}
nsIDOMNodeList list2 = node.getChildNodes();
@@ -196,13 +191,13 @@
String id = element
.getAttribute(RichFacesTreeNodesAdaptorTemplate.ID_ATTR_NAME);
if (id == null)
- id = "";
+ id = Constants.EMPTY;
if (node.getNodeName().equalsIgnoreCase(
- HtmlComponentUtil.HTML_TAG_DIV)
+ HTML.TAG_DIV)
&& list.getLength() == 2
&& !(id
- .equalsIgnoreCase(RichFacesTreeNodesAdaptorTemplate.TREE_NODES_ADAPTOR_NAME) || id
- .equalsIgnoreCase(RichFacesTreeNodesAdaptorTemplate.RECURSIVE_TREE_NODES_ADAPTOR_NAME))) {
+ .equalsIgnoreCase(TREE_NODES_ADAPTOR) || id
+ .equalsIgnoreCase(RECURSIVE_TREE_NODES_ADAPTOR))) {
nsIDOMNode table1 = list.item(0);
nsIDOMNode table2 = list.item(1);
node.removeChild(table1);
@@ -238,11 +233,11 @@
nsIDOMElement childTree = null;
nsIDOMElement childLast = null;
int lenght = nodeList.getLength();
- String treeNodeName = sourceNode.getPrefix() + ":" + TREE_NODE_NAME;
- String treeNodesAdaptorName = sourceNode.getPrefix() + ":"
+ String treeNodeName = sourceNode.getPrefix() + Constants.COLON + TREE_NODE_NAME;
+ String treeNodesAdaptorName = sourceNode.getPrefix() + Constants.COLON
+ TREE_NODES_ADAPTOR;
- String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":"
- + TREE_RECURSIVE_NODES_ADAPTOR;
+ String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + Constants.COLON
+ + RECURSIVE_TREE_NODES_ADAPTOR;
VpeChildrenInfo vpeChildrenInfo = null;
for (int i = 0; i < lenght; i++) {
if (!(nodeList.item(i) instanceof Element)) {
@@ -295,14 +290,14 @@
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data,
String name, String value) {
if (TREE_STYLE_CLASS_ATR_NAME.equalsIgnoreCase(name)) {
- setAttributeToTree(visualNode, HtmlComponentUtil.HTML_CLASS_ATTR,
+ setAttributeToTree(visualNode, HTML.ATTR_CLASS,
value);
- } else if (HtmlComponentUtil.HTML_STYLE_ATTR.equalsIgnoreCase(name)) {
- setAttributeToTree(visualNode, HtmlComponentUtil.HTML_STYLE_ATTR,
+ } else if (HTML.ATTR_STYLE.equalsIgnoreCase(name)) {
+ setAttributeToTree(visualNode, HTML.ATTR_STYLE,
removeFromStyleWithAndHeight(value));
nsIDOMElement visualElement = (nsIDOMElement) visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
visualElement.setAttribute(
- HtmlComponentUtil.HTML_STYLE_ATTR, value);
+ HTML.ATTR_STYLE, value);
}
}
@@ -311,11 +306,11 @@
Element sourceElement, nsIDOMDocument visualDocument,
nsIDOMNode visualNode, Object data, String name) {
if (TREE_STYLE_CLASS_ATR_NAME.equalsIgnoreCase(name)) {
- setAttributeToTree(visualNode, HtmlComponentUtil.HTML_CLASS_ATTR,
- "");
- } else if (HtmlComponentUtil.HTML_STYLE_ATTR.equalsIgnoreCase(name)) {
- setAttributeToTree(visualNode, HtmlComponentUtil.HTML_STYLE_ATTR,
- "");
+ setAttributeToTree(visualNode, HTML.ATTR_CLASS,
+ Constants.EMPTY);
+ } else if (HTML.ATTR_STYLE.equalsIgnoreCase(name)) {
+ setAttributeToTree(visualNode, HTML.ATTR_STYLE,
+ Constants.EMPTY);
}
}
@@ -329,8 +324,8 @@
private nsIDOMElement createBasicTree(nsIDOMDocument visualDocument) {
nsIDOMElement div = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-tree-h-ic-div");
+ .createElement(HTML.TAG_DIV);
+ div.setAttribute(HTML.ATTR_CLASS, "dr-tree-h-ic-div"); //$NON-NLS-1$
return div;
}
17 years
JBoss Tools SVN: r12644 - trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-12-17 11:30:18 -0500 (Wed, 17 Dec 2008)
New Revision: 12644
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
Log:
string was wrong
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2008-12-17 14:55:41 UTC (rev 12643)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2008-12-17 16:30:18 UTC (rev 12644)
@@ -111,7 +111,7 @@
PreferencePageTitle=Project Archives
ProjectSpecificSettings=Enable Project Specific Settings
CorePreferences=Core Preferences
-ProjectExplorerPreferences=Core Preferences
+ProjectExplorerPreferences=Project Explorer Preferences
EnableIncrementalBuilder=Enable incremental builder
ShowBuildErrorDialog=Show build error dialog
EnableNodeAlways=Show node in all projects
17 years
JBoss Tools SVN: r12643 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal: jpa/actions and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2008-12-17 09:55:41 -0500 (Wed, 17 Dec 2008)
New Revision: 12643
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java
Log:
JBIDE-2991
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java 2008-12-17 14:24:38 UTC (rev 12642)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java 2008-12-17 14:55:41 UTC (rev 12643)
@@ -26,6 +26,8 @@
public static String SaveQueryEditorListener_replacetitle_info;
public static String SaveQueryEditorListener_replacequestion_confirm;
public static String SaveQueryEditorListener_errormessage;
+ public static String JPAMapToolActor_message_title;
+ public static String JPAMapToolActor_message;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, JdtUiMessages.class);
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties 2008-12-17 14:24:38 UTC (rev 12642)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties 2008-12-17 14:55:41 UTC (rev 12643)
@@ -30,3 +30,5 @@
SaveQueryEditorListener_replacetitle_info= Query replace
SaveQueryEditorListener_replacequestion_confirm= ''{0}'' was changed. It is not possible to update the query.
SaveQueryEditorListener_errormessage=Error while query refactoring
+JPAMapToolActor_message_title=Hibernate/JPA
+JPAMapToolActor_message=Cannot generate annotations for an interface or enumeration
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2008-12-17 14:24:38 UTC (rev 12642)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2008-12-17 14:55:41 UTC (rev 12643)
@@ -37,16 +37,19 @@
import org.eclipse.jdt.internal.core.PackageFragment;
import org.eclipse.jdt.internal.core.PackageFragmentRoot;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.jdt.ui.Activator;
+import org.hibernate.eclipse.jdt.ui.internal.JdtUiMessages;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
@@ -135,8 +138,7 @@
new HashMap<IJavaProject, Set<ICompilationUnit>>();
while (it.hasNext()) {
ICompilationUnit cu = it.next();
- Set<ICompilationUnit> set =
- mapJP_CUSet.get(cu.getJavaProject());
+ Set<ICompilationUnit> set = mapJP_CUSet.get(cu.getJavaProject());
if (set == null) {
set = new HashSet<ICompilationUnit>();
mapJP_CUSet.put(cu.getJavaProject(), set);
@@ -156,12 +158,23 @@
collector.collect(icu);
}
collector.resolveRelations();
- processor.setAnnotationStylePreference(collector.getAnnotationStylePreference());
- processor.modify(javaProject, collector.getMapCUs_Info(), true);
+ if (collector.getNonAbstractCUNumber() > 0) {
+ processor.setAnnotationStylePreference(collector.getAnnotationStylePreference());
+ processor.modify(javaProject, collector.getMapCUs_Info(), true);
+ }
+ else {
+ MessageDialog.openInformation(getShell(),
+ JdtUiMessages.JPAMapToolActor_message_title,
+ JdtUiMessages.JPAMapToolActor_message);
+ }
}
processor.saveAnnotationStylePreference();
}
+ private Shell getShell() {
+ return Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
+ }
+
public void updateOpen() {
IWorkbench workbench = Activator.getDefault().getWorkbench();
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
@@ -175,7 +188,14 @@
collector.initCollector(javaProject);
collector.collect(cu);
collector.resolveRelations();
- processor.modify(javaProject, collector.getMapCUs_Info(), true);
+ if (collector.getNonAbstractCUNumber() > 0) {
+ processor.modify(javaProject, collector.getMapCUs_Info(), true);
+ }
+ else {
+ MessageDialog.openInformation(getShell(),
+ JdtUiMessages.JPAMapToolActor_message_title,
+ JdtUiMessages.JPAMapToolActor_message);
+ }
}
}
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java 2008-12-17 14:24:38 UTC (rev 12642)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java 2008-12-17 14:55:41 UTC (rev 12643)
@@ -490,6 +490,21 @@
return mapCUs_Info;
}
+ public int getNonAbstractCUNumber() {
+ Iterator<Map.Entry<String, EntityInfo>> it = null;
+ int nonAbstractCUNumber = 0;
+ // generate RefFieldInfoMap (for simple process)
+ it = mapCUs_Info.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry<String, EntityInfo> entry = it.next();
+ EntityInfo entryInfo = entry.getValue();
+ if (!entryInfo.isAbstractFlag()) {
+ nonAbstractCUNumber++;
+ }
+ }
+ return nonAbstractCUNumber;
+ }
+
public AnnotStyle getAnnotationStylePreference() {
return annotationStylePreference;
}
17 years
JBoss Tools SVN: r12642 - trunk/jmx/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-12-17 09:24:38 -0500 (Wed, 17 Dec 2008)
New Revision: 12642
Added:
trunk/jmx/docs/reference/en/modules/mbean_editor.xml
Modified:
trunk/jmx/docs/reference/en/modules/introduction.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-528 text from wiki is converted to xml (not structured yet)
Modified: trunk/jmx/docs/reference/en/modules/introduction.xml
===================================================================
--- trunk/jmx/docs/reference/en/modules/introduction.xml 2008-12-17 14:19:13 UTC (rev 12641)
+++ trunk/jmx/docs/reference/en/modules/introduction.xml 2008-12-17 14:24:38 UTC (rev 12642)
@@ -1,8 +1,55 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<chapter id="intruduction" >
+<chapter id="intruduction" xreflabel="introduction">
+ <?dbhtml filename="introduction.html"?>
+
<title>Introduction</title>
- <para>This chapter covers the basics of working with JMX plugin.</para>
+ <para>This chapter covers the basics of working with JMX plugin, which is used to manage Java applications through JMX and its RMI Connector.</para>
- <para></para>
-</chapter>
+ <para>To start using it, it's necessary to open JMX perspective. Go to Window > Open Perspective > Other... and then select JMX and click OK </para>
+
+ <para>The JMX perspective is composed of a single view - MBean Explorer which lists the mbeans. When you double-click on a MBean in the MBean Explorer view, it opens a multi-page editor to manage the MBean. The MBeanEditor is composed of 3 pages:</para>
+
+ <orderedlist>
+ <listitem><para> Attributes to get/set the attributes of the MBean</para></listitem>
+ <listitem><para>Operations to invoke operations on the MBean</para></listitem>
+ <listitem><para> Notifications to receive notifications from the MBean</para></listitem>
+ <listitem><para> Info which displays general information about the MBean </para></listitem>
+ </orderedlist>
+
+<para>There is a button to update the MBean attribute value (if it is writable)</para>
+
+ <section id="Connection">
+ <title>Connection</title>
+ <para>To connect to a MBean Server - click on the Connect... icon () in the MBean Explorer menu bar, then set the name Host and port and click on OK.</para>
+ <para>The default JMX URL is service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi </para>
+ <para> Also you can alternatively type a complete JMX URL in the Advanced Tab of the JMX Connection window</para>
+
+ <note><title>Note</title>
+ <para>only JMX URL based on RMI are supported </para></note>
+ </section>
+
+ <section id="MBeanExporter">
+
+ <title>MBean Explorer</title>
+ <para>The MBean explorer displays the MBean features (both attributes and operations) in its hierarchy. Double-clicking on a feature will open a MBean Editor, display the page corresponding to the feature type and select the feature.</para>
+ <para>Since It's possible to have many MBean Editors opened at the same time, the MBean Explorer has a Link With Editor checkbox to synchronize selections between the active MBean Editor and the MBean explorer(and vice versa) </para>
+
+ <!-- screens -http://code.google.com/p/eclipse-jmx/wiki/NewAndNoteworthy_0_1_2 -->
+ <para>The MBean Explorer has also a filter text that can be used to filter among all the MBeans the few ones, which interest you.</para>
+
+ <para>For example, if you are only interested by MBeans related to memory, typing memo will show only the MBeans registered under an ObjectName, which contains memo: </para>
+
+ <para>A Collapse All button on the MBean Explorer toolbar is used to collapse all the MBeans and display only the domains. It is also possible to double click on a node to expand/collapse it. </para>
+
+ </section>
+
+ <section id="OpenMBeanAction">
+ <title>Open MBean Action </title>
+ <para>A Navigation action helps opening MBeans in a MBean Editor. This action is available either through the menu Navigate > Open MBean... or using the key shortcut Ctrl + Shift + M (⌘+ Shift + M on Mac OS X)</para>
+ </section>
+
+
+ </section>
+
+</chapter>
\ No newline at end of file
Added: trunk/jmx/docs/reference/en/modules/mbean_editor.xml
===================================================================
--- trunk/jmx/docs/reference/en/modules/mbean_editor.xml (rev 0)
+++ trunk/jmx/docs/reference/en/modules/mbean_editor.xml 2008-12-17 14:24:38 UTC (rev 12642)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<chapter id="mbean_editor" xreflabel="mbean_editor">
+ <?dbhtml filename="mbean_editor.html"?>
+
+ <title>MBean Editor</title>
+ <!-- images -http://code.google.com/p/eclipse-jmx/wiki/NewAndNoteworthy_0_2_0 -->
+
+ <para>The MBean Editor is composed of several pages:</para>
+ <orderedlist><listitem><para>the Attributes page</para></listitem>
+ <listitem><para>the Operations page</para></listitem>
+ <listitem><para>the Info page </para></listitem>
+ </orderedlist>
+
+ <para> The Attributes & Operations pages display a list for either the MBean attributes or operations as well as details for the selection.</para>
+
+ <para> It is possible to toggle the layout between the list and the details either vertically (by default) or horizontally.</para>
+
+ <section>
+ <title>Notifications Page</title>
+ <!-- images could be found here - http://code.google.com/p/eclipse-jmx/wiki/NewAndNoteworthy_0_2_1-->
+ <!-- also so usefull info could be found here http://code.google.com/p/eclipse-jmx/wiki/ReleaseNotes_0_2_1 -->
+ <para>One more page in MBean Editor is a Notifications Page, which gives the possibility to subscribe (resp. unsubscribe) to a MBean to receive its notifications by checking (resp. unchecking) the Subscribe checkbox. </para>
+ <para>The list of notifications is refreshed every time a new notification is received:</para>
+
+ <note><title>Note</title>
+ <para>It is only possible to subscribe to MBean which emits notifications (they must be NotificationBroadcaster).</para></note>
+
+ </section>
+ <section id="AttributeDisplayExtensionPoints">
+ <title>Attribute Display Extension Points</title>
+
+ <para>The value of the MBean attributes which are displayed in the MBean Editor is now contributed through 2 extension points:</para>
+ <orderedlist>
+ <listitem><para>net.jmesnil.jmx.ui.attribute.controls</para></listitem>
+ <listitem><para>net.jmesnil.jmx.ui.attribute.bindings</para> </listitem>
+ </orderedlist>
+ <para>This means that you can now contribute new display for MBean attributes (see some use cases and a simple example in net.jmesnil.jmx.ui.test.interactive plugin.xml)</para>
+
+ </section>
+ </chapter>
\ No newline at end of file
17 years
JBoss Tools SVN: r12641 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-12-17 09:19:13 -0500 (Wed, 17 Dec 2008)
New Revision: 12641
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3361
Added new choice '[JPA Project Configured Connection]'.
Validation checks that project is jpa project and that connection profile specified for it.
Console configuration uses current cp on the build time.
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java 2008-12-17 14:19:09 UTC (rev 12640)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateFactory.java 2008-12-17 14:19:13 UTC (rev 12641)
@@ -62,8 +62,9 @@
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, jpaProject.getName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true );
wc.setAttribute(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS, (List<String>)null);
- wc.setAttribute(IConsoleConfigurationLaunchConstants.CONNECTION_PROFILE_NAME, connectionProfileName);
-
+ //wc.setAttribute(IConsoleConfigurationLaunchConstants.CONNECTION_PROFILE_NAME, connectionProfileName);
+ wc.setAttribute(IConsoleConfigurationLaunchConstants.USE_JPA_PROJECT_PROFILE, "true");//$NON-NLS-1$
+
wc.doSave();
}
}
17 years