JBoss Tools SVN: r3822 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/events.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-26 15:05:12 -0400 (Wed, 26 Sep 2007)
New Revision: 3822
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/events/PollingLabelProvider.java
Log:
polling events for jmx polling enhanced marginally.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/events/PollingLabelProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/events/PollingLabelProvider.java 2007-09-26 19:05:10 UTC (rev 3821)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/events/PollingLabelProvider.java 2007-09-26 19:05:12 UTC (rev 3822)
@@ -22,13 +22,8 @@
package org.jboss.ide.eclipse.as.ui.views.server.providers.events;
import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Properties;
import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
@@ -60,8 +55,8 @@
supported.add(PollThread.POLL_THREAD_EXCEPTION);
supported.add(PollThread.POLLER_NOT_FOUND);
- supported.add(JMXPoller.TYPE_TERMINATED);
- supported.add(JMXPoller.TYPE_RESULT);
+ supported.add(JMXPoller.EVENT_TYPE_EXCEPTION);
+ supported.add(JMXPoller.EVENT_TYPE_STARTING);
supported.add(JBossServerBehavior.FORCE_SHUTDOWN_EVENT_KEY);
}
@@ -86,19 +81,13 @@
return getErrorImage();
}
- if( element.getSpecificType().equals(JMXPoller.TYPE_TERMINATED)) return getErrorImage();
- if( element.getSpecificType().equals(JMXPoller.TYPE_RESULT)) {
- int state = ((Integer)element.getProperty(JMXPoller.STATUS)).intValue();
- boolean expectedState = ((Boolean)element.getProperty(PollThread.EXPECTED_STATE)).booleanValue();
- if( state == JMXPoller.STATE_STOPPED)
- return getStoppedImage();
- if( state == JMXPoller.STATE_STARTED)
- return getStartedImage();
- if( state == JMXPoller.STATE_TRANSITION) {
- if( expectedState == IServerStatePoller.SERVER_UP )
- return getStartingImage();
- return getStoppingImage();
- }
+ if( element.getSpecificType().equals(JMXPoller.EVENT_TYPE_EXCEPTION))
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ if( element.getSpecificType().equals(JMXPoller.EVENT_TYPE_STARTING)) {
+ boolean started = ((Boolean)element.getProperty(JMXPoller.STARTED_PROPERTY)).booleanValue();
+ if( !started )
+ return getStartingImage();
+ return getStartedImage();
}
@@ -122,22 +111,15 @@
if( element.getSpecificType().equals(PollThread.POLLER_NOT_FOUND)) return expectedString + " failed. Poller not found";
}
- if( element.getSpecificType().equals(JMXPoller.TYPE_TERMINATED)) return "All processes have been terminated";
- if( element.getSpecificType().equals(JMXPoller.TYPE_RESULT)) {
- int state = ((Integer)element.getProperty(JMXPoller.STATUS)).intValue();
- boolean expectedState = ((Boolean)element.getProperty(PollThread.EXPECTED_STATE)).booleanValue();
- if( state == JMXPoller.STATE_STOPPED)
- return "The server is down.";
- if( state == JMXPoller.STATE_STARTED)
- return "The server is up.";
- if( state == JMXPoller.STATE_TRANSITION) {
- if( expectedState == IServerStatePoller.SERVER_UP )
- return "The server is still starting";
- return "The server is still stopping.";
- }
+ if( element.getSpecificType().equals(JMXPoller.EVENT_TYPE_EXCEPTION))
+ return (String)element.getProperty(JMXPoller.EXCEPTION_PROPERTY);
+ if( element.getSpecificType().equals(JMXPoller.EVENT_TYPE_STARTING)) {
+ boolean started = ((Boolean)element.getProperty(JMXPoller.STARTED_PROPERTY)).booleanValue();
+ if( !started )
+ return "Server is still starting";
+ return "Server has completed startup";
}
-
if( element.getSpecificType().equals(JBossServerBehavior.FORCE_SHUTDOWN_EVENT_KEY))
return "The server was shutdown forcefully. All processes terminated.";
return null;
@@ -171,13 +153,14 @@
protected void loadPropertyMap() {
// property names and their readable forms
propertyToMessageMap.put(EventLogTreeItem.DATE, "Time");
- propertyToMessageMap.put(JMXPoller.STATUS, "Status");
propertyToMessageMap.put(PollThread.EXPECTED_STATE, "Expected State");
+ propertyToMessageMap.put(JMXPoller.EXCEPTION_PROPERTY, "Exception");
+ propertyToMessageMap.put(JMXPoller.STARTED_PROPERTY, "Server Started");
// now values and their readable forms
- propertyToMessageMap.put(JMXPoller.STATUS + DELIMITER + 0, "Server is Down");
- propertyToMessageMap.put(JMXPoller.STATUS + DELIMITER + 1, "Server is Up");
- propertyToMessageMap.put(JMXPoller.STATUS + DELIMITER + -1, "Server is in transition");
+// propertyToMessageMap.put(JMXPoller.STATUS + DELIMITER + 0, "Server is Down");
+// propertyToMessageMap.put(JMXPoller.STATUS + DELIMITER + 1, "Server is Up");
+// propertyToMessageMap.put(JMXPoller.STATUS + DELIMITER + -1, "Server is in transition");
propertyToMessageMap.put(PollThread.EXPECTED_STATE + DELIMITER + "true", "Up");
propertyToMessageMap.put(PollThread.EXPECTED_STATE + DELIMITER + "false", "Down");
}
17 years, 3 months
JBoss Tools SVN: r3821 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-26 15:05:10 -0400 (Wed, 26 Sep 2007)
New Revision: 3821
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java
Log:
polling events for jmx polling enhanced marginally.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java 2007-09-26 18:26:25 UTC (rev 3820)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java 2007-09-26 19:05:10 UTC (rev 3821)
@@ -22,18 +22,11 @@
package org.jboss.ide.eclipse.as.core.extensions.polling;
import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.Principal;
import java.util.Date;
import java.util.Properties;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MBeanServerConnection;
-import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.OperationsException;
import javax.management.ReflectionException;
@@ -41,9 +34,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
import org.jboss.ide.eclipse.as.core.extensions.jmx.JMXClassLoaderRepository;
@@ -51,16 +41,16 @@
import org.jboss.ide.eclipse.as.core.extensions.jmx.JMXUtil.CredentialException;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
public class JMXPoller implements IServerStatePoller {
- public static final String STATUS = "org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.status";
-
- public static final String TYPE_TERMINATED = "org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.TYPE_TERMINATED";
- public static final String TYPE_RESULT = "org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.TYPE_RESULT";
-
+ public static final String STARTED_PROPERTY = "org.jboss.ide.eclipse.as.core.extensions.polling.jmx.STARTED_PROPERTY";
+ public static final String EXCEPTION_PROPERTY = "org.jboss.ide.eclipse.as.core.extensions.polling.jmx.EXCEPTION_PROPERTY";
+ public static final String EVENT_TYPE_STARTING = "org.jboss.ide.eclipse.as.core.extensions.polling.jmx.eventTypes.STARTING";
+ public static final String EVENT_TYPE_EXCEPTION = "org.jboss.ide.eclipse.as.core.extensions.polling.jmx.eventTypes.EXCEPTION";
+
+
public static final int STATE_STARTED = 1;
public static final int STATE_STOPPED = 0;
public static final int STATE_TRANSITION = -1;
@@ -110,6 +100,7 @@
boolean b = ((Boolean) attInfo).booleanValue();
started = b ? STATE_STARTED : STATE_TRANSITION;
done = b;
+ new JMXEvent(event, b);
}
} catch (SecurityException se) {
pollingException = new PollingSecurityException(
@@ -117,8 +108,10 @@
done = true;
} catch (CommunicationException ce) {
started = STATE_STOPPED;
+ new JMXEvent(event, ce);
} catch (NamingException nnfe) {
started = STATE_STOPPED;
+ new JMXEvent(event, nnfe);
} catch( OperationsException e ) {
failingException = e;
} catch (MBeanException e) {
@@ -146,7 +139,7 @@
Thread.currentThread().setContextClassLoader(currentLoader);
JMXClassLoaderRepository.getDefault().removeConcerned(server, this);
}
-
+
protected void setCredentials() {
try {
JMXUtil.setCredentials(server);
@@ -170,6 +163,7 @@
}
public class PollingSecurityException extends PollingException {
+ private static final long serialVersionUID = 1L;
public PollingSecurityException(String msg) {
super(msg);
}
@@ -195,13 +189,15 @@
return done;
}
- public class JMXPollerEvent extends EventLogTreeItem {
- public JMXPollerEvent(SimpleTreeItem parent, String type, int status,
- boolean expectedState) {
- super(parent, PollThread.SERVER_STATE_MAJOR_TYPE, type);
- setProperty(PollThread.EXPECTED_STATE, new Boolean(expectedState));
- setProperty(STATUS, new Integer(status));
- setProperty(DATE, new Long(new Date().getTime()));
+ public class JMXEvent extends EventLogTreeItem {
+ public JMXEvent(SimpleTreeItem parent, boolean started) {
+ super(parent, PollThread.SERVER_STATE_MAJOR_TYPE, EVENT_TYPE_STARTING );
+ setProperty(STARTED_PROPERTY, new Boolean(started));
}
+
+ public JMXEvent(SimpleTreeItem parent, Exception e) {
+ super(parent, PollThread.SERVER_STATE_MAJOR_TYPE, EVENT_TYPE_EXCEPTION );
+ setProperty(EXCEPTION_PROPERTY, e.getMessage());
+ }
}
}
17 years, 3 months
JBoss Tools SVN: r3820 - trunk/documentation/qa.
by jbosstools-commits@lists.jboss.org
Author: anis
Date: 2007-09-26 14:26:25 -0400 (Wed, 26 Sep 2007)
New Revision: 3820
Added:
trunk/documentation/qa/RHDS Testcases 26092007.doc
Log:
Added a file remotely
Added: trunk/documentation/qa/RHDS Testcases 26092007.doc
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/RHDS Testcases 26092007.doc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 3 months
JBoss Tools SVN: r3819 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: src/org/jboss/tools/jsf/vpe/richfaces/template and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2007-09-26 13:46:45 -0400 (Wed, 26 Sep 2007)
New Revision: 3819
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconClosedNode.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconClosedNodeWithLines.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNodeWithLine.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNotCollapsed.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNotCollapsedWithLines.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/leftLine.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/line.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/rightLine.gif
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/RichFacesTreeNodesAdaptorTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNodeWithLines.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/tree.css
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/RichFacesTreeTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-847 Add rich:treeNodesAdaptor, rich:recursiveTreeNodesAdaptor
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconClosedNode.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconClosedNode.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconClosedNodeWithLines.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconClosedNodeWithLines.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNodeWithLine.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNodeWithLine.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNodeWithLines.gif
===================================================================
(Binary files differ)
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNotCollapsed.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNotCollapsed.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNotCollapsedWithLines.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/iconNotCollapsedWithLines.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/leftLine.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/leftLine.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/line.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/line.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/rightLine.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/rightLine.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/tree.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/tree.css 2007-09-26 16:57:31 UTC (rev 3818)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/tree/tree.css 2007-09-26 17:46:45 UTC (rev 3819)
@@ -1,10 +1,24 @@
.treePictureStyle {
width: 22px;
- height: 100%;
+ height: 22px;
}
-.treeNodeNameStyle{
- width : 100%;
- vertical-align : middle;
- text-align : left;
+.treeNodeNameStyle {
+ width: 100%;
+ vertical-align: middle;
+ text-align: left;
}
+
+.dr-tree-h-ic-div {
+ margin-left: 8px;
+ padding-left: 14px;
+}
+
+.dr-tree-full-width {
+ width: 100%;
+}
+
+.dr-tree-h-ic-line-position {
+ background-position: center;
+ background-repeat: repeat-y;
+}
Added: 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 (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java 2007-09-26 17:46:45 UTC (rev 3819)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+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.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Create template for rich:recursiveTreeNodesAdaptor element
+ *
+ * @author dsakovich(a)exadel.com
+ *
+ */
+public class RichFacesRecursiveTreeNodesAdaptorTemplate extends
+ VpeAbstractTemplate {
+ private final static String TREE_NODE_NAME = "treeNode";
+
+ 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";
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+ Element visualElement = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ addBasicTreeNodeAttributes(visualElement);
+ VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
+ parseTree(pageContext, sourceNode, visualDocument, vpeCreationData,
+ visualElement);
+ return vpeCreationData;
+ }
+
+ /**
+ *
+ * Function for parsing tree by tree nodes;
+ *
+ * @param pageContext
+ * @param sourceNode
+ * @param visualDocument
+ * @return
+ */
+ public void parseTree(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument, VpeCreationData vpeCreationData,
+ Element parentElement) {
+ NodeList nodeList = sourceNode.getChildNodes();
+ Element element = null;
+ int lenght = nodeList.getLength();
+ String treeNodeName = sourceNode.getPrefix() + ":" + TREE_NODE_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 tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ Element td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr.appendChild(td);
+ vpeChildrenInfo = new VpeChildrenInfo(td);
+ vpeCreationData.addChildrenInfo(vpeChildrenInfo);
+ vpeChildrenInfo.addSourceChild(element);
+ parentElement.appendChild(tr);
+ }
+ }
+ }
+
+ /**
+ * Set attributes for treeNode
+ *
+ * @param table
+ */
+ private void addBasicTreeNodeAttributes(Element 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");
+ }
+
+}
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 2007-09-26 16:57:31 UTC (rev 3818)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java 2007-09-26 17:46:45 UTC (rev 3819)
@@ -7,13 +7,14 @@
*
* 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.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;
@@ -31,329 +32,506 @@
*/
public class RichFacesTreeNodeTemplate extends VpeAbstractTemplate {
- public static final String DEFAULT_ICON_PARAM_VALUE = "DEFAULT_ICON_PARAM";
+ public static final String DEFAULT_ICON_PARAM_VALUE = "DEFAULT_ICON_PARAM";
- public static final String ICON_PARAM_NAME = "richFacesTreeNodeParam";
+ 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 DEFAULT_ICON_EXPANDED_PARAM_VALUE = "DEFAULT_ICON_EXPANDED_PARAM";
- public static final String UNDEFINED_ICON = "/tree/unresolved.gif";
+ public static final String UNDEFINED_ICON = "/tree/unresolved.gif";
- public static final String NODE_ICON_LEAF_ATTR_NAME = "iconLeaf";
+ 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_LINES = "/tree/iconNodeWithLines.gif";
- public static final String ICON_EXPANDED_WITH_LINES = "/tree/iconCollapsedWithLines.gif";
+ public static final String ICON_NODE_WITH_LINE = "/tree/iconNodeWithLine.gif";
- public static final String ICON_NODE_WITHOUT_LINES = "/tree/iconNode.gif";
+ public static final String ICON_EXPANDED_WITH_LINES = "/tree/iconCollapsedWithLines.gif";
- public static final String ICON_EXPANDED_WITHOUT_LINES = "/tree/iconCollapsed.gif";
+ public static final String ICON_NODE_WITHOUT_LINES = "/tree/iconNode.gif";
- public static final String ICON_LEAF_WITH_LINES = "/tree/iconLeaf.gif";
+ public static final String ICON_EXPANDED_WITHOUT_LINES = "/tree/iconCollapsed.gif";
- public static final String ICON_LEAF_WITHOUT_LINES = "/tree/iconLeafWithLines.gif";
+ public static final String ICON_NOT_EXPANDED_WITH_LINES = "/tree/iconNotCollapsedWithLines.gif";
- private static final String TREE_TABLE_PICTURE_STYLE_CLASS_NAME = "treePictureStyle";
+ public static final String ICON_NOT_EXPANDED_WITHOUT_LINES = "/tree/iconNotCollapsed.gif";
- private static final String STYLE_CLASS_FOR_NODE_TITLE = "treeNodeNameStyle";
+ public static final String ICON_EXPANDED_ADAPTER_WITH_LINES = "/tree/iconClosedNodeWithLines.gif";
- private static final String NODE_TITLE_STYLE_CLASS_ATTR_NAME = "nodeClass";
+ public static final String ICON_EXPANDED_ADAPTER_WITHOUT_LINES = "/tree/iconClosedNode.gif";
- private static final String NODE_ICON_EXPANDED_ATTR_NAME = "iconExpanded";
+ public static final String ICON_LEAF_WITH_LINES = "/tree/iconLeaf.gif";
- private static final String NODE_ICON_ATTR_NAME = "icon";
+ public static final String ICON_RIGHT_LINE = "/tree/rightLine.gif";
- /**
- * 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
- * child nodes.
- *
- * @param pageContext
- * Contains the information on edited page.
- * @param sourceNode
- * The current node of the source tree.
- * @param visualDocument
- * The document of the visual tree.
- * @return The information on the created node of the visual tree.
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
- Element tableRow = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TR);
- addAttributeToTableNode((Element) sourceNode, tableRow);
- VpeCreationData vpeCreationData = new VpeCreationData(tableRow);
- createBasicTree(pageContext, visualDocument, tableRow, sourceNode,
- vpeCreationData);
- return vpeCreationData;
- }
+ public static final String ICON_LEFT_LINE = "/tree/leftLine.gif";
- /**
- * Checks for attributes for node and if such exist convert it's to html
- * atributes.
- *
- * @param sourceNode
- * @param tableRow
- */
- private void addAttributeToTableNode(Element sourceNode, Element tableRow) {
+ public static final String ICON_LINE = "/tree/line.gif";
- String attrValue = sourceNode
- .getAttribute(NODE_TITLE_STYLE_CLASS_ATTR_NAME);
- if ((attrValue != null) && (attrValue.length() > 0)) {
- tableRow.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- attrValue);
- }
+ public static final String ICON_LEAF_WITHOUT_LINES = "/tree/iconLeafWithLines.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_NODES_ADAPTOR_NAME = "treeNodesAdaptor";
+
+ private static final String TREE_NODES_RECURSIVE_ADAPTOR_NAME = "recursiveTreeNodesAdaptor";
+
+ 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
+ * child nodes.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @return The information on the created node of the visual tree.
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+
+ Element visualElement = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ addBasicTreeNodeAttributes(visualElement);
+
+ Element tbody = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+
+ Element tableRow = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ addAttributeToTableNode((Element) sourceNode, tableRow);
+ visualElement.appendChild(tbody);
+ tbody.appendChild(tableRow);
+
+ VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
+ createBasicTree(pageContext, visualDocument, tableRow, sourceNode,
+ vpeCreationData);
+ 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, Element 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,
- Document visualDocument, Element sourceNode, Element iconCell,
- String nodeAttrName, String defaultImage) {
- Element 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) {
- imgName = ((Element) sourceNode.getParentNode())
- .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);
- }
+ /**
+ * 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,
+ Document visualDocument, Element sourceNode, Element iconCell,
+ String nodeAttrName, String defaultImage) {
+ if (RichFacesTemplatesActivator.getDefault().isDebugging()) {
+ System.out.println("call setAttributeForPictureNode");
}
+ Element 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) {
+ imgName = ((Element) sourceNode.getParentNode())
+ .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,
- Document visualDocument, Element treeRow, Node sourceNode,
- VpeCreationData vpeCreationData) {
- // creates icon node
- Element iconNode = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- String showLinesParam = ((Element) sourceNode.getParentNode())
- .getAttribute(RichFacesTreeTemplate.SHOW_LINES_ATTR_NAME);
- boolean showLinesValue = true;
- if (showLinesParam != null && showLinesParam.equalsIgnoreCase("false")) {
- showLinesValue = false;
- }
- // creates icon with status of node(collapsed or not) node
- Element td1 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ /**
+ * Create simple tree node attribute.Used for creating more complex trees.
+ *
+ * @param treeNodeTitle
+ * @param visualDocument
+ * @return tree
+ */
+ private void createBasicTree(VpePageContext pageContext,
+ Document visualDocument, Element treeRow, Node sourceNode,
+ VpeCreationData vpeCreationData) {
+ // creates icon node
+ String backgroundImagePath;
+ if (RichFacesTemplatesActivator.getDefault().isDebugging()) {
+ System.out.println("call createBasicTree");
+ }
+ boolean showLinesValue = getShowLinesAttr((Element) sourceNode);
- // sets attribute for icon expanded picture or not
+ Element iconNode = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ // creates icon with status of node(collapsed or not) node
+ Element td1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ // sets icon node
+ if (!isLastElement(sourceNode.getParentNode(), sourceNode)) {
+ // sets attribute for icon expanded picture or not
+
+ if (!isAdaptorsChild(sourceNode.getParentNode())) {
+ backgroundImagePath = 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);
- // sets icon node
- if (!isLastElement(sourceNode.getParentNode(), sourceNode)) {
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, iconNode, NODE_ICON_ATTR_NAME,
- showLinesValue == true ? ICON_NODE_WITH_LINES
- : ICON_NODE_WITHOUT_LINES);
- } else {
- setAttributeForPictureNode(pageContext, visualDocument,
- (Element) sourceNode, iconNode, NODE_ICON_LEAF_ATTR_NAME,
- showLinesValue == true ? ICON_LEAF_WITH_LINES
- : ICON_LEAF_WITHOUT_LINES);
+ (Element) sourceNode, td1,
+ NODE_ICON_EXPANDED_ATTR_NAME,
+ showLinesValue == true ? ICON_EXPANDED_WITH_LINES
+ : ICON_EXPANDED_WITHOUT_LINES);
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, iconNode, NODE_ICON_ATTR_NAME,
+ showLinesValue == true ? ICON_NODE_WITH_LINES
+ : ICON_NODE_WITHOUT_LINES);
+ String path = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_LEFT_LINE;
+ if (showLinesValue) {
+ iconNode.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ "background-image: url(file://" + path + "); "
+ + NODE_LINES_STYLE);
}
- treeRow.appendChild(td1);
- treeRow.appendChild(iconNode);
- // creates Tree Node Name Message
- Element nodeTitle = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- addBasicNadeTitleAttributes(nodeTitle);
- // Create mapping to Encode body
- VpeChildrenInfo tdInfo = new VpeChildrenInfo(nodeTitle);
+ } else {
+ backgroundImagePath = 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);
+ }
- // Create mapping to Encode body
- List<Node> children = ComponentUtil.getChildren((Element) sourceNode,
- false);
- for (Node child : children) {
- tdInfo.addSourceChild(child);
+ } else {
+ backgroundImagePath = 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);
+ if (isAdaptorsChild(sourceNode.getParentNode())) {
+ if (!isLastNodesAdaptor(sourceNode)) {
+ String path = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_LEFT_LINE;
+ if (showLinesValue) {
+ iconNode.setAttribute(
+ HtmlComponentUtil.HTML_STYLE_ATTR,
+ "background-image: url(file://" + path + "); "
+ + NODE_LINES_STYLE);
+ }
+
}
- vpeCreationData.addChildrenInfo(tdInfo);
- treeRow.appendChild(nodeTitle);
+ }
+ setAttributeForPictureNode(pageContext, visualDocument,
+ (Element) sourceNode, iconNode, NODE_ICON_LEAF_ATTR_NAME,
+ showLinesValue == true ? ICON_LEAF_WITH_LINES
+ : ICON_LEAF_WITHOUT_LINES);
}
+ if (showLinesValue) {
+ td1.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ "background-image: url(file://" + backgroundImagePath
+ + "); " + NODE_LINES_STYLE);
- /**
- * Sets attributes for no node title name
- *
- * @param nodeTitle
- */
- private void addBasicNadeTitleAttributes(Element nodeTitle) {
- nodeTitle.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- STYLE_CLASS_FOR_NODE_TITLE);
}
+ treeRow.appendChild(td1);
+ treeRow.appendChild(iconNode);
+ // creates Tree Node Name Message
+ Element nodeTitle = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ addBasicNodeTitleAttributes(nodeTitle);
+ // Create mapping to Encode body
+ VpeChildrenInfo tdInfo = new VpeChildrenInfo(nodeTitle);
- @Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
- String value) {
- /*
- * processed only next attributes iconExpanded and icon, becouse tree
- * allways shows as expanded and information is it leaf or not contains
- * in model
- */
- if (NODE_ICON_EXPANDED_ATTR_NAME.equalsIgnoreCase(name)) {
- Element expandedIconCell = (Element) visualNode.getChildNodes()
- .item(0);
- Element img = (Element) expandedIconCell.getChildNodes().item(0);
- ComponentUtil.setImgFromResources(pageContext, img, value,
- UNDEFINED_ICON);
- img.setAttribute(ICON_PARAM_NAME, "");
- } else if (NODE_ICON_ATTR_NAME.equals(name)
- && !isLastElement(visualNode.getParentNode(), visualNode)) {
- Element iconCell = (Element) visualNode.getChildNodes().item(1);
- Element img = (Element) iconCell.getChildNodes().item(0);
- ComponentUtil.setImgFromResources(pageContext, img, value,
- UNDEFINED_ICON);
- img.setAttribute(ICON_PARAM_NAME, "");
- } else if (NODE_ICON_LEAF_ATTR_NAME.equals(name)
- && isLastElement(sourceElement.getParentNode(), sourceElement)) {
- Element iconCell = (Element) visualNode.getChildNodes().item(1);
- Element img = (Element) iconCell.getChildNodes().item(0);
- ComponentUtil.setImgFromResources(pageContext, img, value,
- UNDEFINED_ICON);
- img.setAttribute(ICON_PARAM_NAME, "");
- }
+ // 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);
+ }
- @Override
- public void removeAttribute(VpePageContext pageContext,
- Element sourceElement, Document visualDocument, Node visualNode,
- Object data, String name) {
- /*
- * processed only next attributes iconExpanded and icon, becouse tree
- * allways shows as expanded and information is it leaf or not contains
- * in model
- */
- String showLinesParam = ((Element) sourceElement.getParentNode())
- .getAttribute(RichFacesTreeTemplate.SHOW_LINES_ATTR_NAME);
- boolean showLinesValue = true;
- if (showLinesParam != null && showLinesParam.equalsIgnoreCase("false")) {
- showLinesValue = false;
- }
- if (NODE_ICON_EXPANDED_ATTR_NAME.equalsIgnoreCase(name)) {
- Element expandedIconCell = (Element) visualNode.getChildNodes()
- .item(0);
- Element img = (Element) expandedIconCell.getChildNodes().item(0);
- String parentAttrName = ((Element) sourceElement.getParentNode())
- .getAttribute(NODE_ICON_EXPANDED_ATTR_NAME);
- if (parentAttrName == null || parentAttrName.length() == 0) {
- ComponentUtil.setImg(img,
- showLinesValue == true ? ICON_EXPANDED_WITH_LINES
- : ICON_EXPANDED_WITHOUT_LINES);
- } else {
- ComponentUtil.setImgFromResources(pageContext, img,
- parentAttrName, UNDEFINED_ICON);
- }
- img
- .setAttribute(ICON_PARAM_NAME,
- DEFAULT_ICON_EXPANDED_PARAM_VALUE);
- } else if (NODE_ICON_ATTR_NAME.equalsIgnoreCase(name)
- && !isLastElement(sourceElement.getParentNode(), sourceElement)) {
- Element iconCell = (Element) visualNode.getChildNodes().item(1);
- Element img = (Element) iconCell.getChildNodes().item(0);
- String parentAttrName = ((Element) sourceElement.getParentNode())
- .getAttribute(NODE_ICON_ATTR_NAME);
- if (parentAttrName == null || parentAttrName.length() == 0) {
- ComponentUtil.setImg(img,
- showLinesValue == true ? ICON_NODE_WITH_LINES
- : ICON_NODE_WITHOUT_LINES);
- } else {
- ComponentUtil.setImgFromResources(pageContext, img,
- parentAttrName, UNDEFINED_ICON);
- }
- img.setAttribute(ICON_PARAM_NAME, DEFAULT_ICON_PARAM_VALUE);
+ /**
+ * Sets attributes for no node title name
+ *
+ * @param nodeTitle
+ */
+ private void addBasicNodeTitleAttributes(Element nodeTitle) {
+ nodeTitle.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ STYLE_CLASS_FOR_NODE_TITLE);
+ }
- } else if (NODE_ICON_LEAF_ATTR_NAME.equalsIgnoreCase(name)
- && isLastElement(sourceElement.getParentNode(), sourceElement)) {
- Element iconCell = (Element) visualNode.getChildNodes().item(1);
- Element img = (Element) iconCell.getChildNodes().item(0);
- String parentAttrName = ((Element) sourceElement.getParentNode())
- .getAttribute(NODE_ICON_LEAF_ATTR_NAME);
- if (parentAttrName == null || parentAttrName.length() == 0) {
- ComponentUtil.setImg(img,
- showLinesValue == true ? ICON_LEAF_WITH_LINES
- : ICON_LEAF_WITHOUT_LINES);
- } else {
- ComponentUtil.setImgFromResources(pageContext, img,
- parentAttrName, UNDEFINED_ICON);
- }
- img.setAttribute(ICON_PARAM_NAME, NODE_ICON_LEAF_ATTR_NAME);
- }
+ @Override
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
+ Document visualDocument, Node visualNode, Object data, String name,
+ String value) {
+ /*
+ * processed only next attributes iconExpanded and icon, becouse tree
+ * allways shows as expanded and information is it leaf or not contains
+ * in model
+ */
+ if (NODE_ICON_EXPANDED_ATTR_NAME.equalsIgnoreCase(name)) {
+ Element expandedIconCell = (Element) visualNode.getChildNodes()
+ .item(0);
+ Element img = (Element) expandedIconCell.getChildNodes().item(0);
+ ComponentUtil.setImgFromResources(pageContext, img, value,
+ UNDEFINED_ICON);
+ img.setAttribute(ICON_PARAM_NAME, "");
+ } else if (NODE_ICON_ATTR_NAME.equals(name)
+ && !isLastElement(visualNode.getParentNode(), visualNode)) {
+ Element iconCell = (Element) visualNode.getChildNodes().item(1);
+ Element img = (Element) iconCell.getChildNodes().item(0);
+ ComponentUtil.setImgFromResources(pageContext, img, value,
+ UNDEFINED_ICON);
+ img.setAttribute(ICON_PARAM_NAME, "");
+ } else if (NODE_ICON_LEAF_ATTR_NAME.equals(name)
+ && isLastElement(sourceElement.getParentNode(), sourceElement)) {
+ Element iconCell = (Element) visualNode.getChildNodes().item(1);
+ Element img = (Element) iconCell.getChildNodes().item(0);
+ ComponentUtil.setImgFromResources(pageContext, img, value,
+ UNDEFINED_ICON);
+ img.setAttribute(ICON_PARAM_NAME, "");
}
+ }
- /**
- *
- * @param parentTree
- * @param currentNode
- * @return
+ @Override
+ public void removeAttribute(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument, Node visualNode,
+ Object data, String name) {
+ /*
+ * processed only next attributes iconExpanded and icon, becouse tree
+ * allways shows as expanded and information is it leaf or not contains
+ * in model
*/
- private boolean isLastElement(Node parentTree, Node currentNode) {
- NodeList childs = parentTree.getChildNodes();
- String treeNodeName = parentTree.getPrefix() + ":"
- + RichFacesTreeTemplate.TREE_NODE_NAME;
- Node lastElement = null;
- Node el = null;
- for (int i = 0; i < childs.getLength(); i++) {
- el = childs.item(i);
- if (el.getNodeName().equals(treeNodeName)) {
- lastElement = el;
- }
- }
- return currentNode.equals(lastElement);
+
+ boolean showLinesValue = getShowLinesAttr(sourceElement);
+ if (NODE_ICON_EXPANDED_ATTR_NAME.equalsIgnoreCase(name)) {
+ Element expandedIconCell = (Element) visualNode.getChildNodes()
+ .item(0);
+ Element img = (Element) expandedIconCell.getChildNodes().item(0);
+ String parentAttrName = ((Element) sourceElement.getParentNode())
+ .getAttribute(NODE_ICON_EXPANDED_ATTR_NAME);
+ if (parentAttrName == null || parentAttrName.length() == 0) {
+ ComponentUtil.setImg(img,
+ showLinesValue == true ? ICON_EXPANDED_WITH_LINES
+ : ICON_EXPANDED_WITHOUT_LINES);
+ } else {
+ ComponentUtil.setImgFromResources(pageContext, img,
+ parentAttrName, UNDEFINED_ICON);
+ }
+ img
+ .setAttribute(ICON_PARAM_NAME,
+ DEFAULT_ICON_EXPANDED_PARAM_VALUE);
+ } else if (NODE_ICON_ATTR_NAME.equalsIgnoreCase(name)
+ && !isLastElement(sourceElement.getParentNode(), sourceElement)) {
+ Element iconCell = (Element) visualNode.getChildNodes().item(1);
+ Element img = (Element) iconCell.getChildNodes().item(0);
+ String parentAttrName = ((Element) sourceElement.getParentNode())
+ .getAttribute(NODE_ICON_ATTR_NAME);
+ if (parentAttrName == null || parentAttrName.length() == 0) {
+ ComponentUtil.setImg(img,
+ showLinesValue == true ? ICON_NODE_WITH_LINES
+ : ICON_NODE_WITHOUT_LINES);
+ } else {
+ ComponentUtil.setImgFromResources(pageContext, img,
+ parentAttrName, UNDEFINED_ICON);
+ }
+ img.setAttribute(ICON_PARAM_NAME, DEFAULT_ICON_PARAM_VALUE);
+
+ } else if (NODE_ICON_LEAF_ATTR_NAME.equalsIgnoreCase(name)
+ && isLastElement(sourceElement.getParentNode(), sourceElement)) {
+ Element iconCell = (Element) visualNode.getChildNodes().item(1);
+ Element img = (Element) iconCell.getChildNodes().item(0);
+ String parentAttrName = ((Element) sourceElement.getParentNode())
+ .getAttribute(NODE_ICON_LEAF_ATTR_NAME);
+ if (parentAttrName == null || parentAttrName.length() == 0) {
+ ComponentUtil.setImg(img,
+ showLinesValue == true ? ICON_LEAF_WITH_LINES
+ : ICON_LEAF_WITHOUT_LINES);
+ } else {
+ ComponentUtil.setImgFromResources(pageContext, img,
+ parentAttrName, UNDEFINED_ICON);
+ }
+ img.setAttribute(ICON_PARAM_NAME, NODE_ICON_LEAF_ATTR_NAME);
}
+ }
- /**
- * Adds basic attributes to tree
- *
- * @param img
- */
+ /**
+ *
+ * @param sourceNode
+ * @return
+ */
+ private boolean isAdaptorsChild(Node sourceNode) {
+ String treeNodesAdaptor = sourceNode.getPrefix() + ":"
+ + TREE_NODES_ADAPTOR_NAME;
+ String recursiveTreeNodesAdaptor = sourceNode.getPrefix() + ":"
+ + TREE_NODES_RECURSIVE_ADAPTOR_NAME;
+ if (sourceNode.getNodeName().equals(treeNodesAdaptor)
+ || sourceNode.getNodeName().equals(recursiveTreeNodesAdaptor)) {
+ return true;
+ }
+ return false;
+ }
- private void addBasicAttributesToPicture(Element img) {
- img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- TREE_TABLE_PICTURE_STYLE_CLASS_NAME);
+ /**
+ *
+ * @param parentTree
+ * @param currentNode
+ * @return
+ */
+ private boolean isLastElement(Node parentTree, Node currentNode) {
+ NodeList childs = parentTree.getChildNodes();
+ String treeNodeName = parentTree.getPrefix() + ":"
+ + RichFacesTreeTemplate.TREE_NODE_NAME;
+ Node lastElement = null;
+ Node el = null;
+ for (int i = 0; i < childs.getLength(); i++) {
+ el = childs.item(i);
+ if (el.getNodeName().equals(treeNodeName)) {
+ lastElement = el;
+ }
}
+ return currentNode.equals(lastElement);
+ }
+
+ /**
+ * Adds basic attributes to tree
+ *
+ * @param img
+ */
+
+ private void addBasicAttributesToPicture(Element img) {
+ img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ TREE_TABLE_PICTURE_STYLE_CLASS_NAME);
+ }
+
+ /**
+ * Set attributes for treeNode
+ *
+ * @param table
+ */
+ private void addBasicTreeNodeAttributes(Element 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;
+ }
+
+ /**
+ *
+ * @param sourceNode
+ * @return
+ */
+ private boolean isLastNodesAdaptor(Node sourceNode) {
+ Node nodeAdaptor = sourceNode.getParentNode();
+ if (!(nodeAdaptor instanceof Element)) {
+ return true;
+ }
+ Node parentNode = nodeAdaptor.getParentNode();
+ if (!(parentNode instanceof Element)) {
+ return true;
+ }
+ Node lastNode = parentNode.getLastChild();
+ return lastNode.equals(nodeAdaptor);
+ }
}
Added: 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 (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodesAdaptorTemplate.java 2007-09-26 17:46:45 UTC (rev 3819)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+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.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Create template for rich:treeNodesAdaptor element
+ *
+ * @author dsakovich(a)exadel.com
+ *
+ */
+public class RichFacesTreeNodesAdaptorTemplate extends VpeAbstractTemplate {
+
+ private final static String TREE_NODE_NAME = "treeNode";
+
+ 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";
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+ Element visualElement = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ addBasicTreeNodeAttributes(visualElement);
+ VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
+ parseTree(pageContext, sourceNode, visualDocument, vpeCreationData,
+ visualElement);
+ return vpeCreationData;
+ }
+
+ /**
+ *
+ * Function for parsing tree by tree nodes;
+ *
+ * @param pageContext
+ * @param sourceNode
+ * @param visualDocument
+ * @return
+ */
+ public void parseTree(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument, VpeCreationData vpeCreationData,
+ Element parentElement) {
+ NodeList nodeList = sourceNode.getChildNodes();
+ Element element = null;
+ int lenght = nodeList.getLength();
+ String treeNodeName = sourceNode.getPrefix() + ":" + TREE_NODE_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 tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ Element td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr.appendChild(td);
+ vpeChildrenInfo = new VpeChildrenInfo(td);
+ vpeCreationData.addChildrenInfo(vpeChildrenInfo);
+ vpeChildrenInfo.addSourceChild(element);
+ parentElement.appendChild(tr);
+ }
+ }
+ }
+
+ /**
+ * Set attributes for treeNode
+ *
+ * @param table
+ */
+ private void addBasicTreeNodeAttributes(Element 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");
+ }
+}
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 2007-09-26 16:57:31 UTC (rev 3818)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-09-26 17:46:45 UTC (rev 3819)
@@ -1,13 +1,13 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
@@ -24,381 +24,286 @@
/**
* Create template for rich:tree element.
*
- * @author Max Areshkau
+ * @author dsakovich(a)exadel.com
*
*/
public class RichFacesTreeTemplate extends VpeAbstractTemplate {
- /** Resurces */
+ /** Resurces */
- public static final String TREE_NODE_NAME = "treeNode";
+ public static final String TREE_NODE_NAME = "treeNode";
- public static final String SHOW_LINES_ATTR_NAME = "showConnectingLines";
+ public static final String TREE_NODES_ADAPTOR = "treeNodesAdaptor";
- private static final String STYLE_PATH = "/tree/tree.css";
+ public static final String TREE_RECURSIVE_NODES_ADAPTOR = "recursiveTreeNodesAdaptor";
- private static final String ICON_ATTR = "icon";
+ public static final String SHOW_LINES_ATTR_NAME = "showConnectingLines";
- private static final String TREE_TABLE_ATR_CELLSPACING_VALUE = "0px";
+ private static final String STYLE_PATH = "/tree/tree.css";
- private static final String TREE_TABLE_ATR_CELLPADDING_VALUE = "0px";
+ private static final String ICON_ATTR = "icon";
- private static final String TREE_TABLE_ATR_BORDER_VALUE = "0px";
+ private static final String TREE_STYLE_CLASS_ATR_NAME = "styleClass";
- private static final String TREE_STYLE_CLASS_ATR_NAME = "styleClass";
+ private static final String ICON_COLLAPSED_ATTR_NAME = "iconExpanded";
- 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
- * child nodes.
- *
- * @param pageContext
- * Contains the information on edited page.
- * @param sourceNode
- * The current node of the source tree.
- * @param visualDocument
- * The document of the visual tree.
- * @return The information on the created node of the visual tree.
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
- // sets css for tree on page
- ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "tree");
- Element visualElement = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
- Element treeRow = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TR);
- Element treeCell = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- addBasicTreeAttributes(visualElement);
- treeRow.appendChild(treeCell);
- visualElement.appendChild(treeRow);
- VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
- parseTree(pageContext, sourceNode, visualDocument, vpeCreationData,
- treeCell);
- setStylesAttributesToTree(visualElement, (Element) sourceNode);
- return vpeCreationData;
+ /**
+ * 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
+ * child nodes.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @return The information on the created node of the visual tree.
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+ // sets css for tree on page
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "tree");
+ Element visualElement = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ Element sourceElement = (Element) sourceNode;
+ String style = sourceElement
+ .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ if (style != null) {
+ visualElement
+ .setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
}
-
- /**
- * Sets to tree basic style attributes
- *
- * @param tree
- * @param sourceNode
- */
- private void setStylesAttributesToTree(Element treeTable, Element sourceNode) {
- String styleAttr = sourceNode
- .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
- if (styleAttr != null && styleAttr.length() != 0) {
- setAttributeToTree(treeTable, HtmlComponentUtil.HTML_STYLE_ATTR,
- removeFromStyleWithAndHeight(styleAttr));
- treeTable
- .setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, styleAttr);
- }
- String styleClassAttr = sourceNode
- .getAttribute(TREE_STYLE_CLASS_ATR_NAME);
- if ((styleClassAttr != null) && (styleClassAttr.length() != 0)) {
- setAttributeToTree(treeTable, HtmlComponentUtil.HTML_CLASS_ATTR,
- styleClassAttr);
- }
+ String styleClass = sourceElement
+ .getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
+ if (styleClass != null) {
+ visualElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ styleClass);
}
+ VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
+ parseTree(pageContext, sourceNode, visualDocument, vpeCreationData,
+ visualElement);
+ setStylesAttributesToTree(visualElement, (Element) sourceNode);
+ return vpeCreationData;
+ }
- /**
- *
- * @param styleArgs
- * @return
- */
- private String removeFromStyleWithAndHeight(String styleArgs) {
- StringBuffer result = new StringBuffer();
- String[] mas = styleArgs.split(";");
- for (String styleAttr : mas) {
- if ((styleAttr.indexOf(HtmlComponentUtil.HTML_ATR_WIDTH) != -1)
- || (styleAttr.indexOf(HtmlComponentUtil.HTML_ATR_HEIGHT) != -1)) {
- continue;
- }
- result.append(styleAttr + ";");
- }
- return result.toString();
+ /**
+ * Sets to tree basic style attributes
+ *
+ * @param tree
+ * @param sourceNode
+ */
+ private void setStylesAttributesToTree(Element treeTable, Element sourceNode) {
+ String styleAttr = sourceNode
+ .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ if (styleAttr != null && styleAttr.length() != 0) {
+ setAttributeToTree(treeTable, HtmlComponentUtil.HTML_STYLE_ATTR,
+ removeFromStyleWithAndHeight(styleAttr));
+ treeTable
+ .setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, styleAttr);
}
-
- /**
- * Sets to tree tables attributes
- *
- * @param node
- * @param sourceNode
- * @param attrValue
- */
- private void setAttributeToTree(Node node, String attrName, String attrValue) {
- if (!(node instanceof Element)) {
- return;
- }
- if (node.getNodeName().equalsIgnoreCase(
- HtmlComponentUtil.HTML_TAG_TABLE)) {
- ((Element) node).setAttribute(attrName, attrValue);
- }
- NodeList list2 = node.getChildNodes();
- for (int i = 0; i < list2.getLength(); i++) {
- setAttributeToTree(list2.item(i), attrName, attrValue);
- }
+ String styleClassAttr = sourceNode
+ .getAttribute(TREE_STYLE_CLASS_ATR_NAME);
+ if ((styleClassAttr != null) && (styleClassAttr.length() != 0)) {
+ setAttributeToTree(treeTable, HtmlComponentUtil.HTML_CLASS_ATTR,
+ styleClassAttr);
}
+ }
- /**
- * Is invoked after construction of all child nodes of the current visual
- * node.
- *
- * @param pageContext
- * Contains the information on edited page.
- * @param sourceNode
- * The current node of the source tree.
- * @param visualDocument
- * The document of the visual tree.
- * @param data
- * Object <code>VpeCreationData</code>, built by a method
- * <code>create</code>
- */
- public void validate(VpePageContext pageContext, Node sourceNode,
- Document visualDocument, VpeCreationData data) {
- super.validate(pageContext, sourceNode, visualDocument, data);
- revertTableRows(data.getNode());
+ /**
+ *
+ * @param styleArgs
+ * @return
+ */
+ private String removeFromStyleWithAndHeight(String styleArgs) {
+ StringBuffer result = new StringBuffer();
+ String[] mas = styleArgs.split(";");
+ for (String styleAttr : mas) {
+ if ((styleAttr.indexOf(HtmlComponentUtil.HTML_ATR_WIDTH) != -1)
+ || (styleAttr.indexOf(HtmlComponentUtil.HTML_ATR_HEIGHT) != -1)) {
+ continue;
+ }
+ result.append(styleAttr + ";");
}
+ return result.toString();
+ }
- /**
- * Recursive go throw three and checks if icon was seted for node or not
- *
- * @param node
- */
- private void correctImage(VpePageContext pageContex, Element sourceNode,
- Node node) {
- if (!(node instanceof Element)) {
- return;
- }
- if (node.getNodeName().equalsIgnoreCase(HtmlComponentUtil.HTML_TAG_IMG)) {
- String srcAttr = ((Element) node)
- .getAttribute(RichFacesTreeNodeTemplate.ICON_PARAM_NAME);
- if (RichFacesTreeNodeTemplate.DEFAULT_ICON_EXPANDED_PARAM_VALUE
- .equals(srcAttr)) {
- setImgForNode(pageContex, sourceNode, (Element) node,
- ICON_COLLAPSED_ATTR_NAME,
- RichFacesTreeNodeTemplate.ICON_EXPANDED_WITH_LINES,
- RichFacesTreeNodeTemplate.ICON_EXPANDED_WITHOUT_LINES);
- } else if (RichFacesTreeNodeTemplate.DEFAULT_ICON_PARAM_VALUE
- .equals(srcAttr)) {
- setImgForNode(pageContex, sourceNode, (Element) node,
- ICON_ATTR,
- RichFacesTreeNodeTemplate.ICON_NODE_WITH_LINES,
- RichFacesTreeNodeTemplate.ICON_NODE_WITHOUT_LINES);
- } else if (RichFacesTreeNodeTemplate.NODE_ICON_LEAF_ATTR_NAME
- .equals(srcAttr)) {
- setImgForNode(pageContex, sourceNode, (Element) node,
- RichFacesTreeNodeTemplate.NODE_ICON_LEAF_ATTR_NAME,
- RichFacesTreeNodeTemplate.ICON_LEAF_WITH_LINES,
- RichFacesTreeNodeTemplate.ICON_LEAF_WITHOUT_LINES);
- }
- }
- NodeList list2 = node.getChildNodes();
- for (int i = 0; i < list2.getLength(); i++) {
- correctImage(pageContex, sourceNode, list2.item(i));
- }
+ /**
+ * Sets to tree tables attributes
+ *
+ * @param node
+ * @param sourceNode
+ * @param attrValue
+ */
+ private void setAttributeToTree(Node node, String attrName, String attrValue) {
+ if (!(node instanceof Element)) {
+ return;
}
-
- /**
- * Sets icon fro node
- *
- * @param img
- * @param sourceNode
- */
- private void setImgForNode(VpePageContext pageContext, Element sourceNode,
- Element img, String attrName, String iconWithLines,
- String iconWithoutLines) {
- String treeIconAttr = sourceNode.getAttribute(attrName);
- if (treeIconAttr != null && treeIconAttr.length() > 0) {
- ComponentUtil.setImgFromResources(pageContext, img, treeIconAttr,
- RichFacesTreeNodeTemplate.UNDEFINED_ICON);
- return;
- }
- String showConnectingLinesAttr = sourceNode
- .getAttribute(SHOW_LINES_ATTR_NAME);
- if (showConnectingLinesAttr != null
- && showConnectingLinesAttr.length() > 0
- && showConnectingLinesAttr.equalsIgnoreCase("false")) {
- ComponentUtil.setImg(img, iconWithoutLines);
- } else {
- ComponentUtil.setImg(img, iconWithLines);
- }
+ if (node.getNodeName().equalsIgnoreCase(
+ HtmlComponentUtil.HTML_TAG_TABLE)) {
+ ((Element) node).setAttribute(attrName, attrValue);
}
+ NodeList list2 = node.getChildNodes();
+ for (int i = 0; i < list2.getLength(); i++) {
+ setAttributeToTree(list2.item(i), attrName, attrValue);
+ }
+ }
- /**
- * Revert tree elements in right order.
- *
- * @param node
- */
- private void revertTableRows(Node node) {
- if (!(node instanceof Element)) {
- return;
- }
- NodeList list = node.getChildNodes();
- if (node.getNodeName().equalsIgnoreCase(
- HtmlComponentUtil.HTML_TAG_TABLE)
- && list.getLength() == 2) {
- Node tr1 = list.item(0);
- Node tr2 = list.item(1);
- node.removeChild(tr1);
- node.removeChild(tr2);
- node.appendChild(tr2);
- node.appendChild(tr1);
- }
- NodeList list2 = node.getChildNodes();
- for (int i = 0; i < list2.getLength(); i++) {
- revertTableRows(list2.item(i));
- }
+ /**
+ * Is invoked after construction of all child nodes of the current visual
+ * node.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param data
+ * Object <code>VpeCreationData</code>, built by a method
+ * <code>create</code>
+ */
+ public void validate(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument, VpeCreationData data) {
+ super.validate(pageContext, sourceNode, visualDocument, data);
+ revertTableRows(data.getNode());
+ }
+
+ /**
+ * Revert tree elements in right order.
+ *
+ * @param node
+ */
+ private void revertTableRows(Node node) {
+ if (!(node instanceof Element)) {
+ return;
}
+ NodeList list = node.getChildNodes();
+ if (node.getNodeName().equalsIgnoreCase(HtmlComponentUtil.HTML_TAG_DIV)
+ && list.getLength() == 2) {
+ Node table1 = list.item(0);
+ Node table2 = list.item(1);
+ node.removeChild(table1);
+ node.removeChild(table2);
+ node.appendChild(table2);
+ node.appendChild(table1);
+ }
+ NodeList list2 = node.getChildNodes();
+ for (int i = 0; i < list2.getLength(); i++) {
+ revertTableRows(list2.item(i));
+ }
+ }
- /**
- *
- * Function for parsing tree by tree nodes;
- *
- * @param pageContext
- * @param sourceNode
- * @param visualDocument
- * @return
- */
- public void parseTree(VpePageContext pageContext, Node sourceNode,
- Document visualDocument, VpeCreationData vpeCreationData,
- Element cell) {
- // work arroud, becouse getChielsByName returns always null;
- NodeList nodeList = sourceNode.getChildNodes();
- Element element = null;
- Element tree = null;
- Element childTree = null;
- Element childLast = null;
- int lenght = nodeList.getLength();
- String treeNodeName = sourceNode.getPrefix() + ":" + TREE_NODE_NAME;
- VpeChildrenInfo vpeChildrenInfo = null;
- for (int i = 0; i < lenght; i++) {
- if (!(nodeList.item(i) instanceof Element)) {
- continue;
- }
- element = (Element) nodeList.item(i);
- childTree = null;
- if (element.getNodeName().equals(treeNodeName)) {
- if (tree == null) {
+ /**
+ *
+ * Function for parsing tree by tree nodes;
+ *
+ * @param pageContext
+ * @param sourceNode
+ * @param visualDocument
+ * @return
+ */
+ public void parseTree(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument, VpeCreationData vpeCreationData,
+ Element parentDiv) {
+ NodeList nodeList = sourceNode.getChildNodes();
+ Element element = null;
+ Element div = null;
+ Element childTree = null;
+ Element childLast = null;
+ int lenght = nodeList.getLength();
+ String treeNodeName = sourceNode.getPrefix() + ":" + TREE_NODE_NAME;
+ String treeNodesAdaptorName = sourceNode.getPrefix() + ":"
+ + TREE_NODES_ADAPTOR;
+ String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":"
+ + TREE_RECURSIVE_NODES_ADAPTOR;
+ VpeChildrenInfo vpeChildrenInfo = null;
+ for (int i = 0; i < lenght; i++) {
+ if (!(nodeList.item(i) instanceof Element)) {
+ continue;
+ }
+ element = (Element) nodeList.item(i);
+ childTree = null;
+ if (element.getNodeName().equals(treeNodeName)
+ || element.getNodeName().equals(treeNodesAdaptorName)
+ || element.getNodeName().equals(
+ recursiveTreeNodesAdaptorName)) {
+ if (div == null) {
- tree = createBasicTree(visualDocument);
- vpeChildrenInfo = new VpeChildrenInfo(tree);
- vpeCreationData.addChildrenInfo(vpeChildrenInfo);
- vpeChildrenInfo.addSourceChild(element);
- childLast = tree;
- continue;
- } else if (childTree == null) {
+ vpeChildrenInfo = new VpeChildrenInfo(parentDiv);
+ vpeCreationData.addChildrenInfo(vpeChildrenInfo);
+ vpeChildrenInfo.addSourceChild(element);
+ div = createBasicTree(visualDocument);
+ childLast = parentDiv;
+ continue;
+ } else if (childTree == null) {
- childTree = createBasicTree(visualDocument);
- appendChildTree(childLast, childTree, visualDocument);
- vpeChildrenInfo = new VpeChildrenInfo(childTree);
- vpeCreationData.addChildrenInfo(vpeChildrenInfo);
- vpeChildrenInfo.addSourceChild(element);
- childLast = childTree;
- continue;
- }
- }
+ vpeChildrenInfo = new VpeChildrenInfo(div);
+ vpeCreationData.addChildrenInfo(vpeChildrenInfo);
+ vpeChildrenInfo.addSourceChild(element);
+ childLast.appendChild(div);
+ childLast = div;
+ div = createBasicTree(visualDocument);
+ continue;
}
- if (tree != null) {
- cell.appendChild(tree);
- }
+ }
}
+ }
- /**
- * Appends child node to tree
- *
- * @param parentNode
- * @param childNode
- * @param visualDocument
- */
- private void appendChildTree(Element parentNode, Element childNode,
- Document visualDocument) {
- Element tr = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TR);
- Element emptyCell = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- Element treeCell = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- treeCell.setAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN, "2");
- tr.appendChild(emptyCell);
- tr.appendChild(treeCell);
- treeCell.appendChild(childNode);
- parentNode.appendChild(tr);
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument, Node visualNode,
+ Object data, String name, String value) {
+ if (ICON_COLLAPSED_ATTR_NAME.equals(name)
+ || SHOW_LINES_ATTR_NAME.equals(name)
+ || ICON_ATTR.equals(name)
+ || RichFacesTreeNodeTemplate.NODE_ICON_LEAF_ATTR_NAME
+ .equals(name)) {
+ return true;
}
+ return false;
+ }
- @Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
- String value) {
- if (TREE_STYLE_CLASS_ATR_NAME.equalsIgnoreCase(name)) {
- setAttributeToTree(visualNode, HtmlComponentUtil.HTML_CLASS_ATTR,
- value);
- } else if (HtmlComponentUtil.HTML_STYLE_ATTR.equalsIgnoreCase(name)) {
- setAttributeToTree(visualNode, HtmlComponentUtil.HTML_STYLE_ATTR,
- removeFromStyleWithAndHeight(value));
- ((Element) visualNode).setAttribute(
- HtmlComponentUtil.HTML_STYLE_ATTR, value);
- } else if (ICON_COLLAPSED_ATTR_NAME.equals(name)
- || SHOW_LINES_ATTR_NAME.equals(name)
- || ICON_ATTR.equals(name)
- || RichFacesTreeNodeTemplate.NODE_ICON_LEAF_ATTR_NAME
- .equals(name)) {
- correctImage(pageContext, sourceElement, visualNode);
- }
+ @Override
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
+ Document visualDocument, Node visualNode, Object data, String name,
+ String value) {
+ if (TREE_STYLE_CLASS_ATR_NAME.equalsIgnoreCase(name)) {
+ setAttributeToTree(visualNode, HtmlComponentUtil.HTML_CLASS_ATTR,
+ value);
+ } else if (HtmlComponentUtil.HTML_STYLE_ATTR.equalsIgnoreCase(name)) {
+ setAttributeToTree(visualNode, HtmlComponentUtil.HTML_STYLE_ATTR,
+ removeFromStyleWithAndHeight(value));
+ ((Element) visualNode).setAttribute(
+ HtmlComponentUtil.HTML_STYLE_ATTR, value);
}
+ }
- @Override
- public void removeAttribute(VpePageContext pageContext,
- Element sourceElement, Document visualDocument, Node 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,
- "");
- } else if (ICON_COLLAPSED_ATTR_NAME.equals(name)
- || SHOW_LINES_ATTR_NAME.equals(name)
- || ICON_ATTR.equals(name)
- || RichFacesTreeNodeTemplate.NODE_ICON_LEAF_ATTR_NAME
- .equals(name)) {
- correctImage(pageContext, sourceElement, visualNode);
- }
+ @Override
+ public void removeAttribute(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument, Node 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,
+ "");
}
+ }
- /**
- * Create simple tree node attribute.Used for creating more complex trees.
- *
- * @param treeNodeTitle
- * @param visualDocument
- * @return tree
- */
- private Element createBasicTree(Document visualDocument) {
- // create table
- Element tree = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
- addBasicTreeAttributes(tree);
- return tree;
- }
+ /**
+ * Create simple tree node attribute.Used for creating more complex trees.
+ *
+ * @param treeNodeTitle
+ * @param visualDocument
+ * @return tree
+ */
+ private Element createBasicTree(Document visualDocument) {
- /**
- * Sets some attributes which necessary for displaying table as tree
- *
- * @param tree
- */
- private void addBasicTreeAttributes(Element tree) {
- if (tree == null) {
- return;
- }
- tree.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR,
- TREE_TABLE_ATR_CELLSPACING_VALUE);
- tree.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR,
- TREE_TABLE_ATR_CELLPADDING_VALUE);
- tree.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR,
- TREE_TABLE_ATR_BORDER_VALUE);
- }
+ Element div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-tree-h-ic-div");
+ return div;
+ }
+
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-09-26 16:57:31 UTC (rev 3818)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-09-26 17:46:45 UTC (rev 3819)
@@ -43,6 +43,8 @@
<vpe:drag start-enable="yes" />
<vpe:drop container="yes">
<vpe:container-child tag-name="treeNode" />
+ <vpe:container-child tag-name="treeNodesAdaptor" />
+ <vpe:container-child tag-name="recursiveTreeNodesAdaptor" />
</vpe:drop>
</vpe:dnd>
<vpe:textFormating>
@@ -72,6 +74,38 @@
<vpe:pseudoContent defaultText="yes" />
</vpe:template>
</vpe:tag>
+
+ <vpe:tag name="rich:treeNodesAdaptor" case-sensitive="yes">
+ <vpe:template children="yes" modify="no"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesTreeNodesAdaptorTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes">
+ <vpe:container-child tag-name="treeNode" />
+ </vpe:drop>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="rich:recursiveTreeNodesAdaptor" case-sensitive="yes">
+ <vpe:template children="yes" modify="no"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesTreeNodesAdaptorTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes">
+ <vpe:container-child tag-name="treeNode" />
+ </vpe:drop>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
<vpe:tag name="rich:treeNode" case-sensitive="yes">
<vpe:template children="yes" modify="yes"
17 years, 3 months
JBoss Tools SVN: r3818 - in trunk/hibernatetools/plugins: org.hibernate.eclipse/META-INF and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-09-26 12:57:31 -0400 (Wed, 26 Sep 2007)
New Revision: 3818
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/launch/
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/launch/SeamUtil.java
Removed:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/SeamUtil.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath
trunk/hibernatetools/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
Log:
http://jira.jboss.com/jira/browse/JBIDE-769 I moved SeamUtil from .eclipse.console to .eclipse plugin
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath 2007-09-26 15:22:03 UTC (rev 3817)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath 2007-09-26 16:57:31 UTC (rev 3818)
@@ -8,7 +8,7 @@
<classpathentry exported="true" kind="lib" path="lib/hibernate/concurrent-1.3.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/connector.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/dom4j-1.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate/hibernate3.jar" sourcepath="/hibernate-3.2"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate/hibernate3.jar" sourcepath="/Hibernate3"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jboss-cache.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jboss-common.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jboss-jmx.jar"/>
@@ -20,7 +20,7 @@
<classpathentry exported="true" kind="lib" path="lib/hibernate/oscache-2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/proxool-0.8.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/swarmcache-1.0rc2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/tools/hibernate-tools.jar" sourcepath="/hibernateext.tools"/>
+ <classpathentry exported="true" kind="lib" path="lib/tools/hibernate-tools.jar" sourcepath="/HibernateExt/tools/src/java"/>
<classpathentry exported="true" kind="lib" path="lib/tools/freemarker.jar"/>
<classpathentry exported="true" kind="lib" path="lib/bsh-core-2.0b4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/annotations/ejb3-persistence.jar"/>
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2007-09-26 15:22:03 UTC (rev 3817)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2007-09-26 16:57:31 UTC (rev 3818)
@@ -276,6 +276,7 @@
org.hibernate.dialect.function,
org.hibernate.dialect.lock,
org.hibernate.eclipse,
+ org.hibernate.eclipse.launch,
org.hibernate.eclipse.logging,
org.hibernate.eclipse.logging.xpl,
org.hibernate.ejb,
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/launch/SeamUtil.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/launch/SeamUtil.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/launch/SeamUtil.java 2007-09-26 16:57:31 UTC (rev 3818)
@@ -0,0 +1,21 @@
+package org.hibernate.eclipse.launch;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class SeamUtil {
+
+ public String lower(String name)
+ {
+ return name.substring(0, 1).toLowerCase() + name.substring(1);
+ }
+ public String upper(String name)
+ {
+ return name.substring(0, 1).toUpperCase() + name.substring(1);
+ }
+ public Set set()
+ {
+ return new HashSet();
+ }
+
+}
Deleted: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/SeamUtil.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/SeamUtil.java 2007-09-26 15:22:03 UTC (rev 3817)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/SeamUtil.java 2007-09-26 16:57:31 UTC (rev 3818)
@@ -1,21 +0,0 @@
-package org.hibernate.eclipse.launch;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class SeamUtil {
-
- public String lower(String name)
- {
- return name.substring(0, 1).toLowerCase() + name.substring(1);
- }
- public String upper(String name)
- {
- return name.substring(0, 1).toUpperCase() + name.substring(1);
- }
- public Set set()
- {
- return new HashSet();
- }
-
-}
17 years, 3 months
JBoss Tools SVN: r3817 - in branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ezheleznyakov
Date: 2007-09-26 11:22:03 -0400 (Wed, 26 Sep 2007)
New Revision: 3817
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-897
little fix
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java 2007-09-26 14:22:02 UTC (rev 3816)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java 2007-09-26 15:22:03 UTC (rev 3817)
@@ -15,6 +15,7 @@
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNamedNodeMap;
import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -28,6 +29,7 @@
private nsIDOMElement bodyOld;
private static String STYLE_FOR_DIV = "width: 100%; height: 100%";
+ private static String ID = "id";
/**
*
@@ -37,8 +39,22 @@
goToTree(visualDocument.getChildNodes().item(0));
+ nsIDOMNamedNodeMap attrsMap = bodyOld.getAttributes();
+ long len = attrsMap.getLength();
+ int j = 0;
+ for (int i = 0; i < len; i++) {
+ nsIDOMNode attr = attrsMap.item(j);
+ if (ID.equalsIgnoreCase(attr.getNodeName())) {
+ j++;
+ continue;
+ }
+ bodyOld.removeAttribute(attr.getNodeName());
+ }
+
for (int i = 0; i < sourceNode.getAttributes().getLength(); i++) {
String name = sourceNode.getAttributes().item(i).getNodeName();
+ if(ID.equalsIgnoreCase(name))
+ continue;
String value = sourceNode.getAttributes().item(i).getNodeValue();
// all full path for 'url'
if (VpeStyleUtil.ATTRIBUTE_STYLE.equalsIgnoreCase(name))
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2007-09-26 14:22:02 UTC (rev 3816)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2007-09-26 15:22:03 UTC (rev 3817)
@@ -44,7 +44,7 @@
public static String ATTR_URL = "url";
public static String OPEN_BRACKET = "(";
public static String CLOSE_BRACKET = ")";
- public static String FILE_PRTOCOL = "file:///";
+ public static String FILE_PRTOCOL = "file://";
public static String FILE_STR = "file:";
public static String FILE_SEPARAROT = "/";
17 years, 3 months
JBoss Tools SVN: r3816 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-09-26 10:22:02 -0400 (Wed, 26 Sep 2007)
New Revision: 3816
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
Log:
don't store the generate-entities in the project.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-09-26 14:09:16 UTC (rev 3815)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-09-26 14:22:02 UTC (rev 3816)
@@ -64,8 +64,9 @@
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType =
launchManager.getLaunchConfigurationType("org.hibernate.eclipse.launch.CodeGenerationLaunchConfigurationType");
+ // we put null in location to avoid it being inside the project by default since the launch config currenlty will be machine independent with respect to the paths.
ILaunchConfigurationWorkingCopy wc =
- launchConfigurationType.newInstance(project, project.getName() + "-generate-entities");
+ launchConfigurationType.newInstance(null, project.getName() + "-generate-entities");
//Main
17 years, 3 months
JBoss Tools SVN: r3815 - trunk/documentation/GettingStartedGuide/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2007-09-26 10:09:16 -0400 (Wed, 26 Sep 2007)
New Revision: 3815
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/AddBusinessProcess.xml
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GetStartSeamGen.xml
Log:
http://jira.jboss.com/jira/browse/RHDS-171
JSP -> XML
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/AddBusinessProcess.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/AddBusinessProcess.xml 2007-09-26 13:43:24 UTC (rev 3814)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/AddBusinessProcess.xml 2007-09-26 14:09:16 UTC (rev 3815)
@@ -363,7 +363,7 @@
Order button to the Orders.xhtml file.</para>
<para>You can add the new button right next to the existing "Add orderdetails" button.
Copy/paste the following button code in the actionButtons region:</para>
- <programlisting role="JSP"><![CDATA[<s:button id="buttonId" value="Process Order"
+ <programlisting role="XML"><![CDATA[<s:button id="buttonId" value="Process Order"
action="#{orderProcessor.startProcess}"
view="/Orders.xhtml"/>
]]></programlisting>
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GetStartSeamGen.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GetStartSeamGen.xml 2007-09-26 13:43:24 UTC (rev 3814)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GetStartSeamGen.xml 2007-09-26 14:09:16 UTC (rev 3815)
@@ -201,7 +201,7 @@
<para>The wizard generate a web page with a single text input field and an action button. Notice that the generated page uses layout/template.xhtml as a template. The template page provides the page header, footer, side menu, and CSS styles (see the template.xhtml for more details). The Simplepage.xhtml is assembled into the template when the Simplepage.seam URL is loaded.</para>
- <programlisting role="JSP"><![CDATA[
+ <programlisting role="XML"><![CDATA[
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -351,13 +351,13 @@
<para>Next, on the web page, add the following line to display the value property on the simpleAction component. Notice that code completion is supported for the JSF EL expression.</para>
- <programlisting role="JSP"><![CDATA[
+ <programlisting role="XML"><![CDATA[
<p><b>Hello, #{simpleAction.value}</b></p>
]]></programlisting>
<para>Finally, on the web page, we add a boolean selection box component. It is bound to the XXXX property on the backend component.</para>
- <programlisting role="JSP"><![CDATA[
+ <programlisting role="XML"><![CDATA[
<h:selectBooleanCheckbox title="convertToCap"
value="#{simpleAction.convertToCap}" />
Capitalize the input?
@@ -402,7 +402,7 @@
<para>We can also secure web pages. You can edit the XXXX file to put an access constraint on the XXXXX page.</para>
- <programlisting role="JSP"><![CDATA[
+ <programlisting role="XML"><![CDATA[
]]></programlisting>
<para>You can try to load the XXXX URL in the browser and it will redirect to ask for login.</para>
17 years, 3 months
JBoss Tools SVN: r3814 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-09-26 09:43:24 -0400 (Wed, 26 Sep 2007)
New Revision: 3814
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
Log:
JBIDE-948
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-09-26 13:41:53 UTC (rev 3813)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-09-26 13:43:24 UTC (rev 3814)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.validation;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
17 years, 3 months
JBoss Tools SVN: r3813 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-09-26 09:41:53 -0400 (Wed, 26 Sep 2007)
New Revision: 3813
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
Log:
JBIDE-948
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-09-26 13:34:20 UTC (rev 3812)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-09-26 13:41:53 UTC (rev 3813)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.validation;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -175,7 +177,9 @@
public void clearAll() {
removedFiles.clear();
- registeredResources.clear();
+ synchronized (registeredResources) {
+ registeredResources.clear();
+ }
oldVariableNamesForELValidation.clear();
coreLinks.clearAll();
elLinks.clearAll();
@@ -189,7 +193,9 @@
public void clearRegisteredFiles() {
removedFiles.clear();
- registeredResources.clear();
+ synchronized (registeredResources) {
+ registeredResources.clear();
+ }
}
public void clearElResourceLinks() {
@@ -231,11 +237,17 @@
}
public Set<IFile> getRegisteredFiles() {
- return registeredResources;
+ Set<IFile> copy = new HashSet<IFile>();
+ synchronized (registeredResources) {
+ copy.addAll(registeredResources);
+ }
+ return copy;
}
public void registerFile(IFile file) {
- registeredResources.add(file);
+ synchronized (registeredResources) {
+ registeredResources.add(file);
+ }
}
public static class LinkCollection {
17 years, 3 months