JBoss Tools SVN: r2352 - trunk/documentation/GettingStartedGuide/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2007-07-07 07:38:20 -0400 (Sat, 07 Jul 2007)
New Revision: 2352
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJavaServerFaces.xml
Log:
http://jira.jboss.com/jira/browse/EXIN-373
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJavaServerFaces.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJavaServerFaces.xml 2007-07-06 18:05:50 UTC (rev 2351)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJavaServerFaces.xml 2007-07-07 11:38:20 UTC (rev 2352)
@@ -1214,7 +1214,7 @@
Ant folder and run the script by typing from the command line:</para>
<programlisting role="XML"><![CDATA[ant createtaglib
]]></programlisting>
-<para>To see how this works now, copy the mylib.jar file to the WEB-INF/lib folder of any JSF
+<para>To see how this works now, copy the mylib.jar file to the <emphasis>WEB-INF/lib</emphasis> folder of any JSF
project. Then insert your new custom tag on one of the JSP pages. Don't forget to insert at the
top of the page the definition:</para>
<programlisting role="XML"><![CDATA[<%@ taglib uri="http://jsftutorials.com/" prefix="d" %>
17 years, 6 months
JBoss Tools SVN: r2351 - 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: 2007-07-06 14:05:50 -0400 (Fri, 06 Jul 2007)
New Revision: 2351
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
Log:
http://jira.jboss.com/jira/browse/EXIN-327 Incremental validation for nonunique component names.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-06 16:17:06 UTC (rev 2350)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-06 18:05:50 UTC (rev 2351)
@@ -12,9 +12,11 @@
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
@@ -36,8 +38,12 @@
*/
public class SeamJavaValidator extends SeamValidator {
- public static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID="NONUNIQUE_COMPONENT_NAME_MESSAGE";
+ private static final String NONUNIQUE_NAME_MESSAGE_GROUP = "nonuniqueName";
+ private Map<String, Set<IResource>> markedNonuniqueNamedResources = new HashMap<String, Set<IResource>>();
+ private Map<IResource, String> nonuniqueNames = new HashMap<IResource, String>();
+ public static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID = "NONUNIQUE_COMPONENT_NAME_MESSAGE";
+
public ISchedulingRule getSchedulingRule(IValidationContext helper) {
// TODO
return null;
@@ -45,20 +51,64 @@
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
super.validateInJob(helper, reporter);
- System.out.println("Seam validation in job.");
SeamJavaHelper seamJavaHelper = (SeamJavaHelper)helper;
String[] uris = seamJavaHelper.getURIs();
ISeamProject project = seamJavaHelper.getSeamProject();
if (uris.length > 0) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFile currentFile = null;
+ Set<IResource> checkedResource = new HashSet<IResource>();
+ Set<ISeamComponent> checkedComponent = new HashSet<ISeamComponent>();
for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) {
currentFile = root.getFile(new Path(uris[i]));
if (currentFile != null && currentFile.exists()) {
- Set<ISeamComponent> components = project.getComponentsByResource(currentFile);
- for (ISeamComponent component : components) {
- validateUniqueComponentName(project, component, helper, reporter);
+ String oldComponentNameOfChangedFile = nonuniqueNames.get(currentFile);
+ if(oldComponentNameOfChangedFile!=null) {
+ Set<IResource> resources = new HashSet<IResource>(); // Resources which we have to validate.
+
+ // Check if component name was changed in java file
+ String newComponentNameOfChangedFile = getComponentNameByResource(currentFile, project);
+ if(newComponentNameOfChangedFile!=null && !oldComponentNameOfChangedFile.equals(newComponentNameOfChangedFile)) {
+ // Name was changed. Remove markers from resources with new component name.
+ Set<IResource> rs = markedNonuniqueNamedResources.get(newComponentNameOfChangedFile);
+ if(rs!=null) {
+ for (IResource resource : rs) {
+ reporter.removeMessageSubset(this, resource, NONUNIQUE_NAME_MESSAGE_GROUP);
+ resources.add(resource);
+ }
+ }
+ }
+
+ Set<IResource> linkedResources = markedNonuniqueNamedResources.get(oldComponentNameOfChangedFile);
+ if(linkedResources!=null) {
+ resources.addAll(linkedResources);
+ }
+
+ // Validate all collected linked resources.
+ for (IResource linkedResource : resources) {
+ if(checkedResource.contains(linkedResource)) {
+ continue;
+ }
+ reporter.removeMessageSubset(this, linkedResource, NONUNIQUE_NAME_MESSAGE_GROUP); // Remove markers from java file
+ Set<ISeamComponent> components = project.getComponentsByResource(linkedResource);
+ for (ISeamComponent component : components) {
+ if(checkedComponent.contains(component)) {
+ continue;
+ }
+ validateUniqueComponentName(project, component, helper, reporter);
+ checkedComponent.add(component);
+ }
+ checkedResource.add(linkedResource);
+ }
+ } else {
+ // Validate new (unmarked) Java file.
+ // TODO
}
+// reporter.removeAllMessages(this, currentFile); // Remove all markers from java file
+// Set<ISeamComponent> components = project.getComponentsByResource(currentFile);
+// for (ISeamComponent component : components) {
+// validateUniqueComponentName(project, component, helper, reporter);
+// }
// TODO
}
}
@@ -69,6 +119,14 @@
return OK_STATUS;
}
+ public String getComponentNameByResource(IResource resource, ISeamProject project) {
+ Set<ISeamComponent> components = project.getComponentsByResource(resource);
+ for (ISeamComponent component : components) {
+ return component.getName();
+ }
+ return null;
+ }
+
public void cleanup(IReporter reporter) {
}
@@ -101,20 +159,42 @@
if(checkedDeclaration==null) {
usedPrecedences.put(javaDeclarationPrecedence, javaDeclaration);
} else {
+ IResource javaDeclarationResource = javaDeclaration.getResource();
// Mark nonunique name.
if(!markedDeclarations.contains(checkedDeclaration)) {
- // Mark first wrong declaration
+ // Mark first wrong declaration with that name
ISeamTextSourceReference target = ((SeamComponentDeclaration)checkedDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, target);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, target, NONUNIQUE_NAME_MESSAGE_GROUP);
markedDeclarations.add(checkedDeclaration);
+ addLinkedResource(checkedDeclaration.getName(), checkedDeclaration.getResource());
}
- // Mark next wrong declaration
+ // Mark next wrong declaration with that name
markedDeclarations.add(javaDeclaration);
+ addLinkedResource(javaDeclaration.getName(), javaDeclaration.getResource());
ISeamTextSourceReference target = ((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, target);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, target, NONUNIQUE_NAME_MESSAGE_GROUP);
}
}
}
}
}
+
+ /*
+ * Save linked resources of component name that we marked.
+ * It's needed for incremental validation because we must save all linked resources of changed java file.
+ */
+ private void addLinkedResource(String componentName, IResource linkedResource) {
+ Set<IResource> linkedResources = markedNonuniqueNamedResources.get(componentName);
+ if(linkedResources==null) {
+ // create set of linked resources with component name that we must mark.
+ linkedResources = new HashSet<IResource>();
+ markedNonuniqueNamedResources.put(componentName, linkedResources);
+ }
+ if(!linkedResources.contains(linkedResource)) {
+ // save linked resources that we must mark.
+ linkedResources.add(linkedResource);
+ }
+ // Save link between component name and marked resource. It's needed if component name changes in java file.
+ nonuniqueNames.put(linkedResource, componentName);
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-06 16:17:06 UTC (rev 2350)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-06 18:05:50 UTC (rev 2351)
@@ -46,14 +46,14 @@
return "org.jboss.tools.seam.internal.core.validation.messages";
}
- protected void addError(String messageId, String[] messageArguments, ISeamTextSourceReference target) {
- IMessage message = new Message(getBaseName(), IMessage.HIGH_SEVERITY, messageId, messageArguments, target.getResource());
+ protected void addError(String messageId, String[] messageArguments, ISeamTextSourceReference target, String messageGroup) {
+ IMessage message = new Message(getBaseName(), IMessage.HIGH_SEVERITY, messageId, messageArguments, target.getResource(), messageGroup);
message.setLength(target.getLength());
message.setOffset(target.getStartPosition());
reporter.addMessage(this, message);
}
- protected void addError(String messageId, ISeamTextSourceReference target) {
- addError(messageId, new String[0], target);
+ protected void addError(String messageId, ISeamTextSourceReference target, String messageGroup) {
+ addError(messageId, new String[0], target, messageGroup);
}
}
\ No newline at end of file
17 years, 6 months
JBoss Tools SVN: r2350 - in trunk/documentation/GettingStartedGuide/docs/userguide/en: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sabrashevich
Date: 2007-07-06 12:17:06 -0400 (Fri, 06 Jul 2007)
New Revision: 2350
Added:
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/CreatedProject12.png
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/ConnectionsView.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/CreatedProject.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/Metadata.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/AjaxCRUDApplicationWithSeamAndRichFaces.xml
Log:
http://jira.jboss.org/jira/browse/EXIN-353 added new screenshots
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/ConnectionsView.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/CreatedProject.png
===================================================================
(Binary files differ)
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/CreatedProject12.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/CreatedProject12.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/Metadata.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/AjaxCRUDApplicationWithSeamAndRichFaces.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/AjaxCRUDApplicationWithSeamAndRichFaces.xml 2007-07-06 16:07:13 UTC (rev 2349)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/AjaxCRUDApplicationWithSeamAndRichFaces.xml 2007-07-06 16:17:06 UTC (rev 2350)
@@ -183,7 +183,7 @@
<title>EclipseCon Project</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/CreatedProject.png"/>
+ <imagedata fileref="images/CreatedProject12.png"/>
</imageobject>
</mediaobject>
</figure>
17 years, 6 months
JBoss Tools SVN: r2349 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core: scanner/java and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-06 12:07:13 -0400 (Fri, 06 Jul 2007)
New Revision: 2349
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
Log:
EXIN-217 Added processing of javax.ejb.Stateful annotation
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-06 15:32:10 UTC (rev 2348)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-06 16:07:13 UTC (rev 2349)
@@ -121,6 +121,10 @@
public boolean isStateful() {
return stateful;
}
+
+ public void setStateful(boolean b) {
+ stateful = b;
+ }
public void removeBijectedAttribute(IBijectedAttribute attribute) {
bijectedAttributes.remove(attribute);
@@ -192,7 +196,7 @@
return precedence;
}
- /* (non-Javadoc)
+ /**
* @see org.jboss.tools.seam.core.ISeamJavaComponentDeclaration#setPrecedence(org.jboss.tools.seam.core.SeamComponentPrecedenceType)
*/
public void setPrecedence(int precedence) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-06 15:32:10 UTC (rev 2348)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-06 16:07:13 UTC (rev 2349)
@@ -140,6 +140,7 @@
componentDeclarationsRemoved(old);
loaded = current;
current = null;
+ c = getComponent(name);
} else {
continue;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-06 15:32:10 UTC (rev 2348)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-06 16:07:13 UTC (rev 2349)
@@ -16,6 +16,6 @@
public static String FACTORY_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Factory";
- public static String STATEFUL_TYPE = "javax.ejb.Stateful";
+ public static String STATEFUL_ANNOTATION_TYPE = "javax.ejb.Stateful";
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-06 15:32:10 UTC (rev 2348)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-06 16:07:13 UTC (rev 2349)
@@ -97,7 +97,9 @@
Map<String,Annotation> map = null;
for (int i = 0; i < as.length; i++) {
Class<?> acls = as[i].annotationType();
- if(acls.getName().startsWith(SEAM_ANNOTATION_TYPE_PREFIX)) {
+ if(acls.getName().startsWith(SEAM_ANNOTATION_TYPE_PREFIX) ||
+ //TODO put all non-seam relevant annotations to set
+ acls.getName().equals(STATEFUL_ANNOTATION_TYPE)) {
if(map == null) map = new HashMap<String, Annotation>();
map.put(acls.getName(), as[i]);
}
@@ -123,6 +125,10 @@
Object precedence = getValue(a, "precedence");
if(precedence instanceof Integer) component.setPrecedence((Integer)precedence);
}
+ a = map.get(STATEFUL_ANNOTATION_TYPE);
+ if(a != null) {
+ component.setStateful(true);
+ }
}
Method[] ms = null;
try {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-06 15:32:10 UTC (rev 2348)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-06 16:07:13 UTC (rev 2349)
@@ -155,8 +155,8 @@
IClassFile typeRoot = (IClassFile)es[i];
IType type = typeRoot.getType();
String className = type.getFullyQualifiedName();
- if(className.indexOf("ProcessInstanceF") >= 0) {
- System.out.println("!!");
+ if(className.equals("org.jboss.seam.core.TransactionListener")) {
+// System.out.println("!!");
}
Class<?> cls = null;
@@ -178,7 +178,7 @@
if(ds1 != null) {
ds.add(ds1);
}
- System.out.println(className);
+// System.out.println(className);
}
}
}
17 years, 6 months
JBoss Tools SVN: r2348 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core: scanner/java and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-06 11:32:10 -0400 (Fri, 06 Jul 2007)
New Revision: 2348
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
Log:
EXIN-217 Java class scanner is being developed.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-06 15:03:58 UTC (rev 2347)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-06 15:32:10 UTC (rev 2348)
@@ -10,9 +10,13 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import java.util.List;
+
import org.eclipse.jdt.core.IMember;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.event.Change;
/**
* @author Viacheslav Kabanovich
@@ -43,4 +47,28 @@
this.types = types;
}
+ public List<Change> merge(AbstractContextVariable f) {
+ List<Change> changes = super.merge(f);
+
+ if(f instanceof BijectedAttribute) {
+ BijectedAttribute sf = (BijectedAttribute)f;
+ if(!typesAreEqual(types, sf.types)) {
+ changes = Change.addChange(changes, new Change(this, ISeamXmlComponentDeclaration.NAME, name, f.name));
+ this.types = sf.types;
+ }
+ }
+
+ return changes;
+ }
+
+ boolean typesAreEqual(BijectedAttributeType[] types1, BijectedAttributeType[] types2) {
+ if(types1 == null || types2 == null) return types2 == types1;
+ if(types1.length != types2.length) return false;
+ for (int i = 0; i < types1.length; i++) {
+ if(types1[i] != types2[i]) return false;
+ }
+ return true;
+
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-06 15:03:58 UTC (rev 2347)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-06 15:32:10 UTC (rev 2348)
@@ -120,6 +120,8 @@
loaded.setSourcePath(source);
String name = loaded.getName();
+
+ boolean nameChanged = current != null && !name.equals(current.getName());
SeamComponent c = getComponent(name);
@@ -132,16 +134,28 @@
fireChanges(cchanges);
//TODO if java, fire to others
}
- continue;
+ if(nameChanged) {
+ Map<Object,ISeamComponentDeclaration> old = new HashMap<Object, ISeamComponentDeclaration>();
+ old.put(current.getId(), current);
+ componentDeclarationsRemoved(old);
+ loaded = current;
+ current = null;
+ } else {
+ continue;
+ }
}
if(c == null && name != null) {
c = newComponent(name);
allComponents.put(name, c);
allVariables.add(c);
+ c.addDeclaration(loaded);
addedComponents = Change.addChange(addedComponents, new Change(this, null, null, c));
+ } else if(c != null) {
+ c.addDeclaration(loaded);
+ List<Change> changes = Change.addChange(null, new Change(c, null, null, loaded));
+ fireChanges(changes);
}
- if(c != null) c.addDeclaration(components[i]);
if(loaded instanceof ISeamJavaComponentDeclaration) {
SeamJavaComponentDeclaration jd = (SeamJavaComponentDeclaration)loaded;
@@ -155,7 +169,7 @@
fireChanges(changes);
}
} else if(loaded instanceof ISeamXmlComponentDeclaration) {
- ISeamXmlComponentDeclaration xml = (ISeamXmlComponentDeclaration)components[i];
+ ISeamXmlComponentDeclaration xml = (ISeamXmlComponentDeclaration)loaded;
String className = xml.getClassName();
SeamJavaComponentDeclaration j = javaDeclarations.get(className);
if(j != null) {
@@ -250,7 +264,9 @@
if(removed.containsKey(ds[i].getId())) {
if(ds[i] instanceof ISeamJavaComponentDeclaration) {
String className = ((ISeamJavaComponentDeclaration)ds[i]).getClassName();
- javaDeclarations.remove(className);
+ if(javaDeclarations.get(className) == ds[i]) {
+ javaDeclarations.remove(className);
+ }
}
c.removeDeclaration(ds[i]);
changes = Change.addChange(changes, new Change(c, null, ds[i], null));
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-06 15:03:58 UTC (rev 2347)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-06 15:32:10 UTC (rev 2348)
@@ -14,5 +14,8 @@
public static String DESTROY_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Destroy";
public static String FACTORY_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Factory";
+
+
+ public static String STATEFUL_TYPE = "javax.ejb.Stateful";
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-06 15:03:58 UTC (rev 2347)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-06 15:32:10 UTC (rev 2348)
@@ -133,6 +133,16 @@
if(ms != null) for (int i = 0; i < ms.length; i++) {
process(ms[i], component, ds);
}
+
+ Field[] fs = null;
+ try {
+ fs = cls.getFields();
+ } catch (NoClassDefFoundError e) {
+ //ignore
+ }
+ if(fs != null) for (int i = 0; i < fs.length; i++) {
+ //TODO
+ }
}
private void process(Method m, SeamJavaComponentDeclaration component, LoadedDeclarations ds) {
17 years, 6 months
JBoss Tools SVN: r2347 - trunk/vpe/plugins/org.jboss.tools.vpe.mozilla.win32/os/win32/x86/components.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2007-07-06 11:03:58 -0400 (Fri, 06 Jul 2007)
New Revision: 2347
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.mozilla.win32/os/win32/x86/components/xpti.dat
Log:
http://jira.jboss.org/jira/browse/EXIN-231
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.mozilla.win32/os/win32/x86/components/xpti.dat
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.mozilla.win32/os/win32/x86/components/xpti.dat 2007-07-06 15:03:51 UTC (rev 2346)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.mozilla.win32/os/win32/x86/components/xpti.dat 2007-07-06 15:03:58 UTC (rev 2347)
@@ -2,154 +2,154 @@
[Header,2]
0,Version,2,0
-1,AppDir,C:\MyDocuments\Exadel\projects\eclipse-workspaces\rhds\rhds-j1\org.jboss.tools.vpe.mozilla.win32\os\win32\x86
+1,AppDir,C:\MyDocuments\Exadel\projects\eclipse-workspaces\rhds\jbosstools\org.jboss.tools.vpe.mozilla.win32\os\win32\x86
[Directories,2]
-0,C:\MyDocuments\Exadel\projects\eclipse-workspaces\rhds\rhds-j1\org.jboss.tools.vpe.mozilla.win32\os\win32\x86\components
-1,C:\MyDocuments\Exadel\projects\eclipse-workspaces\rhds\rhds-j1\org.jboss.tools.vpe.mozilla.win32\os\win32\x86\plugins
+0,C:\MyDocuments\Exadel\projects\eclipse-workspaces\rhds\jbosstools\org.jboss.tools.vpe.mozilla.win32\os\win32\x86\components
+1,C:\MyDocuments\Exadel\projects\eclipse-workspaces\rhds\jbosstools\org.jboss.tools.vpe.mozilla.win32\os\win32\x86\plugins
[Files,141]
-0,msgbase.xpt,0,32295,1176981176210
-1,dom_html.xpt,0,17354,1176981175882
-2,msgimap.xpt,0,15708,1176981178226
-3,websrvcs.xpt,0,14664,1176981179914
-4,addrbook.xpt,0,13743,1176981179382
-5,msgcompo.xpt,0,11992,1176981175570
-6,necko.xpt,0,11665,1176981179492
-7,dom_css.xpt,0,11009,1176981176976
-8,editor.xpt,0,10902,1176981176398
-9,gfx.xpt,0,9373,1176981175617
-10,msgsearch.xpt,0,9279,1176981177867
-11,xpcom_ds.xpt,0,8837,1176981176132
-12,accessibility.xpt,0,8575,1176981178085
-13,docshell_base.xpt,0,8200,1176981178101
-14,dom_base.xpt,0,7576,1176981179210
-15,xpconnect.xpt,0,7334,1176981175757
-16,msgdb.xpt,0,6711,1176981176492
-17,xpcom_io.xpt,0,6515,1176981176757
-18,dom_core.xpt,0,6358,1176981178117
-19,dom_xul.xpt,0,6231,1176981179601
-20,jsdservice.xpt,0,5953,1176981179992
-21,dom_events.xpt,0,5808,1176981175867
-22,content_base.xpt,0,5783,1176981175898
-23,msgnews.xpt,0,5564,1176981176914
-24,widget.xpt,0,5401,1176981175554
-25,webBrowser_core.xpt,0,5287,1176981178804
-26,plugin.xpt,0,4728,1176981178320
-27,rdf.xpt,0,4513,1176981175382
-28,msglocal.xpt,0,4050,1176981178382
-29,appshell.xpt,0,3660,1176981179179
-30,xpcom_components.xpt,0,3624,1176981178195
-31,xpcom_obsolete.xpt,0,3355,1176981179726
-32,import.xpt,0,3234,1176981175351
-33,pref.xpt,0,3145,1176981175695
-34,mime.xpt,0,3076,1176981176414
-35,uriloader.xpt,0,3025,1176981178023
-36,inspector.xpt,0,2980,1176981175992
-37,layout_xul_tree.xpt,0,2797,1176981177976
-38,xpcom_thread.xpt,0,2590,1176981177445
-39,xpcom_base.xpt,0,2543,1176981176835
-40,caps.xpt,0,2341,1176981176945
-41,shistory.xpt,0,2277,1176981175632
-42,necko_cache.xpt,0,2180,1176981178632
-43,imglib2.xpt,0,2169,1176981179320
-44,layout_xul.xpt,0,2154,1176981175945
-45,necko_http.xpt,0,2073,1176981177648
-46,windowwatcher.xpt,0,2020,1176981179757
-47,webbrowserpersist.xpt,0,1876,1176981178179
-48,profile.xpt,0,1831,1176981179945
-49,commandhandler.xpt,0,1789,1176981179648
-50,necko_cookie.xpt,0,1642,1176981177007
-51,mimetype.xpt,0,1563,1176981178789
-52,xpcom_xpti.xpt,0,1560,1176981178164
-53,chrome.xpt,0,1512,1176981176742
-54,locale.xpt,0,1512,1176981175726
-55,winhooks.xpt,0,1481,1176981178398
-56,dom_range.xpt,0,1397,1176981177617
-57,necko_strconv.xpt,0,1372,1176981179289
-58,xultmpl.xpt,0,1360,1176981179132
-59,uconv.xpt,0,1339,1176981178132
-60,xmlextras.xpt,0,1335,1176981176992
-61,dom_xpath.xpt,0,1312,1176981177960
-62,dom_traversal.xpt,0,1282,1176981179539
-63,txmgr.xpt,0,1258,1176981175742
-64,webshell_idls.xpt,0,1191,1176981176195
-65,spellchecker.xpt,0,1182,1176981179101
-66,unicharutil.xpt,0,1146,1176981178742
-67,xpinstall.xpt,0,1137,1176981177460
-68,oji.xpt,0,1120,1176981175539
-69,xuldoc.xpt,0,1113,1176981178867
-70,exthandler.xpt,0,1060,1176981177132
-71,search.xpt,0,1057,1176981179570
-72,downloadmanager.xpt,0,1048,1176981175773
-73,find.xpt,0,1036,1176981176164
-74,bookmarks.xpt,0,992,1176981175679
-75,xml-rpc.xpt,0,989,1176981177945
-76,autocomplete.xpt,0,983,1176981176617
-77,wallet.xpt,0,968,1176981179445
-78,cookie.xpt,0,952,1176981176085
-79,jar.xpt,0,941,1176981176117
-80,mozfind.xpt,0,845,1176981178460
-81,content_xslt.xpt,0,766,1176981176273
-82,dom_stylesheets.xpt,0,728,1176981178554
-83,necko_dns.xpt,0,709,1176981179554
-84,content_html.xpt,0,703,1176981177648
-85,content_xmldoc.xpt,0,693,1176981175476
-86,IVpeResizer.xpt,0,688,1176981176054
-87,chardet.xpt,0,676,1176981176726
-88,composer.xpt,0,651,1176981176429
-89,intl.xpt,0,645,1176981177242
-90,p3p.xpt,0,625,1176981179070
-91,dom.xpt,0,604,1176981179664
-92,mailview.xpt,0,550,1176981175398
-93,prefmigr.xpt,0,505,1176981179242
-94,dom_xbl.xpt,0,498,1176981179742
-95,necko_jar.xpt,0,485,1176981178835
-96,mozbrwsr.xpt,0,463,1176981175648
-97,history.xpt,0,432,1176981177679
-98,typeaheadfind.xpt,0,426,1176981179117
-99,content_htmldoc.xpt,0,421,1176981176257
-100,htmlparser.xpt,0,416,1176981175523
-101,ipcd.xpt,0,413,1176981176148
-102,IVpeDnD.xpt,0,409,1176981177007
-103,necko_file.xpt,0,408,1176981179460
-104,mapihook.xpt,0,392,1176981177257
-105,embed_base.xpt,0,390,1176981179148
-106,proxyObject.xpt,0,388,1176981178492
-107,directory.xpt,0,373,1176981178414
-108,necko_about.xpt,0,357,1176981177023
-109,xremoteservice.xpt,0,340,1176981179570
-110,autoconfig.xpt,0,332,1176981178289
-111,layout_base.xpt,0,303,1176981179164
-112,helperAppDlg.xpt,0,292,1176981176648
-113,necko_ftp.xpt,0,287,1176981178476
-114,progressDlg.xpt,0,286,1176981177632
-115,necko_res.xpt,0,285,1176981179195
-116,util.xpt,0,279,1176981177882
-117,alerts.xpt,0,278,1176981177085
-118,imgicon.xpt,0,267,1176981175664
-119,signonviewer.xpt,0,252,1176981176789
-120,jsurl.xpt,0,237,1176981178335
-121,dom_views.xpt,0,226,1176981179460
-122,walletpreview.xpt,0,223,1176981178148
-123,walleteditor.xpt,0,215,1176981179929
-124,windowds.xpt,0,212,1176981176554
-125,sidebar.xpt,0,207,1176981175335
-126,urlwidgt.xpt,0,206,1176981177210
-127,mailnews.xpt,0,205,1176981176773
-128,profilesharingsetup.xpt,0,203,1176981175710
-129,prefetch.xpt,0,192,1176981177664
-130,necko_viewsource.xpt,0,188,1176981176742
-131,txtsvc.xpt,0,188,1176981179851
-132,jsconsole.xpt,0,186,1176981176570
-133,urlbarhistory.xpt,0,183,1176981176710
-134,impComm4xMail.xpt,0,178,1176981179695
-135,lwbrk.xpt,0,174,1176981176835
-136,ucnative.xpt,0,165,1176981175429
-137,intlcmpt.xpt,0,159,1176981179789
-138,related.xpt,0,159,1176981179304
-139,accessibility-msaa.xpt,0,148,1176981176023
-140,necko_data.xpt,0,122,1176981175695
+0,msgbase.xpt,0,32295,1183054976343
+1,dom_html.xpt,0,17354,1183054976171
+2,msgimap.xpt,0,15708,1183054977359
+3,websrvcs.xpt,0,14664,1183054978218
+4,addrbook.xpt,0,13743,1183054977859
+5,msgcompo.xpt,0,11992,1183054976046
+6,necko.xpt,0,11665,1183054977921
+7,dom_css.xpt,0,11009,1183054976718
+8,editor.xpt,0,10902,1183054976421
+9,gfx.xpt,0,9373,1183054976062
+10,msgsearch.xpt,0,9279,1183054977171
+11,xpcom_ds.xpt,0,8837,1183054976296
+12,accessibility.xpt,0,8575,1183054977281
+13,docshell_base.xpt,0,8200,1183054977296
+14,dom_base.xpt,0,7576,1183054977796
+15,xpconnect.xpt,0,7334,1183054976125
+16,msgdb.xpt,0,6711,1183054976468
+17,xpcom_io.xpt,0,6515,1183054976609
+18,dom_core.xpt,0,6358,1183054977296
+19,dom_xul.xpt,0,6231,1183054977984
+20,jsdservice.xpt,0,5953,1183054978281
+21,dom_events.xpt,0,5808,1183054976156
+22,content_base.xpt,0,5783,1183054976171
+23,msgnews.xpt,0,5564,1183054976687
+24,widget.xpt,0,5401,1183054976031
+25,webBrowser_core.xpt,0,5287,1183054977640
+26,plugin.xpt,0,4728,1183054977406
+27,rdf.xpt,0,4513,1183054975937
+28,msglocal.xpt,0,4050,1183054977421
+29,appshell.xpt,0,3660,1183054977781
+30,xpcom_components.xpt,0,3624,1183054977343
+31,xpcom_obsolete.xpt,0,3355,1183054978062
+32,import.xpt,0,3234,1183054975906
+33,pref.xpt,0,3145,1183054976109
+34,mime.xpt,0,3076,1183054976437
+35,uriloader.xpt,0,3025,1183054977250
+36,inspector.xpt,0,2980,1183054976218
+37,layout_xul_tree.xpt,0,2797,1183054977218
+38,xpcom_thread.xpt,0,2590,1183054976937
+39,xpcom_base.xpt,0,2543,1183054976656
+40,caps.xpt,0,2341,1183054976703
+41,shistory.xpt,0,2277,1183054976062
+42,necko_cache.xpt,0,2180,1183054977546
+43,imglib2.xpt,0,2169,1183054977859
+44,layout_xul.xpt,0,2154,1183054976203
+45,necko_http.xpt,0,2073,1183054977062
+46,windowwatcher.xpt,0,2020,1183054978093
+47,webbrowserpersist.xpt,0,1876,1183054977328
+48,profile.xpt,0,1831,1183054978234
+49,commandhandler.xpt,0,1789,1183054978000
+50,necko_cookie.xpt,0,1642,1183054976734
+51,mimetype.xpt,0,1563,1183054977625
+52,xpcom_xpti.xpt,0,1560,1183054977328
+53,chrome.xpt,0,1512,1183054976609
+54,locale.xpt,0,1512,1183054976109
+55,winhooks.xpt,0,1481,1183054977421
+56,dom_range.xpt,0,1397,1183054977031
+57,necko_strconv.xpt,0,1372,1183054977843
+58,xultmpl.xpt,0,1360,1183054977750
+59,uconv.xpt,0,1339,1183054977312
+60,xmlextras.xpt,0,1335,1183054976734
+61,dom_xpath.xpt,0,1312,1183054977218
+62,dom_traversal.xpt,0,1282,1183054977937
+63,txmgr.xpt,0,1258,1183054976125
+64,webshell_idls.xpt,0,1191,1183054976343
+65,spellchecker.xpt,0,1182,1183054977734
+66,unicharutil.xpt,0,1146,1183054977609
+67,xpinstall.xpt,0,1137,1183054976953
+68,oji.xpt,0,1120,1183054976031
+69,xuldoc.xpt,0,1113,1183054977671
+70,exthandler.xpt,0,1060,1183054976812
+71,search.xpt,0,1057,1183054977968
+72,downloadmanager.xpt,0,1048,1183054976140
+73,find.xpt,0,1036,1183054976312
+74,bookmarks.xpt,0,992,1183054976093
+75,xml-rpc.xpt,0,989,1183054977203
+76,autocomplete.xpt,0,983,1183054976546
+77,wallet.xpt,0,968,1183054977890
+78,cookie.xpt,0,952,1183054976281
+79,jar.xpt,0,941,1183054976296
+80,mozfind.xpt,0,845,1183054977453
+81,content_xslt.xpt,0,766,1183054976375
+82,dom_stylesheets.xpt,0,728,1183054977500
+83,necko_dns.xpt,0,709,1183054977953
+84,content_html.xpt,0,703,1183054977046
+85,content_xmldoc.xpt,0,693,1183054976015
+86,IVpeResizer.xpt,0,688,1183054976265
+87,chardet.xpt,0,676,1183054976593
+88,composer.xpt,0,651,1183054976437
+89,intl.xpt,0,645,1183054976859
+90,p3p.xpt,0,625,1183054977718
+91,dom.xpt,0,604,1183054978015
+92,mailview.xpt,0,550,1183054975953
+93,prefmigr.xpt,0,505,1183054977812
+94,dom_xbl.xpt,0,498,1183054978093
+95,necko_jar.xpt,0,485,1183054977656
+96,mozbrwsr.xpt,0,463,1183054976078
+97,history.xpt,0,432,1183054977078
+98,typeaheadfind.xpt,0,426,1183054977750
+99,content_htmldoc.xpt,0,421,1183054976359
+100,htmlparser.xpt,0,416,1183054976015
+101,ipcd.xpt,0,413,1183054976312
+102,IVpeDnD.xpt,0,409,1183054976750
+103,necko_file.xpt,0,408,1183054977906
+104,mapihook.xpt,0,392,1183054976875
+105,embed_base.xpt,0,390,1183054977750
+106,proxyObject.xpt,0,388,1183054977468
+107,directory.xpt,0,373,1183054977437
+108,necko_about.xpt,0,357,1183054976750
+109,xremoteservice.xpt,0,340,1183054977953
+110,autoconfig.xpt,0,332,1183054977390
+111,layout_base.xpt,0,303,1183054977781
+112,helperAppDlg.xpt,0,292,1183054976546
+113,necko_ftp.xpt,0,287,1183054977468
+114,progressDlg.xpt,0,286,1183054977046
+115,necko_res.xpt,0,285,1183054977796
+116,util.xpt,0,279,1183054977171
+117,alerts.xpt,0,278,1183054976781
+118,imgicon.xpt,0,267,1183054976078
+119,signonviewer.xpt,0,252,1183054976625
+120,jsurl.xpt,0,237,1183054977406
+121,dom_views.xpt,0,226,1183054977906
+122,walletpreview.xpt,0,223,1183054977312
+123,walleteditor.xpt,0,215,1183054978218
+124,windowds.xpt,0,212,1183054976500
+125,sidebar.xpt,0,207,1183054975890
+126,urlwidgt.xpt,0,206,1183054976843
+127,mailnews.xpt,0,205,1183054976625
+128,profilesharingsetup.xpt,0,203,1183054976109
+129,prefetch.xpt,0,192,1183054977062
+130,necko_viewsource.xpt,0,188,1183054976593
+131,txtsvc.xpt,0,188,1183054978156
+132,jsconsole.xpt,0,186,1183054976515
+133,urlbarhistory.xpt,0,183,1183054976593
+134,impComm4xMail.xpt,0,178,1183054978031
+135,lwbrk.xpt,0,174,1183054976656
+136,ucnative.xpt,0,165,1183054975984
+137,intlcmpt.xpt,0,159,1183054978125
+138,related.xpt,0,159,1183054977843
+139,accessibility-msaa.xpt,0,148,1183054976250
+140,necko_data.xpt,0,122,1183054976093
[ArchiveItems,0]
17 years, 6 months
JBoss Tools SVN: r2346 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: src/org/jboss/tools/jsf/vpe/richfaces and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2007-07-06 11:03:51 -0400 (Fri, 06 Jul 2007)
New Revision: 2346
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/toolBar/separatorLine.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java
Log:
http://jira.jboss.org/jira/browse/EXIN-231
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/toolBar/separatorLine.gif
===================================================================
(Binary files differ)
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-07-06 15:03:39 UTC (rev 2345)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-07-06 15:03:51 UTC (rev 2346)
@@ -75,6 +75,9 @@
/** HTML_ALIGN_LEFT_VALUE * */
public static final String HTML_ALIGN_LEFT_VALUE = "left";
+ /** HTML_ALIGN_CENTER_VALUE * */
+ public static final String HTML_ALIGN_CENTER_VALUE = "center";
+
/** HTML_ATR_WIDTH */
public static final String HTML_ATR_WIDTH = "width";
@@ -120,4 +123,9 @@
/** HTML_WIDTH_ATTR * */
public static final String HTML_WIDTH_ATTR = "width";
+ /** HTML_ATTR_VALIGN */
+ public static final String HTML_ATTR_VALIGN = "valign";
+
+ /** HTML_ATTR_VALIGN_MIDDLE_VALUE */
+ public static final String HTML_ATTR_VALIGN_MIDDLE_VALUE = "middle";
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java 2007-07-06 15:03:39 UTC (rev 2345)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java 2007-07-06 15:03:51 UTC (rev 2346)
@@ -12,12 +12,13 @@
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.jsf.vpe.richfaces.template.RichFacesToolBarTemplate.SourceToolBarColumnElements;
+import org.jboss.tools.vpe.VpePlugin;
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,359 +31,209 @@
import org.w3c.dom.NodeList;
public class RichFacesToolBarGroupTemplate extends VpeAbstractTemplate {
-
+ public static final String TAG_NAME = "toolBarGroup";
+
+ public static final String ATTR_ITEMSEPARATOR_NAME = "itemSeparator";
+
+ public static final String ATTR_LOCATION_NAME = "location";
+
+ public static final String ATTR_LOCATION_RIGHT_VALUE = "right";
+
@Override
public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement, Document visualDocument, Node visualNode, Object data, String name, String value) {
return true;
}
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document visualDocument) {
- Map visualNodeMap = pageContext.getDomMapping().getVisualMap();
+ private class SourceToolBarGroupItem {
+ private Node toolBarGroupItem;
+ private String itemSeparator;
- RichFacesToolBarTemplate.SourceToolBarElements sourceElements = new RichFacesToolBarTemplate.SourceToolBarElements(sourceNode);
- RichFacesToolBarTemplate.VisualToolBarElements visualElements = new RichFacesToolBarTemplate.VisualToolBarElements();
+ public SourceToolBarGroupItem(Node toolBarGroupItem) {
+ this.toolBarGroupItem = toolBarGroupItem;
+ this.itemSeparator = null;
+ }
- Element sourceElement = (Element)sourceNode;
-
- Element visualRow = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- visualRow.setAttribute("style", "border: 0px; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;");
+ public SourceToolBarGroupItem(String itemSeparator) {
+ this.toolBarGroupItem = null;
+ this.itemSeparator = itemSeparator;
+ }
- VpeCreationData creatorInfo = new VpeCreationData(visualRow);
-
- Element cell = null;
-
- if (true || sourceElements.hasBodySection()) {
-
- // Columns at left
- for (int i = 0; i < sourceElements.getColumnAtLeftCount(); i++) {
- SourceToolBarColumnElements column = sourceElements.getColumnAtLeft(i);
-
- if (column.hasBody()) {
- Node columnBody = column.getColumn();
- cell = visualDocument.createElement("td");
- ComponentUtil.correctAttribute(sourceElement, cell,
- RichFacesToolBarTemplate.CONTENTCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item", "dr-toolbar-int rich-toolbar-item");
- ComponentUtil.correctAttribute(sourceElement, cell,
- RichFacesToolBarTemplate.CONTENTSTYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
-
- visualRow.appendChild(cell);
-
- VpeChildrenInfo info = new VpeChildrenInfo(cell);
- creatorInfo.addChildrenInfo(info);
-
- info.addSourceChild(column.getColumn());
- MozillaSupports.release(cell);
- } else if (column.isSeparator()){
- String itemSeparator = column.getSeparatorType();
- String separatorImageUrl = RichFacesToolBarTemplate.getSeparatorImageUrlString (itemSeparator);
-
- if (separatorImageUrl != null) {
- // Insert separator here
- cell = visualDocument.createElement("td");
- cell.setAttribute("align", "center");
- ComponentUtil.correctAttribute(sourceElement, cell,
- RichFacesToolBarTemplate.SEPARATORCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
- Element separatorImage = visualDocument.createElement("img");
- ComponentUtil.setImg(separatorImage, separatorImageUrl);
- cell.appendChild(separatorImage);
- visualRow.appendChild(cell);
- MozillaSupports.release(separatorImage);
- MozillaSupports.release(cell);
- }
- }
- }
-
- // Columns at right
- for (int i = 0; i < sourceElements.getColumnAtRightCount(); i++) {
- SourceToolBarColumnElements column = sourceElements.getColumnAtRight(i);
- if (column.hasBody()) {
- Node columnBody = column.getColumn();
- cell = visualDocument.createElement("td");
- ComponentUtil.correctAttribute(sourceElement, cell,
- RichFacesToolBarTemplate.CONTENTCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item", "dr-toolbar-int rich-toolbar-item");
- ComponentUtil.correctAttribute(sourceElement, cell,
- RichFacesToolBarTemplate.CONTENTSTYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
- visualRow.appendChild(cell);
-
- VpeChildrenInfo info = new VpeChildrenInfo(cell);
- creatorInfo.addChildrenInfo(info);
-
- info.addSourceChild(column.getColumn());
- MozillaSupports.release(cell);
- } else if (column.isSeparator()){
- String itemSeparator = column.getSeparatorType();
- String separatorImageUrl = RichFacesToolBarTemplate.getSeparatorImageUrlString (itemSeparator);
-
- if (separatorImageUrl != null) {
- // Insert separator here
- cell = visualDocument.createElement("td");
- cell.setAttribute("align", "center");
- ComponentUtil.correctAttribute(sourceElement, cell,
- RichFacesToolBarTemplate.SEPARATORCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
- Element separatorImage = visualDocument.createElement("img");
- ComponentUtil.setImg(separatorImage, separatorImageUrl);
- cell.appendChild(separatorImage);
- visualRow.appendChild(cell);
- MozillaSupports.release(separatorImage);
- MozillaSupports.release(cell);
- }
- }
- }
-
- // Empty column
- cell = visualDocument.createElement("td");
- cell.setAttribute("width", "100%");
- visualRow.appendChild(cell);
- MozillaSupports.release(cell);
+ public Node getToolBarGroupItem() {
+ return toolBarGroupItem;
}
- Object[] elements = new Object[2];
- elements[0] = visualElements;
- elements[1] = sourceElements;
- visualNodeMap.put(this, elements);
-
- return creatorInfo;
- }
-
- private VisualToolBarGroupElements getVisualToolBarElements(Map visualNodeMap) {
- if (visualNodeMap != null) {
- Object o = visualNodeMap.get(this);
- try {
- if (o != null && o instanceof Object[] && ((Object[])o)[0] instanceof VisualToolBarGroupElements) {
- return (VisualToolBarGroupElements)((Object[])o)[0];
- }
- } catch (Exception e) {
- }
+ public String getItemSeparator() {
+ return itemSeparator;
}
- return null;
- }
- private void setRowDisplayStyle(Element row, boolean visible) {
- if (row != null) {
- row.setAttribute("style", "display:" + (visible ? "" : "none"));
+ public boolean isItem() {
+ return toolBarGroupItem != null;
}
}
-
- class SourceToolBarGroupElements {
- private List columns;
- Map attributes;
+
+ private class SourceToolBarGroupItems {
+ private boolean isToolBarGroupLocationRight;
+ private String itemSeparator;
+ boolean isItemSeparatorExists;
+ private List<SourceToolBarGroupItem> toolBarGroupItems = new ArrayList<SourceToolBarGroupItem>();
- public SourceToolBarGroupElements(Node sourceNode) {
+ public SourceToolBarGroupItems(Node sourceNode, boolean isToolBarGroupLocationRight,
+ String itemSeparator) {
+ this.isToolBarGroupLocationRight = isToolBarGroupLocationRight;
+ this.itemSeparator = itemSeparator;
+ this.isItemSeparatorExists = !(itemSeparator == null
+ || (itemSeparator != null && itemSeparator.length() == 0)
+ || RichFacesToolBarTemplate.ITEM_SEPARATOR_NONE.equals(itemSeparator));
+
init(sourceNode);
- initAttributes(sourceNode);
}
- void initAttributes(Node sourceNode) {
- NamedNodeMap attrs = sourceNode.getAttributes();
- attributes = new HashMap<String, String>();
- for (int i = 0; attrs != null && i < attrs.getLength(); i++) {
- Node attribute = attrs.item(i);
- attributes.put(attribute.getNodeName(), attribute.getNodeValue());
- }
- }
-
- void init (Node sourceNode) {
- NodeList children = sourceNode.getChildNodes();
-
- int cnt = children != null ? children.getLength() : 0;
- if (cnt > 0) {
- for (int i = 0; i < cnt; i++) {
- Node child = children.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- Element childElement = (Element)child;
-
- if (childElement.getNodeName().endsWith(":toolBarGroup")) {
- initToolBarGroup(childElement);
- } else {
- if (columns == null) columns = new ArrayList();
- columns.add(new SourceToolBarGroupColumnElements(child));
- columns.add(new SourceToolBarGroupColumnElements(null));
- }
- } else if (child.getNodeType() == Node.TEXT_NODE) {
- String text = child.getNodeValue();
- text = (text == null ? null : text.trim());
- if (text != null && text.length() > 0) {
- if (columns == null) columns = new ArrayList();
- columns.add(new SourceToolBarGroupColumnElements(child));
- columns.add(new SourceToolBarGroupColumnElements(null));
- }
+ private void init(Node sourceNode) {
+ NodeList childrenList = sourceNode.getChildNodes();
+ int childrenCount = childrenList.getLength();
+ boolean isFirstItem = true;
+ for (int i=0; i<childrenCount; i++) {
+ Node child = childrenList.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE
+ || isVisibleText(child)) {
+ if (isItemSeparatorExists && isToolBarGroupLocationRight
+ && !isFirstItem) {
+ toolBarGroupItems.add(new SourceToolBarGroupItem(itemSeparator));
}
- }
- }
- }
-
- void initToolBarGroup(Element sourceElement) {
- if (sourceElement == null) return;
- NodeList children = sourceElement.getChildNodes();
-
- int cnt = children != null ? children.getLength() : 0;
- if (cnt > 0) {
- for (int i = 0; i < cnt; i++) {
- Node child = children.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- Element childElement = (Element)child;
-
- if (childElement.getNodeName().endsWith(":toolBarGroup")) {
- initToolBarGroup(childElement);
- } else {
- if (columns == null) columns = new ArrayList();
- columns.add(new SourceToolBarGroupColumnElements(child));
- }
- } else if (child.getNodeType() == Node.TEXT_NODE) {
- String text = child.getNodeValue();
- text = (text == null ? null : text.trim());
- if (text != null && text.length() > 0) {
- if (columns == null) columns = new ArrayList();
- columns.add(new SourceToolBarGroupColumnElements(child));
- }
+
+ toolBarGroupItems.add(new SourceToolBarGroupItem(child));
+
+ if (isItemSeparatorExists && !isToolBarGroupLocationRight
+ && !isLastItem(childrenList, i)) {
+ toolBarGroupItems.add(new SourceToolBarGroupItem(itemSeparator));
}
+
+ isFirstItem = false;
}
}
}
- public SourceToolBarGroupColumnElements getColumn(int index) {
- if (columns != null && index < getColumnCount()) return (SourceToolBarGroupColumnElements)columns.get(index);
- return null;
+ private boolean isVisibleText(Node textNode) {
+ return textNode.getNodeType() == Node.TEXT_NODE
+ && textNode.getNodeValue() != null
+ && textNode.getNodeValue().trim().length() > 0;
}
-
- public int getColumnCount() {
- if (columns != null) return columns.size();
- return 0;
- }
-
- public boolean hasColspan() {
- return (getColumnCount()) >= 2;
- }
-
- public boolean hasBodySection() {
- for (int i = 0; i < getColumnCount(); i++) {
- SourceToolBarGroupColumnElements column = getColumn(i);
- if (column.hasBody()) return true;
+
+ private boolean isLastItem(NodeList list, int index) {
+ int listLength = list.getLength();
+
+ for (int i=index+1; i < listLength; i++ ) {
+ Node item = list.item(i);
+ if (item.getNodeType() == Node.ELEMENT_NODE
+ || isVisibleText(item)) {
+ return false;
+ }
}
- return false;
+
+ return true;
}
-
- Map getAttributes() {
- return attributes;
- }
- String getAttributeValue(String name) {
- return (String)attributes.get(name);
+ public Iterator<SourceToolBarGroupItem> iterator() {
+ return toolBarGroupItems.iterator();
}
}
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+ Element visualNode = null;
+ VpeCreationData creationData = null;
+
+ Element sourceElement = (Element)sourceNode;
+ String itemSeparator = sourceElement.getAttribute(ATTR_ITEMSEPARATOR_NAME);
+
+ if (!sourceNode.getParentNode().getNodeName().endsWith(":" + RichFacesToolBarTemplate.TAG_NAME)) {
+ visualNode = RichFacesToolBarTemplate.createExceptionNode(visualDocument, "Parent should be toolBar");
+
+ creationData = new VpeCreationData(visualNode);
+ } else if (!RichFacesToolBarTemplate.isValidItemSeparatorName(itemSeparator)) {
+ visualNode = RichFacesToolBarTemplate.createExceptionNode(visualDocument,
+ "Unknown type of separator \"" + itemSeparator + "\"");
+
+ creationData = new VpeCreationData(visualNode);
+ } else {
+
+ SourceToolBarGroupItems sourceToolBarGroupItems = new SourceToolBarGroupItems(sourceNode,
+ ATTR_LOCATION_RIGHT_VALUE.equals(sourceElement.getAttribute(ATTR_LOCATION_NAME)),
+ itemSeparator);
+
+
+ visualNode = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ visualNode.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "border: 0px none; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;");
+ Element body = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ Element row = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ row.setAttribute(HtmlComponentUtil.HTML_ATTR_VALIGN, HtmlComponentUtil.HTML_ATTR_VALIGN_MIDDLE_VALUE);
+
+ creationData = new VpeCreationData(visualNode);
+
+ Iterator<SourceToolBarGroupItem> iterator = sourceToolBarGroupItems.iterator();
+ while(iterator.hasNext()) {
+ SourceToolBarGroupItem toolBarGroupItem = iterator.next();
+
+ Element cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ if (toolBarGroupItem.isItem()) {
+ ComponentUtil.correctAttribute(sourceElement, cell,
+ RichFacesToolBarTemplate.CONTENTCLASS_ATTR_NAME,
+ HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item", "dr-toolbar-int rich-toolbar-item");
+ ComponentUtil.correctAttribute(sourceElement, cell,
+ RichFacesToolBarTemplate.CONTENTSTYLE_ATTR_NAME,
+ HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
- public static class SourceToolBarGroupColumnElements {
- private Node column;
- private List body;
-
- public SourceToolBarGroupColumnElements(Node columnNode) {
- init(columnNode);
- }
-
- private void init(Node columnNode) {
- column = columnNode;
- if (columnNode != null) {
- body = new ArrayList();
- body.add(columnNode);
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(cell);
+ creationData.addChildrenInfo(childrenInfo);
+ childrenInfo.addSourceChild(toolBarGroupItem.getToolBarGroupItem());
+ } else {
+ cell.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR, HtmlComponentUtil.HTML_ALIGN_CENTER_VALUE);
+ ComponentUtil.correctAttribute(sourceElement, cell,
+ RichFacesToolBarTemplate.SEPARATORCLASS_ATTR_NAME,
+ HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
+ String separatorImageUrl = RichFacesToolBarTemplate
+ .getSeparatorImageUrlString(toolBarGroupItem.getItemSeparator());
+ Element separatorImage = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ ComponentUtil.setImg(separatorImage, separatorImageUrl);
+ cell.appendChild(separatorImage);
+ MozillaSupports.release(separatorImage);
+ }
+
+ row.appendChild(cell);
+ MozillaSupports.release(cell);
}
+
+ body.appendChild(row);
+ MozillaSupports.release(row);
+ visualNode.appendChild(body);
+ MozillaSupports.release(body);
}
+
+ return creationData;
+ }
+
- public boolean hasBody() {
- return body != null && body.size() > 0;
- }
-
- public List getBody() {
- return body;
- }
-
- public void setBody(List body) {
- this.body = body;
- }
-
- public void setColumn(Node column) {
- this.column = column;
- }
-
- public int getBodyElementsCount() {
- if (body != null) return body.size();
- return 0;
- }
-
- public Node getBodyElement(int index) {
- if (body != null) return (Node)body.get(index);
+ @Override
+ public Node getNodeForUptate(VpePageContext pageContext, Node sourceNode,
+ Node visualNode, Object data) {
+ String prefix = sourceNode.getPrefix();
+ if (prefix == null) {
return null;
}
- public Node getColumn() {
- return column;
- }
- }
-
- public static class VisualToolBarGroupElements {
- private Element body;
- private Element bodyRow;
- private List columns;
-
- public VisualToolBarGroupElements() {
- }
- public VisualToolBarGroupElements(Element body) {
- this.body = body;
- }
+ String parentNodeName = prefix + ":" + RichFacesToolBarTemplate.TAG_NAME;
- private VisualToolBarGroupColumnElements getColumn(int index) {
- if (columns != null && index < getColumnCount()) return (VisualToolBarGroupColumnElements)columns.get(index);
- return null;
+ Node parent = sourceNode.getParentNode();
+ while (parent != null) {
+ if (parentNodeName.equals(parent.getNodeName())) {
+ break;
+ }
+
+ parent = parent.getParentNode();
}
-
- private int getColumnCount() {
- if (columns != null) return columns.size();
- return 0;
- }
-
- private List getColumns() {
- if (columns == null) columns = new ArrayList();
- return columns;
- }
-
- public Element getBody() {
- return body;
- }
-
- public void setBody(Element body) {
- this.body = body;
- }
-
- public Element getBodyRow() {
- return bodyRow;
- }
-
- public void setBodyRow(Element bodyRow) {
- this.bodyRow = bodyRow;
- }
+
+ return parent;
}
-
- public static class VisualToolBarGroupColumnElements {
- private Element bodyCell;
-
- private boolean isEmpty() {
- return bodyCell == null;
- }
-
- public Element getBodyCell() {
- return bodyCell;
- }
-
- public void setBodyCell(Element bodyCell) {
- this.bodyCell = bodyCell;
- }
- }
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java 2007-07-06 15:03:39 UTC (rev 2345)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java 2007-07-06 15:03:51 UTC (rev 2346)
@@ -12,6 +12,8 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -27,11 +29,11 @@
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
-import com.sun.org.apache.bcel.internal.generic.CPInstruction;
-
public class RichFacesToolBarTemplate extends VpeAbstractTemplate {
-
+ public static final String TAG_NAME = "toolBar";
+
public static final String ITEM_SEPARATOR_NONE = "none";
public static final String ITEM_SEPARATOR_LINE = "line";
public static final String ITEM_SEPARATOR_GRID = "grid";
@@ -43,7 +45,8 @@
public static final String ITEM_SEPARATOR_DISC_URL = "toolBar/separatorDisc.gif";
public static final String ITEM_SEPARATOR_SQUARE_URL = "toolBar/separatorSquare.gif";
-
+ public static final String EXCEPTION_ATTR_STYLE_VALUE = "color: red; font-weight:bold;";
+
static final String CONTENTCLASS_ATTR_NAME = "contentClass";
static final String CONTENTSTYLE_ATTR_NAME = "contentStyle";
static final String STYLECLASS_ATTR_NAME = "styleClass";
@@ -58,150 +61,292 @@
return true;
}
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document visualDocument) {
- SourceToolBarElements sourceElements = new SourceToolBarElements(sourceNode);
- VisualToolBarElements visualElements = new VisualToolBarElements();
-
- Element sourceElement = (Element)sourceNode;
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+ VpeCreationData creationData = null;
+ Element visualNode = null;
- ComponentUtil.setCSSLink(pageContext, "toolBar/toolBar.css", "richFacesToolBar");
-
- Element visualTable = visualDocument.createElement("table");
-
- ComponentUtil.correctAttribute(sourceElement, visualTable,
- WIDTH_ATTR_NAME,
- HtmlComponentUtil.HTML_WIDTH_ATTR, null, "100%");
- ComponentUtil.correctAttribute(sourceElement, visualTable,
- HEIGHT_ATTR_NAME,
- HtmlComponentUtil.HTML_HEIGHT_ATTR, null, null);
- ComponentUtil.correctAttribute(sourceElement, visualTable,
- STYLECLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-ext rich-toolbar", "dr-toolbar-ext rich-toolbar");
-
- String style = ComponentUtil.getHeaderBackgoundImgStyle() + ";";
- ComponentUtil.correctAttribute(sourceElement, visualTable,
- STYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, style, style);
-
-
- VpeCreationData creatorInfo = new VpeCreationData(visualTable);
-
- String separatorClass = sourceElement.getAttribute("separatorClass");
-
- Element section = null, row = null, cell = null;
-
- if (true || sourceElements.hasBodySection()) {
- section = visualDocument.createElement("tbody");
- row = visualDocument.createElement("tr");
- row.setAttribute("valign", "middle");
+ Element sourceElement = (Element) sourceNode;
+ String itemSeparator = sourceElement.getAttribute(ITEMSEPARATOR_ATTR_NAME);
+ if (!isValidItemSeparatorName(itemSeparator)) {
+ visualNode = createExceptionNode(visualDocument,
+ "Unknown type of separator \"" + itemSeparator + "\"");
- // Columns at left
- for (int i = 0; i < sourceElements.getColumnAtLeftCount(); i++) {
- SourceToolBarColumnElements column = sourceElements.getColumnAtLeft(i);
-
- if (column.hasBody()) {
- Node columnBody = column.getColumn();
- cell = visualDocument.createElement("td");
+ creationData = new VpeCreationData(visualNode);
+ } else {
+ SourceToolBarItems sourceToolBarItems = new SourceToolBarItems(sourceNode, itemSeparator);
+ String itemSeparatorImageUrl = getSeparatorImageUrlString(sourceToolBarItems.getItemSeparator());
+
+ ComponentUtil.setCSSLink(pageContext, "toolBar/toolBar.css", "richFacesToolBar");
+
+ visualNode = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+
+ ComponentUtil.correctAttribute(sourceElement, visualNode,
+ WIDTH_ATTR_NAME,
+ HtmlComponentUtil.HTML_WIDTH_ATTR, null, "100%");
+ ComponentUtil.correctAttribute(sourceElement, visualNode,
+ HEIGHT_ATTR_NAME,
+ HtmlComponentUtil.HTML_HEIGHT_ATTR, null, null);
+ ComponentUtil.correctAttribute(sourceElement, visualNode,
+ STYLECLASS_ATTR_NAME,
+ HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-ext rich-toolbar", "dr-toolbar-ext rich-toolbar");
+
+ String style = ComponentUtil.getHeaderBackgoundImgStyle() + ";";
+ ComponentUtil.correctAttribute(sourceElement, visualNode,
+ STYLE_ATTR_NAME,
+ HtmlComponentUtil.HTML_STYLE_ATTR, style, style);
+
+ creationData = new VpeCreationData(visualNode);
+
+ Element body = null, row = null, cell = null;
+
+ body = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ row = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ row.setAttribute(HtmlComponentUtil.HTML_ATTR_VALIGN, HtmlComponentUtil.HTML_ATTR_VALIGN_MIDDLE_VALUE);
+
+ SourceToolBarItem toolBarItem;
+ Iterator<SourceToolBarItem> iterator = sourceToolBarItems.getLeftItemsIterator();
+ while (iterator.hasNext()) {
+ toolBarItem = iterator.next();
+ cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ if (toolBarItem.isItem()) {
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTCLASS_ATTR_NAME,
HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item", "dr-toolbar-int rich-toolbar-item");
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTSTYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
-
- row.appendChild(cell);
-
- VpeChildrenInfo info = new VpeChildrenInfo(cell);
- creatorInfo.addChildrenInfo(info);
+ HtmlComponentUtil.HTML_STYLE_ATTR,
+ toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null,
+ toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null);
- info.addSourceChild(column.getColumn());
- MozillaSupports.release(cell);
- } else if (column.isSeparator()){
- String itemSeparator = column.getSeparatorType();
- String separatorImageUrl = getSeparatorImageUrlString (itemSeparator);
-
- if (separatorImageUrl != null) {
- // Insert separator here
- cell = visualDocument.createElement("td");
- cell.setAttribute("align", "center");
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(cell);
+ creationData.addChildrenInfo(childrenInfo);
+ childrenInfo.addSourceChild(toolBarItem.getToolBarItem());
+ } else {
+ if (itemSeparatorImageUrl != null) {
+ cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ cell.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR, HtmlComponentUtil.HTML_ALIGN_CENTER_VALUE);
ComponentUtil.correctAttribute(sourceElement, cell,
SEPARATORCLASS_ATTR_NAME,
HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
- Element separatorImage = visualDocument.createElement("img");
- ComponentUtil.setImg(separatorImage, separatorImageUrl);
+ Element separatorImage = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ ComponentUtil.setImg(separatorImage, itemSeparatorImageUrl);
cell.appendChild(separatorImage);
- row.appendChild(cell);
MozillaSupports.release(separatorImage);
- MozillaSupports.release(cell);
}
}
+
+ row.appendChild(cell);
+ MozillaSupports.release(cell);
}
-
+
// Empty column
- cell = visualDocument.createElement("td");
- cell.setAttribute("width", "100%");
+ cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ cell.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%");
row.appendChild(cell);
MozillaSupports.release(cell);
-
- // Columns at right
- for (int i = 0; i < sourceElements.getColumnAtRightCount(); i++) {
- SourceToolBarColumnElements column = sourceElements.getColumnAtRight(i);
- if (column.hasBody()) {
- Node columnBody = column.getColumn();
- cell = visualDocument.createElement("td");
+
+ iterator = sourceToolBarItems.getRightItemsIterator();
+ while (iterator.hasNext()) {
+ toolBarItem = iterator.next();
+ cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ if (toolBarItem.isItem()) {
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTCLASS_ATTR_NAME,
HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item", "dr-toolbar-int rich-toolbar-item");
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTSTYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
- row.appendChild(cell);
-
- VpeChildrenInfo info = new VpeChildrenInfo(cell);
- creatorInfo.addChildrenInfo(info);
+ HtmlComponentUtil.HTML_STYLE_ATTR,
+ toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null,
+ toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null);
- info.addSourceChild(column.getColumn());
- MozillaSupports.release(cell);
- } else if (column.isSeparator()){
- String itemSeparator = column.getSeparatorType();
- String separatorImageUrl = getSeparatorImageUrlString (itemSeparator);
-
- if (separatorImageUrl != null) {
- // Insert separator here
- cell = visualDocument.createElement("td");
- cell.setAttribute("align", "center");
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(cell);
+ creationData.addChildrenInfo(childrenInfo);
+ childrenInfo.addSourceChild(toolBarItem.getToolBarItem());
+ } else {
+ if (itemSeparatorImageUrl != null) {
+ cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ cell.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR, HtmlComponentUtil.HTML_ALIGN_CENTER_VALUE);
ComponentUtil.correctAttribute(sourceElement, cell,
SEPARATORCLASS_ATTR_NAME,
HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
- Element separatorImage = visualDocument.createElement("img");
- ComponentUtil.setImg(separatorImage, separatorImageUrl);
+ Element separatorImage = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ ComponentUtil.setImg(separatorImage, itemSeparatorImageUrl);
cell.appendChild(separatorImage);
- row.appendChild(cell);
MozillaSupports.release(separatorImage);
- MozillaSupports.release(cell);
}
}
+
+ row.appendChild(cell);
+ MozillaSupports.release(cell);
}
-
- section.appendChild(row);
+ body.appendChild(row);
MozillaSupports.release(row);
- visualTable.appendChild(section);
- MozillaSupports.release(section);
- visualElements.setBodyRow(row);
- visualElements.setBody(section);
+ visualNode.appendChild(body);
+ MozillaSupports.release(body);
}
-
- Map visualNodeMap = pageContext.getDomMapping().getVisualMap();
- Object[] elements = new Object[2];
- elements[0] = visualElements;
- elements[1] = sourceElements;
- visualNodeMap.put(this, elements);
+ return creationData;
+ }
- return creatorInfo;
+ static Element createExceptionNode(Document visualDocument, String message) {
+ Element visualNode;
+ visualNode = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ visualNode.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, EXCEPTION_ATTR_STYLE_VALUE);
+ Text text = visualDocument.createTextNode(message);
+ visualNode.appendChild(text);
+ MozillaSupports.release(text);
+
+ return visualNode;
}
+
+
+// public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document visualDocument) {
+// SourceToolBarElements sourceElements = new SourceToolBarElements(sourceNode);
+// VisualToolBarElements visualElements = new VisualToolBarElements();
+//
+// Element sourceElement = (Element)sourceNode;
+//
+// ComponentUtil.setCSSLink(pageContext, "toolBar/toolBar.css", "richFacesToolBar");
+//
+// Element visualTable = visualDocument.createElement("table");
+//
+// ComponentUtil.correctAttribute(sourceElement, visualTable,
+// WIDTH_ATTR_NAME,
+// HtmlComponentUtil.HTML_WIDTH_ATTR, null, "100%");
+// ComponentUtil.correctAttribute(sourceElement, visualTable,
+// HEIGHT_ATTR_NAME,
+// HtmlComponentUtil.HTML_HEIGHT_ATTR, null, null);
+// ComponentUtil.correctAttribute(sourceElement, visualTable,
+// STYLECLASS_ATTR_NAME,
+// HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-ext rich-toolbar", "dr-toolbar-ext rich-toolbar");
+//
+// String style = ComponentUtil.getHeaderBackgoundImgStyle() + ";";
+// ComponentUtil.correctAttribute(sourceElement, visualTable,
+// STYLE_ATTR_NAME,
+// HtmlComponentUtil.HTML_STYLE_ATTR, style, style);
+//
+//
+// VpeCreationData creatorInfo = new VpeCreationData(visualTable);
+//
+// String separatorClass = sourceElement.getAttribute("separatorClass");
+//
+// Element section = null, row = null, cell = null;
+//
+// if (true || sourceElements.hasBodySection()) {
+// section = visualDocument.createElement("tbody");
+// row = visualDocument.createElement("tr");
+// row.setAttribute("valign", "middle");
+//
+// // Columns at left
+// for (int i = 0; i < sourceElements.getColumnAtLeftCount(); i++) {
+// SourceToolBarColumnElements column = sourceElements.getColumnAtLeft(i);
+//
+// if (column.hasBody()) {
+// Node columnBody = column.getColumn();
+// cell = visualDocument.createElement("td");
+// ComponentUtil.correctAttribute(sourceElement, cell,
+// CONTENTCLASS_ATTR_NAME,
+// HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item", "dr-toolbar-int rich-toolbar-item");
+// ComponentUtil.correctAttribute(sourceElement, cell,
+// CONTENTSTYLE_ATTR_NAME,
+// HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
+//
+// row.appendChild(cell);
+//
+// VpeChildrenInfo info = new VpeChildrenInfo(cell);
+// creatorInfo.addChildrenInfo(info);
+//
+// info.addSourceChild(column.getColumn());
+// MozillaSupports.release(cell);
+// } else if (column.isSeparator()){
+// String itemSeparator = column.getSeparatorType();
+// String separatorImageUrl = getSeparatorImageUrlString (itemSeparator);
+//
+// if (separatorImageUrl != null) {
+// // Insert separator here
+// cell = visualDocument.createElement("td");
+// cell.setAttribute("align", "center");
+// ComponentUtil.correctAttribute(sourceElement, cell,
+// SEPARATORCLASS_ATTR_NAME,
+// HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
+// Element separatorImage = visualDocument.createElement("img");
+// ComponentUtil.setImg(separatorImage, separatorImageUrl);
+// cell.appendChild(separatorImage);
+// row.appendChild(cell);
+// MozillaSupports.release(separatorImage);
+// MozillaSupports.release(cell);
+// }
+// }
+// }
+//
+// // Empty column
+// cell = visualDocument.createElement("td");
+// cell.setAttribute("width", "100%");
+// row.appendChild(cell);
+// MozillaSupports.release(cell);
+//
+// // Columns at right
+// for (int i = 0; i < sourceElements.getColumnAtRightCount(); i++) {
+// SourceToolBarColumnElements column = sourceElements.getColumnAtRight(i);
+// if (column.hasBody()) {
+// Node columnBody = column.getColumn();
+// cell = visualDocument.createElement("td");
+// ComponentUtil.correctAttribute(sourceElement, cell,
+// CONTENTCLASS_ATTR_NAME,
+// HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item", "dr-toolbar-int rich-toolbar-item");
+// ComponentUtil.correctAttribute(sourceElement, cell,
+// CONTENTSTYLE_ATTR_NAME,
+// HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
+// row.appendChild(cell);
+//
+// VpeChildrenInfo info = new VpeChildrenInfo(cell);
+// creatorInfo.addChildrenInfo(info);
+//
+// info.addSourceChild(column.getColumn());
+// MozillaSupports.release(cell);
+// } else if (column.isSeparator()){
+// String itemSeparator = column.getSeparatorType();
+// String separatorImageUrl = getSeparatorImageUrlString (itemSeparator);
+//
+// if (separatorImageUrl != null) {
+// // Insert separator here
+// cell = visualDocument.createElement("td");
+// cell.setAttribute("align", "center");
+// ComponentUtil.correctAttribute(sourceElement, cell,
+// SEPARATORCLASS_ATTR_NAME,
+// HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
+// Element separatorImage = visualDocument.createElement("img");
+// ComponentUtil.setImg(separatorImage, separatorImageUrl);
+// cell.appendChild(separatorImage);
+// row.appendChild(cell);
+// MozillaSupports.release(separatorImage);
+// MozillaSupports.release(cell);
+// }
+// }
+// }
+//
+//
+// section.appendChild(row);
+// MozillaSupports.release(row);
+// visualTable.appendChild(section);
+// MozillaSupports.release(section);
+// visualElements.setBodyRow(row);
+// visualElements.setBody(section);
+// }
+//
+// Map visualNodeMap = pageContext.getDomMapping().getVisualMap();
+//
+// Object[] elements = new Object[2];
+// elements[0] = visualElements;
+// elements[1] = sourceElements;
+// visualNodeMap.put(this, elements);
+//
+// return creatorInfo;
+// }
+
public static String getSeparatorImageUrlString (String itemSeparator) {
String separatorImageUrl = null;
if (ITEM_SEPARATOR_DISC.equals(itemSeparator)) {
@@ -215,323 +360,139 @@
}
return separatorImageUrl;
}
- private VisualToolBarElements getVisualToolBarElements(Map visualNodeMap) {
- if (visualNodeMap != null) {
- Object o = visualNodeMap.get(this);
- try {
- if (o != null && o instanceof Object[] && ((Object[])o)[0] instanceof VisualToolBarElements) {
- return (VisualToolBarElements)((Object[])o)[0];
- }
- } catch (Exception e) {
- }
- }
- return null;
- }
- private void setRowDisplayStyle(Element row, boolean visible) {
- if (row != null) {
- row.setAttribute("style", "display:" + (visible ? "" : "none"));
- }
+ static boolean isValidItemSeparatorName(String itemSeparator) {
+ return itemSeparator == null
+ || (itemSeparator != null && itemSeparator.length() == 0)
+ || ITEM_SEPARATOR_DISC.equals(itemSeparator)
+ || ITEM_SEPARATOR_LINE.equals(itemSeparator)
+ || ITEM_SEPARATOR_GRID.equals(itemSeparator)
+ || ITEM_SEPARATOR_SQUARE.equals(itemSeparator)
+ || ITEM_SEPARATOR_NONE.equals(itemSeparator);
}
-
- private SourceToolBarElements getSourceToolBarElements(Map visualNodeMap) {
- if (visualNodeMap != null) {
- Object o = visualNodeMap.get(this);
- try {
- if (o != null && o instanceof Object[] && ((Object[])o)[1] instanceof VisualToolBarElements) {
- return (SourceToolBarElements)o;
+
+ private class SourceToolBarItem {
+ private Node toolBarItem;
+ private String itemSeparator;
+ private boolean isToolBarItemLocationRight;
+ private boolean isToolBarGroupItem;
+
+ public SourceToolBarItem(Node toolBarItem) {
+ this.toolBarItem = toolBarItem;
+ this.itemSeparator = null;
+ this.isToolBarItemLocationRight = false;
+
+ if (toolBarItem.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) toolBarItem;
+ this.isToolBarGroupItem = element.getNodeName().endsWith(":" + RichFacesToolBarGroupTemplate.TAG_NAME);
+ if (isToolBarGroupItem()) {
+ isToolBarItemLocationRight = RichFacesToolBarGroupTemplate
+ .ATTR_LOCATION_RIGHT_VALUE
+ .equals(element.getAttribute(RichFacesToolBarGroupTemplate.ATTR_LOCATION_NAME));
}
- } catch (Exception e) {
}
}
- return null;
- }
-
- public static final String TOOLBARGROUP_LOCATE_ATTRIBUTE = "location";
- public static final String TOOLBARGROUP_LOCATE_AT_RIGHT_ATTRIBUTE_VALUE = "right";
- public static final String TOOLBARGROUP_LOCATE_AT_LEFT_ATTRIBUTE_VALUE = "left";
-
- public static class SourceToolBarElements {
- private List columnsAtLeft;
- private List columnsAtRight;
- Map attributes;
-
- public SourceToolBarElements(Node sourceNode) {
- init(sourceNode);
- initAttributes(sourceNode);
+
+ public SourceToolBarItem(String itemSeparator) {
+ this.toolBarItem = null;
+ this.itemSeparator = itemSeparator;
}
- void initAttributes(Node sourceNode) {
- NamedNodeMap attrs = sourceNode.getAttributes();
- attributes = new HashMap<String, String>();
- for (int i = 0; attrs != null && i < attrs.getLength(); i++) {
- Node attribute = attrs.item(i);
- attributes.put(attribute.getNodeName(), attribute.getNodeValue());
- }
+ public Node getToolBarItem() {
+ return toolBarItem;
}
-
- void init (Node sourceNode) {
-
- String separator = ((Element)sourceNode).getAttribute("itemSeparator");
- NodeList children = sourceNode.getChildNodes();
+ public String getItemSeparator() {
+ return itemSeparator;
+ }
- int cnt = children != null ? children.getLength() : 0;
- if (cnt > 0) {
- for (int i = 0; i < cnt; i++) {
- Node child = children.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- Element childElement = (Element)child;
-
- if (childElement.getNodeName().endsWith(":toolBarGroup")) {
- boolean locateAtRight = TOOLBARGROUP_LOCATE_AT_RIGHT_ATTRIBUTE_VALUE.equals(childElement.getAttribute(TOOLBARGROUP_LOCATE_ATTRIBUTE));
- String itemSeparator = childElement.getAttribute(ITEMSEPARATOR_ATTR_NAME);
- if (itemSeparator == null || itemSeparator.trim().length() == 0) {
- itemSeparator = ITEM_SEPARATOR_NONE;
- }
- if (locateAtRight) {
- if (columnsAtRight == null) columnsAtRight = new ArrayList();
- if (i != 0 && !(ITEM_SEPARATOR_NONE.equals(separator))) columnsAtRight.add(new SourceToolBarColumnElements(separator));
- }
- initToolBarGroup(childElement, locateAtRight);
- if (!locateAtRight) {
- if (columnsAtLeft == null) columnsAtLeft = new ArrayList();
- if (!isLastChild(children, i) && !(ITEM_SEPARATOR_NONE.equals(separator))) columnsAtLeft.add(new SourceToolBarColumnElements(separator));
- }
+ public boolean isItem() {
+ return toolBarItem != null;
+ }
+
+ public boolean isToolBarItemLocationRight() {
+ return isToolBarItemLocationRight;
+ }
- } else {
- if (columnsAtLeft == null) columnsAtLeft = new ArrayList();
- columnsAtLeft.add(new SourceToolBarColumnElements(child));
- if (!isLastChild(children, i) && !(ITEM_SEPARATOR_NONE.equals(separator))) columnsAtLeft.add(new SourceToolBarColumnElements(separator));
- }
- } else if (child.getNodeType() == Node.TEXT_NODE) {
- String text = child.getNodeValue();
- text = (text == null ? null : text.trim());
- if (text != null && text.length() > 0) {
- if (columnsAtLeft == null) columnsAtLeft = new ArrayList();
- columnsAtLeft.add(new SourceToolBarColumnElements(child));
- if (!isLastChild(children, i) && !(ITEM_SEPARATOR_NONE.equals(separator))) columnsAtLeft.add(new SourceToolBarColumnElements(separator));
- }
- }
- }
- }
+ public boolean isToolBarGroupItem() {
+ return isToolBarGroupItem;
}
+ }
+
+ private class SourceToolBarItems {
+ private List<SourceToolBarItem> leftToolBarItems;
+ private List<SourceToolBarItem> rightToolBarItems;
+ private String itemSeparator;
+ private boolean itemSeparatorExists;
- private boolean isLastChild(NodeList children, int index) {
- int cnt = children != null ? children.getLength() : 0;
- if (cnt > index + 1) {
- for (int i = index + 1; i < cnt; i++) {
- if (children.item(i).getNodeType() == Node.ELEMENT_NODE) return false;
- else if (children.item(i).getNodeType() == Node.TEXT_NODE) {
- String text = children.item(i).getNodeValue();
- text = (text == null ? null : text.trim());
- if (text != null && text.length() > 0) {
- return false;
- }
- }
- }
- }
- return true;
+ public SourceToolBarItems(Node sourceNode, String itemSeparator) {
+ this.leftToolBarItems = new LinkedList<SourceToolBarItem>();
+ this.rightToolBarItems = new LinkedList<SourceToolBarItem>();
+ this.itemSeparator = itemSeparator;
+ this.itemSeparatorExists = itemSeparator != null && !ITEMSEPARATOR_ATTR_NAME.equals(itemSeparator);
+
+ init(sourceNode);
}
- void initToolBarGroup(Element sourceElement, boolean locateAtRight) {
- if (sourceElement == null) return;
- String itemSeparator = sourceElement.getAttribute(ITEMSEPARATOR_ATTR_NAME);
- if (itemSeparator == null || itemSeparator.trim().length() == 0) {
- itemSeparator = ITEM_SEPARATOR_NONE;
- }
- NodeList children = sourceElement.getChildNodes();
-
- int cnt = children != null ? children.getLength() : 0;
- if (cnt > 0) {
- for (int i = 0; i < cnt; i++) {
- Node child = children.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- Element childElement = (Element)child;
-
- if (childElement.getNodeName().endsWith(":toolBarGroup")) {
- if (locateAtRight) {
- if (columnsAtRight == null) columnsAtRight = new ArrayList();
- if (i != 0 && !(ITEM_SEPARATOR_NONE.equals(itemSeparator))) columnsAtRight.add(new SourceToolBarColumnElements(itemSeparator));
- }
- initToolBarGroup(childElement, locateAtRight);
- if (!locateAtRight) {
- if (columnsAtLeft == null) columnsAtLeft = new ArrayList();
- if (!isLastChild(children, i) && !(ITEM_SEPARATOR_NONE.equals(itemSeparator))) columnsAtLeft.add(new SourceToolBarColumnElements(itemSeparator));
- }
- } else {
- if (locateAtRight) {
- if (columnsAtRight == null) columnsAtRight = new ArrayList();
- if (i != 0 && !(ITEM_SEPARATOR_NONE.equals(itemSeparator))) columnsAtLeft.add(new SourceToolBarColumnElements(itemSeparator));
- columnsAtRight.add(new SourceToolBarColumnElements(child));
- } else {
- if (columnsAtLeft == null) columnsAtLeft = new ArrayList();
- columnsAtLeft.add(new SourceToolBarColumnElements(child));
- if (!isLastChild(children, i) && !(ITEM_SEPARATOR_NONE.equals(itemSeparator))) columnsAtLeft.add(new SourceToolBarColumnElements(itemSeparator));
- }
+ private void init(Node sourceNode) {
+ NodeList childrenList = sourceNode.getChildNodes();
+ int childrenCount = childrenList.getLength();
+ for (int i=0; i < childrenCount; i++) {
+ Node child = childrenList.item(i);
+ if (isVisibleNode(child)) {
+ SourceToolBarItem toolBarItem = new SourceToolBarItem(child);
+ if (toolBarItem.isToolBarItemLocationRight()) {
+ if (isItemSeparatorExists()) {
+ rightToolBarItems.add(new SourceToolBarItem(itemSeparator));
}
- } else if (child.getNodeType() == Node.TEXT_NODE) {
- String text = child.getNodeValue();
- text = (text == null ? null : text.trim());
- if (text != null && text.length() > 0) {
- if (locateAtRight) {
- if (columnsAtRight == null) columnsAtRight = new ArrayList();
- if (i != 0 && !(ITEM_SEPARATOR_NONE.equals(itemSeparator))) columnsAtLeft.add(new SourceToolBarColumnElements(itemSeparator));
- columnsAtRight.add(new SourceToolBarColumnElements(child));
- } else {
- if (columnsAtLeft == null) columnsAtLeft = new ArrayList();
- columnsAtLeft.add(new SourceToolBarColumnElements(child));
- if (!isLastChild(children, i) && !(ITEM_SEPARATOR_NONE.equals(itemSeparator))) columnsAtLeft.add(new SourceToolBarColumnElements(itemSeparator));
- }
+ rightToolBarItems.add(toolBarItem);
+ } else {
+ leftToolBarItems.add(toolBarItem);
+ if (isItemSeparatorExists()) {
+ leftToolBarItems.add(new SourceToolBarItem(itemSeparator));
}
}
}
}
- }
-
- public SourceToolBarColumnElements getColumnAtLeft(int index) {
- if (columnsAtLeft != null && index < getColumnAtLeftCount()) return (SourceToolBarColumnElements)columnsAtLeft.get(index);
- return null;
- }
-
- public SourceToolBarColumnElements getColumnAtRight(int index) {
- if (columnsAtRight != null && index < getColumnAtRightCount()) return (SourceToolBarColumnElements)columnsAtRight.get(index);
- return null;
- }
-
- public int getColumnAtLeftCount() {
- if (columnsAtLeft != null) return columnsAtLeft.size();
- return 0;
- }
-
- public int getColumnAtRightCount() {
- if (columnsAtRight != null) return columnsAtRight.size();
- return 0;
- }
-
- public boolean hasColspan() {
- return (getColumnAtLeftCount() + getColumnAtRightCount()) >= 2;
- }
-
- public boolean hasBodySection() {
- for (int i = 0; i < getColumnAtLeftCount(); i++) {
- SourceToolBarColumnElements column = getColumnAtLeft(i);
- if (column.hasBody()) return true;
+
+ if (!isLeftItemsExists()) {
+ rightToolBarItems.remove(0);
}
- for (int i = 0; i < getColumnAtRightCount(); i++) {
- SourceToolBarColumnElements column = getColumnAtRight(i);
- if (column.hasBody()) return true;
+
+ if (!isRightItemsExists()) {
+ leftToolBarItems.remove(leftToolBarItems.size()-1);
}
- return false;
}
-
- Map getAttributes() {
- return attributes;
- }
- String getAttributeValue(String name) {
- return (String)attributes.get(name);
+ public boolean isLeftItemsExists() {
+ return !leftToolBarItems.isEmpty();
}
- }
-
-
-
- public static class SourceToolBarColumnElements {
- private Node column;
- private String separatorType;
-
- public SourceToolBarColumnElements(Node columnNode) {
- init(columnNode);
- separatorType = null;
+ public boolean isRightItemsExists() {
+ return !rightToolBarItems.isEmpty();
}
-
- public SourceToolBarColumnElements(String separatorType) {
- column = null;
- this.separatorType = separatorType;
- }
-
- private void init(Node columnNode) {
- column = columnNode;
- }
-
- public boolean hasBody() {
- return column != null;
- }
-
- public void setColumn(Node column) {
- this.column = column;
- }
-
- public Node getColumn() {
- return column;
- }
- public boolean isSeparator() {
- return (column == null);
+ public Iterator<SourceToolBarItem> getLeftItemsIterator() {
+ return leftToolBarItems.iterator();
}
-
- public String getSeparatorType() {
- return separatorType;
- }
- }
- public static class VisualToolBarElements {
- private Element body;
- private Element bodyRow;
- private List columns;
-
- public VisualToolBarElements() {
+ public Iterator<SourceToolBarItem> getRightItemsIterator() {
+ return rightToolBarItems.iterator();
}
- public VisualToolBarElements(Element body) {
- this.body = body;
- }
- private VisualToolBarColumnElements getColumn(int index) {
- if (columns != null && index < getColumnCount()) return (VisualToolBarColumnElements)columns.get(index);
- return null;
+ private boolean isVisibleNode(Node node) {
+ return node.getNodeType() == Node.ELEMENT_NODE
+ || (node.getNodeType() == Node.TEXT_NODE
+ && node.getNodeValue() != null
+ && node.getNodeValue().trim().length() > 0);
}
- private int getColumnCount() {
- if (columns != null) return columns.size();
- return 0;
+ public boolean isItemSeparatorExists() {
+ return itemSeparatorExists;
}
- private List getColumns() {
- if (columns == null) columns = new ArrayList();
- return columns;
+ public String getItemSeparator() {
+ return itemSeparator;
}
-
- public Element getBody() {
- return body;
- }
-
- public void setBody(Element body) {
- this.body = body;
- }
-
- public Element getBodyRow() {
- return bodyRow;
- }
-
- public void setBodyRow(Element bodyRow) {
- this.bodyRow = bodyRow;
- }
}
-
- public static class VisualToolBarColumnElements {
- private Element bodyCell;
-
- private boolean isEmpty() {
- return bodyCell == null;
- }
-
- public Element getBodyCell() {
- return bodyCell;
- }
-
- public void setBodyCell(Element bodyCell) {
- this.bodyCell = bodyCell;
- }
- }
}
\ No newline at end of file
17 years, 6 months
JBoss Tools SVN: r2345 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: template and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2007-07-06 11:03:39 -0400 (Fri, 06 Jul 2007)
New Revision: 2345
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeChildrenInfo.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreationData.java
Log:
http://jira.jboss.org/jira/browse/EXIN-231
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-07-06 14:37:50 UTC (rev 2344)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-07-06 15:03:39 UTC (rev 2345)
@@ -623,28 +623,39 @@
// ==========================================================
public void updateNode(Node sourceNode) {
- if (sourceNode != null) {
- if (sourceNode.getNodeType() == Node.DOCUMENT_NODE) {
- rebuildDom((Document)sourceNode);
- } else if (sourceNode.getNodeType() == Node.COMMENT_NODE) {
- updateComment(sourceNode);
- } else {
- Node sourceTable = getParentTable(sourceNode, 2);
- if (sourceTable != null) {
- updateElement(sourceTable);
- return;
- } else {
- Node sourceSelect = getParentSelect(sourceNode);
- if (sourceSelect != null) {
- updateElement(sourceSelect);
- return;
- }
- }
- updateElement(sourceNode);
- }
+ if (sourceNode == null)
+ return;
+
+ switch (sourceNode.getNodeType()) {
+ case Node.DOCUMENT_NODE :
+ rebuildDom((Document)sourceNode);
+ break;
+ case Node.COMMENT_NODE :
+ updateComment(sourceNode);
+ break;
+ default :
+ updateElement(getNodeForUpdate(sourceNode));
}
}
+ // TODO S.Vasilyev make a common code for figuring out
+ // if it is need to update parent node or not
+ private Node getNodeForUpdate(Node sourceNode) {
+ /* Changing of <tr> or <td> tags can affect whole the table */
+ Node sourceTable = getParentTable(sourceNode, 2);
+ if (sourceTable != null) {
+ return sourceTable;
+ }
+
+ /* Changing of an <option> tag can affect the parent select */
+ Node sourceSelect = getParentSelect(sourceNode);
+ if (sourceSelect != null) {
+ return sourceSelect;
+ }
+
+ return sourceNode;
+ }
+
private void updateComment(Node sourceNode) {
VpeNodeMapping mapping = domMapping.getNodeMapping(sourceNode);
if (mapping != null && mapping.getType() == VpeNodeMapping.COMMENT_MAPPING) {
@@ -726,7 +737,7 @@
public void setText(Node sourceText) {
Node sourceParent = sourceText.getParentNode();
if (sourceParent != null && sourceParent.getLocalName() != null) {
- String sourceParentName = sourceParent.getLocalName().toLowerCase();
+ String sourceParentName = sourceParent.getLocalName();
if ("textarea".equalsIgnoreCase(sourceParentName) || "option".equalsIgnoreCase(sourceParentName)) {
updateNode(sourceText.getParentNode());
return;
@@ -918,7 +929,7 @@
private Element createLinkNode(String href_val, String rel_val, String ext_val) {
Element linkNode = null;
- if ((ATTR_REL_STYLESHEET_VALUE.compareToIgnoreCase(rel_val) == 0)
+ if ((ATTR_REL_STYLESHEET_VALUE.equalsIgnoreCase(rel_val))
&& href_val.startsWith("file:")) {
/* Because of the Mozilla caches the linked css files we replace
* tag <link rel="styleseet" href="file://..."> with tag
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeChildrenInfo.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeChildrenInfo.java 2007-07-06 14:37:50 UTC (rev 2344)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeChildrenInfo.java 2007-07-06 15:03:39 UTC (rev 2345)
@@ -22,7 +22,7 @@
public class VpeChildrenInfo {
private Element visualParent;
- private List sourceChildren;
+ private List<Node> sourceChildren;
public VpeChildrenInfo(Element visualParent) {
this.visualParent = visualParent;
@@ -40,7 +40,7 @@
* Returs <code>List</code> of nodes of the source tree for creating new visual nodes.
* @return <code>List</code> of nodes of the source tree for creating new visual nodes.
*/
- public List getSourceChildren() {
+ public List<Node> getSourceChildren() {
return sourceChildren;
}
@@ -49,13 +49,13 @@
* @param child The node of the source tree.
*/
public void addSourceChild(Node child) {
- List children = getChildren();
+ List<Node> children = getChildren();
children.add(child);
}
- private List getChildren() {
+ private List<Node> getChildren() {
if (sourceChildren == null) {
- sourceChildren = new ArrayList();
+ sourceChildren = new ArrayList<Node> ();
}
return sourceChildren;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreationData.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreationData.java 2007-07-06 14:37:50 UTC (rev 2344)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreationData.java 2007-07-06 15:03:39 UTC (rev 2345)
@@ -17,8 +17,8 @@
public class VpeCreationData {
private Node node;
- private List childrenInfoList;
- private List illegalChildren;
+ private List<VpeChildrenInfo> childrenInfoList;
+ private List<Node> illegalChildren;
private Object data;
public VpeCreationData(Node node) {
@@ -31,23 +31,23 @@
public void addChildrenInfo(VpeChildrenInfo info) {
if (childrenInfoList == null) {
- childrenInfoList = new ArrayList();
+ childrenInfoList = new ArrayList<VpeChildrenInfo>();
}
childrenInfoList.add(info);
}
- public List getChildrenInfoList() {
+ public List<VpeChildrenInfo> getChildrenInfoList() {
return childrenInfoList;
}
public void addIllegalChild(Node child) {
if (illegalChildren == null) {
- illegalChildren = new ArrayList();
+ illegalChildren = new ArrayList<Node>();
}
illegalChildren.add(child);
}
- public List getIllegalChildren() {
+ public List<Node> getIllegalChildren() {
return illegalChildren;
}
17 years, 6 months
JBoss Tools SVN: r2344 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-06 10:37:50 -0400 (Fri, 06 Jul 2007)
New Revision: 2344
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
Log:
EXIN-217 Implementations of model interfaces added
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2007-07-06 14:37:50 UTC (rev 2344)
@@ -0,0 +1,119 @@
+package org.jboss.tools.seam.internal.core;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.seam.core.ISeamContextVariable;
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.core.event.Change;
+
+public class AbstractContextVariable implements ISeamContextVariable, ISeamTextSourceReference {
+ /**
+ * Path of resource where this factory is declared.
+ */
+ protected IPath source;
+
+ protected IResource resource = null;
+
+ /**
+ * Object that allows to identify this declaration.
+ */
+ protected Object id;
+
+ protected String name;
+ protected ScopeType scopeType;
+ protected String scope;
+
+ public Object getId() {
+ return id;
+ }
+
+ public void setId(Object id) {
+ this.id = id;
+ }
+
+ public void setSourcePath(IPath path) {
+ source = path;
+ }
+
+ public IPath getSourcePath() {
+ return source;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ScopeType getScope() {
+ return scopeType;
+ }
+
+ public void setScope(ScopeType type) {
+ scopeType = type;
+ scope = scopeType == null ? null : scopeType.toString();
+ }
+
+ public void setScopeAsString(String scope) {
+ try {
+ this.scopeType = scope == null || scope.length() == 0 ? ScopeType.UNSPECIFIED : ScopeType.valueOf(scope.toUpperCase());
+ } catch (Exception e) {
+ //ignore
+ }
+ }
+
+ public int getLength() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public IResource getResource() {
+ if(resource != null) return resource;
+ if(source != null) {
+ resource = ResourcesPlugin.getWorkspace().getRoot().getFile(source);
+ }
+ return resource;
+ }
+
+ public int getStartPosition() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /**
+ * Merges loaded data into currently used declaration.
+ * If changes were done returns a list of changes.
+ * @param f
+ * @return list of changes
+ */
+ public List<Change> merge(AbstractContextVariable f) {
+ List<Change> changes = null;
+
+ source = f.source;
+ id = f.id;
+
+ if(!stringsEqual(name, f.name)) {
+ changes = Change.addChange(changes, new Change(this, ISeamXmlComponentDeclaration.NAME, name, f.name));
+ name = f.name;
+ }
+ if(!stringsEqual(scope, f.scope)) {
+ changes = Change.addChange(changes, new Change(this, ISeamXmlComponentDeclaration.SCOPE, scope, f.scope));
+ scope = f.scope;
+ scopeType = f.scopeType;
+ }
+
+ return changes;
+ }
+
+ boolean stringsEqual(String s1, String s2) {
+ return s1 == null ? s2 == null : s1.equals(s2);
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java 2007-07-06 14:37:50 UTC (rev 2344)
@@ -0,0 +1,7 @@
+package org.jboss.tools.seam.internal.core;
+
+import org.jboss.tools.seam.core.IRole;
+
+public class Role extends SeamJavaContextVariable implements IRole {
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java 2007-07-06 14:37:50 UTC (rev 2344)
@@ -0,0 +1,56 @@
+package org.jboss.tools.seam.internal.core;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IMember;
+import org.jboss.tools.seam.core.ISeamComponentMethod;
+import org.jboss.tools.seam.core.SeamComponentMethodType;
+
+public class SeamComponentMethod implements ISeamComponentMethod {
+ boolean create = false;
+ boolean destroy = false;
+
+ IMember javaSource = null;
+ IResource resource = null;
+
+ public boolean isCreate() {
+ return create;
+ }
+
+ public void setCreate(boolean b) {
+ create = b;
+ }
+
+ public boolean isOfType(SeamComponentMethodType type) {
+ if(type == SeamComponentMethodType.CREATE) return isCreate();
+ if(type == SeamComponentMethodType.DESTROY) return isDestroy();
+ return false;
+ }
+
+ public boolean isDestroy() {
+ return destroy;
+ }
+
+ public void setDestroy(boolean b) {
+ destroy = b;
+ }
+
+ public IMember getSourceMember() {
+ return javaSource;
+ }
+
+ public int getLength() {
+ return 0;
+ }
+
+ public IResource getResource() {
+ if(resource == null && javaSource != null) {
+ resource = javaSource.getResource();
+ }
+ return resource;
+ }
+
+ public int getStartPosition() {
+ return 0;
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2007-07-06 14:37:50 UTC (rev 2344)
@@ -0,0 +1,56 @@
+package org.jboss.tools.seam.internal.core;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.seam.core.ISeamJavaSourceReference;
+import org.jboss.tools.seam.core.event.Change;
+
+public class SeamJavaContextVariable extends AbstractContextVariable implements ISeamJavaSourceReference {
+ protected IMember javaSource = null;
+
+ public IMember getSourceMember() {
+ return javaSource;
+ }
+
+ public int getLength() {
+ if(javaSource == null) return 0;
+ try {
+ if(javaSource.getSourceRange() == null) return 0;
+ return javaSource.getSourceRange().getLength();
+ } catch (JavaModelException e) {
+ //ignore
+ return 0;
+ }
+ }
+
+ public IResource getResource() {
+ return javaSource == null ? null : javaSource.getTypeRoot().getResource();
+ }
+
+ public int getStartPosition() {
+ if(javaSource == null) return 0;
+ try {
+ if(javaSource.getSourceRange() == null) return 0;
+ return javaSource.getSourceRange().getOffset();
+ } catch (JavaModelException e) {
+ //ignore
+ return 0;
+ }
+ }
+
+ public List<Change> merge(AbstractContextVariable f) {
+ List<Change> changes = super.merge(f);
+
+ if(f instanceof SeamJavaContextVariable) {
+ SeamJavaContextVariable sf = (SeamJavaContextVariable)f;
+ javaSource = sf.javaSource;
+ resource = sf.resource;
+ }
+
+ return changes;
+ }
+
+}
17 years, 6 months
JBoss Tools SVN: r2343 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-06 10:37:22 -0400 (Fri, 06 Jul 2007)
New Revision: 2343
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamFactory.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
Log:
EXIN-217 Implementations of model interfaces added
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -19,5 +19,13 @@
/**
* @return type of attribute
*/
- public BijectedAttributeType getType();
+ public BijectedAttributeType[] getTypes();
+
+ /**
+ * Checks if type is contained in list of types.
+ * @param type
+ * @return
+ */
+ public boolean isOfType(BijectedAttributeType type);
+
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -18,7 +18,20 @@
public interface ISeamComponentMethod extends ISeamJavaSourceReference {
/**
- * @return method type
+ * @return is @ Create method
*/
- public SeamComponentMethodType getType();
+ public boolean isCreate();
+
+ /**
+ * @return is @ Destroy method
+ */
+ public boolean isDestroy();
+
+ /**
+ * Returns create or destroy depending on type
+ * @param type
+ * @return
+ */
+ public boolean isOfType(SeamComponentMethodType type);
+
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -10,74 +10,37 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
-import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
-import org.jboss.tools.seam.core.ScopeType;
/**
* @author Viacheslav Kabanovich
*/
-public class BijectedAttribute implements IBijectedAttribute {
- IMember javaSource = null;
- BijectedAttributeType type = null;
- String name = null;
- ScopeType scopeType = ScopeType.UNSPECIFIED;
+public class BijectedAttribute extends SeamJavaContextVariable implements IBijectedAttribute {
+ BijectedAttributeType[] types = null;
+
+ public BijectedAttribute() {
+ }
public void setMember(IMember javaSource) {
this.javaSource = javaSource;
}
- public BijectedAttributeType getType() {
- return type;
+ public BijectedAttributeType[] getTypes() {
+ return types;
}
-
- public String getName() {
- return name;
- }
-
- public ScopeType getScope() {
- return scopeType;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setScope(ScopeType type) {
- this.scopeType = type;
- }
-
- public IMember getSourceMember() {
- return javaSource;
- }
-
- public int getLength() {
- if(javaSource == null) return 0;
- try {
- if(javaSource.getSourceRange() == null) return 0;
- return javaSource.getSourceRange().getLength();
- } catch (JavaModelException e) {
- //ignore
- return 0;
+
+ public boolean isOfType(BijectedAttributeType type) {
+ if(types == null) return false;
+ for (int i = 0; i < types.length; i++) {
+ if(types[i] == type) return true;
}
+ return false;
}
- public IResource getResource() {
- return javaSource == null ? null : javaSource.getTypeRoot().getResource();
+ public void setTypes(BijectedAttributeType[] types) {
+ this.types = types;
}
- public int getStartPosition() {
- if(javaSource == null) return 0;
- try {
- if(javaSource.getSourceRange() == null) return 0;
- return javaSource.getSourceRange().getOffset();
- } catch (JavaModelException e) {
- //ignore
- return 0;
- }
- }
-
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -12,10 +12,7 @@
import java.util.List;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.event.Change;
@@ -23,22 +20,17 @@
/**
* @author Viacheslav Kabanovich
*/
-public class SeamAnnotatedFactory extends SeamFactory implements ISeamAnnotatedFactory {
- IMethod javaSource = null;
+public class SeamAnnotatedFactory extends SeamJavaContextVariable implements ISeamAnnotatedFactory {
boolean autoCreate = false;
public IMethod getSourceMethod() {
- return javaSource;
+ return (IMethod)javaSource;
}
public void setMethod(IMethod method) {
this.javaSource = method;
}
- public IMember getSourceMember() {
- return javaSource;
- }
-
public boolean isAutoCreate() {
return autoCreate;
}
@@ -47,33 +39,7 @@
this.autoCreate = autoCreate;
}
- public int getLength() {
- if(javaSource == null) return 0;
- try {
- if(javaSource.getSourceRange() == null) return 0;
- return javaSource.getSourceRange().getLength();
- } catch (JavaModelException e) {
- //ignore
- return 0;
- }
- }
-
- public IResource getResource() {
- return javaSource == null ? null : javaSource.getTypeRoot().getResource();
- }
-
- public int getStartPosition() {
- if(javaSource == null) return 0;
- try {
- if(javaSource.getSourceRange() == null) return 0;
- return javaSource.getSourceRange().getOffset();
- } catch (JavaModelException e) {
- //ignore
- return 0;
- }
- }
-
- public List<Change> merge(SeamFactory f) {
+ public List<Change> merge(AbstractContextVariable f) {
List<Change> changes = super.merge(f);
SeamAnnotatedFactory af = (SeamAnnotatedFactory)f;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -13,9 +13,11 @@
import java.util.List;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.event.Change;
/**
@@ -29,6 +31,8 @@
* Path of resource where this component is declared.
*/
protected IPath source;
+
+ protected IResource resource;
/**
* Object that allows to identify this declaration.
@@ -70,9 +74,15 @@
}
public IResource getResource() {
- // TODO Auto-generated method stub
- return null;
+ if(resource == null && source != null) {
+ resource = ResourcesPlugin.getWorkspace().getRoot().getFile(source);
+ }
+ return resource;
}
+
+ public void setResource(IResource resource) {
+ this.resource = resource;
+ }
public int getStartPosition() {
// TODO Auto-generated method stub
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamFactory.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamFactory.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -1,96 +0,0 @@
-package org.jboss.tools.seam.internal.core;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.jboss.tools.seam.core.ISeamFactory;
-import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
-import org.jboss.tools.seam.core.ScopeType;
-import org.jboss.tools.seam.core.event.Change;
-
-public class SeamFactory implements ISeamFactory {
- /**
- * Path of resource where this factory is declared.
- */
- protected IPath source;
- /**
- * Object that allows to identify this declaration.
- */
- protected Object id;
-
- String name = null;
- String scope = null;
- ScopeType scopeType = ScopeType.UNSPECIFIED;
-
- public Object getId() {
- return id;
- }
-
- public void setId(Object id) {
- this.id = id;
- }
-
- public void setSourcePath(IPath path) {
- source = path;
- }
-
- public IPath getSourcePath() {
- return source;
- }
-
- public String getName() {
- return name;
- }
-
- public ScopeType getScope() {
- return scopeType;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setScope(ScopeType type) {
- this.scopeType = type;
- scope = scopeType.toString();
- }
-
- public void setScopeAsString(String scope) {
- this.scope = scope;
- try {
- this.scopeType = scope == null || scope.length() == 0 ? ScopeType.UNSPECIFIED : ScopeType.valueOf(scope.toUpperCase());
- } catch (Exception e) {
- //ignore
- }
- }
-
- /**
- * Merges loaded data into currently used declaration.
- * If changes were done returns a list of changes.
- * @param f
- * @return list of changes
- */
- public List<Change> merge(SeamFactory f) {
- List<Change> changes = null;
-
- source = f.source;
- id = f.id;
-
- if(!stringsEqual(name, f.name)) {
- changes = Change.addChange(changes, new Change(this, ISeamXmlComponentDeclaration.NAME, name, f.name));
- name = f.name;
- }
- if(!stringsEqual(scope, f.scope)) {
- changes = Change.addChange(changes, new Change(this, ISeamXmlComponentDeclaration.SCOPE, scope, f.scope));
- scope = f.scope;
- scopeType = f.scopeType;
- }
-
- return changes;
- }
-
- boolean stringsEqual(String s1, String s2) {
- return s1 == null ? s2 == null : s1.equals(s2);
- }
-
-}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -86,7 +86,7 @@
BijectedAttributeType type) {
Set<IBijectedAttribute> result = null;
for(IBijectedAttribute a: getBijectedAttributes()) {
- if(type.equals(a.getType())) {
+ if(a.isOfType(type)) {
if(result == null) result = new HashSet<IBijectedAttribute>();
result.add(a);
}
@@ -102,7 +102,7 @@
SeamComponentMethodType type) {
Set<ISeamComponentMethod> result = null;
for(ISeamComponentMethod a: getMethods()) {
- if(type.equals(a.getType())) {
+ if(a.isOfType(type)) {
if(result == null) result = new HashSet<ISeamComponentMethod>();
result.add(a);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -11,7 +11,6 @@
package org.jboss.tools.seam.internal.core;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -104,7 +103,7 @@
public void registerComponents(LoadedDeclarations ds, IPath source) {
SeamComponentDeclaration[] components = ds.getComponents().toArray(new SeamComponentDeclaration[0]);
- SeamFactory[] factories = ds.getFactories().toArray(new SeamFactory[0]);
+ ISeamFactory[] factories = ds.getFactories().toArray(new ISeamFactory[0]);
if(components.length == 0 && factories.length == 0) {
pathRemoved(source);
@@ -173,15 +172,15 @@
Map<Object, ISeamFactory> currentFactories = findFactoryDeclarations(source);
List<Change> addedFactories = null;
for (int i = 0; i < factories.length; i++) {
- SeamFactory loaded = factories[i];
- SeamFactory current = (SeamFactory)currentFactories.remove(loaded.getId());
+ AbstractContextVariable loaded = (AbstractContextVariable)factories[i];
+ AbstractContextVariable current = (AbstractContextVariable)currentFactories.remove(loaded.getId());
if(current != null) {
List<Change> changes = current.merge(loaded);
fireChanges(changes);
continue;
}
- allFactories.add(loaded);
- allVariables.add(loaded);
+ allFactories.add(factories[i]);
+ allVariables.add(factories[i]);
addedFactories = Change.addChange(addedFactories, new Change(this, null, null, loaded));
}
fireChanges(addedFactories);
@@ -220,7 +219,7 @@
}
Iterator<ISeamFactory> factories = allFactories.iterator();
while(factories.hasNext()) {
- SeamFactory f = (SeamFactory)factories.next();
+ AbstractContextVariable f = (AbstractContextVariable)factories.next();
if(source.equals(f.getSourcePath())) {
List<Change> changes = Change.addChange(null, new Change(this, null, f, null));
factories.remove();
@@ -269,8 +268,8 @@
public Map<Object,ISeamFactory> findFactoryDeclarations(IPath source) {
Map<Object,ISeamFactory> map = new HashMap<Object, ISeamFactory>();
for (ISeamFactory c: allFactories) {
- SeamFactory ci = (SeamFactory)c;
- if(source.equals(ci.getSourcePath())) map.put(ci.getId(), ci);
+ AbstractContextVariable ci = (AbstractContextVariable)c;
+ if(source.equals(ci.getSourcePath())) map.put(ci.getId(), c);
}
return map;
}
@@ -279,7 +278,7 @@
Iterator<ISeamFactory> iterator = allFactories.iterator();
List<Change> changes = null;
while(iterator.hasNext()) {
- SeamFactory c = (SeamFactory)iterator.next();
+ AbstractContextVariable c = (AbstractContextVariable)iterator.next();
if(removed.containsKey(c.getId())) {
iterator.remove();
allVariables.remove(c);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -12,14 +12,13 @@
import java.util.List;
-import org.eclipse.core.resources.IResource;
import org.jboss.tools.seam.core.ISeamXmlFactory;
import org.jboss.tools.seam.core.event.Change;
/**
* @author Viacheslav Kabanovich
*/
-public class SeamXmlFactory extends SeamFactory implements ISeamXmlFactory {
+public class SeamXmlFactory extends AbstractContextVariable implements ISeamXmlFactory {
String method = null;
String value = null;
@@ -39,22 +38,7 @@
this.value = value;
}
- public int getLength() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public IResource getResource() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int getStartPosition() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public List<Change> merge(SeamFactory f) {
+ public List<Change> merge(AbstractContextVariable f) {
List<Change> changes = super.merge(f);
SeamXmlFactory xf = (SeamXmlFactory)f;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -13,8 +13,8 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.tools.seam.core.ISeamFactory;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
-import org.jboss.tools.seam.internal.core.SeamFactory;
/**
* This object keeps all declarations loaded from one source.
@@ -23,13 +23,13 @@
*/
public class LoadedDeclarations {
List<SeamComponentDeclaration> components = new ArrayList<SeamComponentDeclaration>();
- List<SeamFactory> factories = new ArrayList<SeamFactory>();
+ List<ISeamFactory> factories = new ArrayList<ISeamFactory>();
public List<SeamComponentDeclaration> getComponents() {
return components;
}
- public List<SeamFactory> getFactories() {
+ public List<ISeamFactory> getFactories() {
return factories;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -75,7 +75,7 @@
public LoadedDeclarations parse(IFile f) throws Exception {
ICompilationUnit u = getCompilationUnit(f);
if(u == null) return null;
- ASTRequestorImpl requestor = new ASTRequestorImpl(f.getFullPath());
+ ASTRequestorImpl requestor = new ASTRequestorImpl(f);
ICompilationUnit[] us = new ICompilationUnit[]{u};
ASTParser.newParser(AST.JLS3).createASTs(us, new String[0], requestor, null);
return requestor.getDeclarations();
@@ -101,10 +101,12 @@
class ASTRequestorImpl extends ASTRequestor {
private ASTVisitorImpl visitor = new ASTVisitorImpl();
LoadedDeclarations ds = new LoadedDeclarations();
+ IResource resource;
IPath sourcePath;
- public ASTRequestorImpl(IPath sourcePath) {
- this.sourcePath = sourcePath;
+ public ASTRequestorImpl(IResource resource) {
+ this.resource = resource;
+ this.sourcePath = resource.getFullPath();
}
public LoadedDeclarations getDeclarations() {
@@ -130,6 +132,7 @@
component.setId(visitor.type);
component.setSourcePath(sourcePath);
+ component.setResource(resource);
ds.getComponents().add(component);
component.setType(visitor.type);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -11,13 +11,22 @@
package org.jboss.tools.seam.internal.core.scanner.lib;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.AbstractContextVariable;
+import org.jboss.tools.seam.internal.core.BijectedAttribute;
+import org.jboss.tools.seam.internal.core.SeamAnnotatedFactory;
import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
@@ -53,10 +62,16 @@
SeamJavaComponentDeclaration component = new SeamJavaComponentDeclaration();
component.setSourcePath(path);
component.setId(type);
+ component.setType(type);
component.setClassName(type.getFullyQualifiedName());
process(cls, component, ds);
ds.getComponents().add(component);
+ for (int i = 0; i < ds.getFactories().size(); i++) {
+ AbstractContextVariable f = (AbstractContextVariable)ds.getFactories().get(i);
+ f.setSourcePath(path);
+ f.getId();
+ }
return ds;
}
@@ -109,8 +124,13 @@
if(precedence instanceof Integer) component.setPrecedence((Integer)precedence);
}
}
- Method[] ms = cls.getMethods();
- for (int i = 0; i < ms.length; i++) {
+ Method[] ms = null;
+ try {
+ ms = cls.getMethods();
+ } catch (NoClassDefFoundError e) {
+ //ignore
+ }
+ if(ms != null) for (int i = 0; i < ms.length; i++) {
process(ms[i], component, ds);
}
}
@@ -118,9 +138,62 @@
private void process(Method m, SeamJavaComponentDeclaration component, LoadedDeclarations ds) {
Map<String,Annotation> map = getSeamAnnotations(m.getAnnotations());
if(map == null || map.isEmpty()) return;
+ Annotation a = map.get(FACTORY_ANNOTATION_TYPE);
+ if(a != null) {
+ processFactory(m, a, component, ds);
+ }
+ Annotation in = map.get(IN_ANNOTATION_TYPE);
+ Annotation out = map.get(OUT_ANNOTATION_TYPE);
+ if(in != null || out != null) {
+ processBijection(m, in, out, component, ds);
+ }
+ }
+
+ private void processFactory(Method m, Annotation a, SeamJavaComponentDeclaration component, LoadedDeclarations ds) {
+ if(a == null) return;
+ String name = (String)getValue(a, "value");
+ if(name == null || name.length() == 0) {
+ name = m.getName();
+ }
+ SeamAnnotatedFactory factory = new SeamAnnotatedFactory();
+ ds.getFactories().add(factory);
+ IMethod im = findIMethod(component, m);
+ factory.setId(im);
+ factory.setMethod(im);
+ factory.setName(name);
+
+ Object scope = getValue(a, "scope");
+ if(scope != null) factory.setScopeAsString(scope.toString());
+ Object autoCreate = getValue(a, "autoCreate");
+ if(autoCreate instanceof Boolean) {
+ factory.setAutoCreate((Boolean)autoCreate);
+ }
}
+
+ private void processBijection(Member m, Annotation in, Annotation out, SeamJavaComponentDeclaration component, LoadedDeclarations ds) {
+ if(in == null && out == null) return;
+ BijectedAttribute att = new BijectedAttribute();
+ component.getBijectedAttributes().add(att);
+ BijectedAttributeType[] types = (in == null) ? new BijectedAttributeType[]{BijectedAttributeType.OUT}
+ : (out == null) ? new BijectedAttributeType[]{BijectedAttributeType.IN}
+ : new BijectedAttributeType[]{BijectedAttributeType.IN, BijectedAttributeType.OUT};
+ att.setTypes(types);
+
+ String name = (String)getValue(in != null ? in : out, "value");
+ if(name == null || name.length() == 0) {
+ name = m.getName();
+ }
+ att.setName(name);
+ Object scope = getValue(in != null ? in : out, "scope");
+ if(scope != null) att.setScopeAsString(scope.toString());
+
+ IMember im = findIMember(component, m);
+ att.setMember(im);
+
+ }
+
private Object getValue(Annotation a, String method) {
try {
Method m = a.annotationType().getMethod(method, new Class[0]);
@@ -132,4 +205,23 @@
return null;
}
+ private IMember findIMember(SeamJavaComponentDeclaration component, Member m) {
+ if(m instanceof Field) return findIField(component, (Field)m);
+ if(m instanceof Method) return findIMethod(component, (Method)m);
+ return null;
+ }
+
+ private IMethod findIMethod(SeamJavaComponentDeclaration component, Method m) {
+ IType type = (IType)component.getSourceMember();
+ Class<?>[] ps = m.getParameterTypes();
+ String[] params = new String[ps == null ? 0 : ps.length];
+ for (int i = 0; i < ps.length; i++) params[i] = ps[i].getName();
+ return type.getMethod(m.getName(), params);
+ }
+
+ private IField findIField(SeamJavaComponentDeclaration component, Field m) {
+ IType type = (IType)component.getSourceMember();
+ return type.getField(m.getName());
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -155,6 +155,9 @@
IClassFile typeRoot = (IClassFile)es[i];
IType type = typeRoot.getType();
String className = type.getFullyQualifiedName();
+ if(className.indexOf("ProcessInstanceF") >= 0) {
+ System.out.println("!!");
+ }
Class<?> cls = null;
try {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-06 14:08:17 UTC (rev 2342)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-06 14:37:22 UTC (rev 2343)
@@ -25,7 +25,6 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ISeamXmlFactory;
-import org.jboss.tools.seam.internal.core.SeamFactory;
import org.jboss.tools.seam.internal.core.SeamProperty;
import org.jboss.tools.seam.internal.core.SeamXmlComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamXmlFactory;
17 years, 6 months