JBoss Tools SVN: r2432 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core: validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-13 11:23:43 -0400 (Fri, 13 Jul 2007)
New Revision: 2432
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamTextSourceReference.java
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/SeamJavaComponentDeclaration.java
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/SeamValidationContext.java
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/messages.properties
Log:
http://jira.jboss.com/jira/browse/EXIN-327 @Entity, @Create validation
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-13 15:14:33 UTC (rev 2431)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-13 15:23:43 UTC (rev 2432)
@@ -29,6 +29,7 @@
public abstract class SeamComponentDeclaration extends SeamObject implements ISeamComponentDeclaration, IOpenableElement {
public static final String PATH_OF_NAME = "name";
+ public static final String PATH_OF_SCOPE = "scope";
/**
* Seam component name.
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-13 15:14:33 UTC (rev 2431)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-13 15:23:43 UTC (rev 2432)
@@ -26,6 +26,8 @@
public class SeamJavaComponentDeclaration extends SeamComponentDeclaration
implements ISeamJavaComponentDeclaration {
+ public static final String PATH_OF_STATEFUL = "stateful";
+
protected String className = null;
protected ScopeType scopeType = ScopeType.UNSPECIFIED;
protected boolean stateful = false;
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamTextSourceReference.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamTextSourceReference.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamTextSourceReference.java 2007-07-13 15:23:43 UTC (rev 2432)
@@ -0,0 +1,55 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class SeamTextSourceReference implements ISeamTextSourceReference {
+
+ private int length;
+ private int startPosition;
+
+ public SeamTextSourceReference(int length, int startPosition) {
+ this.length = length;
+ this.startPosition = startPosition;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamTextSourceReference#getLength()
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamTextSourceReference#getStartPosition()
+ */
+ public int getStartPosition() {
+ return startPosition;
+ }
+
+ /**
+ * @param length
+ */
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ /**
+ * @param startPosition
+ */
+ public void setStartPosition(int startPosition) {
+ this.startPosition = startPosition;
+ }
+}
\ No newline at end of file
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-13 15:14:33 UTC (rev 2431)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-13 15:23:43 UTC (rev 2432)
@@ -41,6 +41,7 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamProject;
+import org.jboss.tools.seam.internal.core.SeamTextSourceReference;
/**
* Validator for Java files.
@@ -53,13 +54,15 @@
private static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID = "NONUNIQUE_COMPONENT_NAME_MESSAGE";
private static final String UNKNOWN_INJECTION_NAME_MESSAGE_ID = "UNKNOWN_INJECTION_NAME";
private static final String STATEFUL_COMPONENT_DOES_NOT_CONTENT_METHOD_SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DOES_NOT_CONTENT_";
- private static final String STATEFUL_COMPONENT_DUPLICATE_METHOD__SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DUPLICATE_";
+ private static final String DUPLICATE_METHOD_SUFIX_MESSAGE_ID = "DUPLICATE_";
private static final String REMOVE_METHOD_POSTFIX_MESSAGE_ID = "REMOVE";
private static final String DESTROY_METHOD_POSTFIX_MESSAGE_ID = "DESTROY";
-
+ private static final String CREATE_METHOD_POSTFIX_MESSAGE_ID = "CREATE";
private static final String STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "STATEFUL_COMPONENT_WRONG_SCOPE";
+ private static final String ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "ENTITY_COMPONENT_WRONG_SCOPE";
private SeamValidationContext validationContext;
+ private ISeamProject project;
public ISchedulingRule getSchedulingRule(IValidationContext helper) {
return null;
@@ -69,7 +72,7 @@
super.validateInJob(helper, reporter);
SeamJavaHelper seamJavaHelper = (SeamJavaHelper)helper;
String[] uris = seamJavaHelper.getURIs();
- ISeamProject project = seamJavaHelper.getSeamProject();
+ project = seamJavaHelper.getSeamProject();
validationContext = ((SeamProject)project).getValidationContext();
if (uris.length > 0) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
@@ -85,7 +88,7 @@
Set<String> oldVariablesNamesOfChangedFile = validationContext.getVariableNamesByResource(currentFile.getFullPath());
if(oldVariablesNamesOfChangedFile!=null) {
// Check if variable name was changed in java file
- Set<String> newVariableNamesOfChangedFile = getVariablesNameByResource(currentFile.getFullPath(), project);
+ Set<String> newVariableNamesOfChangedFile = getVariablesNameByResource(currentFile.getFullPath());
for (String newVariableName : newVariableNamesOfChangedFile) {
if(!oldVariablesNamesOfChangedFile.contains(newVariableName)) {
// Name was changed.
@@ -113,27 +116,28 @@
}
}
// Validate all collected linked resources.
- // Remove all links between resources and variables names because they will be linked again during validation.
- validationContext.clear();
+ // Remove all links between collected resources and variables names because they will be linked again during validation.
+ validationContext.removeLinkedResources(resources);
for (IPath linkedResource : resources) {
// Remove markers from collected java file
- reporter.removeMessageSubset(this, linkedResource, MARKED_COMPONENT_MESSAGE_GROUP);
- validateComponent(project, linkedResource, checkedComponents, helper, reporter);
+ IFile sourceFile = root.getFile(linkedResource);
+ reporter.removeMessageSubset(this, sourceFile, MARKED_COMPONENT_MESSAGE_GROUP);
+ validateComponent(linkedResource, checkedComponents);
// TODO
}
} else {
- return validateAll(project, helper, reporter);
+ return validateAll();
}
return OK_STATUS;
}
- private void validateComponent(ISeamProject project, IPath sourceFilePath, Set<ISeamComponent> checkedComponents, IValidationContext helper, IReporter reporter) {
+ private void validateComponent(IPath sourceFilePath, Set<ISeamComponent> checkedComponents) {
Set<ISeamComponent> components = project.getComponentsByPath(sourceFilePath);
for (ISeamComponent component : components) {
// Don't validate one component twice.
if(!checkedComponents.contains(component)) {
- validateComponent(project, component, helper, reporter);
+ validateComponent(component);
checkedComponents.add(component);
}
}
@@ -142,7 +146,7 @@
/*
* Returns set of variables which are linked with this resource
*/
- private Set<String> getVariablesNameByResource(IPath resourcePath, ISeamProject project) {
+ private Set<String> getVariablesNameByResource(IPath resourcePath) {
Set<ISeamContextVariable> variables = project.getVariablesByPath(resourcePath);
Set<String> result = new HashSet<String>();
for (ISeamContextVariable variable : variables) {
@@ -158,12 +162,12 @@
super.cleanup(reporter);
}
- private IStatus validateAll(ISeamProject project, IValidationContext helper, IReporter reporter) {
+ private IStatus validateAll() {
reporter.removeAllMessages(this);
validationContext.clear();
Set<ISeamComponent> components = project.getComponents();
for (ISeamComponent component : components) {
- validateComponent(project, component, helper, reporter);
+ validateComponent(component);
// TODO
}
return OK_STATUS;
@@ -172,7 +176,7 @@
/*
* Validates the component
*/
- private void validateComponent(ISeamProject project, ISeamComponent component, IValidationContext helper, IReporter reporter) {
+ private void validateComponent(ISeamComponent component) {
ISeamJavaComponentDeclaration firstJavaDeclaration = component.getJavaDeclaration();
if(firstJavaDeclaration!=null) {
HashMap<Integer, ISeamJavaComponentDeclaration> usedPrecedences = new HashMap<Integer, ISeamJavaComponentDeclaration>();
@@ -188,7 +192,7 @@
// Save link between component name and java source file.
validationContext.addLinkedResource(declaration.getName(), declaration.getSourcePath());
// Validate all elements in declaration but @Name.
- validateJavaDeclaration(project, firstJavaDeclaration, helper, reporter);
+ validateJavaDeclaration(firstJavaDeclaration);
}
if(declaration!=firstJavaDeclaration) {
// Validate @Name
@@ -196,10 +200,10 @@
ISeamJavaComponentDeclaration javaDeclaration = (ISeamJavaComponentDeclaration)declaration;
int javaDeclarationPrecedence = javaDeclaration.getPrecedence();
ISeamJavaComponentDeclaration checkedDeclaration = usedPrecedences.get(javaDeclarationPrecedence);
- boolean sourceCheckedDeclaration = !((IType)checkedDeclaration.getSourceMember()).isBinary();
if(checkedDeclaration==null) {
usedPrecedences.put(javaDeclarationPrecedence, javaDeclaration);
} else if(sourceJavaDeclaration) {
+ boolean sourceCheckedDeclaration = !((IType)checkedDeclaration.getSourceMember()).isBinary();
IResource javaDeclarationResource = javaDeclaration.getResource();
// Mark nonunique name.
if(!markedDeclarations.contains(checkedDeclaration) && sourceCheckedDeclaration) {
@@ -221,41 +225,84 @@
}
}
}
- validateStatefulComponent(project, component, helper, reporter);
+ boolean source = !((IType)firstJavaDeclaration.getSourceMember()).isBinary();
+ if(source) {
+ validateStatefulComponent(component);
+ validateDuplicateComponentMethods(component);
+ validateEntityComponent(component);
+ }
}
}
- private void validateStatefulComponent(ISeamProject project, ISeamComponent component, IValidationContext helper, IReporter reporter) {
+ private void validateEntityComponent(ISeamComponent component) {
+ if(component.isEntity()) {
+ ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
+ ScopeType scope = component.getScope();
+ if(scope == ScopeType.STATELESS) {
+ ISeamTextSourceReference location = getScopeLocation(component);
+ addError(ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID, new String[]{component.getName()}, location, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
+ }
+ }
+ }
+
+ private ISeamTextSourceReference getScopeLocation(ISeamComponent component) {
ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
- if(javaDeclaration!=null && javaDeclaration.isStateful()) {
- int length = 0;
- int offset = 0;
- try {
- length = javaDeclaration.getSourceMember().getNameRange().getLength();
- offset = javaDeclaration.getSourceMember().getNameRange().getOffset();
- } catch (Exception e) {
- SeamCorePlugin.getDefault().logError(e);
- }
- validateStatefulComponentMethods(project, SeamComponentMethodType.DESTROY, component, length, offset, DESTROY_METHOD_POSTFIX_MESSAGE_ID, helper, reporter);
- validateStatefulComponentMethods(project, SeamComponentMethodType.REMOVE, component, length, offset, REMOVE_METHOD_POSTFIX_MESSAGE_ID, helper, reporter);
+ ISeamTextSourceReference location = ((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_SCOPE);
+ if(location==null) {
+ location = getClassNameLocation(javaDeclaration);
+ }
+ return location;
+ }
+
+ private ISeamTextSourceReference getClassNameLocation(ISeamJavaComponentDeclaration declaration) {
+ int length = 0;
+ int offset = 0;
+ try {
+ length = declaration.getSourceMember().getNameRange().getLength();
+ offset = declaration.getSourceMember().getNameRange().getOffset();
+ } catch (Exception e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ return new SeamTextSourceReference(length, offset);
+ }
+
+ private void validateStatefulComponent(ISeamComponent component) {
+ if(component.isStateful()) {
+ ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
+ validateStatefulComponentMethods(SeamComponentMethodType.DESTROY, component, DESTROY_METHOD_POSTFIX_MESSAGE_ID);
+ validateStatefulComponentMethods(SeamComponentMethodType.REMOVE, component, REMOVE_METHOD_POSTFIX_MESSAGE_ID);
ScopeType scope = component.getScope();
if(scope == ScopeType.PAGE || scope == ScopeType.STATELESS) {
- addError(STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID, new String[]{component.getName()}, length, offset, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
+ ISeamTextSourceReference location = getScopeLocation(component);
+ addError(STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID, new String[]{component.getName()}, location, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
}
}
}
- private void validateStatefulComponentMethods(ISeamProject project, SeamComponentMethodType methodType, ISeamComponent component, int lengthOfClassName, int offsetOfClassName, String postfixMessageId, IValidationContext helper, IReporter reporter) {
+ private void validateStatefulComponentMethods(SeamComponentMethodType methodType, ISeamComponent component, String postfixMessageId) {
ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
+ ISeamTextSourceReference classNameLocation = getClassNameLocation(javaDeclaration);
Set<ISeamComponentMethod> methods = javaDeclaration.getMethodsByType(methodType);
if(methods==null || methods.size()==0) {
- addError(STATEFUL_COMPONENT_DOES_NOT_CONTENT_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, new String[]{component.getName()}, lengthOfClassName, offsetOfClassName, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
- } else if(methods.size()>1) {
+ addError(STATEFUL_COMPONENT_DOES_NOT_CONTENT_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, new String[]{component.getName()}, classNameLocation, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
+ }
+ }
+
+ private void validateDuplicateComponentMethods(ISeamComponent component) {
+ validateDuplicateComponentMethod(SeamComponentMethodType.DESTROY, component, DESTROY_METHOD_POSTFIX_MESSAGE_ID);
+ validateDuplicateComponentMethod(SeamComponentMethodType.REMOVE, component, REMOVE_METHOD_POSTFIX_MESSAGE_ID);
+ validateDuplicateComponentMethod(SeamComponentMethodType.CREATE, component, CREATE_METHOD_POSTFIX_MESSAGE_ID);
+ }
+
+ private void validateDuplicateComponentMethod(SeamComponentMethodType methodType, ISeamComponent component, String postfixMessageId) {
+ ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
+ Set<ISeamComponentMethod> methods = javaDeclaration.getMethodsByType(methodType);
+ if(methods!=null && methods.size()>1) {
for (ISeamComponentMethod method : methods) {
try {
IMethod javaMethod = (IMethod)method.getSourceMember();
String methodName = javaMethod.getElementName();
- addError(STATEFUL_COMPONENT_DUPLICATE_METHOD__SUFIX_MESSAGE_ID + postfixMessageId, new String[]{methodName}, method, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
+ addError(DUPLICATE_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, new String[]{methodName}, method, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
} catch (Exception e) {
SeamCorePlugin.getDefault().logError(e);
}
@@ -263,12 +310,12 @@
}
}
- private void validateJavaDeclaration(ISeamProject project, ISeamJavaComponentDeclaration declaration, IValidationContext helper, IReporter reporter) {
- validateBijections(project, declaration, helper, reporter);
+ private void validateJavaDeclaration(ISeamJavaComponentDeclaration declaration) {
+ validateBijections(declaration);
// TODO
}
- private void validateBijections(ISeamProject project, ISeamJavaComponentDeclaration declaration, IValidationContext helper, IReporter reporter) {
+ private void validateBijections(ISeamJavaComponentDeclaration declaration) {
Set<IBijectedAttribute> bijections = declaration.getBijectedAttributes();
if(bijections==null) {
return;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-13 15:14:33 UTC (rev 2431)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-13 15:23:43 UTC (rev 2432)
@@ -12,6 +12,7 @@
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -59,8 +60,8 @@
* @param oldVariableName
* @param linkedResourcePath
*/
- public void removeLinkedResource(String oldVariableName, IPath linkedResourcePath) {
- Set<IPath> linkedResources = resourcesByVariableName.get(oldVariableName);
+ public void removeLinkedResource(String name, IPath linkedResourcePath) {
+ Set<IPath> linkedResources = resourcesByVariableName.get(name);
if(linkedResources!=null) {
// remove linked resource.
linkedResources.remove(linkedResourcePath);
@@ -68,10 +69,29 @@
// Remove link between resource and variable names.
Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
if(variableNames!=null) {
- variableNames.remove(oldVariableName);
+ variableNames.remove(name);
}
}
+ /**
+ * Removes link between resources and variable names.
+ * @param linkedResources
+ */
+ public void removeLinkedResources(Set<IPath> resources) {
+ for (IPath resource : resources) {
+ Set<String> resourceNames = variableNamesByResource.get(resource);
+ if(resourceNames!=null) {
+ for (String name : resourceNames) {
+ Set<IPath> linkedResources = resourcesByVariableName.get(name);
+ if(linkedResources!=null) {
+ linkedResources.remove(resource);
+ }
+ }
+ }
+ variableNamesByResource.remove(resource);
+ }
+ }
+
public Set<IPath> getResourcesByVariableName(String variableName) {
return resourcesByVariableName.get(variableName);
}
@@ -102,7 +122,7 @@
public void load(Element root) {
Element validation = XMLUtilities.getUniqueChild(root, "validation");
if(validation == null) return;
- Element[] linkedResources = XMLUtilities.getChildren(validation, "inked-resource");
+ Element[] linkedResources = XMLUtilities.getChildren(validation, "linked-resource");
if(linkedResources != null) for (int i = 0; i < linkedResources.length; i++) {
String name = linkedResources[i].getAttribute("name");
if(name == null || name.trim().length() == 0) continue;
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-13 15:14:33 UTC (rev 2431)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-13 15:23:43 UTC (rev 2432)
@@ -28,8 +28,8 @@
*/
public abstract class SeamValidator implements IValidatorJob {
- private IValidationContext helper;
- private IReporter reporter;
+ protected IValidationContext helper;
+ protected IReporter reporter;
public SeamValidator() {
super();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-13 15:14:33 UTC (rev 2431)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-13 15:23:43 UTC (rev 2432)
@@ -10,8 +10,10 @@
******************************************************************************/
NONUNIQUE_COMPONENT_NAME_MESSAGE=Duplicate component name: {0}
UNKNOWN_INJECTION_NAME=Unknown context variable name: {0}
-STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE=Stateful component '{0}' must have a method marked @Remove
-STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY=Stateful component '{0}' must have a method marked @Destroy
-STATEFUL_COMPONENT_WRONG_SCOPE=Stateful component '{0}' should not have org.jboss.seam.ScopeType.PAGE, nor org.jboss.seam.ScopeType.STATELESS
-STATEFUL_COMPONENT_DUPLICATE_REMOVE=Duplicate @Remove method '{0}'
-STATEFUL_COMPONENT_DUPLICATE_DESTROY=Duplicate @Destroy method '{0}'
\ No newline at end of file
+STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE=Stateful component "{0}" must have a method marked @Remove
+STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY=Stateful component "{0}" must have a method marked @Destroy
+STATEFUL_COMPONENT_WRONG_SCOPE=Stateful component "{0}" should not have org.jboss.seam.ScopeType.PAGE, nor org.jboss.seam.ScopeType.STATELESS
+ENTITY_COMPONENT_WRONG_SCOPE=Entity component "{0}" should not have org.jboss.seam.ScopeType.STATELESS
+DUPLICATE_REMOVE=Duplicate @Remove method "{0}"
+DUPLICATE_DESTROY=Duplicate @Destroy method "{0}"
+DUPLICATE_CREATE=Duplicate @Create method "{0}"
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2431 - in trunk/documentation/GettingStartedGuide/docs/userguide/en: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sabrashevich
Date: 2007-07-13 11:14:33 -0400 (Fri, 13 Jul 2007)
New Revision: 2431
Removed:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedForCreatingaJSFApplication.xml
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforCreatingaStrutsApplication.xml
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJSFwithHibernate.xml
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJavaServerFaces.xml
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/master.xml
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml
Log:
http://jira.jboss.com/jira/browse/EXIN-385 updated textual context, chapters 2, 4, 5, 6 moved out to a ClassicReferenceManual
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/master.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/master.xml 2007-07-13 14:32:14 UTC (rev 2430)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/master.xml 2007-07-13 15:14:33 UTC (rev 2431)
@@ -3,13 +3,8 @@
"../../../../resources/support/docbook-dtd/docbookx.dtd"
[<!ENTITY GettingStartedWithRHDS SYSTEM "modules/GettingStartedWithRHDS.xml">
-<!ENTITY GettingStartedGuideforJSFwithHibernate SYSTEM "modules/GettingStartedGuideforJSFwithHibernate.xml">
<!ENTITY AjaxCRUDApplicationWithSeamAndRichFaces SYSTEM "modules/AjaxCRUDApplicationWithSeamAndRichFaces.xml">
<!--<!ENTITY BusinessProcessAndRulesApplication SYSTEM "modules/BusinessProcessAndRulesApplication.xml">-->
-<!ENTITY GettingStartedGuideforJavaServerFaces SYSTEM "modules/GettingStartedGuideforJavaServerFaces.xml">
-<!ENTITY GettingStartedForCreatingaJSFApplication SYSTEM "modules/GettingStartedForCreatingAJSFApplication.xml">
-<!ENTITY GettingStartedGuideforCreatingaStrutsApplication SYSTEM "modules/GettingStartedGuideforCreatingaStrutsApplication.xml">
-<!ENTITY GettingStartedStrutsValidationExamples SYSTEM "modules/GettingStartedStrutsValidationExamples.xml">
]>
<book>
@@ -29,12 +24,8 @@
&GettingStartedWithRHDS;
-&GettingStartedGuideforJSFwithHibernate;
&AjaxCRUDApplicationWithSeamAndRichFaces;
<!--&BusinessProcessAndRulesApplication;-->
-&GettingStartedForCreatingaJSFApplication;
-&GettingStartedGuideforCreatingaStrutsApplication;
-&GettingStartedStrutsValidationExamples;
<!--
&GettingStartedGuideforJavaServerFaces;
-->
Deleted: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedForCreatingaJSFApplication.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedForCreatingaJSFApplication.xml 2007-07-13 14:32:14 UTC (rev 2430)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedForCreatingaJSFApplication.xml 2007-07-13 15:14:33 UTC (rev 2431)
@@ -1,371 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="GettingStartedForCreatingAJSFApplication" xreflabel="GettingStartedForCreatingAJSFApplication">
- <?dbhtml filename="GettingStartedForCreatingAJSFApplication.html"?>
- <chapterinfo>
- <keywordset>
- <keyword>Red Hat Developer Studio</keyword>
- <keyword>JSF application</keyword>
- <keyword>Java</keyword>
- </keywordset>
- </chapterinfo>
-
- <title>Getting Started Guide for
-Creating a JSF Application</title>
-<section id="CreatingAJSFApplication">
-<?dbhtml filename="GettingStartedForCreatingAJSFApplication.html"?>
-<title>Creating a Simple JSF Application</title>
-<para>We are going to show you how to create a simple JSF application using the Red Hat Developer Studio
- plug-in for Eclipse. The completed application will ask a user to enter a name and click
-a button. The resulting new page will display the familiar message, "Hello <name>!"
-This document will show you how to create such an application from the beginning, along
-the way demonstrating some of the powerful features of Red Hat Developer Studio. You will design the
-JSF application and then run the application from inside Red Hat Developer Studio.
-We'll assume that you have already launched Eclipse with Red Hat Developer Studio installed and
-also that the Red Hat Developer Studio perspective is the current one. (If not, make it active by
-selecting <emphasis>Window > Open Perspective > Red Hat Developer Studio</emphasis> from the menu bar or by selecting <emphasis>Window/
-Open Perspective/Other...</emphasis> from the menu bar and then selecting Red Hat Developer Studio from
-the Select Perspective dialog box.)</para>
-</section>
-<section id="SettingUpTheProject">
-<?dbhtml filename="SettingUpTheProject.html"?>
-<title>Setting Up the Project</title>
-<para>We are first going to create a new project for the application.</para>
-<itemizedlist>
-<listitem><para>Go to the menu bar and select <emphasis>File > New > Project...</emphasis> .</para></listitem>
-<listitem><para>Select <emphasis>Red Hat Developer Studio > JSF > JSF Project</emphasis> in the New Project dialog box.</para></listitem>
-<listitem><para>Click Next</para></listitem>
-<listitem><para>Enter jsfHello as the project name.</para></listitem>
-<listitem><para>Leave everything else as is, and click Finish.</para></listitem>
-
-</itemizedlist>
-</section>
-<section id="TheJSFApplicationConfigurationFile">
-<?dbhtml filename="TheJSFApplicationConfigurationFile.html"?>
-<title>The JSF Application Configuration File</title>
-<para>A jsfHello node should appear in the upper-left Package Explorer view.</para>
- <figure>
- <title>Package Explorer View</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/pev.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-<itemizedlist continuation="continues">
-<listitem><para>Click the plus sign next to jsfHello to reveal the child nodes.</para></listitem>
-<listitem><para>Click the plus sign next to WebContent under jsfHello.</para></listitem>
-<listitem><para>Click the plus sign next to WEB-INF under WebContent.</para></listitem>
-
-<listitem><para>Then double-click on the faces-config.xml node to display the JSF application configuration file editor.</para></listitem>
-</itemizedlist>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/ConfigEditor.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-
-</section>
-<section id="AddingNavigationToTheApplication">
-<?dbhtml filename="AddingNavigationToTheApplication.html"?>
-<title>Adding Navigation to the Application</title>
-<para>In our simple application, the flow is defined as a single navigation rule connecting two
-views (presentation files). At this point, we will create the placeholders for the two JSP presentation
-files and then the navigation rule to connect them as views. Later, we will complete
-the coding for the JSP presentation files. With Red Hat Developer Studio, we can do all of this in the
-Diagram mode of the configuration file editor.</para>
-<section id="AddingTwoViews(JSPPages)">
-<?dbhtml filename="AddingTwoViews(JSPPages).html"?>
-<title>Adding Two Views (JSP Pages)</title>
-<itemizedlist continuation="continues">
-<listitem><para>Right-click anywhere on the diagram and select<emphasis>New View...</emphasis> from the pop-up
-menu</para></listitem>
-<listitem><para>In the dialog box, type pages/inputname as the value for From-view-id</para></listitem>
-<listitem><para>Leave everything else as is</para></listitem>
-<listitem><para>Click Finish.</para>
-<para>If you look in the Package Explorer view you should see a pages folder under WebContent. Opening it
-will reveal the JSP file you just created</para>
-</listitem>
-<listitem><para>Back on the diagram, right-click anywhere and select<emphasis>New View...</emphasis> from the popup
-menu</para></listitem>
-<listitem><para>In the dialog box, type pages/greeting as the value for From-view-id</para></listitem>
-<listitem><para>Leave everything else as is</para></listitem>
-<listitem><para>Click Finish</para></listitem>
-</itemizedlist>
-<section id="CreatingTheTransition(NavigationRule)">
-<?dbhtml filename="CreatingTheTransition(NavigationRule).html"?>
-<title>Creating the Transition (Navigation Rule)</title>
-<itemizedlist continuation="continues">
-<listitem><para>In the diagram, select the connection icon third from the top along the upper left
-side of the diagram</para></listitem>
-</itemizedlist>
-<figure>
- <title>Connection icon</title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/arrow.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-<para>to get an arrow cursor with a two-pronged plug at the arrow's bottom.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Click on the pages/inputname page icon and then click on the pages/greeting page icon</para></listitem>
-
-</itemizedlist>
-<para>A transition should appear between the two icons.</para>
-<figure>
-<title>Transition between two icons</title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/connection.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-<itemizedlist continuation="continues">
-<listitem><para>Select File/Save from the menu bar.</para></listitem>
-</itemizedlist>
-</section>
-</section>
-</section>
-<section id="AddingAManagedBeanToTheApplication">
-<?dbhtml filename="AddingAManagedBeanToTheApplication.html"?>
-<title>Adding a Managed Bean to the Application</title>
-<para>To store data in the application, we will use a managed bean.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Click on the Tree tab at the bottom of the editing window</para></listitem>
-<listitem><para>Select the Managed Beans node and then click the <emphasis>Add...</emphasis> button displayed along
-the right side of the editor window</para></listitem>
-<listitem><para>Type in jsfHello.PersonBean for Class and personBean for Name. Leave
-Scope as is and Generate Source Code as is (checked)</para></listitem>
-<listitem><para>Click Finish</para></listitem>
-<listitem><para>personBean will now be selected and three sections of information, Managed
-Bean, Properties, and Advanced, will be displayed about it. Under the Properties
-section, click the <emphasis>Add...</emphasis> button</para></listitem>
-<listitem><para>For Property-Name type in name. Leave everything else as is. (When Property-
-Class is not filled in, String is the assumed type.)</para></listitem>
-<listitem><para>Click Finish</para></listitem>
-<listitem><para>Select the personBean node in the tree</para></listitem>
-</itemizedlist>
-<para>You should see this now:</para>
-<figure>
-<title>Tree view in Config Editor</title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/ConfigEditor2.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-<itemizedlist continuation="continues">
-<listitem><para>Select File/Save from the menu bar.</para></listitem>
-</itemizedlist>
-<para>You have now registered the managed bean and created a stub-coded class file for it.</para>
-</section>
-<section id="EditingTheJSPViewFiles">
-<?dbhtml filename="EditingTheJSPViewFiles.html"?>
-<title>Editing the JSP View Files</title>
-
-<para>Now we will finish editing the JSP files for our two "views" using Red Hat JSP Visual Page</para>
-<section id="Inputname.jsp">
-<title>inputname.jsp</title>
-<itemizedlist continuation="continues">
-<listitem><para>Click on the Diagram tab for the configuration file editor</para></listitem>
-<listitem><para>Open the editor for this first JSP file by double-clicking on the /pages/inputname.
-jsp icon</para></listitem>
-</itemizedlist>
-
-<para>The Visual Page Editor will open in a screen split between source code along the top and
-a WYSIWIG view along the bottom:</para>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/visual.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-<para>Some JSF code will already be in the file because we selected a template when creating the page.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Select the Visual tab, so we can work with the editor completely in its WYSIWYG
-mode</para></listitem>
-<listitem><para>To the right of the editor, in the Red Hat Palette, expand the JSF HTML palette folder
-by selecting it</para></listitem>
-</itemizedlist>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/RHDSpalette.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-<itemizedlist continuation="continues">
-<listitem><para>Click on form within this folder, drag the cursor over to the editor,
-and drop it inside the red box in the editor</para></listitem>
-
-<listitem><para>Another red box will appear inside the first red box.</para></listitem>
-
-<listitem><para>Right-click on the innermost box and select <h:form> Attributes from the menu</para></listitem>
-<listitem><para>In the value field next to id, type greeting and click on the Close button</para></listitem>
-<listitem><para>Type Please enter name: inside the boxes</para></listitem>
-<listitem><para>Select inputText within the JSF HTML palette folder and drag it into the innermost
-box in the editor after "Please enter name:"</para></listitem>
-<listitem><para>In the attributes dialog, click in the value field next to the value attribute and click
-on the <emphasis>... </emphasis>button</para></listitem>
-<listitem><para>Then, select the <emphasis>Managed Beans/personBean/name</emphasis> node and click on the Ok
-button</para></listitem>
-<listitem><para>Back in the attributes dialog, select the Advanced tab, type in name as the value
-for the id attribute, and then click on the Finish button</para></listitem>'
-<listitem><para>Select commandButton within the JSF HTML palette folder and drag it into the
-innermost box in the editor after the input box</para></listitem>
-<listitem><para>In the attributes dialog, click in the value field next to the action attribute and click
-on the <emphasis>... </emphasis>button</para></listitem>
-<listitem><para>Then, select the <emphasis>View Actions/greetin</emphasis>g node and click on the Ok button</para></listitem>
-<listitem><para>Back in the attributes dialog box, type in Say Hello as the value for the value
-attribute ("Say Hello") and then click on the Finish button</para></listitem>
-</itemizedlist>
-<para>The source coding should be something like this now:</para>
-<programlisting role="XML"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<html>
-<head>
-<title></title>
-</head>
-<body>
-<f:view>
-<h:form id="greeting">
-<para>Please enter a name:</para>
-<h:inputText id="name" value="#{personBean.name}"/>
-<h:commandButton value=" Say Hello " action="greeting"/>
-</h:form>
-</f:view>
-</body>
-</html>
-]]></programlisting>
-<para>The editor should look like this:</para>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/visual2.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-<itemizedlist continuation="continues">
-<listitem><para>Save the file by selecting File/Save from the menu bar.</para></listitem>
-</itemizedlist>
-</section>
-<section id="Greeting.jsp">
-<title>greeting.jsp</title>
-<itemizedlist continuation="continues">
-<listitem><para>Click on the faces-config.xml tab to bring the diagram back</para></listitem>
-<listitem><para>Open the editor for the second file by double-clicking on the /pages/greeting.jsp
-icon</para></listitem>
-<listitem><para>Select the Visual tab, so we can work with the editor completely in its WYSIWYG
-mode</para></listitem>
-<listitem><para>Type Hello (note space after hello) into the box</para></listitem>
-<listitem><para>Select outputText within the JSF HTML palette folder and drag it into the innermost
-box in the editor after "Hello"</para></listitem>
-<listitem><para>In the attributes dialog, click in value field next to the value attribute and click on
-the ... button</para></listitem>
-<listitem><para>Then, select the <emphasis>Managed Beans/personBean/name</emphasis> node, click on the Ok button,
-and then click on the Finish button</para></listitem>
-<listitem><para>Right after the output field, type an exclamation point (!)</para></listitem>
-</itemizedlist>
-<para>The source coding should be something like this now:</para>
-<programlisting role="XML"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<html>
-<head>
-<title></title>
-</head>
-<body>
-<f:view>
-Hello <h:outputText value="#{personBean.name}"/>!
-</f:view>
-</body>
-</html>
-]]></programlisting>
-<itemizedlist continuation="continues">
-<listitem><para>Save the file.</para></listitem></itemizedlist>
-</section>
-</section>
-<section id="CreatingTheStartPage">
-<?dbhtml filename="CreatingTheStartPage.html"?>
-<title>Creating the Start Page</title>
-<para>You also need to create a start page as an entry point into the application.</para>
-<itemizedlist continuation="continues">
-<listitem><para>In the Package Explorer view to the left, right-click <emphasis>jsfHello/WebContent</emphasis> and select
-New/JSP File</para></listitem>
-<listitem><para>For Name type in index, for Template select JSPRedirect and click Finish.</para></listitem>
-</itemizedlist>
-<para>A JSP editor will open up on the newly created file.</para>
-
-<itemizedlist continuation="continues">
-<listitem><para>In the Source part of the split screen, type <emphasis>/pages/inputname.jsf</emphasis> in between
-the quotes for the page attribute</para></listitem>
-</itemizedlist>
-<para>The source coding should look like this now:</para>
-<programlisting role="JSP"><![CDATA[<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head></head>
-<body>
-<jsp:forward page="/pages/inputname.jsf" />
-</body>
-</html>
-]]></programlisting>
-
-<para>Note the .jsf extension for the file name. This is a mapping defined in the web.xml file
-for the project for invoking JavaServer Faces when you run the application.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Select<emphasis> File/Save</emphasis> from the menu bar.</para></listitem>
-</itemizedlist>
-</section>
-<section id="RunningTheApplicationJSF">
-<?dbhtml filename="RunningTheApplicationJSF.html"?>
-<title>Running the Application</title>
-<para>Everything is now ready for running our application without having to leave Red Hat Developer Studio
-by using the JBoss engine that comes with the Red Hat Developer Studio plug-in. For controlling
-JBoss server within Red Hat Developer Studio, the toolbar contains a special panel</para>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/running.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-<itemizedlist continuation="continues">
-<listitem><para>Start up Tomcat by clicking on the first icon from left. (If Tomcat is already running,
-stop it by clicking on the third icon from the left and then start it again. Remember,
-the JSF run-time requires restarting the servlet engine when any changes have been
-made.) After the messages in the Console tabbed view stop scrolling, Tomcat is available.</para></listitem>
-
-<listitem><para>Click on the Red Hat run icon in the toolbar:</para></listitem>
-</itemizedlist>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/run.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-<para>This is the equivalent of launching the browser and typing http://localhost:8080/jsfHello into your
- browser. Our JSF application should now appear.</para>
- </section>
-
- <section id="OtherRelevantResourcesOnTheTopic3">
-<?dbhtml filename="OtherRelevantResourcesOnTheTopic3.html"?>
-<title>Other relevant resources on the topic</title>
-<para>JSF on Sun: <ulink url="http://java.sun.com/javaee/javaserverfaces/">JavaServer Faces Technology</ulink></para>
-<para>Core JSF: <ulink url="http://www.horstmann.com/corejsf/">Core JavaServer Faces</ulink></para>
-<para>API: <ulink url="http://java.sun.com/javaee/javaserverfaces/1.1/docs/api/index.html">JSF API</ulink></para>
-<para>JSF Tags: <ulink url="http://www.horstmann.com/corejsf/jsf-tags.html">JSF Core Tags</ulink></para>
-<para>HTML Tags Reference: <ulink url="http://www.exadel.com/tutorial/jsf/jsftags-guide.html">JSF HTML Tags Reference</ulink></para>
-<para>JSF Central: <ulink url="http://www.jsfcentral.com/">JSF Central - Your JavaServer Faces Community</ulink></para>
-<para>FAQ: <ulink url="http://wiki.java.net/bin/view/Projects/JavaServerFacesSpecFaq">JSF FAQ</ulink></para>
-<para>Download: <ulink url="http://java.sun.com/javaee/javaserverfaces/download.html">JavaServer Faces Technology - Download</ulink></para>
-</section>
- </chapter>
\ No newline at end of file
Deleted: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforCreatingaStrutsApplication.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforCreatingaStrutsApplication.xml 2007-07-13 14:32:14 UTC (rev 2430)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforCreatingaStrutsApplication.xml 2007-07-13 15:14:33 UTC (rev 2431)
@@ -1,504 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<chapter id="GettingStartedGuideforCreatingaStrutsApplication" xreflabel="GettingStartedGuideforCreatingaStrutsApplication">
- <?dbhtml filename="GettingStartedGuideforCreatingaStrutsApplication.html"?>
- <title>Getting Started Guide for Creating a Struts Application</title>
-<para>We are going to show you how to create a simple Struts application using the Red Hat Developer Studio
-plug-in for Eclipse. The completed application will ask a user to enter a name and click a button.
-The resulting new page will display the familiar message, Hello <name>!</para>
-<para>This document will show you how to create such an application from the beginning, along
-the way demonstrating some of the powerful features of Red Hat Developer Studio. You will design the
-application, generate stub code for the application, fill in the stub coding, compile the application,
-and run the application all from inside Red Hat Developer Studio.</para>
-<para>Well assume that you have already launched Eclipse with Red Hat Developer Studio installed and also that the Red Hat Developer Studio perspective is the current perspective. (If not,
-make it active by selecting Window/Open Perspective/Other/Red Hat Developer Studio from the menu bar.)</para>
-
- <section id="StartingUp">
- <title>Starting Up</title>
-<para>We are first going to create a new project for the application.</para>
- <itemizedlist>
-<listitem><para>Go to the menu bar and select File/New/<emphasis>Project...</emphasis>.</para></listitem>
-<listitem><para><emphasis>Select Red Hat Developer Studio/Struts/Struts Project</emphasis> in the New Project dialog box.</para></listitem>
-<listitem><para>Click Next >.</para></listitem>
-<listitem><para>Enter StrutsHello as the project name.</para></listitem>
-<listitem><para>Leave everything else as is, and click Next >.</para></listitem>
-<listitem><para>Click Next> again.</para></listitem>
- <listitem><para>7. Make sure that struts-bean.tld, struts-html.tld, and struts-logic.tld are checked in the list of included tag libraries and then click Finish.</para></listitem>
-</itemizedlist>
-<para>A StrutsHello node should appear in the upper-left Package Explorer view.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Click the plus sign next to StrutsHello to reveal the child nodes.</para></listitem>
-<listitem><para>Click the plus sign next to WebContent under StrutsHello.</para></listitem>
-<listitem><para>Click the plus sign next to WEB-INF under WebContent.</para></listitem>
- <listitem><para>Then, double-click on the struts-config.xml node to display a diagram of the Struts application configuration file in the editing area.</para></listitem>
- </itemizedlist>
-<para>At this point, its empty except for the background grid lines.</para>
- </section>
-
- <section id="CreatingtheApplicationComponents">
- <?dbhtml filename="CreatingtheApplicationComponents.html"?>
- <title>Creating the Application Components</title>
-<para>Now, we will design the application by creating the individual components as placeholders
-first. (We dont have to complete all of the details inside the components until afterwards.)</para>
- <section id="CreatingJSPPagePlaceholders">
- <title>Creating JSP Page Placeholders</title>
- <para>Next, let's create and place two JSP pages. We will not write any code for the files, but only
-create them as placeholders so that we can create links to them in the diagram. We will write
-the code a little bit later.</para>
- <section id="CreatingthePagePlaceholders">
- <title>Creating the Page Placeholders</title>
- <itemizedlist continuation="continues">
-<listitem><para>Bring the Web Projects view to the front of the Package Explorer view by selecting the Web Projects tab next to that tab.</para></listitem>
-<listitem><para>Right-click the StrutsHello/WEB-ROOT (WebContent) folder in the Web Projects view and select New/<emphasis>Folder...</emphasis>.</para></listitem>
-<listitem><para>Enter pages for a folder name and click Finish.</para></listitem>
-
-<listitem><para>We will keep our presentation files in this folder.</para></listitem>
-
-<listitem><para>Right-click the pages folder and select New/File/JSP... .</para></listitem>
- <listitem><para>For Name type in inputname (the JSP extension will be automatically added to the file), for Template select StrutsForm, and then click on the Finish button.</para></listitem>
-<listitem><para>Right-click the pages folder again and select New/File/JSP... .</para></listitem>
-<listitem><para>For Name type in greeting , for Template leave as Blank, and then click on the Finish button.</para></listitem>
- </itemizedlist>
-<para>Just leave these files as is for now.</para>
- </section>
- <section id="PlacingthePagePlaceholders">
- <title>Placing the Page Placeholders</title>
-<para>Lets now place the two pages just created on the diagram.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Click on the struts-config.xml tab in the Editing area to bring the diagram to the front.</para></listitem>
-<listitem><para>Click on the inputname.jsp page in the Web Projects view, drag it onto the diagram, and drop it.</para></listitem>
-<listitem>Click on the greeting.jsp page in the Web Projects view, drag it onto the diagram,
-and drop it to the right of the /pages/inputname.jsp icon with some extra space.</listitem>
-</itemizedlist>
-<para>You should now have two JSP pages in the diagram.</para>
- </section>
- </section>
- <section id="CreatinganActionMappings">
- <title>Creating an Action Mappings</title>
-<para>Using a context menu on the diagram, we are next going to create an Action mapping.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Right-click between the two icons and select Add/Action</para></listitem>
-<listitem><para>Enter the following values:</para></listitem>
- </itemizedlist>
- <table>
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>path</entry>
- <entry>/greeting</entry>
- </row>
- <row>
- <entry>name</entry>
- <entry>GetNameForm</entry>
- </row>
- <row>
- <entry>scope</entry>
- <entry>request</entry>
- </row>
- <row>
- <entry>type</entry>
- <entry>sample.GreetingAction</entry>
- </row>
- <row>
- <entry>validate</entry>
- <entry><leave blank></entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-<para>(GetNameForm is the name for a form bean that we will create later.)</para>
-<itemizedlist continuation="continues">
- <listitem><para>Click Finish.</para></listitem>
-</itemizedlist>
-
-<para>The /greeting action should appear in two places, in the diagram and also under the action-mappings node under the struts-config.xml node in the Outline view. Also, note the
-asterisk to the right of the name, struts-config.xml, in the Outline view showing that the file has been changed, but not saved to disk.</para>
- </section>
- <section id="CreatingaLink">
- <title>Creating a Link</title>
-<para>Let's now create a link from the inputname.jsp page to the action.</para>
- <itemizedlist continuation="continues">
-<listitem><para>On the left-hand side of the diagram in the column of icons, click on this icon:</para></listitem>
- </itemizedlist>
- <figure>
- <title>Create New Connection Icon</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/arrow.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <itemizedlist continuation="continues">
- <listitem><para>In the connect-the-components mode you are in now, click on the /pages/inputname.jsp icon in the diagram and then click on the /greeting action.</para></listitem>
- </itemizedlist>
-<para>A link will be created from the page to the action.</para>
- </section>
- <section id="CreatingaForward">
- <title>Creating a Forward</title>
-<para>Next, we are going to create a forward for the action.</para>
- <itemizedlist continuation="continues">
-<listitem><para>On the left-hand side of the diagram in the column of icons, click on this icon, again:</para></listitem>
- </itemizedlist>
- <figure>
- <title>Create New Connection Icon</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/arrow.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <itemizedlist continuation="continues">>
-<listitem><para>Click on the /greeting action icon in the diagram and then click on the /pages/greeting.jsp icon.</para></listitem>
-
-<listitem><para>Thats it. A link will be drawn from the actions new greeting forward to the greeting.jsp JSP page. Note that the forwards name will be set based on the name of the target JSP file
-name. If you dont like it, you can easily change it.</para></listitem>
-
-<listitem><para>Select the Tree tab at the bottom of the editor window (between Diagram and Source).</para></listitem>
-<listitem><para>Expand the struts-config.xml/action-mappings//greeting node and then select the greeting forward.</para></listitem>
-<listitem><para>In the Properties Editor to the right, change the text to sayHello in the Name field.</para></listitem>
-<listitem><para>Select the Diagram tab at the bottom of the editor window and see how the diagram is also updated to reflect the change.</para></listitem>
- </itemizedlist>
- </section>
- <section id="CreatingaGlobalForward">
- <title>Creating a Global Forward</title>
-<para>One last component that we need to create in the diagram is a global forward.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Somewhere in the top-left corner of diagram, right-click and select <emphasis> Add/Global Forward...</emphasis></para></listitem>
-<listitem><para>Enter getName in the Name field.</para></listitem>
-<listitem><para>Select the <emphasis>Change...</emphasis>button for Path.</para></listitem>
-<listitem><para>In the Edit Path window, switch to the Pages tab.</para></listitem>
-<listitem><para>Expand the <emphasis>StrutsHello/WEB-ROOT (WebContent)/pages</emphasis> node and then select the inputname.jsp page.</para></listitem>
-<listitem><para>Click <emphasis>Ok</emphasis>.</para></listitem>
-<listitem><para>Leave the rest of the fields blank and click <emphasis>Ok</emphasis>.</para></listitem>
- </itemizedlist>
-<para>A forward object now appears on the diagram and also in the global-forwards folder in the Outline view.</para>
- <itemizedlist continuation="continues">
- <listitem><para>Tidy up the diagram, by clicking and dragging around each icon, so that the diagram looks something like this:</para></listitem>
- </itemizedlist>
- <figure>
- <title>Diagram View</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/Diagram.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section id="CreatingaFormBean">
- <title>Creating a Form Bean</title>
-<para>One last thing that we need to do is to create a form bean.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Switch to the Tree viewer in the editor for the struts-config.xml file, by selecting the Tree tab at the bottom of the editor window.</para></listitem>
-<listitem><para>Right-click struts-config.xml/form-beans and select Create Form Bean.</para></listitem>
-<listitem><para>Enter GetNameForm in the name field and sample.GetNameForm for type.</para></listitem>
-<listitem><para>Click Finish.</para></listitem>
-<listitem><para>To save your changes to struts-config.xml, select <emphasis>File/Save</emphasis> from the menu bar.</para></listitem>
- </itemizedlist>
-<para>Note the disappearance of the asterisk next to the name, struts-config.xml.</para>
-</section>
-</section>
-
- <section id="GeneratingStubCoding">
- <?dbhtml filename="GeneratingStubCoding.html"?>
- <title>Generating Stub Coding</title>
- <para>We are done with designing the application through the diagram. Now we need to write
- code for the action component. We also need to write an action class for the /greeting mapping
- along with a FormBean. To aid in the coding phase, Red Hat Developer Studio can generate Java class
- stubs for all of the components shown in the diagram.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Switch back to the diagram, by selecting the Diagram tab at the bottom of the editor window.</para></listitem>
-<listitem><para>Right-click a blank space in the diagram and select Generate Java Code.</para></listitem>
-<listitem><para>Leave everything as is in the dialog box and click Generate .</para></listitem>
-</itemizedlist>
-<para>You should see a screen that says:</para>
-<para>Generated classes: 2</para>
-<para>Actions: 1</para>
-<para>Form beans: 1</para>
- <itemizedlist continuation="continues">
-<listitem><para>Click Finish.</para></listitem>
- </itemizedlist>
-<para>The Java files will be generated in a <emphasis>JavaSource/sample</emphasis> folder that you can see in the Package
- Explorer view under the StrutsHello node. One Action stub and one FormBean stub will have been generated.</para>
- </section>
- <section id="CodingtheVariousFiles">
- <?dbhtml filename="CodingtheVariousFiles.html"?>
- <title>Coding the Various Files</title>
-<para>We will now code both the Java stub classes just generated, the JSP files left in as placeholders
- from previous steps, and a new start JSP page we will have to create.</para>
- <section id="JavaStubClasses">
- <title>Java Stub Classes</title>
- <itemizedlist continuation="continues">
- <listitem><para>To finish the two Java classes, switch to the Package Explorer view and expand the <emphasis>JavaSource/sample</emphasis> folder.</para></listitem>
- </itemizedlist>
- <section id="GetNameForm.java">
- <title>GetNameForm.java</title>
- <itemizedlist continuation="continues">
-<listitem><para>Double-click GetNameForm.java for editing.</para></listitem>
-
-<listitem><para>You are looking at a Java stub class that was generated by Red Hat Developer Studio. Now we are going to edit the file.</para></listitem>
-
-<listitem><para>Add the following attributes at the beginning of the class:</para></listitem>
- </itemizedlist>
-<para>private String name = "";</para>
-<para>private String greetName = "";</para>
- <itemizedlist continuation="continues">
-<listitem><para>Inside the reset method, delete the TO DO and throw lines and add:</para></listitem>
-</itemizedlist>
-<para>this.name = "";</para>
-<para>this.greetName = "";</para>
- <itemizedlist continuation="continues">
-<listitem><para>Inside the validate method, delete the TO DO and throw lines and add:</para></listitem>
- </itemizedlist>
-<para>ActionErrors errors = new ActionErrors();</para>
-<para>return errors;</para>
- <itemizedlist continuation="continues">
-<listitem><para>Right-click and select Source/Generate Getters and <emphasis>Setters...</emphasis>from the context menu.</para></listitem>
-<listitem><para>In the dialog box, check the check boxes for name and greetName, select First method for Insertion point, and click on the OK button.</para></listitem>
- </itemizedlist>
-<para>The final GetNameForm.java file should look like this:</para>
-<programlisting role="JAVA"><![CDATA[
-package sample;
-
-import javax.servlet.http.HttpServletRequest;
-import org.apache.struts.action.ActionErrors;
-import org.apache.struts.action.ActionMapping;
-
-public class GetNameForm extends org.apache.struts.action.ActionForm {
-
- private String name = "";
- private String greetName = "";
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
-
- public String getGreetName() {
- return greetName;
- }
-
- public void setGreetName(String greetName) {
- this.greetName = greetName;
- }
-
- public GetNameForm() {
- }
-
- public void reset(ActionMapping actionMapping, HttpServletRequest request) {
- this.name = "";
- this.greetName = "";
- }
-
- public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest request) {
- ActionErrors errors = new ActionErrors();
- return errors;
- }
-}
-]]></programlisting>
-
-<itemizedlist continuation="continues">
-<listitem><para>Save the file.</para></listitem>
-</itemizedlist>
-</section>
- <section id="GreetingAction.java">
- <title>GreetingAction.java</title>
- <itemizedlist continuation="continues">
-<listitem><para>Open GreetingAction.java for editing.</para></listitem>
-<listitem><para>Inside the execute method, delete the TO DO and throw lines and add the following:</para></listitem>
- </itemizedlist>
-
- <programlisting role="JAVA"><![CDATA[
-String name = ((GetNameForm)form).getName();
-String greeting = "Hello, "+name+"!";
-((GetNameForm)form).setGreetName(greeting);
-return mapping.findForward(FORWARD_sayHello);
-
-The final version of GreetingAction.java should look like this:
-package sample;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-
-public class GreetingAction extends org.apache.struts.action.Action {
-
- // Global Forwards
- public static final String GLOBAL_FORWARD_getName = "getName";
-
- // Local Forwards
- public static final String FORWARD_sayHello = "sayHello";
-
- public GreetingAction() {
- }
- public ActionForward execute(ActionMapping mapping, ActionForm form,
- HttpServletRequest request, HttpServletResponse response) throws Exception {
- String name = ((GetNameForm)form).getName();
- String greeting = "Hello, "+name+"!";
- ((GetNameForm)form).setGreetName(greeting);
- return mapping.findForward(FORWARD_sayHello);
- }
-}
-]]></programlisting>
- <itemizedlist continuation="continues">
-<listitem><para>Save the file.</para></listitem>
-<listitem><para>Close the editors for the two Java files.</para></listitem>
- </itemizedlist>
-<para>The last thing left to do is to code the JSP files whose editors should still be open from having been created as placeholders.</para>
- </section>
- </section>
- <section id="JSPPages">
- <title>JSP Pages</title>
- <section id="inputname.jsp">
- <title>inputname.jsp</title>
-<para>In this page, the user will enter any name and click the submit button. Then, the greeting action will be called through the form.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Click on the inputname.jsp tab in the Editing area to bring its editor forward.</para></listitem>
-<listitem><para>In the Web Projects view, expand <emphasis>StrutsHello/Configuration/default/strutsconfig.xml/action-mappings</emphasis> and select <emphasis>/greeting</emphasis>.</para></listitem>
-<listitem><para>Drag it and drop it between the quotes for the action attribute to the html:form element in the Source pane of the editor.</para></listitem>
-<listitem><para>Then type this text on a new line just below this line:</para></listitem>
-
-<listitem><para>Input name:</para></listitem>
-
-<listitem><para>Select the Visual pane of the editor.</para></listitem>
-<listitem><para>Then, in the Red Hat Palette, expand the Struts Form library, select text, and drag it onto the box.</para></listitem>
- </itemizedlist>
- <figure>
- <title>Red Hat Palette</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/RH_Palette.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <itemizedlist continuation="continues">
- <listitem><para>In the Insert Tag dialog box, type in name for property and select Finish.</para></listitem>
-<listitem><para>In the Struts Form library in the Red Hat Palette, select submit, and drag it to right after the the text box in the Visual pane of the editor.</para></listitem>
-<listitem><para>Right-click the submit button and select <html:submit> Attributes from the context menu.</para></listitem>
-<listitem><para>In the Attributes dialog box, select the value field and type in Say Hello! for its value.</para></listitem>
- </itemizedlist>
-<para>After tidying the page source, the Editor window for the file should look something like this:</para>
- <figure>
- <title>Editor window</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/strinputname.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section id="greeting.jsp">
- <title>greeting.jsp</title>
-<para>Next, we will fill in the result page.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Click on the greeting.jsp tab in the Editing area to bring its editor forward.</para></listitem>
-<listitem><para>Type in the following code:</para></listitem>
- </itemizedlist>
-<programlisting role="XML"><![CDATA[
-<html>
-<head>
- <title>Greeting</title>
-</head>
- <body>
- <p>
- </p>
- </body>
-</html>
-]]></programlisting>
-
-<para>To complete editing of this file, we will use macros from the Red Hat Palette. This palette is a view that should be available to the right of the editing area.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Click on the <emphasis>Struts Common</emphasis> folder in the Red Hat Palette to open it.</para></listitem>
-<listitem><para>Position the cursor at the beginning of the greeting.jsp file in the Source pane and then click on bean taglib in the Red Hat Palette.</para></listitem>
-</itemizedlist>
-<para>This will insert the following line at the top of the file:</para>
-<programlisting role="JAVA"><![CDATA[
-<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
-]]></programlisting>
-<itemizedlist continuation="continues">
-<listitem><para>Click on the Struts Bean folder in the Red Hat Palette to open it.</para></listitem>
-<listitem><para>Position the cursor inside the p element.</para></listitem>
-<listitem><para>Click on write in the Red Hat Palette.</para></listitem>
-<listitem><para>Type in GetNameForm for the name attribute and add a property attribute with greetName as its value.</para></listitem>
- </itemizedlist>
-<para>The editor should should now look like this:</para>
- <figure>
- <title>Editor window</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/strgreeting.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section id="index.jsp">
- <title>index.jsp</title>
-<para>Finally, we will need to create and edit an index.jsp page. This page will use a Struts forward to simply redirect us to the getName global forward.</para>
- <itemizedlist continuation="continues">
-<listitem><para>In the Web Projects view, right-click on <emphasis>StrutsHello/WEB-ROOT(WebContent)</emphasis></para>
-<para>node and select <emphasis>New/File/JSP...</emphasis> .</para>
-</listitem>
-<listitem><para>Type index for Name and click on the Finish button.</para></listitem>
-<listitem><para>On the Red Hat Palette, select the Struts Common folder of macros by clicking on it in the palette.</para></listitem>
-<listitem><para>Click on the logic taglib icon.</para></listitem>
-<listitem><para>Press the Enter key in the editor to go to the next line.</para></listitem>
-<listitem><para>Back on the palette, select the Struts Logic folder of macros.</para></listitem>
-<listitem><para>Click on redirect.</para></listitem>
-<listitem><para>Delete the ending tag, put a forward slash in front of the closing angle bracket, and type forward=getName in front of the slash.</para></listitem>
- </itemizedlist>
-<para>The finished code for the page is shown below:</para>
-<programlisting role="JAVA"><![CDATA[
-<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
-<logic:redirect forward="getName"/>
-]]></programlisting>
- <itemizedlist continuation="continues">
-<listitem><para>To save all the edits to files, select <emphasis>File/Save All</emphasis> from the menu bar.</para></listitem>
- </itemizedlist>
- </section>
- </section>
- </section>
- <section id="CompilingtheClasses">
- <?dbhtml filename="CompilingtheClasses.html"?>
- <title>Compiling the Classes</title>
- <para>Because this is the Eclipse environment, no explicit compilation step is required. By default,
- Eclipse compiles as you go.</para>
- </section>
- <section id="RunningtheApplication">
- <?dbhtml filename="RunningtheApplication.html"?>
- <title>Running the Application</title>
- <para>Everything is now ready for running our applicationwithout having to leave Red Hat Developer Studio
- by using the JBoss Application Server engine that comes with the Red Hat Developer Studio plug-in. For controlling
- JBoss AS within Red Hat Developer Studio, the toolbar contains a panel.</para>
- <figure>
- <title>JBoss Server Panel</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/running.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <itemizedlist continuation="continues">
-<listitem>Start up JBoss AS by clicking on the first icon from left in this panel. (If JBoss AS is
- already running, stop it by clicking on the third icon from the left and then start it
- again. Remember, the Struts run-time requires restarting the servlet engine when
- any changes have been made.)</listitem>
-<listitem>After the messages in the Console tabbed view stop scrolling, JBoss AS is available.
- At this point, right-click on the getName global forward in the struts-config.xml
- diagram view and select Run on Server.</listitem>
- </itemizedlist>
-<para>The browser should appear with the application started.</para>
- </section>
-
- <section id="OtherRelevantResourcesOnTheTopic4">
-<?dbhtml filename="OtherRelevantResourcesOnTheTopic4.html"?>
-<title>Other relevant resources on the topic</title>
-<para>Apache Struts: <ulink url="http://struts.apache.org/">Struts Technology</ulink></para>
-<para>Struts 2: <ulink url="http://struts.apache.org/2.x/">Apache Struts 2</ulink></para>
-<para>Get Started: <ulink url="http://struts.apache.org/2.x/docs/home.html">Struts Getting Started</ulink></para>
-<para>Struts on IBM: <ulink url="http://www.ibm.com/developerworks/library/j-struts/">Struts - An open-source MVC implementation</ulink></para>
-<para>FAQ: <ulink url="http://struts.apache.org/2.x/docs/faqs.html">Struts FAQ</ulink></para>
-<para>Download: <ulink url="http://struts.apache.org/download.cgi#struts206">Release of Apache Struts</ulink></para>
-</section>
-</chapter>
\ No newline at end of file
Deleted: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJSFwithHibernate.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJSFwithHibernate.xml 2007-07-13 14:32:14 UTC (rev 2430)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJSFwithHibernate.xml 2007-07-13 15:14:33 UTC (rev 2431)
@@ -1,526 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<chapter id="GettingStartedGuideforJSFwithHibernate" xreflabel="GettingStartedGuideforJSFwithHibernate">
- <?dbhtml filename="GettingStartedGuideforJSFwithHibernate.html"?>
- <title>Getting Started Guide for JSF with Hibernate</title>
-<para>In this guide, we will show you how to take a very simple ready-made JSF application and convert it to use a database with the help of RHDS. After downloading, we will first</para>
-<para>set up and run the application without persistence, and then with persistence.</para>
-<para>The application itself is a simple JSF-based application that asks the user to enter a UserID. It tries to locate a record for the entered User ID (entered during the application session).</para>
-<para>If the record is found, details are displayed. If the record is not found, you are asked to create this record. This application, of course, only runs as long as the Tomcat server is running. Once we stop the server all of the data is lost as all information is saved only in the application session context.</para>
-<para>With the help of RHDS, we will convert this application to use the lightweight hsqldb database (included with the downloaded project). We will use RHDS special features for object-relational mapping for this conversion After the conversion, even if we restart the server, the data we entered will have been saved in a database and thus available to the application.</para>
-<para>Before we start, we assume that you have Eclipse, and have installed RHDS with Tomcat server.</para>
-
-<section id="InstallingTheProject">
-<?dbhtml filename="InstallingTheProject.html"?>
-<title>Installing the Project</title>
-<para>We are first going to download and import this project (ormHibernate3-jsf) into Eclipse.</para>
-
-<itemizedlist>
-<listitem><para>Download: http://webdownload.exadel.com/dirdownloads/ormhib/examples/ormHibernate3-...</para></listitem>
-<listitem><para>Unzip this file into your Eclipse workspace folder.</para></listitem>
-<listitem><para>Launch Eclipse.</para></listitem>
-<listitem><para>In Eclipse, select <emphasis>File/Import/JSF Project</emphasis>.</para></listitem>
-<listitem><para>Click Next.</para></listitem>
-<listitem><para>Browse to where the project was unzipped.</para></listitem>
-<listitem><para>Find the web.xml file inside the WebContent folder in the WEB-INF folder, select it, and Click Finish.</para></listitem>
-</itemizedlist>
-<para>The ormHibernate3-jsf project should appear in the Package Explorer with a standard Web application
-structure. As we mentioned before, this is a JSF application. To see the JSF configuration file, browse to
- <emphasis>WebContent/WEB-INF/faces-config.xml</emphasis>.</para>
-<para>In the JavaSource folder, you will find the following Java source files. We will briefly explain these
- files and then run the application.</para>
- <table>
- <title>JavaSource Folder</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Class Name</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>demo/Address.java</entry>
- <entry>holds the user address</entry>
- </row>
- <row>
- <entry>demo/User.java</entry>
- <entry>holds user information</entry>
- </row>
- <row>
- <entry>demo/GetUserIdBean.java</entry>
- <entry>holds user Id and determines navigation (JSF Backing Bean)</entry>
- </row>
- <row>
- <entry>demo/UserFormBean.java</entry>
- <entry>holds new user input (JSF Backing Bean)</entry>
- </row>
- <row>
- <entry>demo.bundle/Messages.properties</entry>
- <entry>holds label messages used in the application</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-</section>
-
-<section id="RunningWithoutADatabase">
-<?dbhtml filename="RunningWithoutADatabase.html"?>
-<title>Running Without a Database</title>
-
-<para>We are ready to run this project in a Web browser and see how it looks. We don't need to
- compile these classes, because Eclipse did it for us when we imported the project.</para>
-
-<itemizedlist continuation="continues">
-<listitem><para>Start Tomcat.</para></listitem>
-<listitem><para>Click on the running-man-and-blue-butterfly icon from the toolbar.</para></listitem>
-<listitem><para>Go ahead and play with the application.</para></listitem>
-</itemizedlist>
-<para>Initially users don't exist, so entering any ID will prompt you to enter user details. Once you have saved a user, you can go back to the main page by clicking on the Back to Login Page link. If you then enter that user's id again, the application will locate and display the user's details.</para>
-
-</section>
-
-<section id="ConvertingforUseWithaDatabase">
-<?dbhtml filename="ConvertingforUseWithaDatabase.html"?><title>Converting for Use With a Database</title>
-<para>Now we are ready to convert this application to use with a database with the help of Red Hat Developer Studio. To convert the application for use with a database, we need to set things up in three different places:</para>
-
-
-<itemizedlist><listitem><para>The Application</para></listitem></itemizedlist>
-<itemizedlist><listitem><para>The Database</para></listitem></itemizedlist>
-<itemizedlist><listitem><para>The Application Server</para></listitem></itemizedlist>
-
-</section>
-
-<section id="SettingUpTheApplication">
-<?dbhtml filename="SettingUpTheApplication.html"?>
-<title>Setting up the Application</title>
-<para>Setting up the Application</para>
-<para>Let's start by using Red Hat Developer Studio with the application project. First, we create
-the object/relational mapping from our simple object model to a database schema after adding Hibernate
-capabilities to our project.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Right-click on ormHibernate3-jsf in the Package Explorer view and select Red Hat</para></listitem>
-<listitem><para><emphasis> <emphasis>Studio/Add Hibernate Capability...</emphasis></emphasis> from the context menu.</para></listitem>
-<listitem><para>Click on Yes in the the dialog box with Add Hibernate Jars selected.</para></listitem>
-<listitem><para>In the Configuration Wizard, click twice in the Value field for dialect and select org.hibernate.dialect.HSQLDialect from the pop-up menu.</para></listitem>
-<listitem><para>Click Finish</para></listitem>
-<listitem><para>Select Object to Schema for the Mapping Approach.</para></listitem>
-</itemizedlist>
-<para>We are only interested in saving the User class in a database, so we are going to create a mapping for the User class to a database table.</para>
-<itemizedlist continuation="continues">
-<listitem><para>In the Persistent Classes Wizard dialog that appears next, click on the SelectClasses.</para></listitem>
-<listitem><para>Leave all other values as they are in the next dialog box and click Finish.</para></listitem>
-</itemizedlist>
-</section>
-
-<section id="EditTheHibernateConfiguration">
-<?dbhtml filename="EditTheHibernateConfiguration.html"?>
-<title>Edit the Hibernate Configuration</title>
-<para>Afterwards, the Hibernate configuration file, hibernate.cfg.xml, will appear in an editor window.
-So, let's adjust this file first.</para>
-
-<itemizedlist continuation="continues">
-<listitem><para>Replace these two lines:</para></listitem>
-</itemizedlist>
-
-
-<programlisting role="XML"><![CDATA[<property
-name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
-<property name="hibernate.connection.url">jdbc:hsqldb:hsql:[hostname]</property>
-]]></programlisting>
-
-<para>With this single line:</para>
-
-<programlisting role="XML"><![CDATA[
-<property name="hibernate.connection.datasource">java:comp/env/
-jdbc/kickstart</property>
-]]></programlisting>
-<para>(Make sure this is one line in the file and not two lines as displayed because of wordwrapping.)</para>
-<para>Your file should now look like this:</para>
-
-<programlisting role="XML"><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration
-DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-<hibernate-configuration>
-<session-factory>
-<property name="hibernate.connection.datasource">java:comp/env/jdbc/
-kickstart</property>
-<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect/>
-property>
-<mapping resource="demo/User.hbm.xml"/>
-</session-factory>
-</hibernate-configuration>
-]]></programlisting>
-<itemizedlist continuation="continues">
-<listitem><para>Save the file.</para></listitem>
-</itemizedlist>
-</section>
-
-<section id="EdittheMappingFile">
-<?dbhtml filename="EdittheMappingFile.html"?>
-<title>Edit the Mapping File</title>
-<para>Next, we need to make on slight change to the mapping file, User.hbm.xml.</para>
-
-<itemizedlist continuation="continues">
-<listitem><para>In the ORM Explorer view, reveal the
-<emphasis>ormHibernate3-jsf/JavaSource/hibernate.cfg.xml/demo/User > user node</emphasis>, right-click it, and select
-Open Mapping from the context menu.</para></listitem>
-<listitem><para>In the editor that opens up for the mapping file, just change the class
-attribute for generator to a value of assigned and you're done with this file.</para></listitem>
-</itemizedlist>
-
-
-<para>Here is what the edited User.hbm.xml file should now look like:</para>
-
-<programlisting role="XML"><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-<para>"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"></para>
-<hibernate-mapping package="demo">
-<class name="User" table="user" optimistic-lock="none">
-<id name="id" type="string" unsaved-value="null" column="id">
-<generator class="assigned"/>
-</id>
-<property name="firstName" type="string" column="first_name"/>
-<property name="lastName" type="string" column="last_name"/>
-<property name="email" type="string" column="email"/>
-<component name="address" update="true" insert="true" class="demo.Address">
-<property name="city" type="string" column="address_city"/>
-<property name="state" type="string" column="address_state"/>
-<property name="street" type="string" column="address_street"/>
-<property name="zip" type="string" column="address_zip"/>
-</component>
-</class>
-</hibernate-mapping>
-]]></programlisting>
-
-
-<itemizedlist continuation="continues">
-<listitem><para>Save the file.</para></listitem>
-</itemizedlist>
-</section>
-<section id="AddAGeneralClassForIncorporatingHibernate">
-<?dbhtml filename="AddAGeneralClassForIncorporatingHibernate.html"?>
-<title>Add a General Class for Incorporating Hibernate</title>
-<para>Next, we will need to create a special Java class for incorprating Hibernate into our application.</para>
-
-<itemizedlist continuation="continues">
-<listitem><para>Switch to the Package Explorer view and create the class,
-HibernateHelper.java, in JavaSource/demo with this content and save it.</para></listitem>
-</itemizedlist>
-<programlisting role="JAVA"><![CDATA[
-package demo;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
-public class HibernateHelper {
-/**
-* Reference to SessionFactory.
-*/
-private static SessionFactory sf;
-public static final ThreadLocal session = new ThreadLocal();
-public static synchronized void init() {
-if (sf != null) return;
-System.out.println("Initializing Hibernate");
-try {
-Configuration cfg = new Configuration().configure();
-sf = cfg.buildSessionFactory();
-} catch (Exception he) {
-System.err.println("Unable to create session factory from
-configuration");
-he.printStackTrace();
-throw new RuntimeException("Unable to create session factory from
-configuration", he);
-}
-System.out.println("Hibernate initialized");
-}
-/**
-* Return the SessionFactory.
-* @return The SessionFactory for this application session
-*/
-public static SessionFactory sessionFactory() {
-if (sf == null) init();
-return sf;
-}
-public static void destroy() {
-if (sf != null) {
-try {
-sf.close();
-} catch (HibernateException he) {
-he.printStackTrace();
-}
-}
-sf = null;
-System.out.println("Hibernate resources released");
-}
-/**
-* Closes an hibernate {@link Session}, releasing its resources.
-* @throws HibernateException if an hibernate error occurs
-*/
-public static void closeSession() throws HibernateException {
-Session s = (Session)session.get();
-session.set(null);
-if (s != null) {
-s.close();
-}
-}
-/**
-* Returns an hibernate {@link Session} from the session factory.
-* @return an hibernate {@link Session}
-* @throws HibernateException if an error occurs
-*/
-public static Session openSession() throws HibernateException {
-if (sf == null) init();
-Session s = (Session)session.get();
-if (s == null) {
-s = sf.openSession();
-session.set(s);
-}
-return (s);
-}
-}
-]]></programlisting>
-</section>
-
-<section id="EdittheTwoBeanClasses">
-<?dbhtml filename="EdittheTwoBeanClasses.html"?>
-<title>Edit the Two Bean Classes</title>
-
-<para>We also need to modify the two bean classes in our application to "Hibernate-ize" them.</para>
-
-<itemizedlist continuation="continues">
-<listitem><para>Modify the GetUserIdBean.java class in JavaSource/demo by adding these imports:
-
-</para></listitem>
-</itemizedlist>
-<programlisting role="JAVA"><![CDATA[import org.hibernate.Session;
-import javax.faces.application.FacesMessage;
-]]></programlisting>
-<itemizedlist continuation="continues">
-<listitem><para>Then, replace the action() method with this code and save.</para></listitem>
-
-</itemizedlist>
-<programlisting role="JAVA"><![CDATA[{
-public String action()
-throws Exception
-UserFormBean ufb;
-User user;
-String actionResult = "inputuser"; // new user by default
-Map sessionMap =
-FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
-if (sessionMap != null) {
-ufb = new UserFormBean();
-ufb.setId(id);
-try {
-Session hSession = HibernateHelper.openSession();
-user = (User)hSession.get(User.class, id);
-HibernateHelper.closeSession();
-} catch (Exception e) {
-FacesContext context = FacesContext.getCurrentInstance();
-context.addMessage(null, new
-FacesMessage(FacesMessage.SEVERITY_ERROR,e.toString(), null));
-return "failed";
-}
-if (user==null || !user.getId().equals(id)) {
-user = new User();
-user.setId(id);
-sessionMap.put("user", user);
-} else {
-// fill UserFormBean with user information
-loadUser(ufb,user);
-actionResult="greeting";
-}
-sessionMap.put("UserFormBean", ufb);
-}
-return actionResult;
-}
-private void loadUser(UserFormBean userForm,User user) {
-userForm.setId(user.getId());
-userForm.setFirstName(user.getFirstName());
-userForm.setLastName(user.getLastName());
-userForm.setEmail(user.getEmail());
-userForm.setStreet(user.getAddress().getStreet());
-userForm.setCity(user.getAddress().getCity());
-userForm.setState(user.getAddress().getState());
-userForm.setZip(user.getAddress().getZip());
-}
-]]></programlisting>
-
-<itemizedlist continuation="continues">
-<listitem><para>Modify the UserFormBean.java class in JavaSource/demo by adding these
- imports:</para></listitem>
-</itemizedlist>
-<programlisting role="JAVA"><![CDATA[import org.hibernate.Session;
-import org.hibernate.Transaction;
-]]></programlisting>
-<itemizedlist continuation="continues">
-<listitem><para>Then, replace the save() method with this code and save the class.</para></listitem>
-</itemizedlist>
-<programlisting role="JAVA"><![CDATA[public String save() throws Exception {
-Map sessionMap =
-FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
-if (sessionMap != null) {
-UserFormBean ufb=(UserFormBean)sessionMap.get("UserFormBean");
-try {
-Session hSession = HibernateHelper.openSession();
-Transaction tran = hSession.beginTransaction();
-User user = (User)hSession.get(User.class, id);
-if (user == null) {
-user = new User();
-user.setId(id);
-hSession.save(user);
-}
-saveUser(ufb, user);
-tran.commit();
-HibernateHelper.closeSession();
-} catch (Exception e) {
-return "failed";
-}
-}
-return "greeting";
-}
-]]></programlisting>
-
-</section>
-
-<section id="SettinguptheDatabase">
-<?dbhtml filename="SettinguptheDatabase.html"?>
-<title>Setting up the Database</title>
-<para>To set up the database end, we need to use Red Hat Developer Studio and our HSQL database engine to create a
-database table corresponding to the class we are trying to persist and make the database available.</para>
-
-</section>
-<section id="CreatingtheDatabaseTable">
-<?dbhtml filename="CreatingtheDatabaseTable.html"?>
-<title>Creating the Database Table</title>
-<para>Let's first create the script for our database table in Red Hat Developer Studio.</para>
-<itemizedlist continuation="continues">
-<listitem><para>In the ORM Explorer view, right-click on <emphasis>JavaSource/hibernate.cfg.xml</emphasis> and select "Generate DDL Wizard".</para></listitem>
-
-<listitem><para>Select HSQL as the Dialect and leave Location as is.</para></listitem>
-<listitem><para>Click Finish.</para></listitem>
-</itemizedlist>
-<para>A DDL file called schema.sql will be created in the root of the project and will be opened in an
- editor window.</para>
- </section>
- <section id="MakingTheDatabaseAvailableForTheApplication">
- <?dbhtml filename="MakingTheDatabaseAvailableForTheApplication.html"?>
-<title>Making the Database Available for the Application</title>
-<para>The databse server, HSQLDB, is provided with the project. It's located in the ormHibernate3-jsf/hsqldb folder.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Start the database server: <emphasis>.../ormHibernate3-jsf/hsqldb/bin/server.bat</emphasis></para></listitem>
-<listitem><para>In a separate window, start the admin tool: <emphasis>.../ormHibernate3-jsf/hsqldb/bin/dbadmin.bat</emphasis></para></listitem>
-</itemizedlist>
-<para>This will launch a small GUI application, HSQL Database Manager.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Leave all values as they are, only change URL: to the following: <emphasis>jdbc:hsqldb:hsql://localhost</emphasis></para></listitem>
-<listitem><para>Click OK.</para></listitem>
-<listitem><para>Select <emphasis> File/Open Script...</emphasis>from the menu bar of HSQL Database Manager.</para></listitem>
-<listitem><para>Find and open the the DDL file we just created.</para></listitem>
-<listitem><para>Click Execute back in the main screen of the Database Manager.</para></listitem>
-<listitem><para>38. Select <emphasis>View/Refresh Tree</emphasis> from the menu bar.</para></listitem>
-</itemizedlist>
-<para>The User database should now appear in the expand/collapse tree to the left.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Select<emphasis> File/Exit </emphasis>from the menu bar.</para></listitem>
-<listitem><para>Stop the database server: <emphasis>.../ormHibernate3-jsf/hsqldb/bin/shutdown.bat</emphasis></para></listitem>
-</itemizedlist>
-</section>
-
-<section id="SettinguptheApplicationServer">
-<?dbhtml filename="SettinguptheApplicationServer.html"?>
-<title>Setting up the Application Server</title>
-
-<para>Finally, we need to set up the application server before we can run the database-enabled
-application in a Web browser. To do this, we'll need to modify the application context in the-
-Tomcat server.xml file.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Stop the Tomcat server, if it's running.</para></listitem>
-<listitem><para>Locate the server.xml file in the Package Explorer view under the Tomcat Server
-node under Servers.</para></listitem>
-<listitem><para>Double-click the file to open an editor on it.</para></listitem>
-<listitem><para>Find the Context tag for your application in the file. It will have a path attribute
-with a value of /ormHibernate3-jsf.</para></listitem>
-</itemizedlist>
-<para>You'll need to convert this "empty" XML element into one with beginning and ending tags,
-so we can insert the special resource tags for Tomcat to run this application with a database.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Delete the closing slash at the end of the Context tag.</para></listitem>
-<listitem><para>Insert a blank line after the tag and then start another line.</para></listitem>
-<listitem><para>On this line, insert a closing tag:</para></listitem>
-</itemizedlist>
-<programlisting role="JAVA"><![CDATA[</Context>
-]]></programlisting>
-<itemizedlist continuation="continues">
-<listitem><para>On the blank line between the starting and ending tags, add the following resource definition coding.</para></listitem>
-</itemizedlist>
-<programlisting role="XML"><![CDATA[<Resource name="jdbc/kickstart" scope="Shareable"
-type="javax.sql.DataSource"/>
-<ResourceParams name="jdbc/kickstart">
-<parameter>
-<name>factory</name>
-<value>org.apache.commons.dbcp.BasicDataSourceFactory</
-value>
-</parameter>
-<parameter>
-<name>url</name>
-<value>jdbc:hsqldb:hsql://localhost</value>
-</parameter>
-<parameter>
-<name>driverClassName</name>
-<value>org.hsqldb.jdbcDriver</value>
-</parameter>
-<parameter>
-<name>username</name>
-<value>sa</value>
-</parameter>
-<parameter>
-<name>password</name>
-<value></value>
-</parameter>
-<parameter>
-<name>maxWait</name>
-<value>3000</value>
-</parameter>
-<parameter>
-<name>maxIdle</name>
-<value>100</value>
-</parameter>
-<parameter>
-<name>maxActive</name>
-<value>10</value>
-</parameter>
-</ResourceParams>
-]]></programlisting>
-<itemizedlist continuation="continues">
-<listitem><para>Finally, copy .../ormHibernate3-jsf/hsqldb/lib/hsqldb.jar to your
-Tomcat .../common/lib folder.</para></listitem>
-</itemizedlist>
-</section>
-
-<section id="RunningOurNewApplication">
-<?dbhtml filename="RunningOurNewApplication.html"?>
-<title>Running Our New Application</title>
-<itemizedlist continuation="continues">
-<listitem><para>Start the database server: .../ormHibernate3-jsf/hsqldb/bin/server.bat</para></listitem>
-<listitem><para>Start the Tomcat server.</para></listitem>
-<listitem><para>Run the application.</para></listitem>
-</itemizedlist>
-<para>Play with the application. Restart Tomcat and the database server. If you run the application
-again and enter a user that you already saved, the application should retrieve it from the database
-and display its details.</para>
-</section>
-
-<section id="OtherRelevantResourcesOnTheTopic">
-<?dbhtml filename="OtherRelevantResourcesOnTheTopic.html"?>
-<title>Other relevant resources on the topic</title>
-<para>Hibernate on JBoss: <ulink url="http://www.jboss.org/products/hibernate">Hibernate Framework</ulink></para>
-
-<para>Hibernate Annotations: <ulink url="http://docs.jboss.org/ejb3/app-server/HibernateAnnotations/reference/en/h...">Hibernate Annotations</ulink></para>
-<para>Downloads: <ulink url="http://www.hibernate.org/6.html">Hibernate Download</ulink></para>
-<para>Wiki: <ulink url="http://www.jboss.org/wiki/Wiki.jsp?page=JBossHibernate">Hibernate Wiki</ulink></para>
-
-</section>
-
-</chapter>
Deleted: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJavaServerFaces.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJavaServerFaces.xml 2007-07-13 14:32:14 UTC (rev 2430)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedGuideforJavaServerFaces.xml 2007-07-13 15:14:33 UTC (rev 2431)
@@ -1,1271 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<chapter id="GettingStartedGuideforJavaServerFaces" xreflabel="GettingStartedGuideforJavaServerFaces">
- <?dbhtml filename="GettingStartedGuideforJavaServerFaces.html"?>
- <title>Getting Started Guide for Java Server Faces</title>
- <chapterinfo>
- <keywordset>
- <keyword>Red Hat Developer Studio</keyword>
- <keyword>RHDS</keyword>
- <keyword>Java</keyword>
- <keyword>JSF Component</keyword>
- </keywordset>
- </chapterinfo>
-<section id="Introduction">
-<?dbhtml filename="Introduction.html"?>
-<title>Introduction</title>
-<para>JavaServer Faces is a technology that helps to build a user interface based on the
-components approach. Using UI Components as building blocks simplifies the development,
-slashes the number of code lines, and allows reusing the same components from one project to
-the next.</para>
-<para>What are the components we are speaking about? The Sun reference implementation of JSF
-provides just a few very common components for Web forms, primitive tags for page layout, and
-"dataTable" as a way to show the data set. The open source implementations of JSF don't
-provide much more. The commercial implementation of GUI Tools for JSF such as WebSphere
-Application Developer and Java Studio Creator do come with significant additions to the set of
-components that allows creating interfaces similar to that of Swing applications. However,
-traditionally, the Web interface lacks all of the richness of thick-client analogs. A customer
-might have an existing design that is not covered by the set of standard controls. Third-party
-components vendors will try to create the most common components with a multitude of custom
-parameters, but still these do not match the requirements for an individual Web application.</para>
-<para>The JSF Specification in Section 1.2.2 mentions the Component Writer role along with Page
-Writer and Application Developer roles. Writing a specific component set for a particular Web
-application might be a good solution instead of trying to use existing ones that a customer might
-not even accept.</para>
-<para>Is it easy to write your own JSF UI component? Sun's J2EE tutorial provides a section
-dedicated to this topic. This paragraph describes an example with Map components giving an
-overview of almost all the features you might need in developing your own components.
-However, the example itself seems too complicated to use it as a beginning "kick start" type of
-application. It gives a good overview of the technology, but does not give enough details for the
-specific steps you would need to go through to write your own components.</para>
-<para>This tutorial is dedicated to closing this gap. It is written in a step-by-step manner where
-each step is extremely easy to understand. The provided example does not cover all the aspects
-of components development, but it is a very good start to understand the idea. Topics not covered
-in this tutorial are set forth in the last section.</para>
-</section>
-<section id="BuildingInstructionsForThisTutorial">
-<?dbhtml filename="BuildingInstructionsForThisTutorial.html"?>
-<title>Building Instructions for This Tutorial</title>
-<para>The tutorial consists of seven separate steps for building up an example application. Each
-step adds new code to the previous example. The tutorial includes code representing the result of
-each step. If you are lost, you can compare these target results with your results. Also, you might
-want to add some extra feature to the code to test how it works. If this messes things up, you can
-just replace your code with the included code to go on to the next step.</para>
-<para>The tutorial material is divided into seven folders with the names Step1, Step2, Step3, Step4,
-Step5, Step6, and Step7. Each folder contains only one subfolder named "ticker". This subfolder
-contains a working example that represents the result up to that particular step. Additionally, a
-folder named Step0 contains the skeleton for starting the JSF project.</para>
-<para>For this tutorial, you can use any tools that allow you to work directly with source code. We
-recommend you to use Red Hat Developer Studio. Developer Studio allows the running of JSF applications
-without redeployment. This is extremely important when you play with the code by adding new
-features to test how they work. At the same time, Developer Studio allows you to have full control over
-the source code. We even recommend turning on the "Use Source Tab as a default for multi-tab
-editors" option in the Preferences Editor (<emphasis>Red Hat>Editors</emphasis> section). You can always use the GUI
-feature of Developer Studio later to slash the development time when you start to understand enough
-how things works on the source code level. The provided example is fully adapted to work with
-Red Hat Developer Studio.</para>
-<para>Red Hat Developer Studio allows debugging Web applications in the same manner in which you can
-debug a regular Java application within the Eclipse environment. This is an extremely important
-feature for learning.</para>
-<para>To start working with the tutorial example, copy the "ticker" folder to a new place on the
-disk. If you use Red Hat Developer Studio, copy this folder to the Eclipse workspace folder (or wherever you
-usually keep projects) and then import this project using the <emphasis>Eclipse File>Import</emphasis> menu. Leave
-the server.xml registration option checked on the second screen of wizard. This allows you to
-change and then run an application without any special redeployment.</para>
-<para>Each ticker folder contains four subfolders:</para>
-<itemizedlist>
-<listitem><para>Ant</para></listitem>
-<listitem><para>ExtLib</para></listitem>
-<listitem><para>JavaSource</para></listitem>
-<listitem><para>WebContent</para></listitem>
-</itemizedlist>
-<section id="AntFolder">
-<?dbhtml filename="AntFolder.html"?>
-<title>Ant Folder</title>
-<para>The ant folder contains the build.xml file that can be used to compile the example and
-deploy it to a target servlet container to run. In order to use this script be sure that ant is in your
-system path. The default Ant target is "deploy", so if you launch Ant without parameters, it
-create an additional folder named deploy and puts the deployable war file into it. If you want,
-you can provide another folder as the target for deployment. Open the build.xml file for editing
-and set the "deploy-dir" Ant property to the different target folder.</para>
-</section>
-<section id="ExtLibFolder">
-<?dbhtml filename="ExtLibFolder.html"?>
-<title>ExtLib Folder</title>
-<para>The ExtLib folder just contains the servlet.jar file that is required to be in the classpath to
-have the code compiled. This jar file is added to the classpath only when you use the Ant script.
-(This file is not used by Developer Studio). If you want, you can any replace it with you own library
-that contains required classes for compilation. Replace the property with name 'servlet.path' for
-this purpose.</para>
-</section>
-<section id="JavaSourceFolder">
-<?dbhtml filename="JavaSourceFolder.html"?>
-<title>JavaSource Folder</title>
-<para>The JavaSource folder contains the java source files and resource bundle files.</para>
-</section>
-<section id="WebContentFolder">
-<?dbhtml filename="WebContentFolder.html"?>
-<title>WebContent Folder</title>
-<para>The WebContent folder contains the pre-deployment structure for a standard J2EE
-application.</para>
-</section>
-<section id="RootFolder">
-<?dbhtml filename="RootFolder.html"?>
-<title>Root Folder</title>
-<para>Additionally, the root folder contains four files start with dot. Those files contain the
-configuration for JSF Studio only.</para>
-</section>
-</section>
-<section if="GeneralTipsForBuildingComponents">
-<?dbhtml filename="GeneralTipsForBuildingComponents.html"?>
-<title>General Tips for Building Components</title>
-<para>
-<itemizedlist>
-<listitem>Simulate a rendered result before implement it. Use any HTML editor with a
-preview option to see how the HTML you are going to produce works buy itself. If
-some HTML construction doesn't work for you, you save time seeing the problem
-before you start to implement the component that produces the unsatisfactory HTML
-code.</listitem>
-<listitem>Localize the JavaScript functions. If the rendered code contains JavaScript, be sure
-this JavaScript code doesn't collide with JavaScript coding in other components that
-will work on the same page.</listitem>
-<listitem>Test how your component works together with other JSF Components. Check the
-situation where your components insert other components or are themselves inserted
-as children for other components.</listitem>
-<listitem>Check how the rendered code works in the different browser. Avoid browser-specific
-tags or attributes.</listitem>
-</itemizedlist>
-</para>
-</section>
-<section id="Step1ComponentsSkeleton">
-<?dbhtml filename="Step1ComponentsSkeleton.html"?>
-<title>Step 1: Components Skeleton</title>
-<para>Before we start, let's see what we have at the beginning. The initial project taken from the
-Step0 folder contains a short example that does nothing except open the bannerpage.jsp page
-when the application starts. This JSP page will be used as a testing area for testing the rendered
-component output.</para>
-<para>After the final step we have got a scrollable area with the text inside. It will look like the
-following picture:</para>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="img/"/>
- </imageobject>
-</mediaobject>
-</figure>
-<para>In the first step we create a component that will be rendered into the following code in the
-resulting HTML page:</para>
-<programlisting role="HTML"><![CDATA[<div>Hello JSF Component</div>
-]]></programlisting>
-<para>On the original JSF page we will have:</para>
-<programlisting role="HTML"><![CDATA[<d:ticker>
-<f:verbatim>Hello JSF Component</f:verbatim>
-</d:ticker>
-]]></programlisting>
-<para>Let's start with creating the tag library definition file. Open the WEB-INF folder and create
-a "ticker.tld" file that contains the following code:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
-"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
-<taglib>
-<tlib-version>1.0</tlib-version>
-<jsp-version>1.2</jsp-version>
-<short-name>d</short-name>
-<uri>http://jsftutorials.com/</uri>
-<tag>
-<name>ticker</name>
-<tag-class>ticker.TickerTag</tag-class>
-<body-content>JSP</body-content>
-</tag>
-</taglib>
-]]></programlisting>
-<para>We have declared the new tag with the name "ticker"and defined ticker.TickerTag as a tag
-class. Open JavaSource folder; create a package "ticker" there and the class TickerTag there that
-contains the following code:</para>
-<programlisting role="JAVA"><![CDATA[package ticker;
-import javax.faces.component.UIComponent;
-import javax.faces.webapp.UIComponentTag;
-public class TickerTag extends UIComponentTag{
-public void release() {
-// the super class method should be called
-super.release();
-}
-protected void setProperties(UIComponent component) {
-// the super class method should be called
-super.setProperties(component);
-}
-public String getComponentType() {
-return "ticker";
-}
-public String getRendererType() {
-// null means the component renders itself
-return null;
-}
-}
-]]></programlisting>
-<para>The class TickerTag processes the <emphasis role="italic"><property>"tag"</property></emphasis> attribute. Such a class name has the suffix "Tag" by a
-naming convention. The TickerTag class extends UIConponentTag and implements four
-methods.</para>
-<para>The getComponentType() method returns the symbolic name of the component type. We
-will define the class for this type latter in the faces-config file.</para>
-<para>The getRendererType() method returns the symbolic name of the renderer. If
-getRendererType() returns null, it means that the renderer name is not defined and the
-component will render it by itself.</para>
-<para>The release() method releases any resources allocated during the execution of this tag
-handler. We will use this method to reset the attribute values. The release() method should call
-the release() method of the super class.</para>
-<para>And the last (but not least) method, setProperties(UIComponent component), is used to pass
-attributes taken from the JSP page to the renderer. You can use the JSF Expression Language in
-the value for the tag attribute. This is also resolved by the setProperties method. We will return
-back to this theme in step 4 of this tutorial.</para>
-<para>Now let's define the component class for the component type declared above. Open WEBINF/
-faces-config.xml and put the declaration there. The faces-config.xml should contain the
-following code:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
-"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
-<faces-config>
-<component>
-<component-type>ticker</component-type>
-<component-class>ticker.UITicker</component-class>
-</component>
-<lifecycle/>
-<application>
-<locale-config/>
-</application>
-<factory/>
-</faces-config>
-]]></programlisting>
-<para>We have defined the ticker.UITicker class as a component class for the "ticker" type. By a
-naming convention, such a class starts with the "UI" prefix. The component class provides a
-rendering user interface, state saving and restoring, and processing of user input.</para>
-<para>Create the tickerUITicker class with the following content:</para>
-<programlisting role="JAVA"><![CDATA[package ticker;
-import java.io.IOException;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-public class UITicker extends UIOutput {
-public void encodeBegin(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.startElement("div", this);
-}
-public void encodeEnd(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.endElement("div");
-}
-}
-]]></programlisting>
-<para>Because our custom component does not provide for any user input, we extend the class
-from the UIOutput. The UITicker class implements two methods encodeBegin(FacesContext
-context) and encodeEnd(FacesContext context). The first method encodes the opening tag; the
-second one encodes the closing tag. However, if your tags do not contain a body, it is
-recommended to encode everything using only the encodeEnd(FacesContext context) method.</para>
-<para>Now let's create the page where our custom tag will be used. Open the bannerpage.jsp page
-located inside the WebContent folder and add a taglib declaration and our tag with test output.
-The page should look like:</para>
-<programlisting role="XML"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib uri="http://jsftutorials.com/" prefix="d" %>
-<html>
-<head>
-<title>Show Custom Component</title>
-</head>
-<body>
-<f:view>
-<d:ticker>
-<f:verbatim>Hello JSF Component</f:verbatim>
-</d:ticker>
-</f:view>
-</body>
-</html>
-]]></programlisting>
-<para>There are two things important to mention here. The first thing concerns the URI attribute.
-Many people think that this attribute must be a reference to an existing URL, but this is not quite
-true. A URI is not the same as a URL. The target of this attribute is defining the unique string
-that will distinguish this particular taglib from the others.</para>
-<para>The second important thing is using <emphasis role="bold"><property><f:verbatim></property></emphasis> <emphasis role="bold"><property></f:verbatim></property></emphasis> around the plain text. When
-the JSF Components tree is rendered, it contains only the JSF Components. So, any children in
-the hierarchy must be JSF components. If you run the first example, there might not be any
-difference, because <emphasis role="bold"><property><d:ticker></property></emphasis> is a root node of the JSF Component hierarchy. However, in case
-you add <emphasis role="bold"><property><h:gridPanel></property></emphasis>, for example, around it, you will find that the plain text without
-<emphasis role="bold"><property><f:verbatim></property></emphasis> will be pushed out of the <emphasis role="bold"><property><div></property></emphasis><emphasis role="bold"><property></div></property></emphasis> in the rendered page.</para>
-<para>At this point, our first step has been finished. We can compile, deploy, and run the result
-application. If you use Ant to do this job, run Ant so that the ticker.war file is copied to the
-servlet container to run.</para>
-<para>If you're using Red Hat Developer Studio, click the Start Tomcat Server button on the toolbar, and then
-click the Run Web Application button. The default browser should be launched and show the
-result of page rendering.</para>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="img/"/>
- </imageobject>
-</mediaobject>
-</figure>
-<para>You can see the "Hello JSF Component" text in the browser window. Because <emphasis role="bold"><property><div></property></emphasis> itself
-does not provide any visual effect, you can recognize that the page is rendered as we expected
-only if you look at the source of the result page. It should contain the "<emphasis role="bold"><property><div></property></emphasis>Hello JSF
-Component<emphasis role="bold"><property></div></property></emphasis>" text. If so, the first step is done. You have already written you first JSF
-Component. Of course, it has very limited functionality, but we just laid the foundation. The
-component will be improved in the next step.</para>
-<para>Before we go any further, let's survey the relationships among the different JSF artifacts we
-are using here. The following picture shows this relationship:</para>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="img/"/>
- </imageobject>
-</mediaobject>
-</figure>
-</section>
-<section id="Step2AddingSimpleAttributes">
-<?dbhtml filename="Step2AddingSimpleAttributes.html"?>
-<title>Step 2: Adding Simple Attributes</title>
-<para>This step is devoted to adding attributes to our custom tag. As we mentioned for the first
-step, tag <emphasis role="bold"><property><div></property></emphasis> does not provide any visible effect. So, in the second step, we will add attributes
-that make more visible results. Commonly, visual JSF tags define the tag style directly with style
-and styleClass attributes or indirectly by using the Cascading Style Sheet file.</para>
-<para>Let's start with the style attribute. Add it to the JSP page. The JSP page will look like this:</para>
-<programlisting role="HTML"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib uri="http://jsftutorials.com/" prefix="d" %>
-<html>
-<head>
-<title>Show Custom Component</title>
-</head>
-<body>
-<f:view>
-<d:ticker style="border:1px solid darkblue;width:100px">
-<f:verbatim>Hello JSF Component</f:verbatim>
-</d:ticker>
-</f:view>
-</body>
-</html>
-]]></programlisting>
-<para>Add the tag attribute to the ticker.tld file:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
-"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
-<taglib>
-<tlib-version>1.0</tlib-version>
-<jsp-version>1.2</jsp-version>
-<short-name>d</short-name>
-<uri>http://jsftutorials.com/</uri>
-<tag>
-<name>ticker</name>
-<tag-class>ticker.TickerTag</tag-class>
-<body-content>JSP</body-content>
-<attribute>
-<name>style</name>
-</attribute>
-</tag>
-</taglib>
-]]></programlisting>
-<para>Add the following code marked with bold to the TickerTag class:</para>
-<programlisting role="JAVA"><![CDATA[import javax.faces.component.UIComponent;
-import javax.faces.webapp.UIComponentTag;
-public class TickerTag extends UIComponentTag{
-String style;
-public String getStyle() {
-return style;
-}
-public void setStyle(String style) {
-this.style = style;
-public void release() {
-// the super class method should be called
-super.release();
-style = null ;
-}
-protected void setProperties(UIComponent component) {
-// the super class method should be called
-super.setProperties(component);
-if(style != null)
-component.getAttributes().put("style", style);
-}
-public String getComponentType() {
-return "ticker";
-}
-public String getRendererType() {
-// null means the component renders itself
-return null;
-}
-}
-]]></programlisting>
-<para>First, we have added a new property with the name "style" and provided the getter and setter
-for it. Then, we reset the property in the release() method. Finally, we have set the new value for
-the component property in the setProperties(UIComponent component) method. The last step is
-important. If you forget to do so, you cannot get to the value in the component type class later
-on.</para>
-<para>Add the code marked with bold to the ticker.UITicker class:</para>
-<programlisting role="JAVA"><![CDATA[import java.io.IOException;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-public class UITicker extends UIOutput {
-public void encodeBegin(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.startElement("div", this);
-String style = (String)getAttributes().get("style");
-if (style!=null)
-writer.writeAttribute("style", style, null);
-}
-public void encodeEnd(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.endElement("div");
-}
-}
-]]></programlisting>
-<para>In the first added line, we have taken the value of the style attribute, checked if it's set, and
-then assigned the style attribute with the new value. Do not forget to check for null, otherwise
-you will get a NullPointer Exception when a tag without this attribute set is rendered.</para>
-<para>Now, we are done with the style attribute. If you use Red Hat Developer Studio just click the Run Web
-Application button to get a result. If you are using an Ant script, run it, deploy the result war file
-under the servlet container, then launch your browser and type the application URL.</para>
-<para>The result page should see the box with dark blue border and the Hello JSF Component text
-inside this box.</para>
-<para>Adding the styleClass component is very similar to what we did for style. Here is a
-bannerpage.jsp content:</para>
-<programlisting role="HTML"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib uri="http://jsftutorials.com/" prefix="d" %>
-<html>
-<head>
-<title>Show Custom Component</title>
-<style>
-.banner {
-border: 1px solid darkblue;
-padding: 5px 5px 5px 5px;
-}
-</style>
-</head>
-<body>
-<f:view>
-<d:ticker styleClass="banner" style="width:100px">
-<f:verbatim>Hello JSF Component</f:verbatim>
-</d:ticker>
-</f:view>
-</body>
-</html>
-]]></programlisting>
-<para>This is the ticker.tld file content:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
-"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
-<taglib>
-<tlib-version>1.0</tlib-version>
-<jsp-version>1.2</jsp-version>
-<short-name>d</short-name>
-<uri>http://jsftutorials.com/</uri>
-<tag>
-<name>ticker</name>
-<tag-class>ticker.TickerTag</tag-class>
-<body-content>JSP</body-content>
-<attribute>
-<name>style</name>
-</attribute>
-<attribute>
-<name>styleClass</name>
-</attribute>
-</tag>
-</taglib>
-]]></programlisting>
-<para>This is the TickerTag.java class content:</para>
-<programlisting role="JAVA"><![CDATA[import javax.faces.component.UIComponent;
-import javax.faces.webapp.UIComponentTag;
-public class TickerTag extends UIComponentTag{
-String style;
-String styleClass;
-public String getStyle() {
-return style;
-}
-public void setStyle(String style) {
-this.style = style;
-}
-public String getStyleClass() {
-return styleClass;
-}
-public void setStyleClass(String styleClass) {
-this.styleClass = styleClass;
-}
-public void release() {
-// the super class method should be called
-super.release();
-style = null ;
-styleClass = null ;
-}
-protected void setProperties(UIComponent component) {
-// the super class method should be called
-super.setProperties(component);
-if(style != null)
-component.getAttributes().put("style", style);
-if(styleClass != null)
-component.getAttributes().put("styleClass", styleClass);
-}
-public String getComponentType() {
-return "ticker";
-}
-public String getRendererType() {
-// null means the component renders itself
-return null;
-}
-}
-]]></programlisting>
-<para>This is the UITicker.java file content:</para>
-<programlisting role="JAVA"><![CDATA[import java.io.IOException;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-public class UITicker extends UIOutput {
-public void encodeBegin(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.startElement("div", this);
-String style = (String)getAttributes().get("style");
-if (style!=null)
-writer.writeAttribute("style", style, null);
-String styleClass = (String)getAttributes().get("styleClass");
-if (styleClass!=null)
-writer.writeAttribute("class", styleClass, null);
-}
-public void encodeEnd(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.endElement("div");
-}
-}
-]]></programlisting>
-<para>Now, step 2 is done. Run the resulting application. The browser window should show the
-bordered box with the Hello JSF Component text inside. Unlike the previous run, you will see 5
-pixels of space between the text and the border.</para>
-</section>
-<section id="Step3AddingJSFSupportAttributes">
-<?dbhtml filename="Step3AddingJSFSupportAttributes.html"?>
-<title>Step 3: Adding JSF Support Attributes</title>
-<para>Looking at the source code of pages rendered by the JSF run-time you can see that most
-components have an id. They have this attribute assigned even you don't explicitly define it for
-the JSF tags.</para>
-<para>Also, JSF has its own naming convention for the component id. While you might specify
-something like id="myId" for h:inputText, the rendered code will contain something like
-id="_id0:myId". This is done to ensure the uniqueness of each element in the JSF Component
-tree. It is especially important for components that process user input. Having the full control
-over the rendered code you can assign any value for id, but we recommend you to follow the
-rules of the game.</para>
-<para>In step 3, we will assign a value for our component that will be the same value that JSF runtime
-assigns for it.</para>
-<para>Any attribute should be present in the tag library definition file. So, open our ticker.tld file
-and add the following code snippet next to the other tag attributes:</para>
-<programlisting role="XML"><![CDATA[<attribute>
-<name>id</name>
-</attribute>
-]]></programlisting>
-<para>Add the following code marked with bold in the encodeBegin method of the UITicker.java:</para>
-<programlisting role="JAVA"><![CDATA[public void encodeBegin(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.startElement("div", this);
-writer.writeAttribute("id", getClientId(context), null);
-String style = (String)getAttributes().get("style");
-if (style!=null)
-writer.writeAttribute("style", style, null);
-String styleClass = (String)getAttributes().get("styleClass");
-if (styleClass!=null)
-writer.writeAttribute("class", styleClass, null);
-}
-]]></programlisting>
-<para>When you run the application at this point, you can see that the id attribute of the <emphasis role="bold"><property><div></property></emphasis> tag
-is assigned. Because the id attribute has no visual effect, you have to open the source of the
-resulting page to see it.</para>
-<para>Provide your id for the <emphasis role="bold"><property><d:ticker></property></emphasis> component and run the application again. Then, you will
-see that the id you have for the rendered code is the same that you assign. This happens because
-the <emphasis role="bold"><property><d:ticker></property></emphasis> is a root element of the component tree. If you add <emphasis role="bold"><property><h:form></property></emphasis> or <emphasis role="bold"><property><h:subview></property></emphasis>
-around it, you can the that the same prefix is added to the value you assigned for id.</para>
-<para>We are done with <emphasis role="italic"><property>"id"</property></emphasis> attribute. Now, let's use the <emphasis role="italic"><property>"rendered"</property></emphasis> attribute. This attribute can
-be used with any JSF Component, because it is inherited from the UIComponent class, the top
-level of the JSF Component hierarchy. The <emphasis role="italic"><property>"rendered"</property></emphasis> attribute itself is not passed through to the HTML code as a tag attribute, but, if it has been set to "false", the tag with all of its children will
-not be rendered at all.</para>
-<para>It is pretty easy to add a <emphasis role="italic"><property>"rendered"</property></emphasis> attribute. Just add it into the ticker.tld and all is set.</para>
-<programlisting role="XML"><![CDATA[<attribute>
-<name>rendered</name>
-</attribute>
-]]></programlisting>
-<para>Add rendered="false" to the <emphasis role="bold"><property><d:ticker></property></emphasis> tag, run the application and see what happens. The
-browser should show the empty page. When you assign the "true" value, the page will show the
-box with a greeting again.</para>
-<para>This is a good time to show why <emphasis role="bold"><property><f:verbatim></property></emphasis> is important for this construction. Remove
-<emphasis role="bold"><property><f:verbatim></property></emphasis> around the Hello JSF Component text, write rendered="false" and run the
-application. You can see that the box disappears, but the greeting text is still there. Looking at
-the resulting code, you can realize that the <emphasis role="bold"><property><div></property></emphasis> tag is stripped out.</para>
-</section>
-<section id="Step4AttributeBinding">
-<?dbhtml filename="Step4AttributeBinding.html"?>
-<title>Step 4: Attribute Binding</title>
-<para>Attribute <emphasis role="bold"><property><binding></property></emphasis> is one of the most powerful JSF features. You can take the value from a
-bean property or resource bundle property rather than just hardcode it into your JSP file. In step
-4, we add one new attribute with the name "title" whose value will be taken from the resource
-bundle instead of defining it directly in the JSP file (that's also possible).</para>
-<para>In order to separate the designed component and the code that test it, lets create an additional
-package with the name "demo" within the JavaSource folder. In the "demo" package, create the
-file with the name "resources.properties" with the following content:</para>
-<programlisting role="XML"><![CDATA[banner_title=Creating JSF Components. Step-By-Step Tutorial.
-]]></programlisting>
-<para>Add the new attribute with the name "title" to the ticker.tld file next to the other attribute of
-the "ticker" tag.</para>
-<programlisting role="XML"><![CDATA[<attribute>
-<name>title</name>
-</attribute>
-]]></programlisting>
-
-<para>Add the text marked with bold to the ticker.TickerTag.java file:</para>
-<programlisting role="JAVA"><![CDATA[package ticker;
-import javax.faces.component.UIComponent;
-import javax.faces.el.ValueBinding;
-import javax.faces.webapp.UIComponentTag;
-public class TickerTag extends UIComponentTag{
-String style;
-String styleClass;
-String title;
-public String getStyle() {
-return style;
-}
-public void setStyle(String style) {
-this.style = style;
-}
-public String getStyleClass() {
-return styleClass;
-}
-public void setStyleClass(String styleClass) {
-this.styleClass = styleClass;
-}
-public String getTitle() {
-return title;
-}
-public void setTitle(String title) {
-this.title = title;
-}
-public void release() {
-// the super class method should be called
-super.release();
-style = null ;
-styleClass = null ;
-title = null;
-}
-protected void setProperties(UIComponent component) {
-// the super class method should be called
-super.setProperties(component);
-if(style != null)
-component.getAttributes().put("style", style);
-if(styleClass != null)
-component.getAttributes().put("styleClass", styleClass);
-if (title != null) {
-if (isValueReference(title)) {
-ValueBinding vb =
-getFacesContext().getApplication().
-createValueBinding(title);
-component.setValueBinding("title", vb);
-} else {
-component.getAttributes().put("title", title);
-}
-}
-}
-public String getComponentType() {
-return "ticker";
-}
-public String getRendererType() {
-// null means the component renders itself
-return null;
-}
-}
-]]></programlisting>
-<para>The most important part of the added code is inside the SetProperties method. We check
-there to see if this value is referenced and if so we create the value binding. Otherwise, we just
-pass the value taken from the JSP page.</para>
-<para>The other code is similar to what we did previously. Add the code marked with bold to the
-encodeBegin method of the ticker.UITicker.java file:</para>
-<programlisting role="HTML"><![CDATA[public void encodeBegin(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.startElement("div", this);
-writer.writeAttribute("id", getClientId(context), null);
-String style = (String)getAttributes().get("style");
-if (style!=null)
-writer.writeAttribute("style", style, null);
-String styleClass = (String)getAttributes().get("styleClass");
-if (styleClass!=null)
-writer.writeAttribute("class", styleClass, null);
-String title = (String)getAttributes().get("title");
-if (title!=null)
-writer.writeAttribute("title", title, null);
-}
-]]></programlisting>
-<para>Add the following code marked with bold to the bannerpage.jsp file:</para>
-<programlisting role="JSP"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib uri="http://jsftutorials.com/" prefix="d" %>
-<f:loadBundle basename="demo.resources" var="bundle" />
-<html>
-<head>
-<title>Show Custom Component</title>
-<style>
-.banner {
-border: 1px solid darkblue;
-padding: 5px 5px 5px 5px;
-}
-</style>
-</head>
-<body>
-<f:view>
-<d:ticker id="banner"
-styleClass="banner"
-style="width:100px"
-rendered="true"
-title="#{bundle.banner_title}">
-<f:verbatim>Hello JSF Component</f:verbatim>
-</d:ticker>
-</f:view>
-</body>
-</html>
-]]></programlisting>
-<para>We have added here the reference to our bundle and taken the banner_title property as a <emphasis role="italic"><property>"title"</property></emphasis>
-attribute for the <emphasis role="bold"><property><d:ticker></property></emphasis> tag.</para>
-<para>Now, we are done with step 4 of our tutorial. Run the application and hold the mouse cursor
-over the box. The tip message should appear. If you look at the source code on the rendered
-page, you can see the <emphasis role="italic"><property>"title"</property></emphasis> attribute set to a value taken from the resource bundle property.</para>
-</section>
-<section id="Step5ComponentBinding">
-<?dbhtml filename="Step5ComponentBinding.html"?>
-<title>Step 5: Component Binding</title>
-<para>One more powerful feature of the JSF technology is component binding. Unlike value
-binding, component binding allows controlling all of the aspects of a bound component and its
-child hierarchy from a Java class that is usually called a "backing bean."</para>
-<para>In step 5, we will demonstrate how this mechanism works. We will add a form with two
-buttons to our bannerpage.jsp page. One button will hide the box for our greeting message; the
-other button will return it back to the page. We will also create a backing bean that will control
-the form and the component located inside the form.</para>
-<para>Actually, the binding mechanism is provided by the super class of our component. All we
-have to do it to add a new attribute with the name "binding" to the ticker.tld file. All other stuff
-added on this step has a testing purpose.</para>
-<para>So, this is our ticker.tld file content:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
-"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
-<taglib>
-<tlib-version>1.0</tlib-version>
-<jsp-version>1.2</jsp-version>
-<short-name>d</short-name>
-<uri>http://jsftutorials.com/</uri>
-<tag>
-<name>ticker</name>
-<tag-class>ticker.TickerTag</tag-class>
-<body-content>JSP</body-content>
-<attribute>
-<name>style</name>
-</attribute>
-<attribute>
-<name>styleClass</name>
-</attribute>
-<attribute>
-<name>id</name>
-</attribute>
-<attribute>
-<name>rendered</name>
-</attribute>
-<attribute>
-<name>title</name>
-</attribute>
-<attribute>
-<name>binding</name>
-</attribute>
-</tag>
-</taglib>
-]]></programlisting>
-<para>Add the code marked with bold to the faces-config.xml file:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE faces-config
-PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
-"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
-<faces-config>
-<component>
-<component-type>ticker</component-type>
-<component-class>ticker.UITicker</component-class>
-</component>
-<managed-bean>
-<managed-bean-name>BannerPageBean</managed-bean-name>
-<managed-bean-class>demo.BannerPageBean</managed-bean-class>
-<managed-bean-scope>request</managed-bean-scope>
-<managed-property>
-<property-name>rendered</property-name>
-<property-class>java.lang.Boolean</property-class>
-<value>true</value>
-</managed-property>
-</managed-bean>
-<lifecycle/>
-<application>
-<locale-config/>
-</application>
-<factory/>
-</faces-config>
-]]></programlisting>
-<para>We have added the managed bean with name BannerPageBean that will play the role on
-backing bean for our form. We also have defined the "rendered" property that is set to true by
-default.</para>
-<para>Create new file with the name BannerPageBean.java inside the "demo" package. Here is the
-content of this file:</para>
-<programlisting role="XML"><![CDATA[package demo;
-import ticker.UITicker;
-public class BannerPageBean {
-Boolean rendered;
-UITicker ticker;
-public Boolean getRendered() {
-return rendered;
-}
-public void setRendered(Boolean rendered) {
-this.rendered = rendered;
-}
-public UITicker getTicker() {
-return ticker;
-}
-public void setTicker(UITicker ticker) {
-this.ticker = ticker;
-}
-public UITicker getTiker() {
-return ticker;
-}
-public void setTiker(UITicker tiker) {
-this.ticker = tiker;
-}
-public String TurnOn() {
-ticker.setRendered(true);
-return null;
-}
-public String TurnOff() {
-ticker.setRendered(false);
-return null;
-}
-}
-]]></programlisting>
-<para>The bean has two properties: rendered that has a Boolean type and ticker that has a type of
-our UITicker class. The two last methods will be called when you click the buttons on the page.
-Those methods call the setter of the "rendered" property of the ticker. Actually, you have full
-control over the ticker component here and can change any attribute you need.</para>
-<para>The bannerpage.jsp file should contain the following:</para>
-<programlisting role="JSP"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib uri="http://jsftutorials.com/" prefix="d" %>
-<f:loadBundle basename="demo.resources" var="bundle" />
-<html>
-<head>
-<title>Show Custom Component</title>
-<style>
-.banner {
-border: 1px solid darkblue;
-padding: 5px 5px 5px 5px;
-}
-</style>
-</head>
-<body>
-<f:view>
-<h:form>
-<h:commandButton value="Turn Off" action="#{BannerPageBean.TurnOff}"/>
-<h:commandButton value="Turn On" action="#{BannerPageBean.TurnOn}"/>
-<d:ticker id="banner"
-styleClass="banner"
-style="width:100px"
-title="#{bundle.banner_title}"
-binding="#{BannerPageBean.ticker}">
-<f:verbatim>Hello JSF Component</f:verbatim>
-</d:ticker>
-</h:form>
-</f:view>
-</body>
-</html>
-]]></programlisting>
-<para>The <emphasis role="italic"><property>"binding"</property></emphasis> attribute of our component refers to the “ticker” property of the backing bean.
-The buttons <emphasis role="italic"><property>"action"</property></emphasis> attribute calls the corresponding method.</para>
-<para>We are done with step 5. When you launch your application you can see our fancy box and
-two buttons above them. Click the "Turn Off" button and the box disappears, click the "Turn
-On" button and the box appears again.</para>
-</section>
-<section id="Step6FinalVersion">
-<?dbhtml filename="Step6FinalVersion.html"?>
-<title>Step 6: Final Version</title>
-<para>In this step, we set up our component with the look and feel we mentioned in the first step.
-Additionally, we assign a couple new attributes: <emphasis role="italic"><property>"width"</property></emphasis> and <emphasis role="italic"><property>"height"</property></emphasis>. It will be more convenient to
-define the value directly rather then use the style attribute. If you define width and height in the
-style and add width and height attributes for the custom tag at the same time, the attributes will
-overwrite the values defined with the style.</para>
-<para>Add <emphasis role="italic"><property>"width"</property></emphasis> and <emphasis role="italic"><property>"heght"</property></emphasis> attribute to the ticker.tld file. Here is the final version of it:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
-"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
-<taglib>
-<tlib-version>1.0</tlib-version>
-<jsp-version>1.2</jsp-version>
-<short-name>d</short-name>
-<uri>http://jsftutorials.com/</uri>
-<tag>
-<name>ticker</name>
-<tag-class>ticker.TickerTag</tag-class>
-<body-content>JSP</body-content>
-<attribute>
-<name>style</name>
-</attribute>
-<attribute>
-<name>styleClass</name>
-</attribute>
-<attribute>
-<name>id</name>
-</attribute>
-<attribute>
-<name>rendered</name>
-</attribute>
-<attribute>
-<name>title</name>
-</attribute>
-<attribute>
-<name>binding</name>
-</attribute>
-<attribute>
-<name>width</name>
-</attribute>
-<attribute>
-<name>height</name>
-</attribute>
-</tag>
-</taglib>
-]]></programlisting>
-<para>Add the code marked with bold to the TickerTag.java file:</para>
-<programlisting role="JAVA"><![CDATA[package ticker;
-import javax.faces.component.UIComponent;
-import javax.faces.el.ValueBinding;
-import javax.faces.webapp.UIComponentTag;
-public class TickerTag extends UIComponentTag{
-String style;
-String styleClass;
-String title;
-String width;
-String height;
-public String getHeight() {
-return height;
-}
-public void setHeight(String height) {
-this.height = height;
-}
-public String getWidth() {
-return width;
-}
-public void setWidth(String width) {
-this.width = width;
-}
-public String getStyle() {
-return style;
-}
-public void setStyle(String style) {
-this.style = style;
-}
-public String getStyleClass() {
-return styleClass;
-}
-public void setStyleClass(String styleClass) {
-this.styleClass = styleClass;
-}
-public String getTitle() {
-return title;
-}
-public void setTitle(String title) {
-this.title = title;
-}
-public void release() {
-// the super class method should be called
-super.release();
-style = null ;
-styleClass = null ;
-title = null;
-height = null;
-width = null;
-}
-protected void setProperties(UIComponent component) {
-// the super class method should be called
-super.setProperties(component);
-if(style != null)
-component.getAttributes().put("style", style);
-if(styleClass != null)
-component.getAttributes().put("styleClass", styleClass);
-if(width != null)
-component.getAttributes().put("width", width);
-if(height != null)
-component.getAttributes().put("height", height);
-if (title != null) {
-if (isValueReference(title)) {
-ValueBinding vb =getFacesContext().getApplication().
-createValueBinding(title);
-component.setValueBinding("title", vb);
-} else {
-component.getAttributes().put("title", title);
-}
-}
-}
-public String getComponentType() {
-return "ticker";
-}
-public String getRendererType() {
-// null means the component renders itself
-return null;
-}
-}
-]]></programlisting>
-<para>This is a final version of the UITicker.java file:</para>
-<programlisting role="JAVA"><![CDATA[package ticker;
-import java.io.IOException;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-public class UITicker extends UIOutput {
-public void encodeBegin(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.startElement("div", this);
-writer.writeAttribute("id", getClientId(context), null);
-String width = (String)getAttributes().get("width");
-String height = (String)getAttributes().get("height");
-String style = (String)getAttributes().get("style");
-style= (style!=null) ? style + ";" : "";
-if (width != null) style += "width:" + width + ";";
-if (height != null) style += "height:" + height+ ";";
-writer.writeAttribute("style", style, null);
-String styleClass = (String)getAttributes().get("styleClass");
-if (styleClass!=null)
-writer.writeAttribute("class", styleClass, null);
-String title = (String)getAttributes().get("title");
-if (title!=null)
-writer.writeAttribute("title", title, null);
-}
-public void encodeEnd(FacesContext context) throws IOException {
-ResponseWriter writer = context.getResponseWriter();
-writer.endElement("div");
-}}
-]]></programlisting>
-<para>The HTML <emphasis role="bold"><property><div></property></emphasis> tag itself does not have the <emphasis role="italic"><property>"width"</property></emphasis> and <emphasis role="italic"><property>"height"</property></emphasis> attributes. So, we use a
-little trick here. We add the width and height to the tail of the <emphasis role="italic"><property>"style"</property></emphasis> attribute. If <emphasis role="italic"><property>"style"</property></emphasis> attribute
-does not exist we create it.</para>
-<para>This is a final version of the bannerpage.jsp file:</para>
-<programlisting role="JSP"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib uri="http://jsftutorials.com/" prefix="d" %>
-<f:loadBundle basename="demo.resources" var="bundle" />
-<html>
-<head>
-<title>Show Custom Component</title>
-<style>
-.banner {
-border: 1px solid darkblue;
-padding: 5px 5px 5px 5px;
-overflow: auto;
-}
-</style>
-</head>
-<body>
-<f:view>
-<h:form>
-<h:commandButton value="Turn Off" action="#{BannerPageBean.TurnOff}"/>
-<h:commandButton value="Turn On" action="#{BannerPageBean.TurnOn}"/>
-<d:ticker id="banner"
-width="300px"
-height="200px"
-styleClass="banner"
-title="#{bundle.banner_title}"
-binding="#{BannerPageBean.ticker}">
-<h:panelGrid columns="1">
-<h:outputText value="Introduction"/>
-<h:outputText value="Building Instructions for This Tutorial"/>
-<h:outputText value="General Tips for Building Components"/>
-<h:outputText value="Step 1: Components Skeleton"/>
-<h:outputText value="Step 2: Adding Simple Attributes"/>
-<h:outputText value="Step 3: Adding JSF Support Attributes"/>
-<h:outputText value="Step 4: Attribute Binding"/>
-<h:outputText value="Step 5: Component Binding"/>
-<h:outputText value="Step 6: Final Version"/>
-<h:outputText value="Step 7: Creating a Deployable Jar File"/>
-<h:outputText value="What Next?"/>
-</h:panelGrid>
-</d:ticker>
-</h:form>
-</f:view>
-</body>
-</html>
-]]></programlisting>
-<para>We have added the "overflow: auto" to the style class to make our text area scrollable,
-replaced a style attribute with the two size attributes and, finally, replaced the text greeting
-message with something new one. You can put any other code here if you want.</para>
-<para>Run and test the application. It should show the scrollable text area with the dark blue border
-around it. If you see this, you have successfully passed the tutorial. We have only one more question to answer: How to distribute what we have done? We will dedicate the last step to this
-question.</para>
-</section>
-<section id="Step7CreatingADeployableJarFile">
-<?dbhtml filename="Step7CreatingADeployableJarFile.html"?>
-<title>Step 7: Creating a Deployable Jar File</title>
-<para>OK. We have created our own JSF component or, even have written a whole custom tag
-library. How do we make it reusable? How do we distribute it?</para>
-<para>Of course, you can copy your classes and TLD file to the new project and add records to the
-faces-config.xml file. It will work. However, this would be inconvenient to do each time,
-especially if your library contains several dozen tags with double that number of class files all
-requiring filling in the faces-config.xml file with references to those classes. No, this is definitely
-not a good way. We will choice another one.</para>
-<para>We will gather all of the information inside just one jar file and this will be the only one file
-we have to distribute.</para>
-<para>To make a long story short, this is the structure of our taglib jar file:</para>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="img/"/>
- </imageobject>
-</mediaobject>
-</figure>
-<para>The package "ticker" contains compiled classes for our ticker component. The top level
-META-INF folder contains the TLD file. It also contains the faces-config.xml file where the
-components, but nothing else are defined.</para>
-<para>To separate the components configuration from other stuff in the configuration file, let's
-split faces-config.xml into two files.</para>
-<para>Create the WEB-INF/faces-config-demo.xml file with the following content:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
-"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
-<faces-config>
-<managed-bean>
-<managed-bean-name>BannerPageBean</managed-bean-name>
-<managed-bean-class>demo.BannerPageBean</managed-bean-class>
-<managed-bean-scope>request</managed-bean-scope>
-<managed-property>
-<property-name>rendered</property-name>
-<property-class>java.lang.Boolean</property-class>
-<value/>
-</managed-property>
-</managed-bean>
-<application>
-<locale-config/>
-</application>
-<factory/>
-<lifecycle/>
-</faces-config>
-]]></programlisting>
-<para>Remove the information about the managed bean from the faces-config.xml file. The
-resulting content of this file will then be the following:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
-"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
-<faces-config>
-<component>
-<component-type>ticker</component-type>
-<component-class>ticker.UITicker</component-class>
-</component>
-<application>
-<locale-config/>
-</application>
-<factory/>
-<lifecycle/>
-</faces-config>
-]]></programlisting>
-<para>To have our demo application working, we have to add the information about the new
-configuration file into the web.xml. This will be the content of this file:</para>
-<programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" version="2.4">
-<context-param>
-<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
-<param-value>server</param-value>
-</context-param>
-<context-param>
-<param-name>javax.faces.CONFIG_FILES</param-name>
-<param-value>/WEB-INF/faces-config.xml,/WEB-INF/faces-config-demo.xml</param-value>
-</context-param>
-<listener>
-<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
-</listener>
-<servlet>
-<servlet-name>Faces Servlet</servlet-name>
-<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
-<load-on-startup>1</load-on-startup>
-</servlet>
-<servlet-mapping>
-<servlet-name>Faces Servlet</servlet-name>
-<url-pattern>*.jsf</url-pattern>
-</servlet-mapping>
-</web-app>
-]]></programlisting>
-<para>To make assembling the resulting jar file archive easier, we need to add the following code
-into the build.xml file:</para>
-<programlisting role="XML"><![CDATA[<property name="taglib.distname" value="mylib.jar"/>
-<property name="taglibdeploy.dir" value="deploy"/>
-<target name="createtaglib" depends="compile"
-description="Create deployable tag libraries file">
-<delete dir="${build.dir}"/>
-<mkdir dir="${build.dir}"/>
-<mkdir dir="${build.dir}/META-INF"/>
-<copy todir="${build.dir}/ticker">
-<fileset dir="${webinf.dir}/classes/ticker"/>
-</copy>
-<copy file="${webinf.dir}/faces-config.xml" todir="${build.dir}/META-INF"/>
-<copy file="${webinf.dir}/ticker.tld" todir="${build.dir}/META-INF"/>
-<mkdir dir="${taglibdeploy.dir}"/>
-<jar basedir="${build.dir}" jarfile="${taglibdeploy.dir}/${taglib.distname}"/>
-</target>
-]]></programlisting>
-<para>In this file, the first property defines the name of the result archive. The second one defines
-the folder where the archive will be placed. To use the new Ant target coding we added, go to the
-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 <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" %>
-]]></programlisting>
-<para>If you do everything right, the custom tag should work properly.</para>
-</section>
-<section id="WhatNext?">
-<?dbhtml filename="WhaNext.html"?>
-<title>What Next?</title>
-<para>In this tutorial we have created new JSF components all the way from scratch to a
-deployable package. In this example, we have covered the major points you will need in order to
-create any JSF component. However, our example does not show all of the aspects of JSF
-component building. You now have just the basic knowledge. If writing JSF components is
-going to be your job, you will need to learn more before you will become an expert in this area.</para>
-<section id="AdditionalTopics">
-<?dbhtml filename="AdditionalTopics.html"?>
-<title>Addititional Topics</title>
-<para>Some of the aspects you will need to learn that were not covered in this tutorial are
-mentioned below.</para>
-<para>Processing user input. If your component accepts data entered or selected by the user, you
-need to take care of encoding or decoding the date. Such a component might need to support
-validators, value changed listener, data converters.</para>
-<para>Working with Facets. Facets are similar to children, but they have names. It is up to the
-component how to process them. For example, the gridPanel from the standard JSF library has
-two facet elements for header and footer. It does not matter where the facet is located in the JSP
-code, the renderer always puts the header at the top and footer at the bottom.</para>
-<para>Custom rendering of the existing components. In our example, the getRendererType
-method of the TickerTag returns null. This means that the component renders itself. If this
-method returns any value, it makes it possible to overwrite the default rendering provided by the
-UITicker class. For this purpose, you or anybody else can add a new renderer with the defined
-name to the render-kit section of the faces configuration file. In the same way, you can
-implement rendered for any standard JSF components. All of the render type names can be found
-in the JSF specification.</para>
-<para>Action components. You can extend your component from the UICommand class. This
-allows you to write components similar to a command button or a link, but with advanced
-behavior. For example, you can implement tabbed panels or drop-down menus.</para>
-</section>
-<section id="JSFResources">
-<?dbhtml filename="JSFResources.html"?>
-<title>JSF Resources</title>
-<para>Beyond this tutorial, there are many resources that will help you go further with JSF. There
-are already a number of published books dedicated to JavaServer Faces. We recommend reading
-chapter 9 of the Core JavaServer Faces book by David Geary and Cay Horstmann. It contains
-very useful information regarding JSF component development.</para>
-<para>There are also several other types of resources available. We support the jsftutorials.net Web
-site where you can read other JSF tutorials. Also, if you or your company are interesting in
-learning JSF technology, Red Hat, Inc. has introduced a new JSF Course. You can read
-information about it on this CD. We are going to prepare several more courses that cover all
-levels from beginner to expert. The first course for beginners will be completed in the near
-future. For more information visit our corporate Web site at www.jboss.org</para>
-</section>
-</section>
-
-</chapter>
\ No newline at end of file
Deleted: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml 2007-07-13 14:32:14 UTC (rev 2430)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedStrutsValidationExamples.xml 2007-07-13 15:14:33 UTC (rev 2431)
@@ -1,250 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<chapter id="GettingStartedStrutsValidationExamples" xreflabel="GettingStartedStrutsValidationExamples">
- <?dbhtml filename="GettingStartedStrutsValidationExamples.html"?>
- <chapterinfo>
- <keywordset>
- <keyword>Red Hat Developer Studio</keyword>
- <keyword>Struts</keyword>
- <keyword>Struts Validation</keyword>
- </keywordset>
- </chapterinfo>
-<title>Getting Started Struts Validation Examples</title>
-
-<para>Validation of input is an important part of any Web application. All Apache Jakarta frameworks,
-including Struts, can use a common Jakarta Validation Framework for streamlining this aspect of Web
-application development. The Validation Framework allows the developer to define validation rules and then
- apply these rules on the client-side or the server-side.</para>
-
-<para>Red Hat Developer Studio makes using the Validation Framework in Struts even easier through a specialized editor
- for the XML files that control validation in a project. In this document, we'll show you how this all
- works by creating some simple client-side validation and server-side validation examples.</para>
-
-<section id="StartingPoint">
-<?dbhtml filename="StartingPoint.html"?>
-<title>Starting Point</title>
-<para>The example assumes that you have already created our sample StrutsHello application from the
-Getting Started Guide for Creating a Struts Application. You should have the Red Hat Developer Studio perspective
- open on this StrutsHello project.</para>
-</section>
-
-<section id="DefiningTheValidationRule">
-<?dbhtml filename="DefiningTheValidationRule.html"?>
-<title>Defining the Validation Rule</title>
-<para>In these steps you will set up the validation that can be used for either client-side or
-serverside validation. You need to enable validation as part of the project, define an error message,
-and tie it into the appropriate part of the application.</para>
-
-<itemizedlist>
-<listitem><para>Right-click the plug-ins node under the <emphasis>StrutsHello/Configuration/default/
-struts-config.xml</emphasis> node in the Web Projects view and select <emphasis>Create Special Plugin/Validators</emphasis> from the context
- menu.</para></listitem>
-<listitem><para>Further down in the Web Projects view, right-click on the
-StrutsHello/ResourceBundles node and select <emphasis> New/Properties File...</emphasis>from the context menu.</para></listitem>
-<listitem><para>In the dialog box, click on the <emphasis>Browse...</emphasis>button next to the Folder field, expand the
-JavaSource folder in this next dialog box, select the sample subfolder, and click on the OK button.</para></listitem>
-<listitem><para>Back in the first dialog box, type in applResources for the Name field and
-click on the Finish button.</para></listitem>
-<listitem><para>Right-click the newly created file and select <emphasis>Add/Default Error Messages</emphasis>
- from the context menu.</para></listitem>
-
-<listitem><para>Drag up the sample.applResources icon until you can drop it on the resources folder under struts-config.xml.</para></listitem>
-<listitem><para>Select<emphasis> File/Save </emphasis>All from the menu bar.</para></listitem>
-<listitem><para>Select validation.xml under the <emphasis>StrutsHello/Validation</emphasis> node and double-click it to open it with the Red Hat Developer Studio Validation Editor.</para></listitem>
-<listitem><para>Select validation.xml under the<emphasis> StrutsHello/Validation</emphasis> node and double-click it to open it with the Red Hat Studio Validation Editor.</para></listitem>
-<listitem><para>Expand the form-beans node under the <emphasis>StrutsHello/Configuration/default/struts-config.xml node.</emphasis> Then, drag the form bean GetNameForm and drop it onto formset (default) in the Validation Editor.</para></listitem>
-<listitem><para>In the Validation Editor, expand the formset node, right-click GetNameForm, and select<emphasis>Add Field...</emphasis> from the context menu.</para></listitem>
-<listitem><para>Enter name for Property in the dialog box.</para></listitem>
-<listitem><para>In the properties for the name field to the right of the "tree" for the validation.xml file, click on the <emphasis>Change...</emphasis>button next to the Depends entry field.</para></listitem>
-<listitem><para>In the displayed double list, select required from the left list and then click <emphasis>Add></emphasis>.</para></listitem>
-<listitem><para>Click Ok.</para></listitem>
-<listitem><para>Right-click name and select<emphasis>Add Arg...</emphasis> from the context menu.</para></listitem>
-<listitem><para>In the Add Arg dialog box, click on the <emphasis>Change...</emphasis>button next to the <emphasis>Key</emphasis> field.</para></listitem>
-<listitem><para>In the Key dialog box that appears now, click on the Add button.</para></listitem>
-<listitem><para>Enter name.required in the Name field, and enter A person's name in the Value field.</para></listitem>
-<listitem><para>Click Finish, then Ok, and then Ok again.</para></listitem>
-<listitem><para>Select <emphasis>File/Save All</emphasis> from the menu bar.</para></listitem>
-</itemizedlist>
-</section>
-
-<section id="Client-SideValidation">
-<?dbhtml filename="Client-SideValidation.html"?>
-<title>Client-Side Validation</title>
-<para>Client-side validation uses a scripting language (like JavaScript) running in the client browser</para>
-<para>to actually do the validation. In a Struts application using the Validation Framework, however,</para>
-<para>you don't actually have to do any of the script coding. The Validation Framework handles this.</para>
-<para>To see how this works in our application, you'll just need to make a couple of modifications to one of the JSP files.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Double-click inputname.jsp under <emphasis>StrutsHello/WEB-ROOT(WebContent)/pages</emphasis> to open it for editing.</para></listitem>
-<listitem><para>Find the tag near the top and hit Return to make a new line under it.</para></listitem>
-<listitem><para>In the Red Hat Palette view to the right, open the HTML folder and click on the javascript tag.</para></listitem>
-<listitem><para>Back in the editor, just in front of the closing slash for this inserted tag, hit Ctrl+Space and select formName from the prompting menu.</para></listitem>
-<listitem><para>Over in the Web Projects view, select GetNameForm under the <emphasis>StrutsHello/Configuration/default/struts-config.xml/form-beans</emphasis> node, drag it, and drop it between the quotes in the editor.</para></listitem>
-<listitem><para>Modify the <html:form> tag by inserting this attribute:</para></listitem>
-</itemizedlist>
-<para>onsubmit="return validateGetNameForm(this)"</para>
-<para>The file should now look like this:</para>
-<programlisting role="HTML"><![CDATA[
-<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
-<html:html>
-<head>
- <title>Input name</title>
- <html:javascript formName="GetNameForm"/>
-</head>
-<body>
- <html:form action="/greeting.do" onsubmit="return
- <para>validateGetNameForm(this)"></para>
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td><b>Input name:</b></td>
- </tr>
- <tr>
- <td>
- <html:text property="name" />
- <html:submit value=" Say Hello! " />
- </td>
- </tr>
- </table>
- </html:form>
-</body>
-</html:html>
-]]></programlisting>
-<itemizedlist continuation="continues">
-<listitem><para>Select<emphasis> File/Save </emphasis>from the menu bar.</para></listitem>
-<listitem><para>28. Start JBoss Application Server by clicking on its icon (a right-pointing arrow) in the toolbar.</para></listitem>
-<listitem><para>29. Click on the Run icon in the toolbar.</para></listitem>
-<listitem><para>Start Tomcat by clicking on its icon (a right-pointing arrow) in the toolbar.</para></listitem>
-<listitem><para>Click on the Run icon in the toolbar.</para></listitem>
-</itemizedlist>
-<figure>
-<title></title>
-<mediaobject>
- <imageobject>
- <imagedata fileref="images/run.png"/>
- </imageobject>
-</mediaobject>
-</figure>
-<itemizedlist><listitem><para>30. In the browser window, click on the Say Hello! button without having entered any name in the form.</para></listitem></itemizedlist>
-<para>A JavaScript error message should be displayed in an alert box.</para>
-</section>
-<section id="Server-SideValidation">
-<?dbhtml filename="Server-SideValidation.html"?>
-<title>Server-Side Validation</title>
-<para>Server-side validation does the validation inside the application on the server. In a Struts
-application using the Validation Framework, you still don't have to do any of the actual validation
-coding. The Validation Framework handles this. You will, though, have to make a few changes to the JSP
-file you modified for client-side validation along with a change to an action and a few changes to the
- form bean class.</para>
-</section>
-
-<section id="EditingTheJSPFile">
-<?dbhtml filename="EditingTheJSPFile.html"?>
-<title>Editing the JSP File</title>
-<itemizedlist continuation="continues">
-<listitem><para>Reopen inputname.jsp for editing.</para></listitem>
-<listitem><para>Delete the onsubmit attribute in the <html:form> element that you put in for client-side validation.</para></listitem>
-
-<listitem><para>Add an <html:errors/> tag after the </html:form> tag.</para></listitem>
-</itemizedlist>
-<para>The JSP file should now look like this:</para>
-
-<programlisting role="HTML"><![CDATA[
-<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
-<html:html>
-<head>
- <title>Input name</title>
- <html:javascript formName="GetNameForm"/>
-</head>
-<body>
- <html:form action="/greeting.do">
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td><b>Input name:</b></td>
- </tr>
- <tr>
- <td>
- <html:text property="name" />
- <html:submit value=" Say Hello! " />
- </td>
- </tr>
- </table>
- </html:form>
- <html:errors />
-</body>
-</html:html>
-]]></programlisting>
-
-</section>
-
-<section id="EditingTheAction">
-<?dbhtml filename="EditingTheAction.html"?>
-<title>Editing the Action</title>
-<itemizedlist continuation="continues">
-<listitem><para>In the Web Projects view, expand the node under the <emphasis>StrutsHello/Configuration/default/struts-config.xml/action-mappings</emphasis> node, right-click the /greeting action, and then select <emphasis>Properties...</emphasis>from the context menu.</para></listitem>
-
-<listitem><para>In the Edit Properties window, insert the cursor into the value column for the input property and click on the <emphasis>...</emphasis> button.</para></listitem>
-
-<listitem><para>In the dialog box, make sure the Pages tab is selected, select <emphasis>StrutsHello/WEB-ROOT(WebContent)/pages/inputname.jsp</emphasis>, click the Ok button, and then click on the Close button.</para></listitem>
-</itemizedlist>
-</section>
-<section id="EditingTheFormBean">
-<?dbhtml filename="EditingTheFormBean.html"?>
-
-<title>Editing the Form Bean</title>
-<itemizedlist continuation="continues">
-<listitem><para>Right-click the /greeting action again and select Open Form-bean Source to open the GetNameForm.java file for editing.</para></listitem>
-<listitem><para>Change the class that it extends to from: <emphasis>org.apache.struts.action.ActionForm</emphasis> to: org.apache.struts.validator.ValidatorForm</para></listitem>
-<listitem><para>Comment out out the validate method.</para></listitem>
-</itemizedlist>
-<para>The file should now look like this:</para>
-<programlisting role="JAVA"><![CDATA[
-package sample;
-
-import javax.servlet.http.HttpServletRequest;
-import org.apache.struts.action.ActionErrors;
-import org.apache.struts.action.ActionMapping;
-public class GetNameForm extends
-
-org.apache.struts.validator.ValidatorForm {
-
- private String name = "";
-
- /**
- * @return Returns the name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name The name to set.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- public GetNameForm () {
- }
-
- public void reset(ActionMapping actionMapping,
- HttpServletRequest request) {
- this.name = "";
- }
-
- // public ActionErrors validate(ActionMapping actionMapping,
- HttpServletRequest request) {
- // ActionErrors errors = new ActionErrors();
- // return errors;
- // }
-}
-]]></programlisting>
-
-
-<para>Select <emphasis>File/Save All </emphasis>from the menu bar.</para>
-<itemizedlist continuation="continues">
-<listitem><para>Reload the application into JBoss AS by clicking on the Change Time Stamp icon (a finger pointing with a little star) in the toolbar.</para></listitem>
-<listitem><para>Run the application.</para></listitem>
-<listitem><para>In the browser window, click on the Say Hello! button without having entered any name in the form.</para></listitem>
-</itemizedlist>
-<para>The error message should appear in a refreshed version of the form.</para>
-</section>
-</chapter>
\ No newline at end of file
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml 2007-07-13 14:32:14 UTC (rev 2430)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml 2007-07-13 15:14:33 UTC (rev 2431)
@@ -6,21 +6,21 @@
<keyword>Red Hat Developer Studio</keyword>
<keyword>Eclipse</keyword>
<keyword>Java</keyword>
- <keyword>Tomcat</keyword>
+ <keyword>JBoss</keyword>
</keywordset>
</chapterinfo>
<title>Getting Started with Red Hat Developer Studio</title>
<section id="Installing">
<?dbhtml filename="Installing.html"?>
-<title>Installing</title>
+<title>Installation</title>
<section id="Inst from down ver">
<title>Installing from the downloaded version</title>
<itemizedlist>
<listitem>
- <para>Download the appropriate installation file for your platform from www.exadel.com/web/portal/download.</para>
+ <para>Download the appropriate installation file for your platform from www.exadel.com/web/portal/download</para>
</listitem>
<listitem>
- <para>Run install.jar and follow the instructions presented by the installation wizard.</para>
+ <para>Run install.jar and follow the instructions presented by the installation wizard</para>
</listitem>
</itemizedlist>
@@ -36,48 +36,56 @@
<para>Installation process includes all required platforms to run Red Hat Developer Studio:</para>
<itemizedlist>
<listitem>
- <para>Eclipse 3.2.2</para>
+ <para>Eclipse 3.3</para>
</listitem>
<listitem>
<para>JBoss J2EE Application Server</para>
+ </listitem>
+ </itemizedlist>
<figure>
<title>JBoss J2EE Application Server installing</title>
- <mediaobject>
- <imageobject>
+ <imageobject>
<imagedata fileref="images/install2.png"/>
</imageobject>
- </mediaobject>
</figure>
<note>The installer will install JBoss J2EE Application Server for running your applications if you select this option during the installation process.
If you want to use a different server than ours, you can change the setting in Red Hat Developer Studio.</note>
- </listitem>
- </itemizedlist>
+
</section>
<section id="InstallingthroughTheUpdateSite">
<?dbhtml filename="InstallingthroughTheUpdateSite.html"?>
<title>Installing via update Site</title>
TBD
</section>
-
-
+
</section>
<section id="Upgrading">
<?dbhtml filename="Upgrading.html"?>
<title>Upgrading</title>
- <para>To upgrade, just uninstall your current version and install the new version.</para>
+ <para>To upgrade, just uninstall your current version and install the new one.</para>
</section>
<section id="Uninstalling">
<?dbhtml filename="Uninstalling.html"?>
<title>Uninstalling</title>
-
- <para>Make sure Red Hat Developer Studio is not running.</para>
- <para>Uninstall your current version of Red Hat Developer Studio by running uninstaller.</para>
-
+ <itemizedlist>
+ <listitem>Make sure Red Hat Developer Studio is not running</listitem>
+ <listitem>Uninstall your current version of Red Hat Developer Studio by running uninstaller</listitem>
+</itemizedlist>
</section>
<section id="Subscription">
<?dbhtml filename="Subscription.html"?>
<title>Subscription</title>
- TBD
+ <para>Enjoy the peace of mind that comes with knowing that you are just an email away from having the advice of our development team at your fingertips to solve the problems that crop up during application development. Get the advice you need to ensure the success of your projects on time and on budget. Whether you are using JSF, RichFaces, Ajax4jsf, Hibernate or Seam, the JBoss team is always available to help. Just subcribe to our subcription program:</para>
+ <para>What You Get:</para>
+ <itemizedlist>
+ <listitem>Email access to the JBoss customer support team (responses within 48 hours)</listitem>
+ <listitem>Application development consultation</listitem>
+ <listitem>Sample code</listitem>
+ <listitem>Code review</listitem>
+ <listitem>General architectural review</listitem>
+ <listitem>User interface design tips</listitem>
+ <listitem>Overviews of JSF or AJAX technologies</listitem>
+ </itemizedlist>
</section>
<section id="Support">
<?dbhtml filename="Support.html"?>
@@ -86,64 +94,59 @@
<ulink url="mailto:support@exadel.com">support(a)exadel.com</ulink> or
<ulink url="http://www.jboss.com/index.html?module=bb&op=viewforum&f=258">Red Hat Developer Studio Forum</ulink>.</para>
<para>When writing to support, please include the following information:</para>
- <itemizedlist>
- <listitem><para> Red Hat Developer Studio version</para></listitem>
+ <orderedlist>
+ <listitem><para>Red Hat Developer Studio version</para></listitem>
<listitem><para>Exact error message</para></listitem>
- <listitem><para>Exact steps you took to get the error</para></listitem>
- </itemizedlist>
+ <listitem><para>Exact steps you take to get the error</para></listitem>
+ </orderedlist>
</section>
<section id="FAQ">
<?dbhtml filename="FAQ.html"?>
<title>FAQ</title>
<para>For easy reference to Red Hat Developer Studio related questions, our FAQ provides answers to our most "popular" questions.
- The sections of questions are organized by type. For further support, please contact support(a)exadel.com.</para>
+ The sections of questions are organized by type. For further support, please contact <ulink url="mailto:support@exadel.com">support(a)exadel.com</ulink>.</para>
<section id="Before_Installing">
<title>Before Installing, Tutorials, Examples, Readme Files</title>
<para><emphasis role="bold">I'm looking for examples, do you have any?</emphasis></para>
- <para>Yes, simply go to our tutorials page</para>
+ <para>Yes, simply go to our <ulink url="http://exadel.com/web/portal/products/Tutorials">tutorials page</ulink></para>
<para><emphasis role="bold">Where can I find the Red Hat Developer Studio readme file?</emphasis></para>
- <para>It's at http://www.exadel.com/web/portal/products/ReleaseNotes</para>
+ <para>It's located at this page: <ulink url="http://www.exadel.com/web/portal/products/ReleaseNotes">Release Notes</ulink></para>
<para><emphasis role="bold">Where can I find some documentation for Red Hat Developer Studio?</emphasis></para>
- <para>Try these resources:</para>
- <para>TBD</para>
+ <para>Try these resources: <ulink url="http://www.exadel.com/exadelstudio/help/">User Guide</ulink></para>
<para><emphasis role="bold">What version of Eclipse does Red Hat Developer Studio support?</emphasis></para>
- <para>Red Hat Developer Studio works with Eclipse 3.2.2 </para>
+ <para>Red Hat Developer Studio works with Eclipse 3.3</para>
</section>
<section id="Downloading">
<title>Downloading</title>
<para><emphasis role="bold">Where can I download a copy of Red Hat Developer Studio?</emphasis></para>
- <para>Simply go TBD. </para>
+ <para>Go to <ulink url="http://www.exadel.com/web/portal/download/esp35">Download Page</ulink></para>
</section>
<section id="Installation_Issues">
<title>Installation Issues</title>
<para><emphasis role="bold">Do I need to have JBoss server installed to run Red Hat Developer Studio?</emphasis></para>
<para>No. Red Hat Developer Studio already comes bundled with JBoss server. We bundle it together so that you don't need to download any
additional software and can test your application in a Web browser right away.</para>
- <para>If you want to use a different JBoss server installation, after installing, simply go to preferences and change the settings to point to another
- Jboss server installation.</para>
- <para>Red Hat Developer Stuiod works with any serlvet container, not just JBoss. For more information on deployment, please see the Deploying Your Application section.</para>
+ <para>If you want to use a different JBoss server installation, after Red Hat Developer Studio is installed open Servers View (select Window > Show View > Others > Server > Servers), then right click on this view > New > Server and follow the wizards steps to point to another Jboss server installation.</para>
+ <para>Red Hat Developer Studio works with any servlet container, not just JBoss. For more information on deployment, please see the Deploying Your Application section.</para>
<para><emphasis role="bold"> What third-party plug-ins are installed with RHDS?</emphasis></para>
- <para>Read the <link linkend="Installing">Installing</link> section.</para>
+ <para>Read the <link linkend="Installing">Installation</link> section.</para>
</section>
<section id="Importing_Projects">
<title>Importing Projects</title>
<para><emphasis role="bold">I have an existing Struts or JSF project. Can I open the project in RHDS?</emphasis></para>
- <para>Yes. Read the TBD</para>
+ <para>Yes. From main menu select File > Import > Other > JSF Project (or Struts Project) and follow wizards steps.</para>
<para><emphasis role="bold">Can I import a .war file?</emphasis></para>
- <para>Yes. Read the TBD</para>
+ <para>Yes. Select File > Import > Web > WAR file. Then follow importing steps.</para>
</section>
<section id="Troubleshooting">
<title>Troubleshooting, Problems, Configuration, Error Messages</title>
<para><emphasis role="bold">Is it possible to increase the performance of Eclipse after installing your product? My Eclipse now crawls.</emphasis></para>
- <para>By default, Eclipse allocates only 128 Mb of memory whatever physical memory you actually have installed. You can significantly increase performance
- if you allocate more memory. For example:</para>
- <para>eclipse.exe -vmargs -Xmx512M</para>
+ <para>By default, Eclipse allocates only 128 Mb of memory whatever physical memory you actually have installed. You can significantly increase performance if you allocate more memory. For example:</para>
+ <para>-vmargs -Xms128m -Xmx512m -XX:MaxPermSize=128m</para>
<para><emphasis role="bold">How can I add my own tag library to the Red Hat Palette?</emphasis></para>
- <para>See Adding Tag Libraries in JBossJSFTools Guide</para>
- <para><emphasis role="bold">I see the Oracle ADF Faces component library tags in the Red Hat Palette, but I can't seem to find the libraries for ADF.
- How do I use this component library with RHDS?</emphasis></para>
- <para>See Adding Support for the Oracle ADF Components Library in the RHDS User Guide.</para>
-
+ <para>See <ulink url="http://labs.jboss.com/jbossjsftools/docs">Adding Tag Libraries</ulink> in JBossJSFTools Guide.</para>
+ <para><emphasis role="bold">I see the Oracle ADF Faces component library tags in the Red Hat Palette, but I can't seem to find the libraries for ADF. How do I use this component library with RHDS?</emphasis></para>
+ <para>See <ulink url="http://labs.jboss.com/jbossrhdsuserguide/docs">Adding Support for the Oracle ADF Components Library</ulink> in the RHDS User Guide.</para>
</section>
</section>
17 years, 5 months
JBoss Tools SVN: r2430 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors: parts and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-13 10:32:14 -0400 (Fri, 13 Jul 2007)
New Revision: 2430
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java 2007-07-13 14:31:55 UTC (rev 2429)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java 2007-07-13 14:32:14 UTC (rev 2430)
@@ -18,15 +18,7 @@
protected boolean childsHiden = true;
- private OrmShape reference=null;
- public void setReference(OrmShape reference){
- this.reference = reference;
- }
-
- public OrmShape getReference(){
- return reference;
- }
public ComponentShape(Object ioe) {
super(ioe);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java 2007-07-13 14:31:55 UTC (rev 2429)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java 2007-07-13 14:32:14 UTC (rev 2430)
@@ -23,7 +23,16 @@
public static final String SHOW_REFERENCES = "show references";
private boolean refHide = false;
-
+
+ private OrmShape reference=null;
+
+ public void setReference(OrmShape reference){
+ this.reference = reference;
+ }
+
+ public OrmShape getReference(){
+ return reference;
+ }
public ExpandeableShape(Object ioe) {
super(ioe);
}
@@ -31,7 +40,10 @@
public void refreshReferences(Object model) {
refHide = !refHide;
if (model instanceof OrmDiagram) {
- ((OrmDiagram)model).processExpand(this);
+ if(refHide)
+ ((OrmDiagram)model).processExpand(this);
+ else
+ ((OrmDiagram)model).processCollapse(this);
}
firePropertyChange(SHOW_REFERENCES, null, new Boolean(refHide));
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-13 14:31:55 UTC (rev 2429)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-13 14:32:14 UTC (rev 2430)
@@ -14,15 +14,34 @@
import java.util.List;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
import org.eclipse.swt.graphics.RGB;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleLabel;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.TopLineBorder;
import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
public class ExpandeableShapeEditPart extends ShapeEditPart {
-
+ protected IFigure createFigure() {
+ if (getModel() instanceof Shape) {
+ Label label = new TitleLabel();
+ label.setText(ormLabelProvider.getText(getElement()));
+ label.setBackgroundColor(getColor());
+ label.setIcon(ormLabelProvider.getImage(getElement()));
+ label.setLabelAlignment(PositionConstants.LEFT);
+ label.setOpaque(true);
+ TopLineBorder border = new TopLineBorder(1,2+getCastedModel().getIndent(),1,2);
+ border.setColor(getOrmShapeEditPart().getColor());
+ label.setBorder(border);
+ return label;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
public void performRequest(Request req) {
if(RequestConstants.REQ_OPEN.equals(req.getType())) {
((ExpandeableShape)getModel()).refreshReferences(getViewer().getContents().getModel());
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-13 14:31:55 UTC (rev 2429)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-13 14:32:14 UTC (rev 2430)
@@ -172,7 +172,7 @@
return anchor;
}
- private OrmShapeEditPart getOrmShapeEditPart() {
+ protected OrmShapeEditPart getOrmShapeEditPart() {
int i = 0;
EditPart part = this;
while (!((part instanceof OrmShapeEditPart))) {
@@ -268,7 +268,7 @@
}
- private Object getElement() {
+ protected Object getElement() {
Object element = getCastedModel().getOrmElement();
if (element instanceof SpecialRootClass) element = (RootClass)element;
return element;
17 years, 5 months
JBoss Tools SVN: r2429 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-13 10:31:55 -0400 (Fri, 13 Jul 2007)
New Revision: 2429
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-13 13:42:16 UTC (rev 2428)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-13 14:31:55 UTC (rev 2429)
@@ -23,7 +23,6 @@
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.JoinedSubclass;
import org.hibernate.mapping.KeyValue;
import org.hibernate.mapping.OneToMany;
import org.hibernate.mapping.PersistentClass;
@@ -161,12 +160,58 @@
} else if (ormElement instanceof Property) {
SpecialRootClass specialRootClass = new SpecialRootClass((Property)ormElement);
ormShape = elements.get(specialRootClass.getEntityName());
- } else if (ormElement instanceof SingleTableSubclass) {
- ormShape = elements.get(((SingleTableSubclass)ormElement).getEntityName());
+ } else if (ormElement instanceof Subclass) {
+ ormShape = elements.get(((Subclass)ormElement).getEntityName());
}
return ormShape;
}
+ private OrmShape removePersistentClass(PersistentClass persistentClass){
+ Table componentClassDatabaseTable=null;
+ OrmShape classShape = null;
+ OrmShape shape = null;
+ if(persistentClass != null) {
+ classShape = elements.get(persistentClass.getClassName());
+ if (classShape == null) classShape = createShape(persistentClass);
+ if(componentClassDatabaseTable == null && persistentClass.getTable() != null)
+ componentClassDatabaseTable = persistentClass.getTable();
+ if(componentClassDatabaseTable != null) {
+ shape = elements.get(componentClassDatabaseTable.getSchema() + "." + componentClassDatabaseTable.getName());
+ if (shape != null){
+ removeLinks(shape);
+ getChildren().remove(shape);
+ elements.remove(componentClassDatabaseTable.getSchema() + "." + componentClassDatabaseTable.getName());
+ }
+ }
+ RootClass rc = (RootClass)persistentClass;
+ Iterator iter = rc.getSubclassIterator();
+ while (iter.hasNext()) {
+ SingleTableSubclass singleTableSubclass = (SingleTableSubclass)iter.next();
+ OrmShape singleTableSubclassShape = elements.get(singleTableSubclass.getEntityPersisterClass().getCanonicalName());
+ if (singleTableSubclassShape != null){
+ removeLinks(singleTableSubclassShape);
+ getChildren().remove(singleTableSubclassShape);
+ elements.remove(singleTableSubclass.getEntityPersisterClass().getCanonicalName());
+ }
+ }
+
+ if (persistentClass.getIdentifier() instanceof Component) {
+ Component identifier = (Component)persistentClass.getIdentifier();
+ if (!identifier.getComponentClassName().equals(identifier.getOwner().getClassName())) {
+ OrmShape componentClassShape = elements.get(identifier.getComponentClassName());
+ if (componentClassShape != null){
+ removeLinks(componentClassShape);
+ getChildren().remove(componentClassShape);
+ elements.remove(identifier.getComponentClassName());
+ }
+ String tableName = identifier.getTable().getSchema() + "." + identifier.getTable().getName();
+ elements.remove(tableName);
+ }
+ }
+ }
+ return classShape;
+ }
+
private OrmShape getOrCreatePersistentClass(PersistentClass persistentClass, Table componentClassDatabaseTable){
OrmShape classShape = null;
OrmShape shape = null;
@@ -218,7 +263,7 @@
}
return classShape;
}
-
+
private OrmShape getOrCreateDatabaseTable(Table databaseTable){
OrmShape tableShape = null;
if(databaseTable != null) {
@@ -303,8 +348,56 @@
firePropertyChange(DIRTY, null, null);
}
}
+
+ public void processCollapse(ExpandeableShape shape) {
+ Object element = shape.getOrmElement();
+ OrmShape reference = shape.getReference();
+ if(reference != null){
+ if(element instanceof RootClass){
+ RootClass rc = (RootClass)element;
+ Table table = rc.getTable();
+ OrmShape sh = getShape(table);
+ removeLinks(sh);
+ getChildren().remove(sh);
+ elements.remove(sh);
+ }
+ if (element instanceof Property) {
+ Property property = (Property)element;
+ if (!property.isComposite()) {
+ Type type = ((Property)element).getType();
+ if (type.isEntityType()) {
+ EntityType et = (EntityType) type;
+ Object clazz = getConfiguration().getClassMapping(et.getAssociatedEntityName());
+ if (clazz instanceof RootClass) {
+ RootClass rootClass = (RootClass)clazz;
+
+ removePersistentClass(rootClass);
+ } else if (clazz instanceof SingleTableSubclass) {
+ removePersistentClass(((SingleTableSubclass)clazz).getRootClass());
+
+ }
+ }
+ } else {
+ removePersistentClass(new SpecialRootClass(property));
+
+ }
+ for(int i = reference.getChildren().size()-1;i>=0;i--){
+ if(reference.getChildren().get(i) instanceof ExpandeableShape)
+ processCollapse((ComponentShape)reference.getChildren().get(i));
+ if(reference.getChildren().get(i) instanceof ComponentShape)
+ hideReferences((ComponentShape)reference.getChildren().get(i));
+ }
+ removeLinks(reference);
+ getChildren().remove(reference);
+ elements.remove(reference);
+ shape.setReference(null);
+ }
+ firePropertyChange(REFRESH, null, null);
+ }
+ }
public void processExpand(ExpandeableShape shape) {
+ OrmShape s=null;
Object element = shape.getOrmElement();
if (element instanceof Property) {
Property property = (Property)element;
@@ -315,7 +408,7 @@
Object clazz = getConfiguration().getClassMapping(et.getAssociatedEntityName());
if (clazz instanceof RootClass) {
RootClass rootClass = (RootClass)clazz;
- OrmShape s = getOrCreatePersistentClass(rootClass, null);
+ s = getOrCreatePersistentClass(rootClass, null);
HashMap targets = new HashMap();
Iterator iterator = shape.getSourceConnections().iterator();
while (iterator.hasNext()) {
@@ -339,12 +432,13 @@
if(!isConnectionExist(shape, s))
new Connection(shape, s);
} else if (clazz instanceof SingleTableSubclass) {
- OrmShape s = getOrCreatePersistentClass(((SingleTableSubclass)clazz).getRootClass(), null);
+ s = getOrCreatePersistentClass(((SingleTableSubclass)clazz).getRootClass(), null);
}
}
} else {
- OrmShape s = getOrCreatePersistentClass(new SpecialRootClass(property), null);
+ s = getOrCreatePersistentClass(new SpecialRootClass(property), null);
}
+ shape.setReference(s);
firePropertyChange(REFRESH, null, null);
}
}
@@ -353,6 +447,33 @@
return configuration;
}
+ public void hideShapes(ExpandeableShape hidenShape){
+ OrmShape reference = hidenShape.getReference();
+ if(reference != null){
+ Object element = reference.getOrmElement();
+ if(element instanceof RootClass){
+ RootClass rc = (RootClass)element;
+ Table table = rc.getTable();
+ OrmShape shape = getShape(table);
+ removeLinks(shape);
+ getChildren().remove(shape);
+ elements.remove(shape);
+ }
+ for(int i = reference.getChildren().size()-1;i>=0;i--){
+ if(reference.getChildren().get(i) instanceof ComponentShape)
+ hideReferences((ComponentShape)reference.getChildren().get(i));
+ if(reference.getChildren().get(i) instanceof ExpandeableShape)
+ processCollapse((ComponentShape)reference.getChildren().get(i));
+ }
+ removeLinks(reference);
+ getChildren().remove(reference);
+ elements.remove(reference);
+ hidenShape.setReference(null);
+ }
+ removeLinks(hidenShape);
+ firePropertyChange(REFRESH, null, null);
+ }
+
protected void hideReferences(ComponentShape componentShape) {
OrmShape reference = componentShape.getReference();
if(reference != null){
@@ -415,6 +536,8 @@
for(int i = reference.getChildren().size()-1;i>=0;i--){
if(reference.getChildren().get(i) instanceof ComponentShape)
hideReferences((ComponentShape)reference.getChildren().get(i));
+ if(reference.getChildren().get(i) instanceof ExpandeableShape)
+ processCollapse((ComponentShape)reference.getChildren().get(i));
}
removeLinks(reference);
getChildren().remove(reference);
17 years, 5 months
JBoss Tools SVN: r2428 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-07-13 09:42:16 -0400 (Fri, 13 Jul 2007)
New Revision: 2428
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELCompletionEngine.java
Log:
http://jira.jboss.org/jira/browse/EXIN-330
Prompting Computer/Processor is added to be used in JavaEditor and XML Editor content assistants
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELCompletionEngine.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELCompletionEngine.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELCompletionEngine.java 2007-07-13 13:42:16 UTC (rev 2428)
@@ -0,0 +1,608 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.text.java;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.rules.IToken;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamContextVariable;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.ui.SeamGuiPlugin;
+
+public final class SeamELCompletionEngine {
+
+ public SeamELCompletionEngine() {
+
+ }
+
+ /**
+ * Create the array of suggestions.
+ *
+ * @param project Seam project
+ * @param file File
+ * @param document
+ * @param prefix the prefix to search for
+ * @param position Offset of the prefix
+ * @return the list of all possible suggestions
+ * @throws BadLocationException if accessing the current document fails
+ */
+ public List<String> getCompletions(ISeamProject project, IFile file, IDocument document, CharSequence prefix,
+ int position) throws BadLocationException {
+
+ List<String> res= new ArrayList<String>();
+ SeamELTokenizer tokenizer = new SeamELTokenizer(document, position + prefix.length());
+ List<ELToken> tokens = tokenizer.getTokens();
+
+ List<ELToken> resolvedExpressionPart = new ArrayList<ELToken>();
+ List<ISeamContextVariable> resolvedVariables = null;
+ ScopeType scope = getScope(project, file);
+ List<List<ELToken>> variations = getPossibleVarsFromPrefix(tokens);
+
+ if (variations.isEmpty()) {
+ resolvedVariables = resolveVariables(project, scope, tokens, tokens);
+ } else {
+ for (List<ELToken> variation : variations) {
+ List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
+ resolvedVars = resolveVariables(project, scope, variation, tokens);
+ if (resolvedVars != null && !resolvedVars.isEmpty()) {
+ resolvedVariables = resolvedVars;
+ resolvedExpressionPart = variation;
+ break;
+ }
+ }
+ }
+
+ // Here we have a list of vars for some part of expression
+ // OK. we'll proceed with members of these vars
+ if (areEqualExpressions(resolvedExpressionPart, tokens)) {
+ // First segment is the last one
+ for (ISeamContextVariable var : resolvedVariables) {
+ res.add(var.getName().substring(prefix.toString().length()));
+ }
+ return res;
+ }
+
+ // First segment is found - proceed with next tokens
+ int startTokenIndex = (resolvedExpressionPart == null ? 0 : resolvedExpressionPart.size());
+ Set<IMember> members = new HashSet<IMember>();
+ for (ISeamContextVariable var : resolvedVariables) {
+ IMember member = SeamExpressionResolver.getMemberByVariable(var);
+ if (member != null && !members.contains(member))
+ members.add(member);
+ }
+ for (int i = startTokenIndex;
+ tokens != null && i < tokens.size() &&
+ members != null && members.size() > 0;
+ i++) {
+ ELToken token = tokens.get(i);
+
+ if (i < tokens.size() - 1) { // inside expression
+ if (token.getType() == ELToken.EL_SEPARATOR_TOKEN)
+ // proceed with next token
+ continue;
+
+ if (token.getType() == ELToken.EL_NAME_TOKEN) {
+ // Find properties for the token
+ String name = token.getText();
+ Set<IMember> newMembers = new HashSet<IMember>();
+ for (IMember mbr : members) {
+ try {
+ IType type = (mbr instanceof IType ? (IType)mbr : EclipseJavaUtil.findType(mbr.getJavaProject(), EclipseJavaUtil.getMemberTypeAsString(mbr)));
+ Set<IMember> properties = SeamExpressionResolver.getProperties(type);
+ for (IMember property : properties) {
+ StringBuffer propertyName = new StringBuffer(property.getElementName());
+ if (property instanceof IMethod) { // Setter or getter
+ propertyName.delete(0, 3);
+ propertyName.setCharAt(0, Character.toLowerCase(propertyName.charAt(0)));
+ }
+ if (name.equals(propertyName.toString())) {
+ newMembers.add(property);
+ }
+ }
+ } catch (JavaModelException ex) {
+ SeamGuiPlugin.getPluginLog().logError(ex);
+ }
+ }
+ members = newMembers;
+ }
+ if (token.getType() == ELToken.EL_METHOD_TOKEN) {
+ // Find methods for the token
+ String name = token.getText();
+ if (name.indexOf('(') != -1) {
+ name = name.substring(0, name.indexOf('('));
+ }
+ Set<IMember> newMembers = new HashSet<IMember>();
+ for (IMember mbr : members) {
+ try {
+ IType type = (mbr instanceof IType ? (IType)mbr : EclipseJavaUtil.findType(mbr.getJavaProject(), EclipseJavaUtil.getMemberTypeAsString(mbr)));
+ Set<IMember> methods = SeamExpressionResolver.getMethods(type);
+ for (IMember method : methods) {
+ if (name.equals(method.getElementName())) {
+ newMembers.add(method);
+ }
+ }
+ } catch (JavaModelException ex) {
+ SeamGuiPlugin.getPluginLog().logError(ex);
+ }
+ }
+ members = newMembers;
+ }
+ } else { // Last segment
+ Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ if (token.getType() == ELToken.EL_SEPARATOR_TOKEN) {
+ // return all the methods + properties
+ for (IMember mbr : members) {
+ try {
+ IType type = (mbr instanceof IType ? (IType)mbr : EclipseJavaUtil.findType(mbr.getJavaProject(), EclipseJavaUtil.getMemberTypeAsString(mbr)));
+ proposals.addAll(SeamExpressionResolver.getMethodPresentations(type));
+ proposals.addAll(SeamExpressionResolver.getPropertyPresentations(type));
+ } catch (JavaModelException ex) {
+ SeamGuiPlugin.getPluginLog().logError(ex);
+ }
+ }
+ } else if (token.getType() == ELToken.EL_NAME_TOKEN ||
+ token.getType() == ELToken.EL_METHOD_TOKEN) {
+ // return filtered methods + properties
+ Set<String> proposalsToFilter = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ for (IMember mbr : members) {
+ try {
+ IType type = EclipseJavaUtil.findType(mbr.getJavaProject(), EclipseJavaUtil.getMemberTypeAsString(mbr));
+ proposalsToFilter.addAll(SeamExpressionResolver.getMethodPresentations(type));
+ proposalsToFilter.addAll(SeamExpressionResolver.getPropertyPresentations(type));
+ } catch (JavaModelException ex) {
+ SeamGuiPlugin.getPluginLog().logError(ex);
+ }
+ }
+ for (String proposal : proposalsToFilter) {
+ // We do expect nothing but name for method tokens (No round brackets)
+ String filter = token.getText();
+ if (proposal.startsWith(filter)) {
+ proposals.add(proposal.substring(filter.length()));
+ }
+ }
+ }
+ res.addAll(proposals);
+ }
+ }
+
+ return res;
+ }
+
+ private String computeVariableName(List<ELToken> tokens){
+ if (tokens == null)
+ tokens = new ArrayList<ELToken>();
+ StringBuffer sb = new StringBuffer();
+ for (ELToken token : tokens) {
+ if (token.getType() == ELToken.EL_NAME_TOKEN ||
+ token.getType() == ELToken.EL_METHOD_TOKEN ||
+ token.getType() == ELToken.EL_SEPARATOR_TOKEN) {
+ sb.append(token.getText());
+ }
+ }
+ return sb.toString();
+ }
+
+ private boolean areEqualExpressions(List<ELToken>first, List<ELToken>second) {
+ if (first == null || second == null)
+ return (first == second);
+
+ if (first.size() != second.size())
+ return false;
+
+ for (int i = 0; i < first.size(); i++) {
+ if (!first.get(i).equals(second.get(i)))
+ return false;
+ }
+ return true;
+ }
+
+ private ScopeType getScope(ISeamProject project, IResource resource) {
+ if (project == null || resource == null)
+ return null;
+
+ Set<ISeamComponent> components = project.getComponentsByPath(resource.getFullPath());
+
+ if (components.size() > 1) // Don't use scope in case of more than one component
+ return null;
+ for (ISeamComponent component : components) {
+ return component.getScope();
+ }
+ return null;
+ }
+
+ List<ISeamContextVariable> resolveVariables(ISeamProject project, ScopeType scope, List<ELToken>part, List<ELToken> tokens) {
+ List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
+ String varName = computeVariableName(part);
+ if (varName != null) {
+ resolvedVars = SeamExpressionResolver.resolveVariables(project, scope, varName);
+ }
+ if (resolvedVars != null && resolvedVars.size() > 0) {
+ List<ISeamContextVariable> newResolvedVars = new ArrayList<ISeamContextVariable>();
+ for (ISeamContextVariable var : resolvedVars) {
+ if(!areEqualExpressions(part, tokens)) {
+ // Do filter by equals (name)
+ // In case of the last pass - do not filter by startsWith(name) instead of equals
+ if (varName.equals(var.getName())) {
+ newResolvedVars.add(var);
+ }
+ } else {
+ newResolvedVars.add(var);
+ }
+ }
+ return newResolvedVars;
+ }
+ return new ArrayList<ISeamContextVariable>();
+ }
+
+ private List<List<ELToken>> getPossibleVarsFromPrefix(List<ELToken>prefix) {
+ ArrayList<List<ELToken>> result = new ArrayList<List<ELToken>>();
+ for (int i = 0; prefix != null && i < prefix.size(); i++) {
+ ELToken lastToken = prefix.get(i);
+ if (lastToken.getType() != ELToken.EL_SEPARATOR_TOKEN) {
+ ArrayList<ELToken> prefixPart = new ArrayList<ELToken>();
+ for (int j = 0; j <= i; j++) {
+ prefixPart.add(prefix.get(j));
+ }
+ result.add(0, prefixPart);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Removes duplicates
+ *
+ * @param suggestions a list of suggestions ({@link String}).
+ * @return a list of unique completion suggestions.
+ */
+ public List<String> makeUnique(List<String> suggestions) {
+ HashSet<String> present = new HashSet<String>();
+ ArrayList<String> unique= new ArrayList<String>();
+
+ if (suggestions == null)
+ return unique;
+
+ for (String item : suggestions) {
+ if (!present.contains(item)) {
+ present.add(item);
+ unique.add(item);
+ }
+ }
+
+ present.clear();
+ return unique;
+ }
+
+ public static class SeamELTokenizer {
+ static final int STATE_INITIAL = 0;
+ static final int STATE_VAR = 1;
+ static final int STATE_METHOD = 2;
+ static final int STATE_SEPARATOR = 3;
+
+ IDocument fDocument;
+ List<ELToken> fTokens;
+ int index;
+
+ public SeamELTokenizer(IDocument document, int offset) {
+ fDocument = document;
+ index = (fDocument == null || fDocument.getLength() < offset? -1 : offset);
+ fTokens = new ArrayList<ELToken>();
+ parseBackward();
+ }
+
+ public List<ELToken> getTokens() {
+ return fTokens;
+ }
+
+ private void parseBackward() {
+ ELToken token;
+ fState = STATE_INITIAL;
+ while ((token = getNextToken()) != ELToken.EOF) {
+
+ if (token.type == ELToken.EL_NAME_TOKEN ||
+ token.type == ELToken.EL_METHOD_TOKEN ||
+ token.type == ELToken.EL_SEPARATOR_TOKEN) {
+
+ fTokens.add(0, token);
+ }
+ }
+ }
+
+ int fState;
+ int fEndOfToken;
+ ELToken getNextToken() {
+ switch (fState) {
+ case STATE_INITIAL: // Just started
+ {
+ int ch = readCharBackward();
+ if (ch == -1) {
+ return ELToken.EOF;
+ }
+ if (Character.isJavaIdentifierPart((char)ch)) {
+ releaseChar();
+ return readVarToken();
+ }
+ if (ch == '.') {
+ releaseChar();
+ return readSeparatorToken();
+ }
+ if (ch == ')') {
+ releaseChar();
+ return readMethodToken();
+ }
+ return ELToken.EOF;
+ }
+ case STATE_VAR: // Variable name is read - expecting a separator
+ {
+ int ch = readCharBackward();
+ if (ch == -1) {
+ return ELToken.EOF;
+ }
+ if (ch == '.') {
+ releaseChar();
+ return readSeparatorToken();
+ }
+ return ELToken.EOF;
+ }
+ case STATE_METHOD: // Method name and parameters are read - expecting a separator
+ {
+ int ch = readCharBackward();
+ if (ch == -1) {
+ return ELToken.EOF;
+ }
+ if (ch == '.') {
+ releaseChar();
+ return readSeparatorToken();
+ }
+ return ELToken.EOF;
+ }
+ case STATE_SEPARATOR: // Separator is read - expecting a var or method
+ {
+ int ch = readCharBackward();
+ if (ch == -1) {
+ return ELToken.EOF;
+ }
+ if (Character.isJavaIdentifierPart((char)ch)) {
+ releaseChar();
+ return readVarToken();
+ }
+ if (ch == ')') {
+ releaseChar();
+ return readMethodToken();
+ }
+ return ELToken.EOF;
+ }
+ }
+ return ELToken.EOF;
+ }
+
+ ELToken readMethodToken() {
+ fState = STATE_METHOD;
+ int endOfToken = index;
+
+ // read the method parameters
+ if (!skipMethodParameters())
+ return ELToken.EOF;
+
+ // skip spaces between the method's name and it's parameters
+ if (!skipSpaceChars())
+ return ELToken.EOF;
+ // read the method name
+ if (!skipMethodName())
+ return ELToken.EOF;
+
+ return (endOfToken - index > 0 ? new ELToken(index, endOfToken - index, getCharSequence(index, endOfToken - index), ELToken.EL_METHOD_TOKEN) : ELToken.EOF);
+ }
+
+ private CharSequence getCharSequence(int start, int length) {
+ String text = "";
+ try {
+ text = fDocument.get(start, length);
+ } catch (BadLocationException e) {
+ text = ""; // For sure
+ }
+ return text.subSequence(0, text.length());
+ }
+
+ boolean skipSpaceChars() {
+ int ch;
+ while ((ch = readCharBackward()) != -1) {
+ if (!Character.isSpaceChar(ch)) {
+ releaseChar();
+ break;
+ }
+ }
+ return true;
+ }
+
+ boolean skipMethodName() {
+ int endOfToken = index;
+ int ch;
+ while((ch = readCharBackward()) != -1) {
+ if (!Character.isJavaIdentifierPart(ch)) {
+ releaseChar();
+ return (endOfToken - index > 0);
+ }
+ }
+ return false;
+ }
+
+ boolean skipMethodParameters() {
+ int ch = readCharBackward();
+ if (ch != ')')
+ return false;
+ int pCount = 1;
+ while (pCount > 0) {
+ ch = readCharBackward();
+ if (ch == -1)
+ return false;
+
+ if (ch == '"' || ch == '\'') {
+ skipQuotedChars((char)ch);
+ continue;
+ }
+ if (ch == ')') {
+ pCount++;
+ continue;
+ }
+ if (ch == '(') {
+ pCount--;
+ continue;
+ }
+ }
+ return true;
+ }
+
+ void skipQuotedChars(char pair) {
+ int ch = readCharBackward();
+
+ while (ch != -1) {
+ if (ch == pair) {
+ ch = readCharBackward();
+ if (ch == '\\') {
+ int backSlashCount = 0;
+ while (ch == '\\') {
+ backSlashCount++;
+ ch = readCharBackward();
+ }
+ releaseChar(); // Return the last non-slash char to the buffer
+ if ((backSlashCount/2)*2 == backSlashCount) {
+ return;
+ }
+ }
+ }
+ ch = readCharBackward();
+ }
+ }
+
+ ELToken readSeparatorToken() {
+ fState = STATE_SEPARATOR;
+ int ch = readCharBackward();
+
+ return (ch == '.' ? new ELToken(index, 1, getCharSequence(index, 1), ELToken.EL_SEPARATOR_TOKEN) :
+ ELToken.EOF);
+ }
+
+ ELToken readVarToken() {
+ fState = STATE_VAR;
+ int endOfToken = index;
+ int ch;
+ while((ch = readCharBackward()) != -1) {
+ if (!Character.isJavaIdentifierPart(ch)) {
+ releaseChar();
+ return (endOfToken - index > 0 ? new ELToken(index, endOfToken - index, getCharSequence(index, endOfToken - index), ELToken.EL_NAME_TOKEN) : ELToken.EOF);
+ }
+ }
+ releaseChar();
+ return (endOfToken - index > 0 ? new ELToken(index, endOfToken - index, getCharSequence(index, endOfToken - index), ELToken.EL_NAME_TOKEN) : ELToken.EOF);
+ }
+
+ int readCharBackward() {
+ if (--index < 0 ||
+ fDocument == null ||
+ fDocument.getLength() <= index)
+ return -1;
+
+ try {
+ return fDocument.getChar(index);
+ } catch (BadLocationException e) {
+ return -1;
+ }
+ }
+
+ void releaseChar() {
+ if (index < fDocument.getLength())
+ index++;
+ }
+ }
+
+ public static String getPrefix(ITextViewer viewer, int offset) throws BadLocationException {
+ IDocument doc= viewer.getDocument();
+ if (doc == null || offset > doc.getLength())
+ return null;
+
+ SeamELTokenizer tokenizer = new SeamELTokenizer(doc, offset);
+ List<ELToken> tokens = tokenizer.getTokens();
+
+ if (tokens == null || tokens.size() == 0)
+ return null;
+
+ return doc.get(tokens.get(0).start, offset - tokens.get(0).start);
+ }
+
+
+}
+class ELToken implements IToken {
+ static final ELToken EOF = new ELToken(-1, -1, null, -1);
+ static final int EL_NAME_TOKEN = 1;
+ static final int EL_METHOD_TOKEN = 2;
+ static final int EL_SEPARATOR_TOKEN = 3;
+
+ int start;
+ int length;
+ CharSequence chars;
+ int type;
+
+ public ELToken(int start, int length, CharSequence chars, int type) {
+ this.start = start;
+ this.length = length;
+ this.chars = chars;
+ this.type = type;
+ }
+
+ public String toString() {
+ return "ELToken(" + start + ", " + length + ", " + type + ") [" + (chars == null ? "<Empty>" : chars.toString()) + "]";
+ }
+
+ public Object getData() {
+ return (chars == null ? null : chars.subSequence(start, start+length).toString());
+ }
+
+ public boolean isEOF() {
+ return (start == -1 && length == -1 && chars == null);
+ }
+
+ public boolean isOther() {
+ return false;
+ }
+
+ public boolean isUndefined() {
+ return false;
+ }
+
+ public boolean isWhitespace() {
+ return false;
+ }
+
+ public int getType(){
+ return type;
+ }
+
+ public String getText() {
+ return chars.toString();
+ }
+}
17 years, 5 months
JBoss Tools SVN: r2427 - in trunk/seam/plugins/org.jboss.tools.seam.ui: META-INF and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-07-13 09:41:16 -0400 (Fri, 13 Jul 2007)
New Revision: 2427
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalComputer.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamExpressionResolver.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java
Log:
http://jira.jboss.org/jira/browse/EXIN-330
Prompting Computer/Processor is added to be used in JavaEditor and XML Editor content assistants
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-13 12:46:01 UTC (rev 2426)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-13 13:41:16 UTC (rev 2427)
@@ -16,14 +16,22 @@
org.eclipse.wst.common.modulecore,
org.eclipse.wst.common.frameworks,
org.eclipse.wst.common.project.facet.core,
- org.eclipse.jdt.core,
org.eclipse.jst.jsf.ui,
org.eclipse.wst.common.frameworks.ui,
org.jboss.tools.common,
org.jboss.tools.seam.core,
org.apache.log4j,
org.hibernate.eclipse.console,
+ org.eclipse.jdt.ui,
+ org.eclipse.jface.text,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.ui.editors,
+ org.hibernate.eclipse.console,
org.eclipse.jst.j2ee,
+ org.jboss.tools.common.text.ext,
+ org.eclipse.jdt.core,
+ org.jboss.tools.common.model,
+ org.eclipse.jst.j2ee,
org.eclipse.wst.common.emfworkbench.integration,
org.eclipse.jem,
org.eclipse.jem.util,
@@ -36,4 +44,9 @@
org.jboss.tools.seam.ui.internal.project.facet;x-internal:=true,
org.jboss.tools.seam.ui.widget.editor,
org.jboss.tools.seam.ui.widget.field,
- org.jboss.tools.seam.ui.wizard
+ org.jboss.tools.seam.ui.wizard,
+ org.jboss.tools.seam.ui.text.java;
+ uses:="org.eclipse.jface.text,
+ org.eclipse.jdt.ui.text.java,
+ org.eclipse.core.runtime,
+ org.eclipse.jface.text.contentassist"
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-13 12:46:01 UTC (rev 2426)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-13 13:41:16 UTC (rev 2427)
@@ -108,55 +108,84 @@
</perspectiveExtension>
</extension>
-<extension point="org.eclipse.ui.navigator.viewer">
- <viewerContentBinding viewerId="org.jboss.tools.seam.ui.views.SeamComponentsNavigator">
- <includes>
- <contentExtension pattern="org.jboss.tools.seam.ui.views.rootContent" />
- </includes>
- </viewerContentBinding>
-</extension>
+ <extension point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding viewerId="org.jboss.tools.seam.ui.views.SeamComponentsNavigator">
+ <includes>
+ <contentExtension pattern="org.jboss.tools.seam.ui.views.rootContent" />
+ </includes>
+ </viewerContentBinding>
+ </extension>
-<extension point="org.eclipse.ui.navigator.navigatorContent">
- <navigatorContent
- name="Seam Components"
- priority="highest"
- icon="icons/sample.gif"
- activeByDefault="true"
- contentProvider="org.jboss.tools.seam.ui.views.RootContentProvider"
- labelProvider="org.jboss.tools.seam.ui.views.SeamLabelProvider"
- id="org.jboss.tools.seam.ui.views.rootContent">
- <triggerPoints>
- <or>
- <instanceof
- value="org.eclipse.core.resources.IWorkspaceRoot" />
- <instanceof
- value="org.jboss.tools.seam.core.ISeamElement" />
- </or>
- </triggerPoints>
- <possibleChildren>
- <or>
- <instanceof value="org.jboss.tools.seam.core.ISeamElement" />
- </or>
- </possibleChildren>
- <actionProvider
- class="org.jboss.tools.seam.ui.views.actions.SeamActionProvider"
- id="org.jboss.tools.seam.ui.views.actions.SeamActionProvider">
- <enablement>
- <or>
- <instanceof value="org.jboss.tools.seam.core.ISeamElement"/>
- </or>
- </enablement>
- </actionProvider>
- </navigatorContent>
-</extension>
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ name="Seam Components"
+ priority="highest"
+ icon="icons/sample.gif"
+ activeByDefault="true"
+ contentProvider="org.jboss.tools.seam.ui.views.RootContentProvider"
+ labelProvider="org.jboss.tools.seam.ui.views.SeamLabelProvider"
+ id="org.jboss.tools.seam.ui.views.rootContent">
+ <triggerPoints>
+ <or>
+ <instanceof
+ value="org.eclipse.core.resources.IWorkspaceRoot" />
+ <instanceof
+ value="org.jboss.tools.seam.core.ISeamElement" />
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="org.jboss.tools.seam.core.ISeamElement" />
+ </or>
+ </possibleChildren>
+ <actionProvider
+ class="org.jboss.tools.seam.ui.views.actions.SeamActionProvider"
+ id="org.jboss.tools.seam.ui.views.actions.SeamActionProvider">
+ <enablement>
+ <or>
+ <instanceof value="org.jboss.tools.seam.core.ISeamElement"/>
+ </or>
+ </enablement>
+ </actionProvider>
+ </navigatorContent>
+ </extension>
-<extension point="org.eclipse.core.runtime.adapters">
- <factory
- class="org.jboss.tools.seam.ui.views.properties.SeamElementAdapterFactory"
- adaptableType="org.jboss.tools.seam.core.ISeamElement">
-
- <adapter type="org.eclipse.ui.views.properties.IPropertySource"/>
- </factory>
-</extension>
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.jboss.tools.seam.ui.views.properties.SeamElementAdapterFactory"
+ adaptableType="org.jboss.tools.seam.core.ISeamElement">
+
+ <adapter type="org.eclipse.ui.views.properties.IPropertySource"/>
+ </factory>
+ </extension>
+ <extension point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
+ id="seam_el_proposals"
+ name="Seam EL Proposals">
+ <proposalCategory icon="icons/sample.gif"/>
+ </extension>
+
+ <extension point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
+ id="SeamELCompletionProposalComputer"
+ name="Seam EL Completion Proposal Computer">
+ <javaCompletionProposalComputer
+ class="org.jboss.tools.seam.ui.text.java.SeamELProposalComputer"
+ categoryId="org.jboss.tools.seam.ui.seam_el_proposals"
+ activate="true">
+ <partition type="__java_string"/>
+ </javaCompletionProposalComputer>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.common.text.xml.contentAssistProcessor"
+ id="org.jboss.tools.seam.ui.contentAssistProcessor"
+ name="org.jboss.tools.seam.ui.contentAssistProcessor">
+
+ <contentAssistProcessor
+ class="org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor"
+ id="org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor">
+ <partitiontype id="org.eclipse.wst.xml.XML_DEFAULT" />
+ </contentAssistProcessor>
+ </extension>
+
</plugin>
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java 2007-07-13 12:46:01 UTC (rev 2426)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java 2007-07-13 13:41:16 UTC (rev 2427)
@@ -12,12 +12,14 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.jboss.tools.common.log.IPluginLog;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class SeamGuiPlugin extends AbstractUIPlugin {
+public class SeamGuiPlugin extends BaseUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.seam.ui";
@@ -60,4 +62,12 @@
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
+
+ /**
+ * @return IPluginLog object
+ */
+ public static IPluginLog getPluginLog() {
+ return getDefault();
+ }
+
}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalComputer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalComputer.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalComputer.java 2007-07-13 13:41:16 UTC (rev 2427)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.text.java;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+
+
+public class SeamELProposalComputer implements IJavaCompletionProposalComputer {
+ /** The wrapped processor. */
+ private final SeamELProposalProcessor fProcessor= new SeamELProposalProcessor();
+
+ /**
+ * Default constructor to make it instantiatable via the extension mechanism.
+ */
+ public SeamELProposalComputer() {
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.ICompletionProposalComputer#computeCompletionProposals(org.eclipse.jface.text.contentassist.TextContentAssistInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {
+ return Arrays.asList(fProcessor.computeCompletionProposals(context.getViewer(), context.getInvocationOffset()));
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.ICompletionProposalComputer#computeContextInformation(org.eclipse.jface.text.contentassist.TextContentAssistInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
+ return Arrays.asList(fProcessor.computeContextInformation(context.getViewer(), context.getInvocationOffset()));
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.ICompletionProposalComputer#getErrorMessage()
+ */
+ public String getErrorMessage() {
+ return fProcessor.getErrorMessage();
+ }
+
+ /*
+ * @see org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer#sessionStarted()
+ */
+ public void sessionStarted() {
+ }
+
+ /*
+ * @see org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer#sessionEnded()
+ */
+ public void sessionEnded() {
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2007-07-13 13:41:16 UTC (rev 2427)
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.text.java;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension3;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.jboss.tools.common.text.ext.IEditorWrapper;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+public class SeamELProposalProcessor implements IContentAssistProcessor {
+
+ private static final ICompletionProposal[] NO_PROPOSALS= new ICompletionProposal[0];
+ private static final IContextInformation[] NO_CONTEXTS= new IContextInformation[0];
+
+ private static final class Proposal implements ICompletionProposal, ICompletionProposalExtension, ICompletionProposalExtension2, ICompletionProposalExtension3, ICompletionProposalExtension4 {
+
+ private final String fString;
+ private final String fPrefix;
+ private final int fOffset;
+
+ public Proposal(String string, String prefix, int offset) {
+ fString= string;
+ fPrefix= prefix;
+ fOffset= offset;
+ }
+
+ public void apply(IDocument document) {
+ apply(null, '\0', 0, fOffset);
+ }
+
+ public Point getSelection(IDocument document) {
+ return new Point(fOffset + fString.length(), 0);
+ }
+
+ public String getAdditionalProposalInfo() {
+ return null;
+ }
+
+ public String getDisplayString() {
+ return fPrefix + fString;
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ public IContextInformation getContextInformation() {
+ return null;
+ }
+
+ public void apply(IDocument document, char trigger, int offset) {
+ try {
+ String replacement= fString.substring(offset - fOffset);
+ document.replace(offset, 0, replacement);
+ } catch (BadLocationException x) {
+ // TODO Auto-generated catch block
+ x.printStackTrace();
+ }
+ }
+
+ public boolean isValidFor(IDocument document, int offset) {
+ return validate(document, offset, null);
+ }
+
+ public char[] getTriggerCharacters() {
+ return null;
+ }
+
+ public int getContextInformationPosition() {
+ return 0;
+ }
+
+ public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
+ apply(viewer.getDocument(), trigger, offset);
+ }
+
+ public void selected(ITextViewer viewer, boolean smartToggle) {
+ }
+
+ public void unselected(ITextViewer viewer) {
+ }
+
+ public boolean validate(IDocument document, int offset, DocumentEvent event) {
+ try {
+ int prefixStart= fOffset - fPrefix.length();
+ return offset >= fOffset && offset < fOffset + fString.length() && document.get(prefixStart, offset - (prefixStart)).equals((fPrefix + fString).substring(0, offset - prefixStart));
+ } catch (BadLocationException x) {
+ return false;
+ }
+ }
+
+ public IInformationControlCreator getInformationControlCreator() {
+ return null;
+ }
+
+ public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) {
+ return fPrefix + fString;
+ }
+
+ public int getPrefixCompletionStart(IDocument document, int completionOffset) {
+ return fOffset - fPrefix.length();
+ }
+
+ public boolean isAutoInsertable() {
+ return true;
+ }
+
+ }
+
+ private final SeamELCompletionEngine fEngine= new SeamELCompletionEngine();
+
+ /**
+ * Creates a new Seam EL completion proposal computer.
+ */
+ public SeamELProposalProcessor() {
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
+ */
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
+ try {
+ ITextEditor part = getActiveEditor();
+ if (part == null)
+ return NO_PROPOSALS;
+
+ IEditorInput editorInput = part.getEditorInput();
+ if (!(editorInput instanceof IFileEditorInput))
+ return NO_PROPOSALS;
+
+ IFile file = ((IFileEditorInput)editorInput).getFile();
+ IProject project = (file == null ? null : file.getProject());
+
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
+ if (seamProject == null)
+ return NO_PROPOSALS;
+
+ String prefix= SeamELCompletionEngine.getPrefix(viewer, offset);
+ prefix = (prefix == null ? "" : prefix);
+
+ if (!checkStartPositionInEL(viewer, offset))
+ return NO_PROPOSALS;
+
+ List<String> suggestions = fEngine.getCompletions(seamProject, file, viewer.getDocument(), prefix, offset - prefix.length());
+ List<String> uniqueSuggestions = fEngine.makeUnique(suggestions);
+
+ List<ICompletionProposal> result= new ArrayList<ICompletionProposal>();
+ for (String string : uniqueSuggestions) {
+ if (string.length() > 0)
+ result.add(createProposal(string, prefix, offset));
+ }
+
+ return (ICompletionProposal[]) result.toArray(new ICompletionProposal[uniqueSuggestions.size()]);
+ } catch (BadLocationException x) {
+ return NO_PROPOSALS;
+ }
+ }
+
+ private ICompletionProposal createProposal(String string, String prefix, int offset) {
+ return new Proposal(string, prefix, offset);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
+ */
+ public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
+ // no context informations for Seam EL completions
+ return NO_CONTEXTS;
+ }
+
+ private char[] autoActivChars;
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
+ */
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ if(autoActivChars==null) {
+ IPreferenceStore store= EditorsUI.getPreferenceStore();
+ String superDefaultChars = store.getDefaultString(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA);
+ StringBuffer redhatDefaultChars = new StringBuffer(superDefaultChars);
+ if(superDefaultChars.indexOf("{")<0) {
+ redhatDefaultChars.append('{');
+ }
+ if(superDefaultChars.indexOf(".")<0) {
+ redhatDefaultChars.append('.');
+ }
+ autoActivChars = new char[redhatDefaultChars.length()];
+ redhatDefaultChars.getChars(0, redhatDefaultChars.length(), autoActivChars, 0);
+ store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, redhatDefaultChars.toString());
+ store.setValue(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, redhatDefaultChars.toString());
+ }
+ return autoActivChars;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
+ */
+ public char[] getContextInformationAutoActivationCharacters() {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
+ */
+ public IContextInformationValidator getContextInformationValidator() {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.contentassist.ICompletionProposalComputer#getErrorMessage()
+ */
+ public String getErrorMessage() {
+ return null; // no custom error message
+ }
+
+ private ITextEditor getActiveEditor() {
+ IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window != null) {
+ IWorkbenchPage page= window.getActivePage();
+ if (page != null) {
+ IEditorPart editor= page.getActiveEditor();
+ if (editor instanceof IEditorWrapper)
+ editor = ((IEditorWrapper) editor).getEditor();
+
+ if (editor instanceof ITextEditor)
+ return (ITextEditor) editor;
+ else
+ return (ITextEditor)editor.getAdapter(ITextEditor.class);
+ }
+ }
+ return null;
+ }
+
+ private boolean checkStartPositionInEL(ITextViewer viewer, int offset) throws BadLocationException {
+ IDocument doc= viewer.getDocument();
+ if (doc == null || offset > doc.getLength())
+ return false;
+
+ while (--offset >= 0) {
+ if ('}' == doc.getChar(offset))
+ return false;
+
+ if ('{' == doc.getChar(offset) &&
+ (offset - 1) >= 0 &&
+ ('#' == doc.getChar(offset - 1) ||
+ '$' == doc.getChar(offset - 1))) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamExpressionResolver.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamExpressionResolver.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamExpressionResolver.java 2007-07-13 13:41:16 UTC (rev 2427)
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.text.java;
+
+import java.lang.reflect.Modifier;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+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.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.seam.core.IBijectedAttribute;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamContextVariable;
+import org.jboss.tools.seam.core.ISeamElement;
+import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamJavaSourceReference;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamXmlFactory;
+import org.jboss.tools.seam.core.ScopeType;
+
+public class SeamExpressionResolver {
+
+ public static List<ISeamContextVariable> resolveVariables(ISeamProject project, ScopeType scope, String name) {
+ if (project == null || name == null) return null;
+ return (scope == null ? internalResolveVariables(project, name) :
+ internalResolveVariablesByScope(project, scope, name));
+ }
+
+ private static List<ISeamContextVariable> internalResolveVariables(ISeamProject project, String name) {
+ List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
+ Set<ISeamContextVariable> variables = project.getVariables();
+ for (ISeamContextVariable variable : variables) {
+ if (variable.getName().startsWith(name)) {
+ resolvedVariables.add(variable);
+ }
+ }
+ return resolvedVariables;
+ }
+
+ private static List<ISeamContextVariable> internalResolveVariablesByScope(ISeamProject project, ScopeType scope, String name) {
+ List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
+ Set<ISeamContextVariable> variables = project.getVariablesByScope(scope);
+ for (ISeamContextVariable variable : variables) {
+ if (variable.getName().startsWith(name)) {
+ resolvedVariables.add(variable);
+ }
+ }
+ return resolvedVariables;
+ }
+
+ public static IMember getMemberByVariable(ISeamContextVariable variable) {
+ IMember member = null;
+ if (variable instanceof ISeamComponent) {
+ ISeamComponent component = (ISeamComponent)variable;
+ ISeamJavaComponentDeclaration decl = component.getJavaDeclaration();
+ if (decl != null) {
+ member = decl.getSourceMember();
+ }
+ }
+ if (member == null && variable instanceof IBijectedAttribute) {
+ member = ((ISeamJavaSourceReference)variable).getSourceMember();
+ }
+ if (member == null && variable instanceof ISeamJavaSourceReference) {
+ member = ((ISeamJavaSourceReference)variable).getSourceMember();
+ }
+ if (member == null && variable instanceof ISeamXmlFactory) {
+ ISeamXmlFactory factory = (ISeamXmlFactory)variable;
+ String value = factory.getValue();
+ if (value != null && value.length() > 0) {
+ // TODO: Need to make sure that it's correct way to get the project and
+ // the scope from the factory
+ ISeamProject project = ((ISeamElement)factory).getSeamProject();
+// ISeamProject project = getSeamProject(factory.getResource());
+ if (project != null) {
+ List<ISeamContextVariable> resolvedValues = resolveVariables(project, factory.getScope(), value);
+ for (ISeamContextVariable var : resolvedValues) {
+ if (var.getName().equals(value)) {
+ member = getMemberByVariable(var);
+ break;
+ }
+ }
+ }
+ }
+ }
+ return member;
+ }
+
+ public static Set<IMember> getMethods(IType type) {
+ Set<IMember> methods = new HashSet<IMember>();
+ if (type != null) {
+ try {
+ IMethod[] mthds = type.getMethods();
+ for (int i = 0; mthds != null && i < mthds.length; i++) {
+ IMethod m = mthds[i];
+ if (Modifier.isPublic(m.getFlags()) &&
+ (!m.getElementName().startsWith("get") && !m.getElementName().startsWith("set")) ||
+ "get".equals(m.getElementName()) || "set".equals(m.getElementName())) {
+ methods.add(m);
+ }
+ }
+ } catch (JavaModelException e) {
+ }
+ }
+ return methods;
+ }
+
+ public static Set<String> getMethodPresentations(IType type) {
+ Set<String> methods = new HashSet<String>();
+ if (type != null) {
+ try {
+ IMethod[] mthds = type.getMethods();
+ for (int i = 0; mthds != null && i < mthds.length; i++) {
+ IMethod m = mthds[i];
+ if (Modifier.isPublic(m.getFlags()) &&
+ (!m.getElementName().startsWith("get") && !m.getElementName().startsWith("set")) ||
+ "get".equals(m.getElementName()) || "set".equals(m.getElementName())) {
+
+ StringBuffer name = new StringBuffer(m.getElementName());
+
+ name.append('(');
+ String[] mParams = null;
+ mParams = m.getParameterNames();
+ for (int j = 0; mParams != null && j < mParams.length; j++) {
+ if (j > 0) name.append(", ");
+ name.append(mParams[j]);
+ }
+ name.append(')');
+
+ methods.add(name.toString());
+ }
+ }
+ } catch (JavaModelException e) {
+ }
+ }
+ return methods;
+ }
+
+ public static Set<IMember> getProperties(IType type) {
+ Set<IMember> properties = new HashSet<IMember>();
+ if (type != null) {
+ try {
+ IMethod[] props = type.getMethods();
+ for (int i = 0; props != null && i < props.length; i++) {
+ IMethod m = props[i];
+ if (Modifier.isPublic(m.getFlags()) &&
+ (m.getElementName().startsWith("get") && !"get".equals(m.getElementName())) ||
+ (m.getElementName().startsWith("set") && !"set".equals(m.getElementName()))) {
+ properties.add(m);
+ }
+ }
+ } catch (JavaModelException e) {
+ }
+
+ try {
+ IField[] fields = type.getFields();
+ for (int i = 0; fields != null && i < fields.length; i++) {
+ IField f = fields[i];
+ if (Modifier.isPublic(f.getFlags())) {
+ properties.add(f);
+ }
+ }
+ } catch (JavaModelException e) {
+ }
+ }
+ return properties;
+ }
+ public static Set<String> getPropertyPresentations(IType type) {
+ Set<String> properties = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ if (type != null) {
+ try {
+ IMethod[] props = type.getMethods();
+ for (int i = 0; props != null && i < props.length; i++) {
+ IMethod m = props[i];
+ if (Modifier.isPublic(m.getFlags()) &&
+ (m.getElementName().startsWith("get") && !"get".equals(m.getElementName())) ||
+ (m.getElementName().startsWith("set") && !"set".equals(m.getElementName()))) {
+
+ StringBuffer name = new StringBuffer(m.getElementName());
+ name.delete(0, 3);
+ name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
+
+ properties.add(name.toString());
+ }
+ }
+ } catch (JavaModelException e) {
+ }
+
+ try {
+ IField[] fields = type.getFields();
+ for (int i = 0; fields != null && i < fields.length; i++) {
+ IField f = fields[i];
+ if (Modifier.isPublic(f.getFlags())) {
+ properties.add(f.getElementName());
+ }
+ }
+ } catch (JavaModelException e) {
+ }
+ }
+ return properties;
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r2426 - in trunk/vpe/plugins: org.jboss.tools.vpe.mozilla/src/org/jboss/tools/vpe/mozilla/browser and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2007-07-13 08:46:01 -0400 (Fri, 13 Jul 2007)
New Revision: 2426
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.mozilla/src/org/jboss/tools/vpe/mozilla/browser/MozillaBrowser.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
Log:
bug fixing JBIDE 528, some code was adjusted
[ http://jira.jboss.com/jira/browse/JBIDE-528?page=all ]
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2007-07-13 11:05:55 UTC (rev 2425)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2007-07-13 12:46:01 UTC (rev 2426)
@@ -334,10 +334,17 @@
return true;
}
}
+ /**
+ * Deletes right char
+ * @param sourceSelectionBuilder
+ *
+ * @param selection -contains information about current selection
+ *
+ * @return
+ */
-
private VpeSourceSelection deleteRightChar(VpeSourceSelectionBuilder sourceSelectionBuilder, VpeSourceSelection selection) {
- boolean atLeastOneCharIsDeleted = false;
+ boolean atLeastOneCharIsDeleted = false;
Node focusNode = null;
while (selection != null && (focusNode = selection.getFocusNode()) != null) {
@@ -389,9 +396,23 @@
if (!TextUtil.isWhitespace(((TextImpl)focusNode).getValueSource().toCharArray()[offset])
) {
break;
+ }else if(!atLeastOneCharIsDeleted) {
+
+ //delete whitespaces
+ int endPos = 0;
+ while(TextUtil.isWhitespace(((TextImpl)focusNode).getValueSource().toCharArray()[offset+endPos])){
+ endPos++;
+ }
+ Point range = sourceEditor.getTextViewer().getSelectedRange();
+ sourceEditor.getTextViewer().getTextWidget().replaceTextRange(range.x, endPos, "");
+ selection = sourceSelectionBuilder.getSelection();
+ atLeastOneCharIsDeleted = true;
+ break;
+ } else {
+ break;
}
- sourceEditor.getAction(ITextEditorActionDefinitionIds.DELETE_NEXT).run();
- selection = sourceSelectionBuilder.getSelection();
+// sourceEditor.getAction(ITextEditorActionDefinitionIds.DELETE_NEXT).run();
+// selection = sourceSelectionBuilder.getSelection();
}
return selection;
@@ -709,10 +730,25 @@
}
}
+ if(!atLeastOneCharIsDeleted) {
+
+ int endPos = 1;
+ while(TextUtil.isWhitespace(((TextImpl)focusNode).getValueSource().toCharArray()[offset-endPos])){
+ endPos++;
+ }
+ endPos--;
+ if(endPos!=0){
+ Point range = sourceEditor.getTextViewer().getSelectedRange();
+ sourceEditor.getTextViewer().getTextWidget().replaceTextRange(range.x-endPos, endPos, "");
+ selection = sourceSelectionBuilder.getSelection();
+ atLeastOneCharIsDeleted = true;
+ }
+ }
+ if(!atLeastOneCharIsDeleted){
sourceEditor.getAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS).run();
selection = sourceSelectionBuilder.getSelection();
atLeastOneCharIsDeleted = true;
- continue;
+ continue;}
}
String valueSource = ((TextImpl)focusNode).getValueSource();
if (valueSource==null) {
@@ -722,8 +758,12 @@
if(offset>charArray.length || !TextUtil.isWhitespace(valueSource.toCharArray()[offset - 1])) {
break;
}
+ }
+ if(!atLeastOneCharIsDeleted) {
+ sourceEditor.getAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS).run();
+ }else {
+ break;
}
- sourceEditor.getAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS).run();
selection = sourceSelectionBuilder.getSelection();
}
@@ -1004,7 +1044,7 @@
char[] s = new char[1];
s[0] = (char) charCode;
String str = new String(s);
- if(TextUtil.containsKey(s[0]) && s[0] != ' '){
+ if(TextUtil.containsKey(s[0])){
str = TextUtil.getValue(s[0]);
}
sourceEditor.getTextViewer().getTextWidget().replaceTextRange(start, 0, str);
@@ -1339,16 +1379,19 @@
String nodeValue=selection.getFocusNode().getNodeValue();
int visualOffser=TextUtil.visualPosition(sourceValue, fo);
+
int sourseOffset=TextUtil.sourcePosition(sourceValue, nodeValue, visualOffser+1);
int diff = sourseOffset-fo;
-
+ if(isTextToSkip(chars, fo + diff-1)){
while ((fo + diff < chars.length) && isTextToSkip(chars, fo + diff)) {
diff++;
}
+ }
if (fo + diff > chars.length||diff==0) {
return moveCursorToNextVisualNode(selection.getFocusNode());
}
setSourceFocus(so + fo + diff);
+
return true;
} else if (selection.getFocusNode().getNodeType() == Node.ELEMENT_NODE) {
// Move to second position of the visual attribute (because we're placed
@@ -1411,10 +1454,17 @@
int visualOffser=TextUtil.visualPosition(sourceValue, fo);
int sourseOffset=TextUtil.sourcePosition(sourceValue, nodeValue, visualOffser-1);
int diff = sourseOffset-fo;
+ boolean cicle=false;
- while ((fo + diff > 0) && isTextToSkip(chars, fo + diff)) {
+ while ((fo + diff >= 0)&&(fo+diff<chars.length) && isTextToSkip(chars, fo + diff)) {
diff--;
+ cicle=true;
}
+
+ if(cicle==true){
+ diff++;
+ }
+
if (fo + diff < 0||diff==0) {
return moveCursorToPrevVisualNode(selection.getFocusNode());
@@ -1436,7 +1486,7 @@
private boolean isTextToSkip(char[] chars, int position) {
try {
- if (chars[position] < ' ')
+ if (chars[position] == ' ')
return true;
if (TextUtil.isWhitespaceText(new String(chars, 0, position + 1)) ||
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.mozilla/src/org/jboss/tools/vpe/mozilla/browser/MozillaBrowser.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.mozilla/src/org/jboss/tools/vpe/mozilla/browser/MozillaBrowser.java 2007-07-13 11:05:55 UTC (rev 2425)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.mozilla/src/org/jboss/tools/vpe/mozilla/browser/MozillaBrowser.java 2007-07-13 12:46:01 UTC (rev 2426)
@@ -3161,11 +3161,11 @@
}
/**
- * Finds visible nearest visble node for hidden node
+ * Finds visible nearest visible node for hidden node
*
* @param element
*
- * @return nearest visble node or null if can't find
+ * @return nearest visible node or null if can't find
*/
private nsIDOMElement findVisbleParentElement(nsIDOMElement element) {
17 years, 5 months
JBoss Tools SVN: r2425 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-13 07:05:55 -0400 (Fri, 13 Jul 2007)
New Revision: 2425
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java
Log:
http://jira.jboss.com/jira/browse/EXIN-216
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java 2007-07-13 09:58:31 UTC (rev 2424)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java 2007-07-13 11:05:55 UTC (rev 2425)
@@ -13,26 +13,11 @@
/**
* @author Viacheslav Kabanovich
*/
-public interface IValueInfo {
+public interface IValueInfo extends ISeamTextSourceReference {
/**
* Returns string value
* @return
*/
public String getValue();
-
- /**
- * Returns start position of value or, when value is implied,
- * position of object that could contains that value.
- * @return
- */
- public int getStartPosition();
-
- /**
- * Returns length of value or, when value is implied,
- * that of object that could contains that value.
- * @return
- */
- public int getLength();
-
-}
+}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2424 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-13 05:58:31 -0400 (Fri, 13 Jul 2007)
New Revision: 2424
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLValueInfo.java
Modified:
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/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/SeamXmlComponentDeclaration.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/java/ComponentBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
Log:
EXIN-217 Added IValueInfo and implemented for components.xml source
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -0,0 +1,38 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public interface IValueInfo {
+
+ /**
+ * Returns string value
+ * @return
+ */
+ public String getValue();
+
+ /**
+ * Returns start position of value or, when value is implied,
+ * position of object that could contains that value.
+ * @return
+ */
+ public int getStartPosition();
+
+ /**
+ * Returns length of value or, when value is implied,
+ * that of object that could contains that value.
+ * @return
+ */
+ public int getLength();
+
+}
Modified: 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 2007-07-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -14,14 +14,12 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
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.IValueInfo;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.event.Change;
-import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
/**
* @author Viacheslav Kabanovich
@@ -32,7 +30,7 @@
protected ScopeType scopeType;
protected String scope;
- protected Map<String,ValueInfo> attributes = new HashMap<String, ValueInfo>();
+ protected Map<String,IValueInfo> attributes = new HashMap<String, IValueInfo>();
public String getName() {
return name;
@@ -99,12 +97,12 @@
return s1 == null ? s2 == null : s1.equals(s2);
}
- public void setName(ValueInfo value) {
+ public void setName(IValueInfo value) {
attributes.put(ISeamXmlComponentDeclaration.NAME, value);
name = value == null ? null : value.getValue();
}
- public void setScope(ValueInfo value) {
+ public void setScope(IValueInfo value) {
attributes.put(ISeamXmlComponentDeclaration.SCOPE, value);
setScopeAsString(value == null ? null : value.getValue());
}
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-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -16,8 +16,8 @@
import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
-import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
/**
* @author Viacheslav Kabanovich
@@ -56,7 +56,7 @@
* invoke getLocationFor("name");
*/
public ISeamTextSourceReference getLocationFor(String path) {
- final ValueInfo valueInfo = attributes.get(path);
+ final IValueInfo valueInfo = attributes.get(path);
ISeamTextSourceReference reference = new ISeamTextSourceReference() {
public int getLength() {
return valueInfo != null ? valueInfo.getLength() : 0;
@@ -69,7 +69,7 @@
return reference;
}
- public void setAutoCreate(ValueInfo value) {
+ public void setAutoCreate(IValueInfo value) {
attributes.put(ISeamXmlComponentDeclaration.AUTO_CREATE, value);
setAutoCreate(value != null && "true".equals(value.getValue()));
}
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-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -15,14 +15,13 @@
import java.util.Map;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.jboss.tools.seam.core.IOpenableElement;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.event.Change;
-import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
/**
* @author Viacheslav Kabanovich
@@ -36,7 +35,7 @@
*/
protected String name;
- protected Map<String,ValueInfo> attributes = new HashMap<String, ValueInfo>();
+ protected Map<String,IValueInfo> attributes = new HashMap<String, IValueInfo>();
public String getName() {
return name;
@@ -100,7 +99,7 @@
* invoke getLocationFor("name");
*/
public ISeamTextSourceReference getLocationFor(String path) {
- final ValueInfo valueInfo = attributes.get(path);
+ final IValueInfo valueInfo = attributes.get(path);
ISeamTextSourceReference reference = new ISeamTextSourceReference() {
public int getLength() {
return valueInfo != null ? valueInfo.getLength() : 0;
@@ -113,7 +112,7 @@
return reference;
}
- public void setName(ValueInfo value) {
+ public void setName(IValueInfo value) {
attributes.put(ISeamXmlComponentDeclaration.NAME, value);
name = value == null ? null : value.getValue();
}
@@ -122,4 +121,4 @@
}
-}
\ No newline at end of file
+}
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-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -16,12 +16,12 @@
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamComponentMethodType;
import org.jboss.tools.seam.core.SeamComponentPrecedenceType;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.event.Change;
-import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
public class SeamJavaComponentDeclaration extends SeamComponentDeclaration
implements ISeamJavaComponentDeclaration {
@@ -316,12 +316,12 @@
this.precedence = precedence;
}
- public void setScope(ValueInfo value) {
+ public void setScope(IValueInfo value) {
attributes.put(ISeamXmlComponentDeclaration.SCOPE, value);
setScope(value == null ? null : value.getValue());
}
- public void setPrecedence(ValueInfo value) {
+ public void setPrecedence(IValueInfo value) {
attributes.put(ISeamXmlComponentDeclaration.PRECEDENCE, value);
try {
setPrecedence(value == null ? 0 : Integer.parseInt(value.getValue()));
@@ -331,12 +331,12 @@
}
}
- public void setEntity(ValueInfo value) {
+ public void setEntity(IValueInfo value) {
attributes.put("entity", value);
setEntity(value != null && "true".equals(value.getValue()));
}
- public void setStateful(ValueInfo value) {
+ public void setStateful(IValueInfo value) {
attributes.put("stateful", value);
setStateful(value != null && "true".equals(value.getValue()));
}
@@ -349,4 +349,5 @@
SeamCorePlugin.getPluginLog().logError(e);
}
}
+
}
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-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -702,6 +702,7 @@
}
} else {
IResource variableResource = variable.getResource();
+ if(variableResource == null) continue;
if(path.equals(variableResource.getFullPath())) {
result.add(variable);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2007-07-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -3,6 +3,7 @@
import java.util.List;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.event.Change;
@@ -61,26 +62,56 @@
this.className = className;
}
+ public void setClassName(IValueInfo value) {
+ attributes.put(INSTALLED, value);
+ setInstalled(value == null ? null : value.getValue());
+ }
+
public void setAutoCreate(String autoCreate) {
this.autoCreate = autoCreate;
}
+ public void setAutoCreate(IValueInfo value) {
+ attributes.put(AUTO_CREATE, value);
+ setAutoCreate(value == null ? null : value.getValue());
+ }
+
public void setInstalled(String installed) {
this.installed = installed;
}
+ public void setInstalled(IValueInfo value) {
+ attributes.put(INSTALLED, value);
+ setInstalled(value == null ? null : value.getValue());
+ }
+
public void setJndiName(String jndiName) {
this.jndiName = jndiName;
}
+ public void setJndiName(IValueInfo value) {
+ attributes.put(JNDI_NAME, value);
+ setJndiName(value == null ? null : value.getValue());
+ }
+
public void setPrecedence(String precedence) {
this.precedence = precedence;
}
+ public void setPrecedence(IValueInfo value) {
+ attributes.put(PRECEDENCE, value);
+ setPrecedence(value == null ? null : value.getValue());
+ }
+
public void setScope(String scope) {
this.scope = scope;
}
+ public void setScope(IValueInfo value) {
+ attributes.put(SCOPE, value);
+ setScope(value == null ? null : value.getValue());
+ }
+
/**
* Merges loaded data into currently used declaration.
* If changes were done returns a list of changes.
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-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -13,6 +13,7 @@
import java.util.List;
import org.jboss.tools.seam.core.ISeamXmlFactory;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
/**
@@ -34,9 +35,19 @@
this.method = method;
}
+ public void setMethod(IValueInfo value) {
+ attributes.put("method", value);
+ setMethod(value == null ? null : value.getValue());
+ }
+
public void setValue(String value) {
this.value = value;
}
+
+ public void setValue(IValueInfo value) {
+ attributes.put("value", value);
+ setValue(value == null ? null : value.getValue());
+ }
public List<Change> merge(SeamObject s) {
List<Change> changes = super.merge(s);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -366,4 +366,4 @@
return true;
}
-}
\ No newline at end of file
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java 2007-07-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -9,8 +9,9 @@
import org.eclipse.jdt.core.dom.QualifiedName;
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.StringLiteral;
+import org.jboss.tools.seam.core.IValueInfo;
-public class ValueInfo {
+public class ValueInfo implements IValueInfo {
String value;
int valueStartPosition;
int valueLength;
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-13 08:47:45 UTC (rev 2423)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -97,13 +97,13 @@
component.setSourcePath(source);
component.setId(os[i]);
- component.setName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.NAME));
- component.setClassName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.CLASS));
- component.setScope(os[i].getAttributeValue(ISeamXmlComponentDeclaration.SCOPE));
- component.setPrecedence(os[i].getAttributeValue(ISeamXmlComponentDeclaration.PRECEDENCE));
- component.setInstalled(os[i].getAttributeValue(ISeamXmlComponentDeclaration.INSTALLED));
- component.setAutoCreate(os[i].getAttributeValue(ISeamXmlComponentDeclaration.AUTO_CREATE));
- component.setJndiName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.JNDI_NAME));
+ component.setName(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.NAME));
+ component.setClassName(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.CLASS));
+ component.setScope(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.SCOPE));
+ component.setPrecedence(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.PRECEDENCE));
+ component.setInstalled(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.INSTALLED));
+ component.setAutoCreate(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.AUTO_CREATE));
+ component.setJndiName(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.JNDI_NAME));
XAttribute[] attributes = componentEntity.getAttributes();
for (int ia = 0; ia < attributes.length; ia++) {
@@ -152,10 +152,10 @@
SeamXmlFactory factory = new SeamXmlFactory();
factory.setId(os[i]);
factory.setSourcePath(source);
- factory.setName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.NAME));
- factory.setScopeAsString(os[i].getAttributeValue(ISeamXmlComponentDeclaration.SCOPE));
- factory.setValue(os[i].getAttributeValue("value"));
- factory.setMethod(os[i].getAttributeValue("method"));
+ factory.setName(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.NAME));
+ factory.setScope(new XMLValueInfo(os[i], ISeamXmlComponentDeclaration.SCOPE));
+ factory.setValue(new XMLValueInfo(os[i], "value"));
+ factory.setMethod(new XMLValueInfo(os[i], "method"));
ds.getFactories().add(factory);
//TODO assign positioning attributes to created ISeamProperty object
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLValueInfo.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLValueInfo.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLValueInfo.java 2007-07-13 09:58:31 UTC (rev 2424)
@@ -0,0 +1,54 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.scanner.xml;
+
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.PositionHolder;
+import org.jboss.tools.seam.core.IValueInfo;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class XMLValueInfo implements IValueInfo {
+ XModelObject object;
+ String attribute;
+
+ PositionHolder h = null;
+
+ public XMLValueInfo(XModelObject object, String attribute) {
+ this.object = object;
+ this.attribute = attribute;
+ }
+
+ public int getLength() {
+ getPositionHolder();
+ int length = h.getEnd() - h.getStart();
+ return length < 0 ? 0 : length;
+ }
+
+ public int getStartPosition() {
+ getPositionHolder();
+ return h.getStart();
+ }
+
+ public String getValue() {
+ return object.getAttributeValue(attribute);
+ }
+
+ PositionHolder getPositionHolder() {
+ if(h == null) {
+ h = PositionHolder.getPosition(object, attribute);
+ }
+ h.update();
+ return h;
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r2423 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-13 04:47:45 -0400 (Fri, 13 Jul 2007)
New Revision: 2423
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationVizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java
Log:
http://jira.jboss.org/jira/browse/EXIN-222
Fields were added to wizard
http://jira.jboss.org/jira/browse/EXIN-223
Fields were added to wizard
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -24,5 +24,5 @@
public static String SEAM_METHOD_NAME = "seam.method.name";
public static String SEAM_PAGE_NAME = "seam.page.name";
public static String SEAM_MASTER_PAGE_NAME = "seam.master.page.name";
-
+ public static String SEAM_ENTITY_CLASS_NAME = "seam.entity.class.name";
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -24,10 +24,9 @@
public SeamActionWizard() {
super(CREATE_SEAM_ACTION);
- setWindowTitle("Create New Action");
+ setWindowTitle("New Seam Action");
//setDefaultPageImageDescriptor();
addPage(new SeamActionWizardPage1());
-
}
// TODO move operations to core plugin
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -10,41 +10,20 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
-import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
-import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
-
/**
* @author eskimo
*
*/
public class SeamActionWizardPage1 extends SeamBaseWizardPage {
-
- public SeamActionWizardPage1(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- public SeamActionWizardPage1(String pageName) {
- super(pageName);
- }
-
/**
* @param pageName
* @param title
* @param titleImage
*/
public SeamActionWizardPage1() {
- super("Create New Action", "Create a new Java interface and SLSB with key Seam/EJB annotations.", null);
- addEditors(SeamWizardFactory.createDefaultWizardEditors(SeamWizardUtils.getSelectedProjectName()));
+ super("seam.new.action.page1", "Seam Action", null);
+ setMessage("Select the name of the new Seam Conversation. A new Java interface and SLSB " +
+ "with key Seam/EJB annotations will be created.");
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -24,7 +24,6 @@
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.wst.common.frameworks.internal.ui.RunnableWithProgressWrapper;
import org.jboss.tools.seam.core.SeamCorePlugin;
/**
@@ -78,6 +77,7 @@
* @return
*/
public IUndoableOperation getOperation() {
+ if(operation!=null) return operation;
throw new IllegalStateException("Operation is not defined for wizard");
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -39,6 +39,7 @@
public SeamBaseWizardPage(String pageName, String title,
ImageDescriptor titleImage) {
super(pageName, title, titleImage);
+ createEditors();
}
/**
@@ -46,9 +47,13 @@
*/
protected SeamBaseWizardPage(String pageName) {
super(pageName);
+ createEditors();
+ }
+ protected void createEditors() {
+ addEditors(SeamWizardFactory.createDefaultWizardEditors(SeamWizardUtils.getSelectedProjectName()));
}
-
+
Map<String,IFieldEditor> editorRegistry = new HashMap<String,IFieldEditor>();
List<IFieldEditor> editorOrder = new ArrayList<IFieldEditor>();
@@ -105,6 +110,10 @@
columnNumber=fieldEditor.getNumberOfControls();
}
GridLayout gl = new GridLayout(columnNumber,false);
+ gl.verticalSpacing = 5;
+ gl.marginTop = 3;
+ gl.marginLeft = 3;
+ gl.marginRight = 3;
setLayout(gl);
for (IFieldEditor fieldEditor2 : editorOrder) {
fieldEditor2.doFillIntoGrid(this);
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationVizardPage1.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationVizardPage1.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationVizardPage1.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamConversationVizardPage1 extends SeamBaseWizardPage {
+
+ public SeamConversationVizardPage1() {
+ super("seam.new.conversation.page1","Seam Conversation",null);
+ setMessage("Select the name of the new Seam Conversation. A set of classes " +
+ "managing a coversation will be created.");
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -18,17 +18,14 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
public class SeamConversationWizard extends SeamBaseWizard implements INewWizard {
public SeamConversationWizard() {
super(CREATE_SEAM_CONVERSATION);
setWindowTitle("reate New Conversation");
- addPage(new SeamActionWizardPage1());
+ addPage(new SeamConversationVizardPage1());
}
public static final IUndoableOperation CREATE_SEAM_CONVERSATION = new SeamBaseOperation("Action creating operation"){
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -10,39 +10,43 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
/**
* @author eskimo
*
*/
-public class SeamEntityWizard extends Wizard implements INewWizard {
+public class SeamEntityWizard extends SeamBaseWizard implements INewWizard {
/**
*
*/
public SeamEntityWizard() {
- // TODO Auto-generated constructor stub
+ super(CREATE_SEAM_ENTITY);
+ setWindowTitle("New Seam Entity");
+ addPage(new SeamEntityWizardPage1());
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- @Override
- public boolean performFinish() {
- // TODO Auto-generated method stub
- return false;
- }
+
+ // TODO move operations to core plugin
+ public static final IUndoableOperation CREATE_SEAM_ENTITY = new SeamBaseOperation("Action creating operation"){
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // TODO Auto-generated method stub
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ Map params = (Map)info.getAdapter(Map.class);
+
+ return Status.OK_STATUS;
+ }
+
+ };
- }
-
}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamEntityWizardPage1 extends SeamBaseWizardPage {
+
+ /**
+ *
+ */
+ public SeamEntityWizardPage1() {
+ super("seam.new.entity.page1","Seam Entity", null);
+ setMessage("Select the name of the new Seam Entity. A new Seam Entity Bean with key Seam/EJB3 " +
+ "annotations and wxample attributes will be created.");
+ }
+
+ /**
+ *
+ */
+ protected void createEditors() {
+ addEditor(SeamWizardFactory.createSeamProjctSelectionFieldEditor(SeamWizardUtils.getSelectedProjectName()));
+ addEditor(SeamWizardFactory.createSeamEntityClasNameFieldEditor());
+ addEditor(SeamWizardFactory.createSeamMasterPageNameFieldEditor());
+ addEditor(SeamWizardFactory.createSeamPageNameFieldEditor());
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -10,31 +10,39 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
/**
*
* @author eskimo
*
*/
-public class SeamFofrmWizard extends Wizard implements INewWizard {
+public class SeamFofrmWizard extends SeamBaseWizard implements INewWizard {
public SeamFofrmWizard() {
- // TODO Auto-generated constructor stub
+ super(CREATE_SEAM_FORM);
+ setWindowTitle("New Seam Form");
+ addPage(new SeamFormWizardPage1());
}
- @Override
- public boolean performFinish() {
- // TODO Auto-generated method stub
- return false;
- }
+ private static IUndoableOperation CREATE_SEAM_FORM = new SeamBaseOperation("Action creating operation"){
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // TODO Auto-generated method stub
-
- }
-
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ Map params = (Map)info.getAdapter(Map.class);
+
+ return Status.OK_STATUS;
+ }
+
+ };
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -10,45 +10,19 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
-import java.util.Arrays;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
-import org.jboss.tools.seam.ui.widget.editor.IFieldEditorFactory;
-
/**
* @author eskimo
*
*/
-public class SeamFormWizardPage1 extends WizardPage {
+public class SeamFormWizardPage1 extends SeamBaseWizardPage {
/**
* @param pageName
*/
- public SeamFormWizardPage1(String pageName) {
- super(pageName);
- // TODO Auto-generated constructor stub
+ public SeamFormWizardPage1() {
+ super("seam.new.form.page1","Seam Form",null);
+ setMessage("Select the name of the new Seam Form. A new Seam Form with a single input field and related " +
+ "Java Interface, SLSB and key Seam/EJB3 annotations will be created.");
}
-
- /**
- * @param pageName
- * @param title
- * @param titleImage
- */
- public SeamFormWizardPage1(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- // TODO Auto-generated constructor stub
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizardPage1.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizardPage1.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizardPage1.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -14,6 +14,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -11,11 +11,9 @@
package org.jboss.tools.seam.ui.wizard;
-import org.eclipse.core.resources.IProject;
import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
-import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor.ButtonPressedAction;
/**
* @author eskimo
@@ -81,4 +79,12 @@
SeamWizardFactory.createSeamPageNameFieldEditor()
};
}
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamEntityClasNameFieldEditor() {
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_ENTITY_CLASS_NAME, "Seam entity class name:", "");
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java 2007-07-13 08:30:53 UTC (rev 2422)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java 2007-07-13 08:47:45 UTC (rev 2423)
@@ -13,12 +13,9 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.dialogs.ListDialog;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
public class SelectSeamProjectAction extends ButtonFieldEditor.ButtonPressedAction {
17 years, 5 months