JBoss Tools SVN: r7744 - trunk/documentation/jboss-tools-docs.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-04-24 12:09:47 -0400 (Thu, 24 Apr 2008)
New Revision: 7744
Modified:
trunk/documentation/jboss-tools-docs/pom.xml
Log:
Modified: trunk/documentation/jboss-tools-docs/pom.xml
===================================================================
--- trunk/documentation/jboss-tools-docs/pom.xml 2008-04-24 16:06:56 UTC (rev 7743)
+++ trunk/documentation/jboss-tools-docs/pom.xml 2008-04-24 16:09:47 UTC (rev 7744)
@@ -61,26 +61,4 @@
</plugins>
</build>
-
-
- <properties>
- <translation>en-US</translation>
- </properties>
- <pluginRepositories>
- <pluginRepository>
- <id>repository.jboss.com</id>
- <name>Jboss Repository for Maven</name>
- <url>http://repository.jboss.com/maven2/</url>
- <layout>default</layout>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- <updatePolicy>never</updatePolicy>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
-
-
</project>
17 years, 8 months
JBoss Tools SVN: r7743 - trunk/documentation/jboss-tools-docs.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-04-24 12:06:56 -0400 (Thu, 24 Apr 2008)
New Revision: 7743
Modified:
trunk/documentation/jboss-tools-docs/pom.xml
Log:
Modified: trunk/documentation/jboss-tools-docs/pom.xml
===================================================================
--- trunk/documentation/jboss-tools-docs/pom.xml 2008-04-24 16:00:14 UTC (rev 7742)
+++ trunk/documentation/jboss-tools-docs/pom.xml 2008-04-24 16:06:56 UTC (rev 7743)
@@ -1,70 +1,86 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.jboss.tools</groupId>
- <artifactId>all-guides</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>All_Userguides</name>
-
-<modules>
- <module>../guides/Exadel-migration</module>
- <module>../guides/GettingStartedGuide</module>
- <module>../../as/docs/reference</module>
- <module>../../hibernatetools/docs/reference</module>
- <module>../../jbpm/docs/reference</module>
- <module>../../jsf/docs/userguide</module>
- <module>../../jsf/docs/jsf_tools_ref_guide</module>
- <module>../../jsf/docs/jsf_tools_tutorial</module>
- <module>../../seam/docs/reference</module>
- <module>../../struts/docs/struts_tools_ref_guide</module>
- <module>../../struts/docs/struts_tools_tutorial</module>
- <module>../../esb/docs/esb_ref_guide</module>
-</modules>
-
- <build>
- <plugins>
-
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>all-guides.xml</descriptor>
- </descriptors>
- <finalName>en</finalName>
- <outputDirectory>nightly-docs</outputDirectory>
- <appendAssemblyId>false</appendAssemblyId>
- <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
- </configuration>
- </plugin>
- <!--plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <configuration>
- <tasks>
- <echo message="################### Deleting archive-tmp #####################"/>
- <delete includeEmptyDirs="true" dir="target/archive-tmp"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin-->
-
-
- </plugins>
- </build>
-
-
-<properties>
- <translation>en-US</translation>
-</properties>
-
-</project>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>all-guides</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>All_Userguides</name>
+
+ <modules>
+ <module>../guides/Exadel-migration</module>
+ <module>../guides/GettingStartedGuide</module>
+ <module>../../as/docs/reference</module>
+ <module>../../hibernatetools/docs/reference</module>
+ <module>../../jbpm/docs/reference</module>
+ <module>../../jsf/docs/userguide</module>
+ <module>../../jsf/docs/jsf_tools_ref_guide</module>
+ <module>../../jsf/docs/jsf_tools_tutorial</module>
+ <module>../../seam/docs/reference</module>
+ <module>../../struts/docs/struts_tools_ref_guide</module>
+ <module>../../struts/docs/struts_tools_tutorial</module>
+ <module>../../esb/docs/esb_ref_guide</module>
+ </modules>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>all-guides.xml</descriptor>
+ </descriptors>
+ <finalName>en</finalName>
+ <outputDirectory>nightly-docs</outputDirectory>
+ <appendAssemblyId>false</appendAssemblyId>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ </configuration>
+ </plugin>
+ <!--plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <echo message="################### Deleting archive-tmp #####################"/>
+ <delete includeEmptyDirs="true" dir="target/archive-tmp"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin-->
+
+
+ </plugins>
+ </build>
+
+
+ <properties>
+ <translation>en-US</translation>
+ </properties>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.com</id>
+ <name>Jboss Repository for Maven</name>
+ <url>http://repository.jboss.com/maven2/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+
+</project>
17 years, 8 months
JBoss Tools SVN: r7742 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-04-24 12:00:14 -0400 (Thu, 24 Apr 2008)
New Revision: 7742
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
Log:
http://jira.jboss.com/jira/browse/JBIDE-2122 Fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-04-24 15:41:38 UTC (rev 7741)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-04-24 16:00:14 UTC (rev 7742)
@@ -40,7 +40,6 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -53,7 +52,8 @@
*/
public class SeamEarProjectValidator implements IValidatorJob {
- protected static final String INVALID_APPLICATION_XML_MESSAGE_ID = "INVALID_APPLICATION_XML"; //$NON-NLS-1$
+ protected static final String INVALID_SEAM_JAR_MODULE_IN_APPLICATION_XML_MESSAGE_ID = "INVALID_SEAM_JAR_MODULE_IN_APPLICATION_XML"; //$NON-NLS-1$
+ protected static final String INVALID_JAR_MODULE_IN_APPLICATION_XML_MESSAGE_ID = "INVALID_JAR_MODULE_IN_APPLICATION_XML"; //$NON-NLS-1$
private IValidationErrorManager errorManager;
@@ -105,8 +105,8 @@
private static final String MODULE_NODE_NAME = "module";
private static final String JAVA_NODE_NAME = "java";
+ private static final String SEAM_JAR_NAME = "jboss-seam.jar";
private static final String[] JARS = new String[]{
- "jboss-seam",
"el-ri",
"jbpm",
"drools-core",
@@ -187,10 +187,14 @@
private void validateJarName(IResource file, String text, int offset) {
String jarName = text.trim();
for(int jarIndex=0; jarIndex<JARS.length; jarIndex++) {
+ int position = offset + text.indexOf(jarName);
+ int length = jarName.length();
+ if(SEAM_JAR_NAME.equals(jarName)) {
+ errorManager.addError(INVALID_SEAM_JAR_MODULE_IN_APPLICATION_XML_MESSAGE_ID, IMessage.HIGH_SEVERITY, new String[]{}, length, position, file);
+ break;
+ }
if(jarName.startsWith(JARS[jarIndex])) {
- int position = offset + text.indexOf(jarName);
- int length = jarName.length();
- errorManager.addError(INVALID_APPLICATION_XML_MESSAGE_ID, IMessage.HIGH_SEVERITY, new String[]{jarName}, length, position, file);
+ errorManager.addError(INVALID_JAR_MODULE_IN_APPLICATION_XML_MESSAGE_ID, IMessage.NORMAL_SEVERITY, new String[]{jarName}, length, position, file);
break;
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-04-24 15:41:38 UTC (rev 7741)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-04-24 16:00:14 UTC (rev 7742)
@@ -60,7 +60,8 @@
INVALID_CONNECTION_NAME=Connection profiler "{0}" specified for Seam project "{1}" does not exist. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
#Invalid ear application.xml
-INVALID_APPLICATION_XML=Invalid module "{0}"
+INVALID_SEAM_JAR_MODULE_IN_APPLICATION_XML=jboss-seam.el needs to be inside a <module><ejb>jboss-seam.jar</ejb><module> to work correctly.
+INVALID_JAR_MODULE_IN_APPLICATION_XML=Having "{0}" listed as a java module in application.xml can cause publishing errors. It is recommended to remove this module entry from application.xml.
#Messages for Progress Monitor
SEARCHING_RESOURCES=project "{0}"; searching resources for validation.
17 years, 8 months
JBoss Tools SVN: r7741 - in trunk/seam/docs/reference/en: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2008-04-24 11:41:38 -0400 (Thu, 24 Apr 2008)
New Revision: 7741
Modified:
trunk/seam/docs/reference/en/images/seam_preferences/seam_preferences1_2.png
trunk/seam/docs/reference/en/modules/seam_menus_and_actions.xml
trunk/seam/docs/reference/en/modules/seam_preferences.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-296 chapters update according Svetlana's remarks
Modified: trunk/seam/docs/reference/en/images/seam_preferences/seam_preferences1_2.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/modules/seam_menus_and_actions.xml
===================================================================
--- trunk/seam/docs/reference/en/modules/seam_menus_and_actions.xml 2008-04-24 15:41:07 UTC (rev 7740)
+++ trunk/seam/docs/reference/en/modules/seam_menus_and_actions.xml 2008-04-24 15:41:38 UTC (rev 7741)
@@ -17,7 +17,7 @@
<itemizedlist>
<listitem><para>Menu bar</para></listitem>
<listitem><para>Toolbar</para></listitem>
- <listitem><para>Context menus in views.</para></listitem>
+ <listitem><para>Context menus in views</para></listitem>
</itemizedlist>
@@ -32,9 +32,7 @@
<tgroup cols="2">
<colspec colnum="1" colwidth="1*"/>
<colspec colnum="2" colwidth="4*"/>
-
-
-
+
<thead>
<row>
<entry align="center">
@@ -151,7 +149,7 @@
<section id="navigate_menu">
<title>Navigate Menu Actions</title>
- <para>The following Seam actions help you to easily navigate through the source code.</para>
+ <para>These Seam actions help you to easily navigate through the source code.</para>
<section id="find_seam_ref_decl">
@@ -180,6 +178,7 @@
</mediaobject>
</figure>
+ <para>In the table below read a description about the actions.</para>
<table>
<title>Find Seam References/Declarations actions</title>
@@ -233,7 +232,7 @@
</table>
- <para>Look at the screenshot example</para>
+ <para>You could see the screenshot example below:</para>
<figure>
<title>Find Seam Declaration for "Identity"</title>
@@ -244,7 +243,7 @@
</mediaobject>
</figure>
- <para>You can also use Ctrl + 1 in .java files</para>
+ <para>You can also use Ctrl + 1 in .java files to activate the actions:</para>
<figure>
<title>Find Seam References for "Identity"</title>
@@ -272,6 +271,8 @@
</mediaobject>
</figure>
+ <para>In the table below read a description about the dialog.</para>
+
<table>
<title>Open Seam Components Dialog</title>
<tgroup cols="3">
@@ -320,6 +321,7 @@
</tgroup>
</table>
+ <para>Enter a name in the text field and see the results as it shown on screenshot: </para>
<figure>
<title>Open Seam Components Dialog</title>
Modified: trunk/seam/docs/reference/en/modules/seam_preferences.xml
===================================================================
--- trunk/seam/docs/reference/en/modules/seam_preferences.xml 2008-04-24 15:41:07 UTC (rev 7740)
+++ trunk/seam/docs/reference/en/modules/seam_preferences.xml 2008-04-24 15:41:38 UTC (rev 7741)
@@ -98,7 +98,7 @@
<title>Project Preferences</title>
<para>Once Seam project is created you can modify its settings. Right click on Seam project in Project Explorer and select <emphasis><property>Properties > Seam Settings</property>.</emphasis></para>
- <para>This project properties page allows you to have a flexible project layout. It means that you are not restricted with specific project structure. You can use the Seam wizards
+ <para>This project properties page allows you to have a flexible project layout. It means that you are not restricted with a specific project structure. You can use the Seam wizards
(New Action, Form, Entity, etc.) on Maven, command line seam-gen or your own project structure. </para>
<para>Moreover you are not required to use the Seam New Project wizard to benefit from Seam artifact wizards. You can just enable Seam on your existing project and configure the folders as you want.</para>
17 years, 8 months
JBoss Tools SVN: r7740 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-04-24 11:41:07 -0400 (Thu, 24 Apr 2008)
New Revision: 7740
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2122
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-04-24 15:40:07 UTC (rev 7739)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-04-24 15:41:07 UTC (rev 7740)
@@ -105,7 +105,21 @@
private static final String MODULE_NODE_NAME = "module";
private static final String JAVA_NODE_NAME = "java";
- private static final String[] JARS = new String[]{"jboss-seam", "el-ri", "jbpm", "drools-core", "drools-compiler", "janino", "antlr", "commons-jci-core", "commons-jci-janino", "stringtemplate"};
+ private static final String[] JARS = new String[]{
+ "jboss-seam",
+ "el-ri",
+ "jbpm",
+ "drools-core",
+ "drools-compiler",
+ "janino",
+ "antlr",
+ "commons-jci-core",
+ "commons-jci-janino",
+ "stringtemplate",
+ "jboss-el",
+ "jbpm-jpdl",
+ "mvel14",
+ "richfaces-api"};
private void validateApplicationXml(IResource applicationXml) {
if(applicationXml==null || !(applicationXml instanceof IFile) || !applicationXml.exists()) {
@@ -149,7 +163,6 @@
model.releaseFromRead();
}
}
- return;
}
private void validateJavaModule(IResource file, Node node) {
17 years, 8 months
JBoss Tools SVN: r7739 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2008-04-24 11:40:07 -0400 (Thu, 24 Apr 2008)
New Revision: 7739
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-310 "Write your first project with JBDS" chapter name updated
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-04-24 14:43:50 UTC (rev 7738)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-04-24 15:40:07 UTC (rev 7739)
@@ -9,7 +9,7 @@
</keywordset>
</chapterinfo>
- <title>Write Your First Project</title>
+ <title>Write Your First Project with JBoss Developer Studio</title>
<para>This chapter is a set of hands-on labs. You get step-by-step information about how the JBoss Developer Studio can be used during the development process.</para>
17 years, 8 months
JBoss Tools SVN: r7738 - 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: dmaliarevich
Date: 2008-04-24 10:43:50 -0400 (Thu, 24 Apr 2008)
New Revision: 7738
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-2058, fixed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css 2008-04-24 14:09:04 UTC (rev 7737)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css 2008-04-24 14:43:50 UTC (rev 7738)
@@ -6,7 +6,7 @@
vertical-align: middle;
}
-.rich-pmenu-top-group-div, .rich-pmenu-group-div {
+.dr-pmenu-top-group-div, .dr-pmenu-group-div {
margin-bottom: 3px;
padding: 1px;
cursor: pointer;
@@ -16,7 +16,8 @@
height: 20px;
width: 100%;
}
-.rich-pmenu-top-group {
+
+.dr-pmenu-top-group, .dr-pmenu-group {
background-color: #D4CFC7;
font-family: Arial, Verdana, sans-serif;
font-size: 11px;
@@ -28,7 +29,6 @@
width: 100%;
}
-
.rich-pmenu-top-group-self-label, .rich-pmenu-group-self-label {
padding-left: 5px;
width: 100%;
@@ -38,5 +38,5 @@
}
.rich-pmenu-disabled-element {
- color: #B1ADA7;
+ /*color: #B1ADA7;*/
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java 2008-04-24 14:09:04 UTC (rev 7737)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java 2008-04-24 14:43:50 UTC (rev 7738)
@@ -11,16 +11,22 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMText;
@@ -30,8 +36,11 @@
import org.w3c.dom.Node;
import org.w3c.dom.Text;
-public class RichFacesPanelMenuGroupTemplate extends VpeAbstractTemplate {
+public class RichFacesPanelMenuGroupTemplate extends VpeAbstractTemplate implements
+VpeToggableTemplate {
+ public static final String VPE_EXPANDED_TOGGLE_IDS = "vpe-expanded-toggle-ids"; //$NON-NLS-1$
+
public static final String GROUP_COUNT_SEPARATOR = "-"; //$NON-NLS-1$
public static final Map<String, String> DEFAULT_ICON_MAP = new HashMap<String, String>();
@@ -41,6 +50,8 @@
private static final String DISABLED = "disabled"; //$NON-NLS-1$
private static final String DISABLED_CLASS = "disabledClass"; //$NON-NLS-1$
private static final String DISABLED_STYLE = "disabledStyle"; //$NON-NLS-1$
+ private static final String ICON_CLASS = "iconClass"; //$NON-NLS-1$
+ private static final String ICON_STYLE = "iconStyle"; //$NON-NLS-1$
private static final String ICON_EXPANDED = "iconExpanded"; //$NON-NLS-1$
private static final String ICON_COLLAPSED = "iconCollapsed"; //$NON-NLS-1$
private static final String ICON_DISABLED = "iconDisabled"; //$NON-NLS-1$
@@ -51,14 +62,16 @@
/*
* rich:panelMenuGroup css styles
*/
- private static final String CSS_TOP_GROUP_DIV = "rich-pmenu-top-group-div"; //$NON-NLS-1$
- private static final String CSS_TOP_GROUP = "rich-pmenu-top-group"; //$NON-NLS-1$
+ private static final String CSS_DR_TOP_GROUP_DIV = "dr-pmenu-top-group-div"; //$NON-NLS-1$
+ private static final String CSS_DR_TOP_GROUP = "dr-pmenu-top-group"; //$NON-NLS-1$
+ private static final String CSS_DR_GROUP = "dr-pmenu-group"; //$NON-NLS-1$
private static final String CSS_TOP_GROUP_ICON = "rich-pmenu-top-group-self-icon"; //$NON-NLS-1$
private static final String CSS_TOP_GROUP_LABEL = "rich-pmenu-top-group-self-label"; //$NON-NLS-1$
- private static final String CSS_GROUP_DIV = "rich-pmenu-group-div"; //$NON-NLS-1$
+ private static final String CSS_DR_GROUP_DIV = "dr-pmenu-group-div"; //$NON-NLS-1$
private static final String CSS_GROUP = "rich-pmenu-group"; //$NON-NLS-1$
private static final String CSS_GROUP_ICON = "rich-pmenu-group-self-icon"; //$NON-NLS-1$
private static final String CSS_GROUP_LABEL = "rich-pmenu-group-self-label"; //$NON-NLS-1$
+ private static final String CSS_HOVERED_ELEMENT = "rich-pmenu-hovered-element"; //$NON-NLS-1$
private static final String CSS_DISABLED_ELEMENT = "rich-pmenu-disabled-element"; //$NON-NLS-1$
private static final String NAME_COMPONENT = "panelMenuGroup"; //$NON-NLS-1$
@@ -67,13 +80,14 @@
private static final String PANEL_MENU_ITEM_END_TAG = ":panelMenuItem"; //$NON-NLS-1$
private static final String COMPONENT_ATTR_VPE_SUPPORT = "vpeSupport"; //$NON-NLS-1$
- private static final String COMPONENT_ATTR_VPE_USER_TOGGLE_ID = "vpe-user-toggle-id"; //$NON-NLS-1$
private static final String PANEL_MENU_GROUP_ICON_SPACER_PATH = "/panelMenuGroup/spacer.gif"; //$NON-NLS-1$
private static final String STYLE_PATH = "/panelMenuGroup/style.css"; //$NON-NLS-1$
- private static final String EMPTY_DIV_STYLE = "display: none;"; //$NON-NLS-1$
-
+
+ private static final String VSPACE = "vspace"; //$NON-NLS-1$
+ private static final String HSPACE = "hspace"; //$NON-NLS-1$
private static final String TRUE = "true"; //$NON-NLS-1$
private static final String RIGHT = "right"; //$NON-NLS-1$
+ private static final String LEFT = "right"; //$NON-NLS-1$
private static final String SPACE = " "; //$NON-NLS-1$
private static final String EMPTY = ""; //$NON-NLS-1$
@@ -85,40 +99,45 @@
/*
* rich:panelMenu attributes for groups
*/
- private static String pm_iconGroupPosition;
- private static String pm_iconGroupTopPosition;
- private static String pm_iconCollapsedGroup;
- private static String pm_iconCollapsedTopGroup;
- private static String pm_iconExpandedGroup;
- private static String pm_iconExpandedTopGroup;
- private static String pm_iconDisableGroup;
- private static String pm_iconTopDisableGroup;
+ private String pm_iconGroupPosition;
+ private String pm_iconGroupTopPosition;
+ private String pm_iconCollapsedGroup;
+ private String pm_iconCollapsedTopGroup;
+ private String pm_iconExpandedGroup;
+ private String pm_iconExpandedTopGroup;
+ private String pm_iconDisableGroup;
+ private String pm_iconTopDisableGroup;
+ private String pm_expandSingle;
/*
* rich:panelMenu style classes for groups
*/
- private static String pm_disabled;
- private static String pm_disabledGroupClass;
- private static String pm_disabledGroupStyle;
- private static String pm_topGroupClass;
- private static String pm_topGroupStyle;
- private static String pm_groupClass;
- private static String pm_groupStyle;
- private static String pm_style;
- private static String pm_styleClass;
+ private String pm_disabled;
+ private String pm_disabledGroupClass;
+ private String pm_disabledGroupStyle;
+ private String pm_topGroupClass;
+ private String pm_topGroupStyle;
+ private String pm_groupClass;
+ private String pm_groupStyle;
+ private String pm_style;
+ private String pm_styleClass;
/*
* pich:panelMenuGroup attributes
*/
- private static String pmg_disabledStyle;
- private static String pmg_disabledClass;
- private static String pmg_disabled;
- private static String pmg_iconExpanded;
- private static String pmg_iconCollapsed;
- private static String pmg_iconDisabled;
- private static String pmg_style;
- private static String pmg_styleClass;
-
+ private String pmg_disabledStyle;
+ private String pmg_disabledClass;
+ private String pmg_disabled;
+ private String pmg_iconClass;
+ private String pmg_iconStyle;
+ private String pmg_iconExpanded;
+ private String pmg_iconCollapsed;
+ private String pmg_iconDisabled;
+ private String pmg_style;
+ private String pmg_styleClass;
+
+ private List<String> expandedIds = new ArrayList<String>();
+
static {
DEFAULT_ICON_MAP.put("chevron", "/panelMenuGroup/chevron.gif"); //$NON-NLS-1$ //$NON-NLS-2$
DEFAULT_ICON_MAP.put("chevronUp", "/panelMenuGroup/chevronUp.gif"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -131,118 +150,87 @@
DEFAULT_ICON_MAP.put("grid", "/panelMenuGroup/grid.gif"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @SuppressWarnings("unchecked")
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- nsIDOMElement div = visualDocument
+
+ Element groupSourceElement = (Element) sourceNode;
+ nsIDOMElement creationDataDiv = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, EMPTY_DIV_STYLE);
- return new VpeCreationData(div);
- }
-
- public boolean isRecreateAtAttrChange(VpePageContext pageContext,
- Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMElement visualNode, Object data, String name, String value) {
- return true;
- }
-
- public static VpeCreationData encode(VpePageContext pageContext,
- VpeCreationData creationData, Element sourceParentElement,
- Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMElement parentVisualElement, List<String> activeIds,
- String childId) {
-
+ VpeCreationData creationData = new VpeCreationData(creationDataDiv);
+
+ expandedIds = (List<String>) sourceNode.getUserData(VPE_EXPANDED_TOGGLE_IDS);
+ String childId = (String) sourceNode.getUserData(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID);
+
/*
* Counts child groups in a parent group
*/
int childGroupCount = 1;
- boolean disabled = false;
- Element parent = getRichPanelParent(sourceElement);
- readPanelMenuGroupAttributes(sourceElement);
- readPanelMenuAttributes(sourceParentElement);
+ Element anySuitableParent = getGroupParent(groupSourceElement, false);
+ Element panelMenuParent = getGroupParent(groupSourceElement, true);
+ readPanelMenuGroupAttributes(groupSourceElement);
+ readPanelMenuAttributes(panelMenuParent);
+
ComponentUtil.setCSSLink(pageContext, STYLE_PATH, NAME_COMPONENT);
- boolean expanded = activeIds.contains(childId);
+ boolean expanded = false;
+ if (null != expandedIds) {
+ expanded = expandedIds.contains(childId);
+ }
nsIDOMElement div = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- parentVisualElement.appendChild(div);
+ creationDataDiv.appendChild(div);
div.setAttribute(COMPONENT_ATTR_VPE_SUPPORT, NAME_COMPONENT);
- div.setAttribute(COMPONENT_ATTR_VPE_USER_TOGGLE_ID, childId);
+ div.setAttribute(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID, childId);
- if (TRUE.equalsIgnoreCase(pm_disabled)) {
- disabled = true;
- } else if (TRUE.equalsIgnoreCase(parent
- .getAttribute(DISABLED))) {
- disabled = true;
- } else if (TRUE.equalsIgnoreCase(pmg_disabled)) {
- disabled = true;
- }
+ buildTable(pageContext, anySuitableParent, groupSourceElement,
+ visualDocument, div, expanded, childId);
+
+ nsIDOMElement childSpan = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(childSpan);
- buildTable(pageContext, sourceParentElement, parent, sourceElement,
- visualDocument, div, expanded, disabled, childId);
-
- List<Node> children = ComponentUtil.getChildren(sourceElement);
-
- if (!children.isEmpty()) {
- nsIDOMElement childSpan = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(childSpan);
+ List<Node> children = ComponentUtil.getChildren(groupSourceElement);
+ if (expanded) {
for (Node child : children) {
- if (!child.getNodeName().endsWith(PANEL_MENU_GROUP_END_TAG)
- && !child.getNodeName().endsWith(
- PANEL_MENU_ITEM_END_TAG)) {
- if (childrenInfo.getSourceChildren() == null
- || childrenInfo.getSourceChildren().size() == 0) {
- div.appendChild(childSpan);
- }
- childrenInfo.addSourceChild(child);
- } else {
- if (expanded && !disabled) {
- if (child.getNodeName().endsWith(
- PANEL_MENU_GROUP_END_TAG)) {
- RichFacesPanelMenuGroupTemplate.encode(pageContext,
- creationData, sourceParentElement,
- (Element) child, visualDocument, div, activeIds,
- childId + GROUP_COUNT_SEPARATOR + childGroupCount);
- childGroupCount++;
- } else {
- RichFacesPanelMenuItemTemplate
- .encode(pageContext, creationData,
- sourceParentElement,
- (Element) child, visualDocument,
- div, childId);
- }
- }
-
- if (childrenInfo.getSourceChildren() != null
- && childrenInfo.getSourceChildren().size() > 0) {
- creationData.addChildrenInfo(childrenInfo);
- childSpan = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- childrenInfo = new VpeChildrenInfo(childSpan);
- }
+ boolean isGroup = child.getNodeName().endsWith(
+ PANEL_MENU_GROUP_END_TAG);
+ boolean isItem = child.getNodeName().endsWith(
+ PANEL_MENU_ITEM_END_TAG);
+ if (isGroup) {
+ String newLevelToggleId = childId + GROUP_COUNT_SEPARATOR
+ + childGroupCount;
+ childGroupCount++;
+ child.setUserData(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID, newLevelToggleId, null);
+ child.setUserData(VPE_EXPANDED_TOGGLE_IDS, expandedIds, null);
}
- }
-
- if (childrenInfo.getSourceChildren() != null
- && childrenInfo.getSourceChildren().size() > 0) {
+ if (isItem) {
+ child.setUserData(RichFacesPanelMenuItemTemplate.VPE_PANEL_MENU_ITEM_ID, childId, null);
+ }
+ childrenInfo = new VpeChildrenInfo(div);
+ childrenInfo.addSourceChild(child);
creationData.addChildrenInfo(childrenInfo);
}
}
+
+ if (childrenInfo.getSourceChildren() == null) {
+ creationData.addChildrenInfo(childrenInfo);
+ }
+
return creationData;
}
- private static final void buildTable(VpePageContext pageContext,
- Element sourceParentElement, Element parent, Element sourceElement,
- nsIDOMDocument visualDocument, nsIDOMElement div, boolean expanded,
- boolean disabled, String activeChildId) {
- String disabledStyle = EMPTY;
- String disableClass = EMPTY;
+ private void buildTable(VpePageContext pageContext,
+ Element anySuitableParent, Element groupSourceElement,
+ nsIDOMDocument visualDocument, nsIDOMElement div,
+ boolean expanded, String activeChildId) {
String tableStyle = MARGIN_TOP;
String tableClass = EMPTY;
- String col1ImgClass = EMPTY;
- String col2Class = EMPTY;
- String col3ImgClass = EMPTY;
+ String iconCellClass = EMPTY;
+ String iconCellStyle = EMPTY;
+ String labelCellClass = EMPTY;
+ String emptyCellClass = EMPTY;
String divClass = EMPTY;
nsIDOMElement table = visualDocument
@@ -258,9 +246,10 @@
table.appendChild(tableBodyRow);
/*
- * Add indentation for nested gruops
+ * Add indentation for nested groups
*/
String[] ids = activeChildId.split(GROUP_COUNT_SEPARATOR);
+ List<nsIDOMElement> indentTds = new ArrayList<nsIDOMElement>();
if (ids.length > 1) {
for (int i = 1; i <= ids.length - 1; i++) {
nsIDOMElement spacerTd = visualDocument
@@ -271,33 +260,34 @@
ComponentUtil.setImg(spacerImg, PANEL_MENU_GROUP_ICON_SPACER_PATH);
setDefaultImgAttributes(spacerImg);
tableBodyRow.appendChild(spacerTd);
+ indentTds.add(spacerTd);
}
}
nsIDOMElement column1 = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TD);
- column1.setAttribute(COMPONENT_ATTR_VPE_USER_TOGGLE_ID, activeChildId);
+ column1.setAttribute(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID, activeChildId);
tableBodyRow.appendChild(column1);
- nsIDOMElement columnn1_img = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_IMG);
- column1.appendChild(columnn1_img);
- ComponentUtil.setImg(columnn1_img, PANEL_MENU_GROUP_ICON_SPACER_PATH);
-
nsIDOMElement column2 = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TD);
tableBodyRow.appendChild(column2);
column2.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, WIDTH_100_PERSENTS);
+ nsIDOMElement column3 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ column3.setAttribute(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID, activeChildId);
+ tableBodyRow.appendChild(column3);
+
/*
- * Item label routine.
+ * Group Label Routine.
*/
Attr labelAttr = null;
String labelValue = EMPTY;
String bundleValue = EMPTY;
String resultValue = EMPTY;
- if (sourceElement.hasAttribute(LABEL)) {
- labelAttr = sourceElement.getAttributeNode(LABEL);
+ if (groupSourceElement.hasAttribute(LABEL)) {
+ labelAttr = groupSourceElement.getAttributeNode(LABEL);
}
if (null != labelAttr) {
labelValue = labelAttr.getNodeValue();
@@ -325,72 +315,132 @@
nsIDOMText text = visualDocument.createTextNode(resultValue);
column2.appendChild(text);
- column2.setAttribute(COMPONENT_ATTR_VPE_USER_TOGGLE_ID, activeChildId);
+ column2.setAttribute(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID, activeChildId);
- nsIDOMElement column3 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- column3.setAttribute(COMPONENT_ATTR_VPE_USER_TOGGLE_ID, activeChildId);
- tableBodyRow.appendChild(column3);
+ boolean childOfPanelMenu = anySuitableParent.getNodeName().endsWith(
+ PANEL_MENU_END_TAG);
+
+ /*
+ * Group Icon Routine
+ */
+ nsIDOMElement iconCell = column1;
+ nsIDOMElement emptyCell = column3;
+ if (attrPresents(pm_iconGroupPosition)) {
+ if (RIGHT.equalsIgnoreCase(pm_iconGroupPosition)) {
+ /*
+ * Set icon image on the right
+ */
+ iconCell = column3;
+ emptyCell = column1;
+ }
+ }
+ if (childOfPanelMenu && attrPresents(pm_iconGroupTopPosition)) {
+ if (RIGHT.equalsIgnoreCase(pm_iconGroupTopPosition)) {
+ /*
+ * Set icon image on the right
+ */
+ iconCell = column3;
+ emptyCell = column1;
+ } else if (LEFT.equalsIgnoreCase(pm_iconGroupTopPosition)) {
+ iconCell = column1;
+ emptyCell = column3;
+ }
+ }
- nsIDOMElement column3_img = visualDocument
+ nsIDOMElement imgIcon = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_IMG);
- column3.appendChild(column3_img);
- ComponentUtil.setImg(column3_img, PANEL_MENU_GROUP_ICON_SPACER_PATH);
+
+ nsIDOMElement imgSpacer = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ ComponentUtil.setImg(imgSpacer, PANEL_MENU_GROUP_ICON_SPACER_PATH);
+ setDefaultImgAttributes(imgSpacer);
+
+ iconCell.appendChild(imgIcon);
+ emptyCell.appendChild(imgSpacer);
- setIcon(pageContext, parent, sourceParentElement, sourceElement, columnn1_img,
- column3_img, expanded, disabled);
+ setIcon(pageContext, anySuitableParent, groupSourceElement,
+ imgIcon, expanded);
- boolean childOfPanelMenu = parent.getNodeName().endsWith(
- PANEL_MENU_END_TAG);
-
- tableClass += SPACE + CSS_GROUP;
+ /*
+ * Group Style Classes Routine
+ */
+ tableClass += SPACE + CSS_GROUP + SPACE + CSS_DR_GROUP;
+ if (TRUE.equalsIgnoreCase(pm_disabled)) {
+ if (childOfPanelMenu) {
+ tableClass = SPACE + CSS_DR_TOP_GROUP + SPACE + CSS_GROUP;
+ tableClass += SPACE + CSS_DISABLED_ELEMENT;
+ divClass += SPACE + CSS_DR_TOP_GROUP_DIV;
+ if (attrPresents(pm_disabledGroupClass)) {
+ tableClass += SPACE + pm_disabledGroupClass;
+ }
+ if (attrPresents(pm_topGroupStyle)) {
+ tableStyle += SPACE + pm_topGroupStyle;
+ }
+ }
+ }
- if (disabled) {
- if (attrPresents(pm_disabledGroupClass)) {
- disableClass += pm_disabledGroupClass;
+ if ((TRUE.equalsIgnoreCase(pmg_disabled))) {
+ tableClass += SPACE + CSS_GROUP + SPACE + CSS_DR_GROUP;
+
+ if (!(TRUE.equalsIgnoreCase(pm_disabled))) {
+ tableClass += SPACE + CSS_DISABLED_ELEMENT;
+ if (attrPresents(pm_disabledGroupClass)){
+ tableClass += SPACE + pm_disabledGroupClass;
+ }
}
+
if (attrPresents(pmg_disabledClass)) {
- disableClass += SPACE + pmg_disabledClass;
+ tableClass += SPACE + pmg_disabledClass;
}
- disableClass += SPACE + CSS_DISABLED_ELEMENT;
- tableClass += SPACE + disableClass;
-
if (attrPresents(pm_disabledGroupStyle)) {
- disabledStyle += pm_disabledGroupStyle;
+ tableStyle += SPACE + pm_disabledGroupStyle;
}
if (attrPresents(pmg_disabledStyle)) {
- disabledStyle += SPACE + pmg_disabledStyle;
+ tableStyle += SPACE + pmg_disabledStyle;
}
- tableStyle += SPACE + disabledStyle;
- } else {
-
+ }
+
+ if (!(TRUE.equalsIgnoreCase(pm_disabled))
+ && (!(TRUE.equalsIgnoreCase(pmg_disabled)))) {
+ tableClass = SPACE + CSS_DR_GROUP + SPACE + CSS_GROUP;
+ iconCellClass = SPACE + CSS_GROUP_ICON;
+ labelCellClass += SPACE + CSS_GROUP_LABEL;
+ emptyCellClass += SPACE + CSS_GROUP_ICON;
+ divClass += SPACE + CSS_DR_GROUP_DIV;
if (attrPresents(pm_groupClass)) {
tableClass += SPACE + pm_groupClass;
}
if (attrPresents(pm_groupStyle)) {
- tableStyle += pm_groupStyle;
+ tableStyle += SPACE + pm_groupStyle;
}
- col1ImgClass += SPACE + CSS_GROUP_ICON;
- col2Class += SPACE + CSS_GROUP_LABEL;
- col3ImgClass += SPACE + CSS_GROUP_ICON;
- divClass += SPACE + CSS_GROUP_DIV;
+ if (attrPresents(pmg_iconClass)) {
+ iconCellClass += SPACE + pmg_iconClass;
+ }
+ if (attrPresents(pmg_iconStyle)) {
+ iconCellStyle += SPACE + pmg_iconStyle;
+ }
if (childOfPanelMenu) {
+ tableClass = SPACE + CSS_DR_TOP_GROUP + SPACE + CSS_GROUP;
+ iconCellClass = SPACE + CSS_GROUP_ICON + SPACE + CSS_TOP_GROUP_ICON;
+ labelCellClass = SPACE + CSS_TOP_GROUP_LABEL;
+ emptyCellClass = SPACE + CSS_TOP_GROUP_ICON;
+ divClass += SPACE + CSS_DR_TOP_GROUP_DIV;
if (attrPresents(pm_topGroupClass)) {
tableClass += SPACE + pm_topGroupClass;
}
if (attrPresents(pm_topGroupStyle)) {
tableStyle += pm_topGroupStyle;
}
- tableClass += SPACE + CSS_TOP_GROUP + SPACE + CSS_GROUP;
- col1ImgClass += SPACE + CSS_TOP_GROUP_ICON;
- col2Class += SPACE + CSS_TOP_GROUP_LABEL;
- col3ImgClass += SPACE + CSS_TOP_GROUP_ICON;
- divClass += SPACE + CSS_TOP_GROUP_DIV;
+ if (attrPresents(pmg_iconClass)) {
+ iconCellClass += SPACE + pmg_iconClass;
+ }
+ if (attrPresents(pmg_iconStyle)) {
+ iconCellStyle += SPACE + pmg_iconStyle;
+ }
}
}
-
if (attrPresents(pm_styleClass)) {
tableClass += SPACE + pm_styleClass;
}
@@ -401,9 +451,15 @@
tableStyle += SPACE + pmg_style;
}
- columnn1_img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, col1ImgClass);
- column2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, col2Class);
- column3_img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, col3ImgClass);
+ iconCell.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, iconCellClass);
+// iconCell.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, iconCellStyle);
+
+ for (nsIDOMElement indentTdCell : indentTds) {
+ indentTdCell.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, iconCellClass);
+ }
+
+ column2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, labelCellClass);
+ emptyCell.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, emptyCellClass);
div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, divClass);
table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, tableClass);
table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, tableStyle);
@@ -412,37 +468,47 @@
private static void setDefaultImgAttributes(nsIDOMElement element) {
element.setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH,
DEFAULT_SIZE_VALUE);
- element.setAttribute("vspace", NO_SIZE_VALUE); //$NON-NLS-1$
- element.setAttribute("hspace", NO_SIZE_VALUE); //$NON-NLS-1$
+ element.setAttribute(VSPACE, NO_SIZE_VALUE);
+ element.setAttribute(HSPACE, NO_SIZE_VALUE);
element.setAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT,
DEFAULT_SIZE_VALUE);
}
- private static final Element getRichPanelParent(Element sourceElement) {
+ /**
+ * Gets the panel menu group parent.
+ *
+ * @param sourceElement the source element
+ * @param findOnlyPanelMenuParent flag to find only panel menu parent
+ *
+ * @return the group parent
+ */
+ private static final Element getGroupParent(Element sourceElement,
+ boolean findOnlyPanelMenuParent) {
Element parent = (Element) sourceElement.getParentNode();
-
while (true) {
- if (parent.getNodeName().endsWith(PANEL_MENU_END_TAG)
- || parent.getNodeName().endsWith(PANEL_MENU_GROUP_END_TAG)) {
- break;
+ if (findOnlyPanelMenuParent) {
+ if (parent.getNodeName().endsWith(PANEL_MENU_END_TAG)) {
+ break;
+ }
} else {
- parent = (Element) parent.getParentNode();
+ if (parent.getNodeName().endsWith(PANEL_MENU_END_TAG)
+ || parent.getNodeName().endsWith(
+ PANEL_MENU_GROUP_END_TAG)) {
+ break;
+ }
}
+ parent = (Element) parent.getParentNode();
}
-
return parent;
}
- private static final void setIcon(VpePageContext pageContext, Node parent,
- Element sourceParentElement, Element sourceElement,
- nsIDOMElement img1, nsIDOMElement img2, boolean expanded,
- boolean disabled) {
- boolean needChangePosition = false;
+ private void setIcon(VpePageContext pageContext, Node anySuitableParent,
+ Element groupSourceElement, nsIDOMElement imgIcon, boolean expanded) {
String pathIconExpanded = pmg_iconExpanded;
String pathIconCollapsed = pmg_iconCollapsed;
String pathIconDisabled = pmg_iconDisabled;
- if (parent.getNodeName().endsWith(PANEL_MENU_END_TAG)) {
+ if (anySuitableParent.getNodeName().endsWith(PANEL_MENU_END_TAG)) {
if (pathIconExpanded == null) {
pathIconExpanded = pm_iconExpandedTopGroup;
}
@@ -452,62 +518,52 @@
if (pathIconDisabled == null) {
pathIconDisabled = pm_iconTopDisableGroup;
}
-
- if (RIGHT.equals(pm_iconGroupTopPosition)) {
- needChangePosition = true;
- }
- } else {
- if (pathIconExpanded == null) {
- pathIconExpanded = pm_iconExpandedGroup;
- }
- if (pathIconCollapsed == null) {
- pathIconCollapsed = pm_iconCollapsedGroup;
- }
- if (pathIconDisabled == null) {
- pathIconDisabled = pm_iconDisableGroup;
- }
-
- if (RIGHT.equals(pm_iconGroupPosition)) {
- needChangePosition = true;
- }
}
- if (needChangePosition) {
- nsIDOMElement temp = img2;
- img2 = img1;
- img1 = temp;
- }
-
- if (disabled) {
- if (pathIconDisabled != null
- && DEFAULT_ICON_MAP.containsKey(pathIconDisabled)) {
- pathIconDisabled = DEFAULT_ICON_MAP.get(pathIconDisabled);
- ComponentUtil.setImg(img1, pathIconDisabled);
+ if (TRUE.equalsIgnoreCase(pmg_disabled)) {
+ if (attrPresents(pathIconDisabled)) {
+ if (DEFAULT_ICON_MAP.containsKey(pathIconDisabled)) {
+ pathIconDisabled = DEFAULT_ICON_MAP.get(pathIconDisabled);
+ ComponentUtil.setImg(imgIcon, pathIconDisabled);
+ } else {
+ String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(
+ pathIconDisabled, pageContext);
+ imgIcon.setAttribute(HtmlComponentUtil.HTML_ATR_SRC,
+ imgFullPath);
+ }
} else {
- ComponentUtil.setImgFromResources(pageContext, img1,
- pathIconDisabled, PANEL_MENU_GROUP_ICON_SPACER_PATH);
+ ComponentUtil.setImg(imgIcon, PANEL_MENU_GROUP_ICON_SPACER_PATH);
}
} else {
if (expanded) {
- if (pathIconExpanded != null
- && DEFAULT_ICON_MAP.containsKey(pathIconExpanded)) {
- pathIconExpanded = DEFAULT_ICON_MAP.get(pathIconExpanded);
- ComponentUtil.setImg(img1, pathIconExpanded);
+ if (attrPresents(pathIconExpanded)) {
+ if (DEFAULT_ICON_MAP.containsKey(pathIconExpanded)) {
+ pathIconExpanded = DEFAULT_ICON_MAP
+ .get(pathIconExpanded);
+ ComponentUtil.setImg(imgIcon, pathIconExpanded);
+ } else {
+ String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(
+ pathIconExpanded, pageContext);
+ imgIcon.setAttribute(HtmlComponentUtil.HTML_ATR_SRC,
+ imgFullPath);
+ }
} else {
- ComponentUtil
- .setImgFromResources(pageContext, img1,
- pathIconExpanded,
- PANEL_MENU_GROUP_ICON_SPACER_PATH);
+ ComponentUtil.setImg(imgIcon, PANEL_MENU_GROUP_ICON_SPACER_PATH);
}
} else {
- if (pathIconCollapsed != null
- && DEFAULT_ICON_MAP.containsKey(pathIconCollapsed)) {
- pathIconCollapsed = DEFAULT_ICON_MAP.get(pathIconCollapsed);
- ComponentUtil.setImg(img1, pathIconCollapsed);
+ if (attrPresents(pathIconCollapsed)) {
+ if (DEFAULT_ICON_MAP.containsKey(pathIconCollapsed)) {
+ pathIconCollapsed = DEFAULT_ICON_MAP
+ .get(pathIconCollapsed);
+ ComponentUtil.setImg(imgIcon, pathIconCollapsed);
+ } else {
+ String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(
+ pathIconCollapsed, pageContext);
+ imgIcon.setAttribute(HtmlComponentUtil.HTML_ATR_SRC,
+ imgFullPath);
+ }
} else {
- ComponentUtil.setImgFromResources(pageContext, img1,
- pathIconCollapsed,
- PANEL_MENU_GROUP_ICON_SPACER_PATH);
+ ComponentUtil.setImg(imgIcon, PANEL_MENU_GROUP_ICON_SPACER_PATH);
}
}
}
@@ -518,12 +574,12 @@
*
* @param sourceNode the source node
*/
- private static void readPanelMenuAttributes(Element sourceParentElement) {
+ private void readPanelMenuAttributes(Element sourceParentElement) {
if (null == sourceParentElement) {
return;
}
-
+
/*
* rich:panelMenu attributes for groups
*/
@@ -535,6 +591,7 @@
pm_iconExpandedTopGroup = sourceParentElement.getAttribute(RichFacesPanelMenuTemplate.ICON_EXPANDED_TOP_GROUP);
pm_iconDisableGroup = sourceParentElement.getAttribute(RichFacesPanelMenuTemplate.ICON_DISABLE_GROUP);
pm_iconTopDisableGroup = sourceParentElement.getAttribute(RichFacesPanelMenuTemplate.ICON_TOP_DISABLE_GROUP);
+ pm_expandSingle = sourceParentElement.getAttribute(RichFacesPanelMenuTemplate.EXPAND_SINGLE);
/*
* rich:panelMenu style classes for groups
@@ -555,7 +612,7 @@
*
* @param sourceNode the source node
*/
- private static void readPanelMenuGroupAttributes(Element sourceElement) {
+ private void readPanelMenuGroupAttributes(Element sourceElement) {
if (null == sourceElement) {
return;
@@ -567,6 +624,8 @@
pmg_disabledStyle = sourceElement.getAttribute(DISABLED_STYLE);
pmg_disabledClass = sourceElement.getAttribute(DISABLED_CLASS);
pmg_disabled = sourceElement.getAttribute(DISABLED);
+ pmg_iconClass = sourceElement.getAttribute(ICON_CLASS);
+ pmg_iconStyle = sourceElement.getAttribute(ICON_STYLE);
pmg_iconExpanded = sourceElement.getAttribute(ICON_EXPANDED);
pmg_iconCollapsed = sourceElement.getAttribute(ICON_COLLAPSED);
pmg_iconDisabled = sourceElement.getAttribute(ICON_DISABLED);
@@ -585,4 +644,125 @@
private static boolean attrPresents(String attr) {
return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
}
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.vpe.editor.template.VpeToggableTemplate#toggle(org.jboss.tools.vpe.editor.VpeVisualDomBuilder, org.w3c.dom.Node, java.lang.String)
+ */
+ @SuppressWarnings("unchecked")
+ public void toggle(VpeVisualDomBuilder builder, Node sourceNode,
+ String toggleId) {
+ if ((null != sourceNode) && (sourceNode instanceof Element)) {
+ Element sourceElement = (Element) sourceNode;
+ pmg_disabled = sourceElement.getAttribute(DISABLED);
+ Element panelMenu = getGroupParent(sourceElement, true);
+ if (null != panelMenu) {
+ pm_disabled = panelMenu.getAttribute(DISABLED);
+ pm_expandSingle = panelMenu.getAttribute(RichFacesPanelMenuTemplate.EXPAND_SINGLE);
+ }
+ }
+
+ /*
+ * Do nothing when panel menu or panel group are disabled.
+ */
+// if ((TRUE.equalsIgnoreCase(pm_disabled))
+// || (TRUE.equalsIgnoreCase(pmg_disabled))) {
+// return;
+// }
+
+ expandedIds = (List<String>) sourceNode.getUserData(VPE_EXPANDED_TOGGLE_IDS);
+ if (null == expandedIds) {
+ expandedIds = new ArrayList<String>();
+ }
+ /*
+ * Expand only one group.
+ */
+ if ((null != pm_expandSingle) && (TRUE.equalsIgnoreCase(pm_expandSingle))) {
+ if (expandedIds.contains(toggleId)) {
+ /*
+ * Close group and its children
+ */
+ expandedIds.remove(toggleId);
+ for (Iterator<String> iterator = expandedIds.iterator(); iterator.hasNext();) {
+ String id = iterator.next();
+ if (id.startsWith(toggleId)) {
+ iterator.remove();
+ }
+ }
+ } else {
+ /*
+ * Expand new group, close others
+ */
+ String[] toggleIds = toggleId.split(RichFacesPanelMenuGroupTemplate.GROUP_COUNT_SEPARATOR);
+ if ((null != toggleIds) && (toggleIds.length > 0)) {
+ for (Iterator<String> iterator = expandedIds.iterator(); iterator.hasNext();) {
+ String id = iterator.next();
+ String[] ids = id.split(RichFacesPanelMenuGroupTemplate.GROUP_COUNT_SEPARATOR);
+ if ((null != ids) && (ids.length > 0)) {
+ if (ids.length >= toggleIds.length) {
+ /*
+ * Remove all ids that are deeper than selected
+ * and that are on the same level.
+ */
+ iterator.remove();
+ } else {
+ /*
+ * Remove all ids that are not in the selected branch.
+ */
+ for (int i = 0; i < ids.length; i++) {
+ if (!ids[i].equalsIgnoreCase(toggleIds[i])) {
+ iterator.remove();
+ }
+ }
+ }
+ }
+ }
+ }
+ expandedIds.add(toggleId);
+ }
+ } else {
+ /*
+ * Expand any number of groups.
+ */
+ if (expandedIds.contains(toggleId)) {
+ expandedIds.remove(toggleId);
+ for (Iterator<String> iterator = expandedIds.iterator(); iterator.hasNext();) {
+ String id = iterator.next();
+ if (id.startsWith(toggleId)) {
+ iterator.remove();
+ }
+ }
+ } else {
+ expandedIds.add(toggleId);
+ }
+ }
+ sourceNode.setUserData(VPE_EXPANDED_TOGGLE_IDS, expandedIds, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.vpe.editor.template.VpeToggableTemplate#stopToggling(org.w3c.dom.Node)
+ */
+ public void stopToggling(Node sourceNode) {
+ if (null != expandedIds) {
+ expandedIds.clear();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument, org.mozilla.interfaces.nsIDOMElement, java.lang.Object, java.lang.String, java.lang.String)
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#setSourceAttributeSelection(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Element, int, int, java.lang.Object)
+ */
+ @Override
+ public void setSourceAttributeSelection(VpePageContext pageContext,
+ Element sourceElement, int offset, int length, Object data) {
+ VpeSourceDomBuilder sourceBuilder = pageContext.getSourceBuilder();
+ sourceBuilder.setSelection(sourceElement, 0, 0);
+ }
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2008-04-24 14:09:04 UTC (rev 7737)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2008-04-24 14:43:50 UTC (rev 7738)
@@ -15,6 +15,7 @@
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
@@ -30,6 +31,8 @@
public class RichFacesPanelMenuItemTemplate extends VpeAbstractTemplate {
+ public static final String VPE_PANEL_MENU_ITEM_ID = "vpe-panel-menu-item-id"; //$NON-NLS-1$
+
/*
* rich:panelMenuItem attributes
*/
@@ -54,6 +57,7 @@
public static final String CSS_ITEM_ICON = "rich-pmenu-item-icon"; //$NON-NLS-1$
public static final String CSS_ITEM_LABEL = "rich-pmenu-item-label"; //$NON-NLS-1$
public static final String CSS_ITEM_SELECTED = "rich-pmenu-item-selected"; //$NON-NLS-1$
+ public static final String CSS_HOVERED_ELEMENT = "rich-pmenu-hovered-element"; //$NON-NLS-1$
public static final String CSS_DISABLED_ELEMENT = "rich-pmenu-disabled-element"; //$NON-NLS-1$
/*
@@ -79,7 +83,6 @@
private static final String COMPONENT_NAME = "panelMenuItem"; //$NON-NLS-1$
private static final String PANEL_MENU_END_TAG = ":panelMenu"; //$NON-NLS-1$
private static final String PANEL_MENU_GROUP_END_TAG = ":panelMenuGroup"; //$NON-NLS-1$
- private static final String EMPTY_DIV_STYLE = "display: none; "; //$NON-NLS-1$
private static final String MARGIN_TOP = "margin-top: 3px; "; //$NON-NLS-1$
private static final String WIDTH_100_PERCENTS = "width: 100%; "; //$NON-NLS-1$
@@ -119,43 +122,35 @@
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- nsIDOMElement div = visualDocument
+ nsIDOMElement creationDataDiv = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, EMPTY_DIV_STYLE);
-
- return new VpeCreationData(div);
- }
-
- public static VpeCreationData encode(VpePageContext pageContext,
- VpeCreationData creationData, Element sourceParentElement,
- Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMElement parentVisualElement, String childId) {
-
+ VpeCreationData creationData = new VpeCreationData(creationDataDiv);
+ Element itemSourceElement = (Element) sourceNode;
+ String childId = (String) sourceNode.getUserData(VPE_PANEL_MENU_ITEM_ID);
+
ComponentUtil.setCSSLink(pageContext, STYLE_PATH, COMPONENT_NAME);
- readPanelMenuAttributes(sourceParentElement);
- readPanelMenuItemAttributes(sourceElement);
+ Element anySuitableParent = getItemParent(itemSourceElement, false);
+ Element panelMenuParent = getItemParent(itemSourceElement, true);
- nsIDOMElement parentDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- parentDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, DR_TOP_DIV);
- parentDiv.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0"); //$NON-NLS-1$
- parentDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, MARGIN_TOP);
- parentVisualElement.appendChild(parentDiv);
- nsIDOMElement div = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- parentDiv.appendChild(div);
+ readPanelMenuAttributes(panelMenuParent);
+ readPanelMenuItemAttributes(itemSourceElement);
+ creationDataDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, DR_TOP_DIV);
+ creationDataDiv.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0"); //$NON-NLS-1$
+ creationDataDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, MARGIN_TOP);
- boolean childOfPanelMenu = sourceElement.getParentNode().getNodeName().endsWith(
+ boolean childOfPanelMenu = anySuitableParent.getNodeName().endsWith(
PANEL_MENU_END_TAG);
- boolean childOfPanelMenuGroup = sourceElement.getParentNode().getNodeName().endsWith(
+ boolean childOfPanelMenuGroup = anySuitableParent.getNodeName().endsWith(
PANEL_MENU_GROUP_END_TAG);
if (childOfPanelMenu || childOfPanelMenuGroup) {
- div.setAttribute("vpeSupport", COMPONENT_NAME); //$NON-NLS-1$
+ creationDataDiv.setAttribute("vpeSupport", COMPONENT_NAME); //$NON-NLS-1$
+
nsIDOMElement table = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
- div.appendChild(table);
+ creationDataDiv.appendChild(table);
table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR,
NO_SIZE_VALUE);
@@ -212,8 +207,8 @@
String labelValue = EMPTY;
String bundleValue = EMPTY;
String resultValue = EMPTY;
- if (sourceElement.hasAttribute(LABEL)) {
- labelAttr = sourceElement.getAttributeNode(LABEL);
+ if (itemSourceElement.hasAttribute(LABEL)) {
+ labelAttr = itemSourceElement.getAttributeNode(LABEL);
}
if (null != labelAttr) {
labelValue = labelAttr.getNodeValue();
@@ -246,10 +241,10 @@
.createElement(HtmlComponentUtil.HTML_TAG_TD);
tr.appendChild(tdRight);
- nsIDOMElement imgPoints = visualDocument
+ nsIDOMElement imgIcon = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_IMG);
- setDefaultImgAttributes(imgPoints);
- setIcon(childOfPanelMenu, pageContext, imgPoints);
+ setDefaultImgAttributes(imgIcon);
+ setIcon(childOfPanelMenu, pageContext, imgIcon);
nsIDOMElement imgSpacer1 = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_IMG);
@@ -258,10 +253,10 @@
tdNowrapLeft.appendChild(imgSpacer1);
- nsIDOMElement imgSpacer2 = visualDocument
+ nsIDOMElement imgSpacer = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_IMG);
- setDefaultImgAttributes(imgSpacer2);
- ComponentUtil.setImg(imgSpacer2, IMG_SPACER_SRC);
+ setDefaultImgAttributes(imgSpacer);
+ ComponentUtil.setImg(imgSpacer, IMG_SPACER_SRC);
nsIDOMElement iconCell = tdNowrapLeft;
nsIDOMElement emptyCell = tdRight;
@@ -286,23 +281,32 @@
emptyCell = tdRight;
}
}
- iconCell.appendChild(imgPoints);
- emptyCell.appendChild(imgSpacer2);
+ iconCell.appendChild(imgIcon);
+ emptyCell.appendChild(imgSpacer);
- setItemClassAndStyle(childOfPanelMenu, table, tr, iconCell, tdLabel, emptyCell);
+ setItemClassAndStyle(childOfPanelMenu, table, tr, iconCell, imgIcon, tdLabel, emptyCell);
- List<Node> children = ComponentUtil.getChildren(sourceElement);
-
+ List<Node> children = ComponentUtil.getChildren(itemSourceElement);
+
+ nsIDOMElement childSpan = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(childSpan);
+
if (!children.isEmpty()) {
- VpeChildrenInfo childInfo = new VpeChildrenInfo(tdLabel);
- creationData.addChildrenInfo(childInfo);
+ childrenInfo = new VpeChildrenInfo(tdLabel);
+ creationData.addChildrenInfo(childrenInfo);
for (Node child : children) {
if (!(child.getNodeName().endsWith(PANEL_MENU_GROUP_END_TAG) || child
.getNodeName().endsWith(PANEL_MENU_END_TAG))) {
- childInfo.addSourceChild(child);
+ childrenInfo.addSourceChild(child);
}
}
}
+
+ if (childrenInfo.getSourceChildren() == null) {
+ creationData.addChildrenInfo(childrenInfo);
+ }
+
}
return creationData;
}
@@ -366,17 +370,15 @@
* The second array element contains default icon path.
*/
String[] imgPath = {EMPTY, EMPTY};
- boolean disabled = (TRUE.equalsIgnoreCase(pmi_disabled))
- || (TRUE.equalsIgnoreCase(pm_disabled));
if (childOfPanelMenu) {
- if (disabled) {
+ if (TRUE.equalsIgnoreCase(pmi_disabled)) {
imgPath = getSpecifiedIcon(pm_iconTopDisabledItem, pmi_iconDisabled);
} else {
imgPath = getSpecifiedIcon(pm_iconTopItem, pmi_icon);
}
} else {
- if (disabled) {
+ if (TRUE.equalsIgnoreCase(pmi_disabled)) {
imgPath = getSpecifiedIcon(pm_iconDisabledItem, pmi_iconDisabled);
} else {
imgPath = getSpecifiedIcon(pm_iconItem, pmi_icon);
@@ -415,15 +417,19 @@
nsIDOMElement table,
nsIDOMElement tr,
nsIDOMElement iconCell,
+ nsIDOMElement imgIcon,
nsIDOMElement labelCell,
nsIDOMElement emptyCell) {
String tableStyle = MARGIN_TOP;
- String iconStyle = EMPTY;
+ String iconCellStyle = EMPTY;
+ String labelCellStyle = WIDTH_100_PERCENTS;
+ String emptyCellStyle = EMPTY;
String tableClass = EMPTY;
String trClass = EMPTY;
String iconCellClass = EMPTY;
+ String imgIconClass = EMPTY;
String labelCellClass = EMPTY;
String emptyCellClass = EMPTY;
@@ -434,12 +440,26 @@
tableStyle += SPACE + pmi_style;
}
- tableClass = CSS_ITEM;
+ tableClass += SPACE + CSS_ITEM;
- if ((TRUE.equalsIgnoreCase(pmi_disabled))
- || (TRUE.equalsIgnoreCase(pm_disabled))) {
- tableClass += SPACE + CSS_DISABLED_ELEMENT;
- if (attrPresents(pm_disabledItemClass)) {
+ if (TRUE.equalsIgnoreCase(pm_disabled)) {
+ if (childOfPanelMenu) {
+ tableClass += SPACE + CSS_TOP_ITEM;
+ iconCellClass += SPACE + CSS_TOP_ITEM_ICON;
+ labelCellClass += SPACE + CSS_TOP_ITEM_LABEL;
+ if (attrPresents(pm_disabledItemClass)) {
+ tableClass += SPACE + pm_disabledItemClass;
+ }
+ if (attrPresents(pm_topItemStyle)) {
+ tableStyle += SPACE + pm_topItemStyle;
+ }
+ }
+ }
+
+ if (TRUE.equalsIgnoreCase(pmi_disabled)) {
+// tableClass += SPACE + CSS_DISABLED_ELEMENT;
+ if ((attrPresents(pm_disabledItemClass))
+ && !(TRUE.equalsIgnoreCase(pm_disabled))) {
tableClass += SPACE + pm_disabledItemClass;
}
if (attrPresents(pm_disabledItemStyle)) {
@@ -451,27 +471,25 @@
if (attrPresents(pmi_disabledStyle)) {
tableStyle += SPACE + pmi_disabledStyle;
}
-
- } else {
- iconCellClass = DR_NOWARP_CLASS + SPACE + CSS_ITEM_ICON;
+ }
+
+ if (!(TRUE.equalsIgnoreCase(pm_disabled))
+ && (!(TRUE.equalsIgnoreCase(pmi_disabled)))) {
+// iconCellClass = DR_NOWARP_CLASS + SPACE + CSS_ITEM_ICON;
+ iconCellClass = DR_NOWARP_CLASS;
+ imgIconClass = CSS_ITEM_ICON;
labelCellClass = CSS_ITEM_LABEL;
emptyCellClass = DR_NOWARP_CLASS;
if (attrPresents(pmi_iconClass)) {
- iconCellClass += SPACE + pmi_iconClass;
+ imgIconClass += SPACE + pmi_iconClass;
}
if (attrPresents(pmi_iconStyle)) {
- iconStyle += SPACE + pmi_iconStyle;
+ iconCellStyle += SPACE + pmi_iconStyle;
}
- if (attrPresents(pm_itemClass)) {
- tableClass += SPACE + pm_itemClass;
- }
- if (attrPresents(pm_itemStyle)) {
- tableStyle += SPACE + pm_itemStyle;
- }
if (childOfPanelMenu) {
tableClass += SPACE + CSS_TOP_ITEM;
- iconCellClass += SPACE + CSS_TOP_ITEM_ICON;
+ imgIconClass += SPACE + CSS_TOP_ITEM_ICON;
labelCellClass += SPACE + CSS_TOP_ITEM_LABEL;
if (attrPresents(pm_topItemClass)) {
tableClass += SPACE + pm_topItemClass;
@@ -479,21 +497,58 @@
if (attrPresents(pm_topItemStyle)) {
tableStyle += SPACE + pm_topItemStyle;
}
+ } else {
+ if (attrPresents(pm_itemClass)) {
+ tableClass += SPACE + pm_itemClass;
+ }
+ if (attrPresents(pm_itemStyle)) {
+ tableStyle += SPACE + pm_itemStyle;
+ }
}
}
table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, tableStyle);
- iconCell.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, iconStyle);
- labelCell.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, WIDTH_100_PERCENTS);
+ iconCell.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, iconCellStyle);
+ labelCell.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, labelCellStyle);
+ emptyCell.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, emptyCellStyle);
table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, tableClass);
tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, trClass);
iconCell.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, iconCellClass);
+ imgIcon.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, imgIconClass);
labelCell.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, labelCellClass);
emptyCell.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, emptyCellClass);
}
/**
+ * Gets the panel menu item parent.
+ *
+ * @param sourceItemElement the source item element
+ * @param findOnlyPanelMenuParent flag to find only panel menu parent
+ *
+ * @return the item parent
+ */
+ private static final Element getItemParent(Element sourceItemElement,
+ boolean findOnlyPanelMenuParent) {
+ Element parent = (Element) sourceItemElement.getParentNode();
+ while (true) {
+ if (findOnlyPanelMenuParent) {
+ if (parent.getNodeName().endsWith(PANEL_MENU_END_TAG)) {
+ break;
+ }
+ } else {
+ if (parent.getNodeName().endsWith(PANEL_MENU_END_TAG)
+ || parent.getNodeName().endsWith(
+ PANEL_MENU_GROUP_END_TAG)) {
+ break;
+ }
+ }
+ parent = (Element) parent.getParentNode();
+ }
+ return parent;
+ }
+
+ /**
* Read attributes from the source element.
*
* @param sourceNode the source node
@@ -563,4 +618,14 @@
private static boolean attrPresents(String attr) {
return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
}
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#setSourceAttributeSelection(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Element, int, int, java.lang.Object)
+ */
+ @Override
+ public void setSourceAttributeSelection(VpePageContext pageContext,
+ Element sourceElement, int offset, int length, Object data) {
+ VpeSourceDomBuilder sourceBuilder = pageContext.getSourceBuilder();
+ sourceBuilder.setSelection(sourceElement, 0, 0);
+ }
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java 2008-04-24 14:09:04 UTC (rev 7737)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java 2008-04-24 14:43:50 UTC (rev 7738)
@@ -11,10 +11,7 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
@@ -23,11 +20,9 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -36,8 +31,7 @@
* @author ezheleznyakov(a)exadel.com
*
*/
-public class RichFacesPanelMenuTemplate extends VpeAbstractTemplate implements
- VpeToggableTemplate {
+public class RichFacesPanelMenuTemplate extends VpeAbstractTemplate {
/*
* rich:panelMenu attributes
@@ -101,25 +95,17 @@
private static final String PANEL_MENU_GROUP_END = ":panelMenuGroup"; //$NON-NLS-1$
private static final String PANEL_MENU_ITEM_END = ":panelMenuItem"; //$NON-NLS-1$
- private static final String TRUE = "true"; //$NON-NLS-1$
private static final String MARGIN_TOP = "margin-top: 3px; "; //$NON-NLS-1$
private static final String TOP_MENU_ITEM_ID = ""; //$NON-NLS-1$
- private List<String> activeIds = new ArrayList<String>();
-
- private String expandSingle;
- // private static final String DISABLED_STYLE_FOR_TABLE = "color:#B1ADA7";
-
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
Element sourceElement = (Element) sourceNode;
-
String width = sourceElement.getAttribute(WIDTH);
String style = sourceElement.getAttribute(STYLE);
String styleClass = sourceElement.getAttribute(STYLE_CLASS);
- expandSingle = sourceElement.getAttribute(EXPAND_SINGLE);
if (width != null) {
style += "" + "; width:" + width; //$NON-NLS-1$ //$NON-NLS-2$
@@ -139,128 +125,29 @@
List<Node> children = ComponentUtil.getChildren(sourceElement);
int i = 1;
-
+ List<String> expandedIds = new ArrayList<String>();
for (Node child : children) {
if (child.getNodeName().endsWith(PANEL_MENU_GROUP_END)) {
- RichFacesPanelMenuGroupTemplate.encode(pageContext,
- vpeCreationData, sourceElement, (Element) child,
- visualDocument, div, getActiveIds(), String.valueOf(i));
+ child.setUserData(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID, String.valueOf(i), null);
+ child.setUserData(RichFacesPanelMenuGroupTemplate.VPE_EXPANDED_TOGGLE_IDS, expandedIds, null);
i++;
- } else if (child.getNodeName().endsWith(PANEL_MENU_ITEM_END)) {
- RichFacesPanelMenuItemTemplate.encode(pageContext,
- vpeCreationData, sourceElement, (Element) child,
- visualDocument, div, TOP_MENU_ITEM_ID);
- } else {
- nsIDOMElement childDiv = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(childDiv);
- div.appendChild(childDiv);
- childrenInfo.addSourceChild(child);
- vpeCreationData.addChildrenInfo(childrenInfo);
}
+ if (child.getNodeName().endsWith(PANEL_MENU_ITEM_END)) {
+ child.setUserData(RichFacesPanelMenuItemTemplate.VPE_PANEL_MENU_ITEM_ID, TOP_MENU_ITEM_ID, null);
+ }
+
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(div);
+ childrenInfo.addSourceChild(child);
+ vpeCreationData.addChildrenInfo(childrenInfo);
}
-
return vpeCreationData;
}
- /**
- * Gets the active ids.
- *
- * @return the active ids
- */
- private List<String> getActiveIds() {
- return activeIds;
- }
-
- /**
- *
- * @param children
- * @return
- */
- private int getChildrenCount(List<Node> children) {
- int count = 0;
- for (Node child : children) {
- if (child.getNodeName().endsWith(PANEL_MENU_GROUP_END)) {
- count++;
- }
- }
- return count;
- }
-
- public void toggle(VpeVisualDomBuilder builder, Node sourceNode,
- String toggleId) {
-
- /*
- * Expand only one group.
- */
- if ((null != expandSingle) && (TRUE.equalsIgnoreCase(expandSingle))) {
- if (activeIds.contains(toggleId)) {
- /*
- * Close group and its children
- */
- activeIds.remove(toggleId);
- for (Iterator<String> iterator = activeIds.iterator(); iterator.hasNext();) {
- String id = iterator.next();
- if (id.startsWith(toggleId)) {
- iterator.remove();
- }
- }
- } else {
- /*
- * Expand new group, close others
- */
- String[] toggleIds = toggleId.split(RichFacesPanelMenuGroupTemplate.GROUP_COUNT_SEPARATOR);
- if ((null != toggleIds) && (toggleIds.length > 0)) {
- for (Iterator<String> iterator = activeIds.iterator(); iterator.hasNext();) {
- String id = iterator.next();
- String[] ids = id.split(RichFacesPanelMenuGroupTemplate.GROUP_COUNT_SEPARATOR);
- if ((null != ids) && (ids.length > 0)) {
- if (ids.length >= toggleIds.length) {
- /*
- * Remove all ids that are deeper than selected
- * and that are on the same level.
- */
- iterator.remove();
- } else {
- /*
- * Remove all ids that are not in the selected branch.
- */
- for (int i = 0; i < ids.length; i++) {
- if (!ids[i].equalsIgnoreCase(toggleIds[i])) {
- iterator.remove();
- }
- }
- }
- }
- }
- }
- activeIds.add(toggleId);
- }
- } else {
- /*
- * Expand any number of groups.
- */
- if (activeIds.contains(toggleId)) {
- activeIds.remove(toggleId);
- for (Iterator<String> iterator = activeIds.iterator(); iterator.hasNext();) {
- String id = iterator.next();
- if (id.startsWith(toggleId)) {
- iterator.remove();
- }
- }
- } else {
- activeIds.add(toggleId);
- }
- }
- }
-
- public void stopToggling(Node sourceNode) {
- activeIds.clear();
- }
-
public boolean isRecreateAtAttrChange(VpePageContext pageContext,
Element sourceElement, nsIDOMDocument visualDocument,
nsIDOMElement visualNode, Object data, String name, String value) {
return true;
}
+
+
}
\ No newline at end of file
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 2008-04-24 14:09:04 UTC (rev 7737)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-04-24 14:43:50 UTC (rev 7738)
@@ -574,6 +574,8 @@
<vpe:template children="yes" modify="yes" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesPanelMenuItemTemplate">
<vpe:drag start-enable="yes"/>
<vpe:drop container="yes"/>
+ <vpe:textFormatting use-default-formats="yes">
+ </vpe:textFormatting>
</vpe:template>
</vpe:tag>
@@ -581,6 +583,8 @@
<vpe:template children="yes" modify="yes" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesPanelMenuGroupTemplate">
<vpe:drag start-enable="yes"/>
<vpe:drop container="yes"/>
+ <vpe:textFormatting use-default-formats="yes">
+ </vpe:textFormatting>
</vpe:template>
</vpe:tag>
@@ -588,6 +592,7 @@
<vpe:template children="yes" modify="yes" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesPanelMenuTemplate">
<vpe:resize>
<vpe:width width-attr="width" />
+ <vpe:height height-attr="style.height" />
</vpe:resize>
<vpe:drag start-enable="yes"/>
<vpe:drop container="yes"/>
17 years, 8 months
JBoss Tools SVN: r7737 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-04-24 10:09:04 -0400 (Thu, 24 Apr 2008)
New Revision: 7737
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2122
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-04-24 14:08:12 UTC (rev 7736)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-04-24 14:09:04 UTC (rev 7737)
@@ -141,9 +141,9 @@
}
}
} catch (CoreException e) {
- SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
+ SeamCorePlugin.getDefault().logError(e);
} catch (IOException e) {
- SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
+ SeamCorePlugin.getDefault().logError(e);
} finally {
if (model != null) {
model.releaseFromRead();
17 years, 8 months
JBoss Tools SVN: r7736 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-04-24 10:08:12 -0400 (Thu, 24 Apr 2008)
New Revision: 7736
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/IValidationErrorManager.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ValidationErrorManager.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
Log:
http://jira.jboss.com/jira/browse/JBIDE-2122
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/IValidationErrorManager.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/IValidationErrorManager.java 2008-04-24 13:15:29 UTC (rev 7735)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/IValidationErrorManager.java 2008-04-24 14:08:12 UTC (rev 7736)
@@ -18,7 +18,6 @@
/**
* @author Alexey Kazakov
- *
*/
public interface IValidationErrorManager {
@@ -68,6 +67,17 @@
String[] messageArguments, int length, int offset, IResource target);
/**
+ * Adds a marker to the resource
+ * @param messageId
+ * @param severity
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ */
+ void addError(String messageId, int severity, String[] messageArguments, int length, int offset, IResource target);
+
+ /**
* Displays a subtask in the progress view.
* @param messageId
*/
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-04-24 13:15:29 UTC (rev 7735)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2008-04-24 14:08:12 UTC (rev 7736)
@@ -10,20 +10,41 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.validation;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualArchiveComponent;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* This validator is workaround for bug of WTP 2.0.2
@@ -31,6 +52,9 @@
* @author Alexey Kazakov
*/
public class SeamEarProjectValidator implements IValidatorJob {
+
+ protected static final String INVALID_APPLICATION_XML_MESSAGE_ID = "INVALID_APPLICATION_XML"; //$NON-NLS-1$
+
private IValidationErrorManager errorManager;
/* (non-Javadoc)
@@ -44,7 +68,6 @@
* @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#validateInJob(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
*/
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
-
SeamValidationHelper seamHelper = (SeamValidationHelper)helper;
IProject project = seamHelper.getProject();
if(!project.isAccessible()) {
@@ -66,7 +89,13 @@
}
ISeamProject seamProject = SeamCorePlugin.getSeamProject(folder.getProject(), false);
if(seamProject!=null) {
- validateEar(project, rs);
+ IVirtualFolder earRootFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+ if(earRootFolder!=null) {
+ IFolder f = (IFolder)earRootFolder.getUnderlyingFolder();
+ if(f!=null ) {
+ validateApplicationXml(f.findMember(new Path("META-INF/application.xml")));
+ }
+ }
break;
}
}
@@ -74,16 +103,86 @@
return OK_STATUS;
}
- private void validateEar(IProject ear, IVirtualReference[] rs) {
- for (int i = 0; i < rs.length; i++) {
- IVirtualComponent c = rs[i].getReferencedComponent();
- if(c != null && c instanceof J2EEModuleVirtualArchiveComponent) {
- J2EEModuleVirtualArchiveComponent component = (J2EEModuleVirtualArchiveComponent)c;
- System.out.println(c.getName());
+ private static final String MODULE_NODE_NAME = "module";
+ private static final String JAVA_NODE_NAME = "java";
+ private static final String[] JARS = new String[]{"jboss-seam", "el-ri", "jbpm", "drools-core", "drools-compiler", "janino", "antlr", "commons-jci-core", "commons-jci-janino", "stringtemplate"};
+
+ private void validateApplicationXml(IResource applicationXml) {
+ if(applicationXml==null || !(applicationXml instanceof IFile) || !applicationXml.exists()) {
+ return;
+ }
+
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager == null) {
+ return;
+ }
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead((IFile)applicationXml);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ Element root = document.getDocumentElement();
+ if(root==null) {
+ return;
+ }
+ NodeList children = root.getChildNodes();
+ for(int i=0; i<children.getLength(); i++) {
+ Node curentValidatedNode = children.item(i);
+ if(Node.ELEMENT_NODE == curentValidatedNode.getNodeType() && MODULE_NODE_NAME.equals(curentValidatedNode.getNodeName())) {
+ NodeList moduleChildren = curentValidatedNode.getChildNodes();
+ for(int j=0; j<moduleChildren.getLength(); j++) {
+ Node child = moduleChildren.item(j);
+ if(Node.ELEMENT_NODE == child.getNodeType() && JAVA_NODE_NAME.equals(child.getNodeName())) {
+ validateJavaModule(applicationXml, child);
+ }
+ }
+ }
+ }
}
+ } catch (CoreException e) {
+ SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
+ } catch (IOException e) {
+ SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_EL_VALIDATOR_ERROR_VALIDATING_SEAM_EL, e);
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
}
+ return;
}
+ private void validateJavaModule(IResource file, Node node) {
+ NodeList children = node.getChildNodes();
+ for(int i=0; i<children.getLength(); i++) {
+ Node child = children.item(i);
+ if(Node.TEXT_NODE == child.getNodeType()) {
+ IStructuredDocumentRegion strRegion = ((IDOMNode)child).getFirstStructuredDocumentRegion();
+ ITextRegionList regions = strRegion.getRegions();
+ for(int j=0; j<regions.size(); j++) {
+ ITextRegion region = regions.get(j);
+ if(region.getType() == DOMRegionContext.XML_CONTENT) {
+ String text = strRegion.getFullText(region);
+ int offset = strRegion.getStartOffset() + region.getStart();
+ validateJarName(file, text, offset);
+ }
+ }
+ }
+ }
+ }
+
+ private void validateJarName(IResource file, String text, int offset) {
+ String jarName = text.trim();
+ for(int jarIndex=0; jarIndex<JARS.length; jarIndex++) {
+ if(jarName.startsWith(JARS[jarIndex])) {
+ int position = offset + text.indexOf(jarName);
+ int length = jarName.length();
+ errorManager.addError(INVALID_APPLICATION_XML_MESSAGE_ID, IMessage.HIGH_SEVERITY, new String[]{jarName}, length, position, file);
+ break;
+ }
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.wst.validation.internal.provisional.core.IValidator#cleanup(org.eclipse.wst.validation.internal.provisional.core.IReporter)
*/
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ValidationErrorManager.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ValidationErrorManager.java 2008-04-24 13:15:29 UTC (rev 7735)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ValidationErrorManager.java 2008-04-24 14:08:12 UTC (rev 7736)
@@ -91,7 +91,6 @@
addError(messageId, preferenceKey, new String[0], location, target);
}
-
/* (non-Javadoc)
* @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String, java.lang.String, java.lang.String[], org.eclipse.core.resources.IResource)
*/
@@ -152,6 +151,36 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String, int, java.lang.String[], int, int, org.eclipse.core.resources.IResource)
+ */
+ public void addError(String messageId, int severity, String[] messageArguments, int length, int offset, IResource target) {
+ IMessage message = new Message(getBaseName(), severity,
+ messageId, messageArguments, target,
+ getMarkerId());
+ message.setLength(length);
+ message.setOffset(offset);
+ try {
+ if (coreHelper != null) {
+ coreHelper.getDocumentProvider().connect(target);
+ message.setLineNo(coreHelper.getDocumentProvider().getDocument(
+ target).getLineOfOffset(offset) + 1);
+ }
+ } catch (BadLocationException e) {
+ SeamCorePlugin.getPluginLog().logError(
+ "Exception occurred during error line number calculation",
+ e);
+ return;
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(
+ "Exception occurred during error line number calculation",
+ e);
+ return;
+ }
+ reporter.addMessage(validationManager, message);
+ }
+
+ /*
+ * (non-Javadoc)
*
* @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#displaySubtask(java.lang.String)
*/
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-04-24 13:15:29 UTC (rev 7735)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-04-24 14:08:12 UTC (rev 7736)
@@ -59,6 +59,9 @@
INVALID_TEST_PACKAGE_NAME=Test package name "{0}" specified for Seam project "{1}" is not valid. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
INVALID_CONNECTION_NAME=Connection profiler "{0}" specified for Seam project "{1}" does not exist. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
+#Invalid ear application.xml
+INVALID_APPLICATION_XML=Invalid module "{0}"
+
#Messages for Progress Monitor
SEARCHING_RESOURCES=project "{0}"; searching resources for validation.
VALIDATING_COMPONENT=project "{0}"; component "{1}"
17 years, 8 months
JBoss Tools SVN: r7735 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2008-04-24 09:15:29 -0400 (Thu, 24 Apr 2008)
New Revision: 7735
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-310 "Write your first project" update, image titles
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-04-24 12:28:18 UTC (rev 7734)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-04-24 13:15:29 UTC (rev 7735)
@@ -332,7 +332,7 @@
you so there is no need to change them. Click on <property>Finish</property>.</para>
<figure>
- <title></title>
+ <title>New Seam Action Wizard</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam19.png"/>
@@ -359,7 +359,7 @@
created a TestNG test case for you.</para>
<figure>
- <title></title>
+ <title>"workshop-test" Project</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam20.png" scale="85"/>
@@ -372,7 +372,7 @@
As...</property> toolbar shortcut as shown below.</para>
<figure>
- <title></title>
+ <title>TestNG Running</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam21.png"/>
@@ -383,7 +383,7 @@
<para>With any luck, the test case will pass. Look at the TestNG view.</para>
<figure>
- <title></title>
+ <title>TestNG Results</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam22.png"/>
@@ -395,7 +395,7 @@
show the appropriate url in the browser. Alternatively you can manually enter <emphasis><property>http://localhost/workshop/myAction.seam</property></emphasis> into a browser.</para>
<figure>
- <title></title>
+ <title>Seam Action in a Web Browser</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam23.png" scale="80"/>
@@ -414,7 +414,7 @@
<para>Open <emphasis><property>WebContent/myAction.xhtml</property></emphasis> in JBoss Developer Studio to use the nice facelets editor.</para>
<figure>
- <title></title>
+ <title>Open Seam Action with Editor </title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam24.png"/>
@@ -425,7 +425,7 @@
<para>Right click on the "myAction!" button in the visual part of editor and select <property><h:commandButton> Attributes</property>.</para>
<figure>
- <title></title>
+ <title>Seam Action Editing</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam25.png"/>
@@ -437,7 +437,7 @@
page. Then, type <emphasis><property>CTRL + S</property></emphasis> to save the facelet.</para>
<figure>
- <title></title>
+ <title>Attributes Dialog</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam26.png"/>
@@ -450,7 +450,7 @@
<para>Notice that you did not have to publish the application. JBoss Developer Studio auto-published it for you.</para>
<figure>
- <title></title>
+ <title>Seam Action Is Modified</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam27.png"/>
@@ -466,12 +466,12 @@
<section id="declarative_security">
<title>Declarative Security</title>
+ <para>In this section you will see how it’s easy to secure the facelets and facelet components in Seam. Let’s go ahead and secure the action button,
+ then we will secure the entire page.</para>
+
<section id="edit_login">
<title>Edit Login Authentication Logic</title>
-
- <para>It’s easy to secure facelets and facelet components in Seam. Let’s go ahead and secure the action button,
- then we will secure the entire page.</para>
-
+
<para>There is a class called <property>Authenticator.java</property>. The login page will execute
the <property>Authenticator.authenticate()</property> method by default, so we’ll start by adding some custom login logic.</para>
<para>Open <property>Authenticator.java</property> in JBoss Developer Studio and replace the <property>authenticate()</property> method with this code:</para>
@@ -501,7 +501,7 @@
<figure>
- <title></title>
+ <title>One Button on a Page</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam28.png"/>
@@ -512,7 +512,7 @@
<para>The secured button is not visible because the user isn’t logged in as <property>"admin"</property>.</para>
<figure>
- <title></title>
+ <title>Secured Button is Visible</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam29.png"/>
@@ -531,7 +531,7 @@
back to the login page.</para>
<figure>
- <title></title>
+ <title>Login Page</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam30.png"/>
@@ -553,18 +553,19 @@
<section id="browsing_workshop_db">
<title>Browsing Workshop Database</title>
+ <para>In this section you get to know how to use the workshop database that was started at the beginning of the lab.</para>
+
<section id="database_connectivity">
<title>Database Connectivity Setup</title>
- <para>Now, it’s time to use the workshop database that was started at the beginning of the lab. The workshop
- data can be browsed inside of JBoss Developer Studio.</para>
+ <para>The workshop data can be browsed inside of JBoss Developer Studio.</para>
<para>To open the Data Source Explorer, click on <emphasis><property>Window > Open Perspective > Other > Database Development</property>.</emphasis></para>
<para>In the Data Source Explorer, expand a <property>Databases</property> node and select a <property>Default</property> database.
Right click on it, select <property>Connect</property> from the context menu.</para>
<figure>
- <title></title>
+ <title>Data Source Explorer</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam31.png"/>
@@ -580,7 +581,7 @@
<para>Then in the current view, drill down to the <property>CUSTOMERS</property> table.</para>
<figure>
- <title></title>
+ <title>"CUSTOMERS" Table</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam32.png"/>
@@ -595,7 +596,7 @@
<figure>
- <title></title>
+ <title>SQL Results View</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam33.png" scale="85"/>
@@ -617,18 +618,18 @@
<section id="db_programming">
<title>Database Programming</title>
+ <para>Now, it’s time to reverse engineer the workshop database into a fully functioning Seam CRUD(Create
+ Read Update Delete) application.</para>
+
<section id="reverse_engineer_crud">
<title>Reverse Engineer CRUD from a Running Database</title>
- <para>Now, it’s time to reverse engineer the workshop database into a fully functioning Seam CRUD(Create
- Read Update Delete) application.</para>
-
<para>In JBoss Developer Studio, switch to Seam perspective and click on <emphasis><property>File > New > Seam Generate Entities</property>.</emphasis></para>
<para>In the Seam Generate Entities wizard, select "workshop" project using the <property>Browse</property> button. There is no need to change something more, click on <property>Finish</property>.</para>
<figure>
- <title></title>
+ <title>Generate Seam Entities</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam34.png"/>
@@ -640,7 +641,7 @@
These classes represent insert/update/delete/query logic.</para>
<figure>
- <title></title>
+ <title>org.domain.workshop.entity Classes</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam35.png" scale="85"/>
@@ -658,7 +659,7 @@
and data table sorting in the list pages. </para>
<figure>
- <title></title>
+ <title>CustomersList.xhtml in the Editor</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam36.png"/>
@@ -678,7 +679,7 @@
<para>In the upper right corner of the workbench there is a small <property>>></property>, click on it and choose <property>Hibernate</property>.</para>
<figure>
- <title></title>
+ <title>Hibernate Perspective</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam37.png"/>
@@ -690,7 +691,7 @@
<property>Session Factory</property> and notice that the JPA entities/attributes are listed in a nice tree view.</para>
<figure>
- <title></title>
+ <title>Hibernate Configurations View</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam38.png"/>
@@ -704,7 +705,7 @@
<para>Write your query and click on the "Hibernate Dynamic SQL Preview" tab. You should see the SQL that will be executed if this JPA query is run.</para>
<figure>
- <title></title>
+ <title>JPA Query Editor</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam39.png"/>
@@ -714,12 +715,12 @@
<para>Run the query by clicking on the green run icon.</para>
- <para>The results are listed in the "Hiberanate Query Result" tab. There is a "Properties" tab in the workbench
+ <para>The results are listed in the "Hibernate Query Result" tab. There is a "Properties" tab in the workbench
that can be used to see a specific JPA result. These results represent the JPA objects because our
query did not specify column names.</para>
<figure>
- <title></title>
+ <title>Hibernate Query Result View</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam40.png" scale="80"/>
@@ -730,7 +731,7 @@
<para>The query can be refined, and take note that there is nice code completion in the JPA query editor.</para>
<figure>
- <title></title>
+ <title>Code Completion</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam41.png"/>
@@ -741,7 +742,7 @@
<para>A refined query will return results that are more ResultSet oriented. Notice the join logic that JPA supports.</para>
<figure>
- <title></title>
+ <title>The Results</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam42.png"/>
@@ -757,16 +758,14 @@
provided in this lab.</para>
<figure>
- <title></title>
+ <title>Criteria Editor</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam43.png"/>
</imageobject>
</mediaobject>
</figure>
-
-
-
+
</section>
<section id="use_hibernate_to_vizualize">
@@ -778,7 +777,7 @@
Select the <property>Customers</property> entity, right click on it, choose <property>Open Mapping Diagram</property>.</para>
<figure>
- <title></title>
+ <title>Mapping Diagram Opening</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam44.png"/>
@@ -793,7 +792,7 @@
<figure>
- <title></title>
+ <title>Diagram Tab</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam45.png" scale="80"/>
@@ -808,18 +807,18 @@
<section id="rich_components">
<title>Rich Components</title>
+ <para>This lab will conclude with one last AJAX twist. In this section we add a RichFaces <property>inputNumberSlider</property> to the Order
+ Details edit screen.</para>
+
<section id="add_richfaces">
<title>Add a Richfaces component to the CRUD Application</title>
-
- <para>This lab will conclude with one last AJAX twist. We will add a RichFaces <property>inputNumberSlider</property> to the Order
- Details edit screen.</para>
-
+
<para>Switch to Seam perspective, open <emphasis><property>WebContent/OrderdetailsEdit.xhtml</property></emphasis> in JBoss Developer Studio.</para>
<para>Change the form field values using the visual editor. Seam has generated the form field names that match the
database column names. This is not ideal for business users.</para>
<figure>
- <title></title>
+ <title>Form Fields Editing</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam46.png"/>
@@ -831,7 +830,7 @@
Studio palette or right click on the form and insert the RichFaces component.</para>
<figure>
- <title></title>
+ <title>RichFaces Component Inserting</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam47.png" scale="85"/>
@@ -842,10 +841,10 @@
<para>One the last option is to use the source view and manually copy the inputNumberSlider markup listed below:</para>
<programlisting><![CDATA[<rich:inputNumberSlider id="quantityOrdered" required="true"
- value="#{orderdetailsHome.instance.quantityordered}"/>]]></programlisting>
+ value="#{orderdetailsHome.instance.quantityordered}"/>]]></programlisting>
<figure>
- <title></title>
+ <title>Adding the Source</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam48.png"/>
@@ -856,7 +855,7 @@
<para>The end result is an edit page that has better form labels and a new RichFaces control.</para>
<figure>
- <title></title>
+ <title>The Result Page</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam49.png" scale="85"/>
17 years, 8 months