JBoss Tools SVN: r10783 - in trunk/vpe/plugins: org.jboss.tools.vpe.resref and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-10-11 11:42:39 -0400 (Sat, 11 Oct 2008)
New Revision: 10783
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeELReferenceSupport.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeElVariableValidator.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties
trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta
Log:
=JBIDE-2828, validation for el expressions was added
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta 2008-10-11 13:26:44 UTC (rev 10782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta 2008-10-11 15:42:39 UTC (rev 10783)
@@ -138,7 +138,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Add El Reference..." kind="action" name="AddItem">
<EntityData EntityName="VPEElReference">
<AttributeData AttributeName="location"/>
@@ -149,7 +149,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Edit El Reference..." kind="action" name="EditItem">
<EntityData EntityName="VPEElReference">
<AttributeData AttributeName="location"/>
@@ -192,7 +192,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Add El Reference..." kind="action" name="AddItem">
<EntityData EntityName="VPEElReferenceExt">
<AttributeData AttributeName="location"/>
@@ -203,7 +203,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Edit El Reference..." kind="action" name="EditItem">
<EntityData EntityName="VPEElReference">
<AttributeData AttributeName="location"/>
@@ -244,7 +244,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Add El Reference..." kind="action" name="AddItem">
<EntityData EntityName="VPEGlobalElReference">
<AttributeData AttributeName="location" Mandatory="no"/>
@@ -255,7 +255,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Edit El Reference..." kind="action" name="EditItem">
<EntityData EntityName="VPEGlobalElReference">
<AttributeData AttributeName="location"/>
@@ -297,7 +297,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Add El Reference..." kind="action" name="AddItem">
<EntityData EntityName="VPEGlobalElReferenceExt">
<AttributeData AttributeName="location"/>
@@ -308,7 +308,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Edit El Reference..." kind="action" name="EditItem">
<EntityData EntityName="VPEGlobalElReferenceExt">
<AttributeData AttributeName="location"/>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml 2008-10-11 13:26:44 UTC (rev 10782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml 2008-10-11 15:42:39 UTC (rev 10783)
@@ -4,5 +4,7 @@
<extension point="org.jboss.tools.common.model.classes">
<xclass id="org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
class="org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"/>
+ <xclass id="org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
+ class="org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"/>
</extension>
</plugin>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java 2008-10-11 13:26:44 UTC (rev 10782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java 2008-10-11 15:42:39 UTC (rev 10783)
@@ -3,13 +3,10 @@
import java.util.List;
import org.jboss.tools.common.el.core.ELReferenceList;
-import org.jboss.tools.common.meta.XAttribute;
-import org.jboss.tools.common.meta.XModelEntity;
-import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintFileFilter;
-import org.jboss.tools.common.meta.impl.XModelMetaDataImpl;
import org.jboss.tools.common.resref.core.ResourceReference;
import org.jboss.tools.common.resref.core.ResourceReferenceList;
import org.jboss.tools.common.resref.ui.AbstractResourceReferencesComposite;
+import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
/**
@@ -37,7 +34,7 @@
*/
@Override
protected String getEntity() {
- return (file != null) ? "VPEElReference" : "VPEElReferenceExt";
+ return (file != null) ? "VPEElReference" : "VPEElReferenceExt"; //$NON-NLS-1$//$NON-NLS-2$
}
/**c
@@ -64,7 +61,7 @@
ResourceReference css = getDefaultResourceReference();
initFilterInFileChooser();
- boolean ok = VpeAddReferenceSupport.add(file, css, getReferenceArray(),
+ boolean ok = BaseAddReferenceSupport.add(file, css, getReferenceArray(),
getEntity());
if (!ok)
return;
@@ -82,7 +79,7 @@
}
ResourceReference css = getReferenceArray()[index];
initFilterInFileChooser();
- boolean ok = VpeAddReferenceSupport.edit(file, css,
+ boolean ok = BaseAddReferenceSupport.edit(file, css,
getReferenceArray(), getEntity());
if (ok) {
update();
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java 2008-10-11 13:26:44 UTC (rev 10782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java 2008-10-11 15:42:39 UTC (rev 10783)
@@ -42,4 +42,5 @@
public static String INCLUDED_TAG_LIBS;
public static String SUBSTITUTED_EL_EXPRESSIONS;
public static String ACTUAL_RUN_TIME_ABSOLUTE_FOLDER;
+ public static String INVALID_EL_EXPRESSION;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java 2008-10-11 13:26:44 UTC (rev 10782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java 2008-10-11 15:42:39 UTC (rev 10783)
@@ -29,6 +29,7 @@
import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
import org.jboss.tools.common.resref.core.ResourceReference;
import org.jboss.tools.common.resref.core.ResourceReferenceList;
+import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
public abstract class ResourceReferencesDialogView extends AbstractQueryWizardView {
@@ -124,7 +125,7 @@
protected void add(int index) {
ResourceReference css = new ResourceReference("", ResourceReference.FOLDER_SCOPE);
- boolean ok = VpeAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
+ boolean ok = BaseAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
if(!ok) return;
dataList.add(css);
update();
@@ -134,7 +135,7 @@
protected void edit(int index) {
if(index < 0) return;
ResourceReference css = getReferenceArray()[index];
- boolean ok = VpeAddReferenceSupport.edit(file, css, getReferenceArray(), getEntity());
+ boolean ok = BaseAddReferenceSupport.edit(file, css, getReferenceArray(), getEntity());
if(!ok) return;
update();
}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeELReferenceSupport.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeELReferenceSupport.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeELReferenceSupport.java 2008-10-11 15:42:39 UTC (rev 10783)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+* Copyright (c) 2007-2008 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.vpe.resref.core;
+
+import org.jboss.tools.common.meta.action.impl.WizardDataValidator;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VpeELReferenceSupport extends VpeAddReferenceSupport {
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.meta.action.impl.SpecialWizardSupport#getValidator(int)
+ */
+ @Override
+ public WizardDataValidator getValidator(int step) {
+ return new VpeElVariableValidator(this ,getStepId());
+ }
+
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeElVariableValidator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeElVariableValidator.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeElVariableValidator.java 2008-10-11 15:42:39 UTC (rev 10783)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2007-2008 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.vpe.resref.core;
+
+import java.util.Properties;
+
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VpeElVariableValidator extends DefaultWizardDataValidator {
+
+
+ /**
+ *
+ */
+ public VpeElVariableValidator(SpecialWizardSupport support, int step) {
+ super.setSupport(support, step);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator#validate(java.util.Properties)
+ */
+ @Override
+ public void validate(Properties data) {
+
+ super.validate(data);
+ if( (getErrorMessage()!=null) ||
+ (getWarningMessage()!=null)) {
+ return;
+ }
+ String location = (String) data.get("location"); //$NON-NLS-1$
+ ELParser elParser = ELParserUtil.getDefaultFactory().createParser();
+ elParser.parse("#{"+location+'}'); //$NON-NLS-1$
+ if(elParser.getSyntaxErrors().size()>0) {
+ message=Messages.INVALID_EL_EXPRESSION;
+ }
+
+ }
+
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java 2008-10-11 13:26:44 UTC (rev 10782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java 2008-10-11 15:42:39 UTC (rev 10783)
@@ -16,6 +16,7 @@
import org.jboss.tools.common.resref.core.ResourceReference;
import org.jboss.tools.common.resref.core.ResourceReferenceList;
import org.jboss.tools.common.resref.ui.AbstractResourceReferencesComposite;
+import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
public abstract class VpeResourceReferencesComposite extends AbstractResourceReferencesComposite {
@@ -41,7 +42,7 @@
ResourceReference css = getDefaultResourceReference();
initFilterInFileChooser();
- boolean ok = VpeAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
+ boolean ok = BaseAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
if(!ok) return;
dataList.add(css);
update();
@@ -52,7 +53,7 @@
if(index < 0) return;
ResourceReference css = getReferenceArray()[index];
initFilterInFileChooser();
- boolean ok = VpeAddReferenceSupport.edit(file, css, getReferenceArray(), getEntity());
+ boolean ok = BaseAddReferenceSupport.edit(file, css, getReferenceArray(), getEntity());
if(!ok) return;
update();
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties 2008-10-11 13:26:44 UTC (rev 10782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties 2008-10-11 15:42:39 UTC (rev 10783)
@@ -1,4 +1,5 @@
INCLUDED_CSS_FILES=Included css files
INCLUDED_TAG_LIBS=Included tag libs
SUBSTITUTED_EL_EXPRESSIONS=Substituted El expressions
-ACTUAL_RUN_TIME_ABSOLUTE_FOLDER=Actual Run-Time Absolute Folder
\ No newline at end of file
+ACTUAL_RUN_TIME_ABSOLUTE_FOLDER=Actual Run-Time Absolute Folder
+INVALID_EL_EXPRESSION=Invalid El Expression
16 years, 3 months
JBoss Tools SVN: r10782 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-10-11 09:26:44 -0400 (Sat, 11 Oct 2008)
New Revision: 10782
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2828Test.java
Log:
=JBIDE-2828
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2828Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2828Test.java 2008-10-11 01:14:05 UTC (rev 10781)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2828Test.java 2008-10-11 13:26:44 UTC (rev 10782)
@@ -30,8 +30,10 @@
public JBIDE2828Test(String name) {
super(name);
}
- public void testJBIDE2828JbossELParser() {
+ public void testJBIDE2828JbossELParser() throws Throwable {
+ setException(null);
+
ELParserFactory jbossParserFactory = ELParserUtil.getJbossFactory();
assertNotNull("Couldn't get jboss parser factory", jbossParserFactory); //$NON-NLS-1$
@@ -40,23 +42,20 @@
assertNotNull(elParser);
- ELModel elModel1 = elParser.parse("#{faces.context}"); //$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
- ELModel elModel2 = elParser.parse("faces.context"); //$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
- ELModel elModel3 = elParser.parse("");//$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
- ELModel elModel4 = elParser.parse("org.richfaces.SKIN"); //$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
- ELModel elModel5 = elParser.parse(" jdsfh dskfj lksdjf asjfdsd; dsf; ");//$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
- assertNotNull(elModel1);
+ checkELParser(elParser);
+
+ if(getException()!=null) {
+
+ throw getException();
+ }
}
/**
* Test for default parser
*/
- public void testJBIDE2828DefaultELParser() {
+ public void testJBIDE2828DefaultELParser() throws Throwable {
+ setException(null);
+
ELParserFactory defaultParserFactory = ELParserUtil.getDefaultFactory();
assertNotNull("Couldn't get jboss parser factory", defaultParserFactory); //$NON-NLS-1$
@@ -65,17 +64,29 @@
assertNotNull(elParser);
+ checkELParser(elParser);
+
+ if(getException()!=null) {
+
+ throw getException();
+ }
+ }
+ /**
+ * Checks el parser
+ */
+ private void checkELParser(ELParser elParser) {
ELModel elModel1 = elParser.parse("#{faces.context}"); //$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
- ELModel elModel2 = elParser.parse("faces.context"); //$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
- ELModel elModel3 = elParser.parse("");//$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
- ELModel elModel4 = elParser.parse("org.richfaces.SKIN"); //$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
- ELModel elModel5 = elParser.parse(" jdsfh dskfj lksdjf asjfdsd; dsf; ");//$NON-NLS-1$
- assertEquals("In which expression parser will found error?",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
assertNotNull(elModel1);
+ assertEquals("There shouldn't be errors",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
+
+ ELModel elModel2 = elParser.parse("#{org.richfaces.SKIN}"); //$NON-NLS-1$
+ assertNotNull(elModel2);
+ assertEquals("There shouldn't be errors",elParser.getSyntaxErrors().size(),0); //$NON-NLS-1$
+
+ ELModel elModel3 = elParser.parse("#{klsjdf lsaijf aslkjd; sikjfd}"); //$NON-NLS-1$
+ assertNotNull(elModel3);
+ assertTrue("There should be errorrs", elParser.getSyntaxErrors().size()>0); //$NON-NLS-1$
+
}
}
16 years, 3 months
JBoss Tools SVN: r10781 - in trunk: common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-10 21:14:05 -0400 (Fri, 10 Oct 2008)
New Revision: 10781
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp
Modified:
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java
Log:
add nJunit tests fro common.text.ext plugin
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp 2008-10-11 01:14:05 UTC (rev 10781)
@@ -0,0 +1,5 @@
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<jsp:useBean id="b1" class="org.jboss.tools.test.TestBean1"></jsp:useBean>
+<jsp:getProperty property="property1" name="b1"/>
+
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp 2008-10-11 01:14:05 UTC (rev 10781)
@@ -0,0 +1 @@
+<!-- forward test page -->
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp 2008-10-11 01:14:05 UTC (rev 10781)
@@ -0,0 +1 @@
+<!-- forward test page -->
\ No newline at end of file
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp 2008-10-11 01:14:05 UTC (rev 10781)
@@ -0,0 +1,2 @@
+<jsp:forward page="forward/forwardHiperlinkPage2Tests.jsp"></jsp:forward>
+<jsp:forward page="forwardHiperlinkPage1Tests.jsp"></jsp:forward>
\ No newline at end of file
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp 2008-10-11 01:14:05 UTC (rev 10781)
@@ -0,0 +1 @@
+<!-- include test page -->
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp 2008-10-11 01:14:05 UTC (rev 10781)
@@ -0,0 +1 @@
+<!-- include test page -->
\ No newline at end of file
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp 2008-10-11 01:14:05 UTC (rev 10781)
@@ -0,0 +1,2 @@
+<jsp:forward page="include/includeHiperlinkPage2Tests.jsp"></jsp:forward>
+<jsp:forward page="includeHiperlinkPage1Tests.jsp"></jsp:forward>
\ No newline at end of file
Property changes on: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-10 18:50:50 UTC (rev 10780)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-11 01:14:05 UTC (rev 10781)
@@ -35,14 +35,14 @@
public class OpenOnsTest extends TestCase {
- public static final String STYLE_OPENON_PROJECT = "HiperlinksTestProject";
+ public static final String OPENON_TEST_PROJECT = "HiperlinksTestProject";
public IProject project = null;
protected void setUp() {
project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- STYLE_OPENON_PROJECT);
+ OPENON_TEST_PROJECT);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
JobUtils.waitForIdle();
}
@@ -55,12 +55,10 @@
super("styleClass OpenOn tests");
}
- public static final String WEB_XML_FILE_PATH = "WebContent/WEB-INF/web.xml";
+ public static final String WEB_XML_FILE_PATH = OPENON_TEST_PROJECT+"/WebContent/WEB-INF/web.xml";
public void testFilterNameOpenOn() throws PartInitException, BadLocationException {
- IFile webXml = project.getFile(WEB_XML_FILE_PATH);
- IEditorDescriptor descriptor = IDE.getEditorDescriptor(webXml);
- IEditorPart editor = WorkbenchUtils.openEditor(webXml, descriptor.getId());
+ IEditorPart editor = WorkbenchUtils.openEditor(WEB_XML_FILE_PATH);
editor = ((EditorPartWrapper)editor).getEditor();
JobUtils.waitForIdle();
DefaultMultipageEditor xmlMultyPageEditor = (DefaultMultipageEditor) editor;
@@ -84,9 +82,7 @@
}
public void testRoleNameOpenOn() throws PartInitException, BadLocationException {
- IFile webXml = project.getFile(WEB_XML_FILE_PATH);
- IEditorDescriptor descriptor = IDE.getEditorDescriptor(webXml);
- IEditorPart editor = WorkbenchUtils.openEditor(webXml, descriptor.getId());
+ IEditorPart editor = WorkbenchUtils.openEditor(WEB_XML_FILE_PATH);
editor = ((EditorPartWrapper)editor).getEditor();
JobUtils.waitForIdle();
DefaultMultipageEditor xmlMultyPageEditor = (DefaultMultipageEditor) editor;
@@ -108,9 +104,7 @@
}
public void testServletNameOpenOn() throws PartInitException, BadLocationException {
- IFile webXml = project.getFile(WEB_XML_FILE_PATH);
- IEditorDescriptor descriptor = IDE.getEditorDescriptor(webXml);
- IEditorPart editor = WorkbenchUtils.openEditor(webXml, descriptor.getId());
+ IEditorPart editor = WorkbenchUtils.openEditor(WEB_XML_FILE_PATH);
editor = ((EditorPartWrapper)editor).getEditor();
JobUtils.waitForIdle();
DefaultMultipageEditor xmlMultyPageEditor = (DefaultMultipageEditor) editor;
@@ -137,11 +131,10 @@
assertEquals("<servlet-name>", selection.getText());
}
- public static final String TAGLIB_URI_TEST_FILE = "WebContent/tldUriHyperlinkTests.jsp";
+ public static final String TAGLIB_URI_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/tldUriHyperlinkTests.jsp";
public void testTaglibUriFromJarOpenOn() throws BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(TAGLIB_URI_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(TAGLIB_URI_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JobUtils.waitForIdle();
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
@@ -155,17 +148,17 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
System.out.println(fileName);
assertTrue("jsf_core.tld".equals(fileName));
}
- public static final String TAGLIB_URI_JSP_ROOT_TEST_FILE = "WebContent/jspTagsHyperlinkTests.jsp";
+ public static final String TAGLIB_URI_JSP_ROOT_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/jspTagsHyperlinkTests.jsp";
public void testTaglibUriFromJarinJspRootOpenOn() throws BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(TAGLIB_URI_JSP_ROOT_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(TAGLIB_URI_JSP_ROOT_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JobUtils.waitForIdle();
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
@@ -179,6 +172,8 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
+
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
@@ -186,13 +181,12 @@
assertTrue("jsf_core.tld".equals(fileName));
}
- public static final String STYLE_TEST_FILE = "WebContent/styleHyperlinkTests.jsp";
- public static final String CSS1_TEST_FILE = "WebContent/stylesheet/style1.css";
- public static final String CSS2_TEST_FILE = "WebContent/stylesheet/style2.css";
+ public static final String STYLE_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/styleHyperlinkTests.jsp";
+ public static final String CSS1_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/stylesheet/style1.css";
+ public static final String CSS2_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/stylesheet/style2.css";
public void testStylesheetOpenOn() throws BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(STYLE_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(STYLE_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JobUtils.waitForIdle();
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
@@ -206,6 +200,7 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
@@ -213,8 +208,7 @@
}
public void testStyleClassOpenOns() throws CoreException, BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(STYLE_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(STYLE_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JobUtils.waitForIdle();
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
@@ -228,6 +222,7 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
@@ -241,6 +236,7 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
fileName = editor.getEditorInput().getName();
@@ -250,23 +246,24 @@
"style-class6", true, true, false, false);
links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
links[0].open();
+ JobUtils.waitForIdle();
assertNotNull(links);
assertTrue(links.length!=0);
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
fileName = editor.getEditorInput().getName();
assertTrue("style2.css".equals(fileName));
}
- public static final String CLASS_TEST_FILE = "WebContent/classHyperlinkTests.jsp";
- public static final String CLASS1_TEST_FILE = "JavaSource/org/jboss/test/ChangeListenerInstance.java";
+ public static final String CLASS_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/classHyperlinkTests.jsp";
+ public static final String CLASS1_TEST_FILE = OPENON_TEST_PROJECT + "/JavaSource/org/jboss/test/ChangeListenerInstance.java";
public void testClassNameOpenOn() throws CoreException, BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(CLASS_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(CLASS_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
@@ -279,6 +276,7 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
@@ -286,8 +284,7 @@
}
public void testTaglibTagNameOpenOn() throws CoreException, BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(CLASS_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(CLASS_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
@@ -301,11 +298,121 @@
assertNotNull(links[0].toString());
System.out.println(links[0].getClass().getName());
links[0].open();
+ JobUtils.waitForIdle();
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
assertTrue("jsf_core.tld".equals(fileName));
}
+ public static final String USE_BEAN_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/beanHyperlinkTests.jsp";
+ public void testUseBeanClassOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(USE_BEAN_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "org.jboss.tools.test.TestBean1", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("TestBean1.java".equals(fileName));
+
+ reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(reg.getOffset(),
+ "b1", true, true, false, false);
+ links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ ITextSelection selection = (ITextSelection)viewer.getSelectionProvider().getSelection();
+ assertEquals("<jsp:useBean id=\"b1\" class=\"org.jboss.tools.test.TestBean1\">", selection.getText());
+ }
+
+ public static final String FORWARD_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/forwardHiperlinkTests.jsp";
+
+
+ public void testJspForwardOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(FORWARD_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new FindReplaceDocumentAdapter(viewer.getDocument()).find(0,
+ "forward/forwardHiperlinkPage2Tests.jsp", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("forwardHiperlinkPage2Tests.jsp".equals(fileName));
+
+ reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "forwardHiperlinkPage1Tests.jsp", true, true, false, false);
+ links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ fileName = editor.getEditorInput().getName();
+ assertTrue("forwardHiperlinkPage1Tests.jsp".equals(fileName));
+ }
+
+ public static final String INCLUDE_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/includeHiperlinkTests.page.jsp";
+
+
+ public void testJspIncludeOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(INCLUDE_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "include/includeHiperlinkPage2Tests.jsp", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("includeHiperlinkPage2Tests.jsp".equals(fileName));
+
+ reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "includeHiperlinkPage1Tests.jsp", true, true, false, false);
+ links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ fileName = editor.getEditorInput().getName();
+ assertTrue("includeHiperlinkPage1Tests.jsp".equals(fileName));
+ }
}
Modified: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2008-10-10 18:50:50 UTC (rev 10780)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2008-10-11 01:14:05 UTC (rev 10781)
@@ -62,23 +62,6 @@
tplPrjLcStr = FileLocator.resolve(bundle.getEntry(templLocation))
.getFile();
IProject importedPrj = importProjectIntoWorkspace(tplPrjLcStr, new Path(tplPrjLcStr).lastSegment());
-// IProject importedPrj = createEclipseProject(bundle,tplPrjLcStr,monitor);
-// ImportOperation op = new ImportOperation(importedPrj.getFullPath(),
-// new File(tplPrjLcStr),
-// FileSystemStructureProvider.INSTANCE,
-// new IOverwriteQuery() {
-// public String queryOverwrite(String pathString) {
-// return IOverwriteQuery.ALL;
-// }},
-// Arrays.asList(new File(tplPrjLcStr).listFiles()));
-//
-// op.setCreateContainerStructure(false);
-// if( Display.getCurrent() == null || Display.getCurrent().getActiveShell() == null ) {
-// op.setContext(new Shell());
-// } else {
-// op.setContext(Display.getCurrent().getActiveShell());
-// }
-// op.run(monitor);
return importedPrj;
}
Modified: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java 2008-10-10 18:50:50 UTC (rev 10780)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java 2008-10-11 01:14:05 UTC (rev 10781)
@@ -18,10 +18,12 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
@@ -29,6 +31,7 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.wizards.IWizardDescriptor;
@@ -88,10 +91,10 @@
.getActiveShell(), project, pageId, new String[] {pageId}, null);
}
- public static IEditorPart openEditor(IFile inputFile, String editorId) {
+ public static IEditorPart openEditor(String inputFile) {
IEditorPart part = null;
try {
- part = getWorkbenchActivePage().openEditor(new FileEditorInput(inputFile), editorId);
+ part = IDE.openEditor(getWorkbenchActivePage(),ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(inputFile)));
} catch (PartInitException e) {
e.printStackTrace();
}
16 years, 3 months
JBoss Tools SVN: r10780 - trunk/vpe/plugins/org.jboss.tools.vpe/templates.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-10 14:50:50 -0400 (Fri, 10 Oct 2008)
New Revision: 10780
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-auto.xml
Log:
fix results veb page errors
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-auto.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-auto.xml 2008-10-10 16:59:10 UTC (rev 10779)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-auto.xml 2008-10-10 18:50:50 UTC (rev 10780)
@@ -1,2 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<vpe:templates/>
+<vpe:templates>
+ <vpe:tag case-sensitive="no" name="">
+ <vpe:template children="no" modify="no">
+ <vpe:any style="color:red" tag-for-display="tag-name1" value="tag-value"/>
+ </vpe:template>
+ </vpe:tag>
+ <vpe:tag case-sensitive="no" name="">
+ <vpe:template children="no" modify="no">
+ <vpe:any style="color:white" tag-for-display="tag-name2" value="tag-value"/>
+ </vpe:template>
+ </vpe:tag>
+</vpe:templates>
16 years, 3 months
JBoss Tools SVN: r10779 - trunk/birt/docs/en/modules.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2008-10-10 12:59:10 -0400 (Fri, 10 Oct 2008)
New Revision: 10779
Modified:
trunk/birt/docs/en/modules/birt_designer.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-388
Modified: trunk/birt/docs/en/modules/birt_designer.xml
===================================================================
--- trunk/birt/docs/en/modules/birt_designer.xml 2008-10-10 16:18:15 UTC (rev 10778)
+++ trunk/birt/docs/en/modules/birt_designer.xml 2008-10-10 16:59:10 UTC (rev 10779)
@@ -14,23 +14,41 @@
<para>BIRT Designer is an intuitive and quite easy Eclipse-based set of plugins to make reports. We will describe all its features to you.</para>
+ <section id="birt_designer_UI" xreflabel="birt_designer_UI">
+ <title>BIRT User Interface</title>
+
+ <para>The central part of the user interface is the Layout Editor. It displays the whole process of building a report and contains the following tabs:</para>
+
+ <itemizedlist>
+ <listitem><para><emphasis role="bold">Layout</emphasis> - this is an area where you can edit your report design;</para></listitem>
+ <listitem><para><emphasis role="bold">Preview</emphasis> - runs your report created and shows the output;</para></listitem>
+ <listitem><para><emphasis role="bold">Script</emphasis> - on this page you can add JavaScript to your report to customize its behavior;</para></listitem>
+ <listitem><para><emphasis role="bold">XML Source</emphasis> - this is an area where you can view and modify the XML source of your report;</para></listitem>
+ <listitem><para><emphasis role="bold">Master Page</emphasis> - use it to format page data.</para></listitem>
+
+
+
+
+ </itemizedlist>
+
+ </section>
+
<section id="birt_designer_features">
<title>BIRT Report Designer Features</title>
<para>Here are the main BIRT Report Designer features:</para>
<itemizedlist><listitem><para><emphasis role="bold">Palette</emphasis> - contains tables, labels, and charts. It is used in conjunction with the Layout View to design reports.</para></listitem>
- <listitem><para><emphasis role="bold">Layout View</emphasis> - WYSIWYG editor that provides drag and drop creation of the presentation portion of your report.</para></listitem>
- <listitem><para><emphasis role="bold">Data Explorer</emphasis> - Organizes your data sources (connections) and data sets (queries). The data set editor allows you to test your data set to ensure the report receives the correct data. Within this view multi dimensional cubes can be created using existing data sets. Cubes are currently used when building dynamic cross tables. This view also is used to design report parameters.</para></listitem>
- <listitem><para><emphasis role="bold">Property Editor</emphasis> - Presents the most commonly used properties in a convenient format that makes editing quick and easy. BIRT also integrates with the standard Eclipse property view to provide a detailed listing of all properties for an item.</para></listitem>
- <listitem><para><emphasis role="bold">Report Preview</emphasis> - You can test your report at any time with real data. The preview is a window directly within Eclipse.</para></listitem>
- <listitem><para><emphasis role="bold">Script Editor</emphasis> - Scripting adds business logic to reports during data access, during report generation, or during viewing. The code editor provides standard Eclipse features for editing your scripts: syntax coloring, auto-complete and more. An interesting new feature, for BIRT 2.3 is the ability to debug scripts while the report is running.</para></listitem>
- <listitem><para><emphasis role="bold">Outline</emphasis> - BIRT reports are organized as a tree structure with the overall report as the root, and separate categories for styles, report content, data sources, data sets, report parameters and more. The Outline view provides a compact overview of your entire report structure.</para></listitem>
- <listitem><para><emphasis role="bold">Cheat Sheets</emphasis> - Learning a new tool is always a challenge, but Eclipse offers an innovative solution: cheat sheets. These are short bits of documentation that walk you through new tasks.</para></listitem>
- <listitem><para><emphasis role="bold">Resource Explorer</emphasis> - BIRT allows the reuse of report objects, such as tables, data sources and styles. Objects created for reuse are stored in a library file. To browse the contents of report libraries BIRT supplies a Resource Explorer view. This view list all libraries within the resource folder, in addition other shared content such as images and JavaScript files.</para></listitem>
- <listitem><para><emphasis role="bold">Chart Builder</emphasis> - Adding Charts to BIRT designs is expedited with the Chart Builder. Chart creation is separated into three phases: Select Chart Type, Select Data, and Format Chart.</para></listitem>
- <listitem><para><emphasis role="bold">Expression Builder </emphasis> - BIRT expressions are really just simple scripts that return a value. Expressions are used for assigning data values to report elements, building image locations, hyperlinks, parameter default values and many other places. Expressions are constructed within BIRT using the Expression Builder.</para></listitem>
-
- </itemizedlist>
+ <listitem><para><emphasis role="bold">Data Explorer</emphasis> - Organizes your data sources (connections) and data sets (queries). The data set editor allows you to test your data set to ensure the report receives the correct data. Within this view multi dimensional cubes can be created using existing data sets. Cubes are currently used when building dynamic cross tables. This view also is used to design report parameters.</para></listitem>
+ <listitem><para><emphasis role="bold">Resource Explorer</emphasis> - BIRT allows the reuse of report objects, such as tables, data sources and styles. Objects created for reuse are stored in a library file. To browse the contents of report libraries BIRT supplies a Resource Explorer view. This view list all libraries within the resource folder, in addition other shared content such as images and JavaScript files.</para></listitem>
+ <listitem><para><emphasis role="bold">Property Editor</emphasis> - Presents the most commonly used properties in a convenient format that makes editing quick and easy. BIRT also integrates with the standard Eclipse property view to provide a detailed listing of all properties for an item.</para></listitem>
+ <listitem><para><emphasis role="bold">Layout View</emphasis> - WYSIWYG editor that provides drag and drop creation of the presentation portion of your report.</para></listitem>
+ <listitem><para><emphasis role="bold">Script Editor</emphasis> - Scripting adds business logic to reports during data access, during report generation, or during viewing. The code editor provides standard Eclipse features for editing your scripts: syntax coloring, auto-complete and more. An interesting new feature, for BIRT 2.3 is the ability to debug scripts while the report is running.</para></listitem>
+ <listitem><para><emphasis role="bold">Report Preview</emphasis> - You can test your report at any time with real data. The preview is a window directly within Eclipse.</para></listitem>
+ <listitem><para><emphasis role="bold">Chart Builder</emphasis> - Adding Charts to BIRT designs is expedited with the Chart Builder. Chart creation is separated into three phases: Select Chart Type, Select Data, and Format Chart.</para></listitem>
+ <listitem><para><emphasis role="bold">Expression Builder </emphasis> - BIRT expressions are really just simple scripts that return a value. Expressions are used for assigning data values to report elements, building image locations, hyperlinks, parameter default values and many other places. Expressions are constructed within BIRT using the Expression Builder.</para></listitem>
+ <listitem><para><emphasis role="bold">Cheat Sheets</emphasis> - Learning a new tool is always a challenge, but Eclipse offers an innovative solution: cheat sheets. These are short bits of documentation that walk you through new tasks.</para></listitem>
+ <listitem><para><emphasis role="bold">Outline</emphasis> - BIRT reports are organized as a tree structure with the overall report as the root, and separate categories for styles, report content, data sources, data sets, report parameters and more. The Outline view provides a compact overview of your entire report structure.</para></listitem>
+ </itemizedlist>
16 years, 3 months
JBoss Tools SVN: r10778 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces: template and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-10-10 12:18:15 -0400 (Fri, 10 Oct 2008)
New Revision: 10778
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/AttributeMap.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
Log:
Minor changes.
Class AttributeMap moved to org.jboss.tools.jsf.vpe.richfaces.template.util package
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java 2008-10-10 15:25:59 UTC (rev 10777)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java 2008-10-10 16:18:15 UTC (rev 10778)
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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.jsf.vpe.richfaces;
-
-import org.w3c.dom.Element;
-
-/**
- * A wrapper of DOM Element that can extract its attributes as objects of different types.
- * The methods of the class never throw exceptions. In case if parsing is impossible they
- * always return a correct value.
- *
- * @author yradtsevich
- * @see Element
- */
-public class AttributeMap {
- private Element element;
-
- public AttributeMap(Element element) {
- this.element = element;
- }
-
- /**
- * A wrapper of <code>ComponentUtil.getAttribute(sourceElement, attributeName)</code>
- *
- * @param attributeName attribute name
- * @return <code>ComponentUtil.getAttribute(sourceElement, attributeName)</code>
- *
- * @see ComponentUtil
- */
- public String getString(String attributeName) {
- return ComponentUtil.getAttribute(element, attributeName);
- }
-
- /**
- * Returns Boolean representation of the attribute.
- *
- * @param attributeName attribute name
- * @return attribute value.
- * <code>Boolean.TRUE</code>, if the attribute equals "true",
- * <code>Boolean.False</code>, if the attribute equals "false",
- * <code>null</code> otherwise.
- */
- public Boolean getBoolean(String attributeName) {
- String attribute = element.getAttribute(attributeName);
-
- Boolean ret;
-
- if ("true".equals(attribute)) {
- ret = Boolean.TRUE;
- } else if ("false".equals(attribute)) {
- ret = Boolean.FALSE;
- } else {
- ret = null;
- }
-
- return ret;
- }
-
- public boolean isBlank(String attributeName) {
- String value = getString(attributeName);
- return ComponentUtil.isBlank(value);
- }
-}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-10-10 15:25:59 UTC (rev 10777)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-10-10 16:18:15 UTC (rev 10778)
@@ -17,8 +17,8 @@
import java.util.List;
import java.util.Map;
-import org.jboss.tools.jsf.vpe.richfaces.AttributeMap;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.AttributeMap;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/AttributeMap.java (from rev 10777, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java)
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/AttributeMap.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/AttributeMap.java 2008-10-10 16:18:15 UTC (rev 10778)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.jsf.vpe.richfaces.template.util;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.w3c.dom.Element;
+
+/**
+ * A wrapper of DOM Element that can extract its attributes as objects of different types.
+ * The methods of the class never throw exceptions. In case if parsing is impossible they
+ * always return a correct value.
+ *
+ * @author yradtsevich
+ * @see Element
+ */
+public class AttributeMap {
+ private Element element;
+
+ public AttributeMap(Element element) {
+ this.element = element;
+ }
+
+ /**
+ * A wrapper of <code>ComponentUtil.getAttribute(sourceElement, attributeName)</code>
+ *
+ * @param attributeName attribute name
+ * @return <code>ComponentUtil.getAttribute(sourceElement, attributeName)</code>
+ *
+ * @see ComponentUtil
+ */
+ public String getString(String attributeName) {
+ return ComponentUtil.getAttribute(element, attributeName);
+ }
+
+ /**
+ * Returns Boolean representation of the attribute.
+ *
+ * @param attributeName attribute name
+ * @return attribute value.
+ * <code>Boolean.TRUE</code>, if the attribute equals "true",
+ * <code>Boolean.False</code>, if the attribute equals "false",
+ * <code>null</code> otherwise.
+ */
+ public Boolean getBoolean(String attributeName) {
+ String attribute = element.getAttribute(attributeName);
+
+ Boolean ret;
+
+ if ("true".equals(attribute)) {
+ ret = Boolean.TRUE;
+ } else if ("false".equals(attribute)) {
+ ret = Boolean.FALSE;
+ } else {
+ ret = null;
+ }
+
+ return ret;
+ }
+
+ public boolean isBlank(String attributeName) {
+ String value = getString(attributeName);
+ return ComponentUtil.isBlank(value);
+ }
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/AttributeMap.java
___________________________________________________________________
Name: svn:mergeinfo
+
16 years, 3 months
JBoss Tools SVN: r10777 - in trunk: jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-10-10 11:25:59 -0400 (Fri, 10 Oct 2008)
New Revision: 10777
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/down-disabled.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java
Log:
Bug fix https://jira.jboss.org/jira/browse/JBIDE-2856.
Part 2.
Added support of custom button icons and 'disabled' attribute in RichFaces Combo Box.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css 2008-10-10 14:37:12 UTC (rev 10776)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/comboBox.css 2008-10-10 15:25:59 UTC (rev 10777)
@@ -72,7 +72,7 @@
border-top-color: #C4C0B9;
}
-input.rich-combobox-button-icon-inactive {
+input.rich-combobox-button-icon-inactive, input.rich-combobox-button-icon-disabled {
background: transparent none no-repeat scroll center;
cursor: pointer;
}
@@ -81,6 +81,10 @@
background-image: url(down.gif);
}
+input.rich-combobox-button-icon-disabled {
+ background-image: url(down-disabled.gif);
+}
+
.rich-combobox-strut {
border: 1px solid #C0C0C0;
margin: 0pt;
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/down-disabled.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/comboBox/down-disabled.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/AttributeMap.java 2008-10-10 15:25:59 UTC (rev 10777)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.jsf.vpe.richfaces;
+
+import org.w3c.dom.Element;
+
+/**
+ * A wrapper of DOM Element that can extract its attributes as objects of different types.
+ * The methods of the class never throw exceptions. In case if parsing is impossible they
+ * always return a correct value.
+ *
+ * @author yradtsevich
+ * @see Element
+ */
+public class AttributeMap {
+ private Element element;
+
+ public AttributeMap(Element element) {
+ this.element = element;
+ }
+
+ /**
+ * A wrapper of <code>ComponentUtil.getAttribute(sourceElement, attributeName)</code>
+ *
+ * @param attributeName attribute name
+ * @return <code>ComponentUtil.getAttribute(sourceElement, attributeName)</code>
+ *
+ * @see ComponentUtil
+ */
+ public String getString(String attributeName) {
+ return ComponentUtil.getAttribute(element, attributeName);
+ }
+
+ /**
+ * Returns Boolean representation of the attribute.
+ *
+ * @param attributeName attribute name
+ * @return attribute value.
+ * <code>Boolean.TRUE</code>, if the attribute equals "true",
+ * <code>Boolean.False</code>, if the attribute equals "false",
+ * <code>null</code> otherwise.
+ */
+ public Boolean getBoolean(String attributeName) {
+ String attribute = element.getAttribute(attributeName);
+
+ Boolean ret;
+
+ if ("true".equals(attribute)) {
+ ret = Boolean.TRUE;
+ } else if ("false".equals(attribute)) {
+ ret = Boolean.FALSE;
+ } else {
+ ret = null;
+ }
+
+ return ret;
+ }
+
+ public boolean isBlank(String attributeName) {
+ String value = getString(attributeName);
+ return ComponentUtil.isBlank(value);
+ }
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-10-10 14:37:12 UTC (rev 10776)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-10-10 15:25:59 UTC (rev 10777)
@@ -12,12 +12,12 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
-
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.jboss.tools.jsf.vpe.richfaces.AttributeMap;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
@@ -28,6 +28,7 @@
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -38,13 +39,21 @@
/**
- * The Class RichFacesComboBox2Template.
+ * The Class RichFacesComboBoxTemplate.
*
* @author Eugene Stherbin
*/
public class RichFacesComboBoxTemplate extends AbstractEditableRichFacesTemplate implements VpeToggableTemplate {
- /** CSS_FILE_NAME. */
+ private static final String BUTTON_ICON_CLASSES_DISABLED = "rich-combobox-font-inactive rich-combobox-button-icon-disabled rich-combobox-button-inactive"; //$NON-NLS-1$
+ private static final String BUTTON_ICON_CLASSES = "rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive"; //$NON-NLS-1$
+ private static final String SECOND_DIV = "secondDiv"; //$NON-NLS-1$
+ private static final String THIRD_DIV = "thirdDiv"; //$NON-NLS-1$
+ private static final String THIRD_EMPTY_DIV = "thirdEmptyDiv"; //$NON-NLS-1$
+ private static final String TEXT_FIELD = "textField"; //$NON-NLS-1$
+ private static final String BUTTON_ICON = "buttonIcon"; //$NON-NLS-1$
+
+ /** CSS_FILE_NAME. */
private static final String CSS_FILE_NAME = "comboBox/comboBox.css"; //$NON-NLS-1$
/** The Constant DEFAULT_ALIGN. */
@@ -74,8 +83,8 @@
/** The Constant RICH_COMBOBOX_INPUT_CELL_STYLE. */
private static final String RICH_COMBOBOX_INPUT_CELL_STYLE = "rich-combobox-inputCell"; //$NON-NLS-1$
- /** The Constant SECOND_INPUT. */
- private static final String SECOND_INPUT = "secondInput"; //$NON-NLS-1$
+ /** The Constant BUTTON_BACKGROUND. */
+ private static final String BUTTON_BACKGROUND = "buttonBackground"; //$NON-NLS-1$
/** The Constant STYLE_EXT. */
private static final String STYLE_EXT = "richFacesComboBox"; //$NON-NLS-1$
@@ -89,7 +98,8 @@
private static final String ZERO_STRING = "0"; //$NON-NLS-1$
/** The source align. */
- private String sourceAlign;
+ // Commented because of not working alignment in RichFaces implementation
+ // private String sourceAlign;
/** The source button style. */
private String sourceButtonStyle;
@@ -133,7 +143,13 @@
/** Source button icon **/
private String sourceButtonIcon;
+
+ private String sourceButtonIconInactive;
+
+ private String sourceButtonIconDisabled;
+ private boolean disabled;
+
/**
* The Constructor.
*/
@@ -186,11 +202,16 @@
rootDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH+Constants.COLON+sourceWidth);
final nsIDOMElement comboBoxDiv = visualDocument.createElement(HTML.TAG_DIV);
final nsIDOMElement secondDiv = visualDocument.createElement(HTML.TAG_DIV);
- comboBoxDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign); //$NON-NLS-1$
- secondDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+
+ // Commented because of not working alignment in RichFaces implementation
+ // comboBoxDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+ // secondDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+
+
//comboBoxDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("secondDiv")); //$NON-NLS-1$
- secondDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("secondDiv")); //$NON-NLS-1$
+ secondDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(SECOND_DIV)); //$NON-NLS-1$
String secondDivSubStyle = "; position: {0}; z-index: {1} ;"; //$NON-NLS-1$
+
if (isToggle) {
secondDivSubStyle = MessageFormat.format(secondDivSubStyle, "relative", "2"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
@@ -202,15 +223,15 @@
secondDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + this.sourceListWidth
+ Constants.SEMICOLON + secondDivSubStyle + sourceStyle);
final nsIDOMElement thirdDiv = visualDocument.createElement(HTML.TAG_DIV);
- thirdDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("thirdDiv")); //$NON-NLS-1$
+ thirdDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(THIRD_DIV));
thirdDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + this.sourceWidth
+ "; z-index: 1;"); //$NON-NLS-1$
- final nsIDOMElement firstInput = visualDocument.createElement(HTML.TAG_INPUT);
- firstInput.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
- ;
- firstInput.setAttribute(HTML.ATTR_CLASS, styleClasess.get("firstInput") + Constants.WHITE_SPACE + sourceInputClass); //$NON-NLS-1$
- firstInput.setAttribute("autocomplete", "off"); //$NON-NLS-1$ //$NON-NLS-2$
- firstInput.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH+ Constants.COLON + calculateWithForDiv(this.sourceWidth, 17) + Constants.SEMICOLON
+ final nsIDOMElement textField = visualDocument.createElement(HTML.TAG_INPUT);
+ textField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+
+ textField.setAttribute(HTML.ATTR_CLASS, styleClasess.get(TEXT_FIELD) + Constants.WHITE_SPACE + sourceInputClass); //$NON-NLS-1$
+ textField.setAttribute("autocomplete", "off"); //$NON-NLS-1$ //$NON-NLS-2$
+ textField.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH+ Constants.COLON + calculateWithForDiv(this.sourceWidth, 17) + Constants.SEMICOLON
+ sourceInputStyle);
String value = null;
if (ComponentUtil.isNotBlank(this.sourceDefaultLabel)) {
@@ -220,33 +241,49 @@
}
if (value != null) {
- firstInput.setAttribute(RichFaces.ATTR_VALUE, value);
+ textField.setAttribute(RichFaces.ATTR_VALUE, value);
}
- final nsIDOMElement secondInput = visualDocument.createElement(HTML.TAG_INPUT);
- secondInput.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
- ;
- secondInput.setAttribute(HTML.ATTR_CLASS, styleClasess.get(SECOND_INPUT));
- secondInput.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
- secondInput.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ final nsIDOMElement buttonBackground = visualDocument.createElement(HTML.TAG_INPUT);
+ buttonBackground.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+
+ if (disabled) {
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES_DISABLED); //$NON-NLS-1$
+ } else {
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES); //$NON-NLS-1$
+ }
+
+ buttonBackground.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_BACKGROUND));
+ buttonBackground.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
+ buttonBackground.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
if (this.sourceButtonStyle != null) {
- secondInput.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ buttonBackground.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
}
//
- final nsIDOMElement thirdInput = visualDocument.createElement(HTML.TAG_INPUT);
- thirdInput.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ final nsIDOMElement buttonIcon = visualDocument.createElement(HTML.TAG_INPUT);
+ buttonIcon.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
;
- thirdInput.setAttribute(HTML.ATTR_CLASS, styleClasess.get("thirdInput")); //$NON-NLS-1$
- thirdInput.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
- thirdInput.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ buttonIcon.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_ICON)); //$NON-NLS-1$
+ buttonIcon.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
+ buttonIcon.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
if (this.sourceButtonStyle != null) {
- thirdInput.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ buttonIcon.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
}
-
-// if (ComponentUtil.isNotBlank(this.sourceButtonIcon) && (this.sourceButtonIcon != IMAGE_NAME_DOWN)) {
-// thirdInput.setAttribute(HTML.ATTR_STYLE, thirdInput.getAttribute(HTML.ATTR_STYLE) + " ; background-image: url("
-// + this.sourceButtonIcon + ")");
-// }
+ String actualSourceButton;
+ if (disabled) {
+ actualSourceButton = sourceButtonIconDisabled;
+ } else if (isToggle) {
+ actualSourceButton = sourceButtonIcon;
+ } else {
+ actualSourceButton = sourceButtonIconInactive;
+ }
+
+ if (ComponentUtil.isNotBlank(actualSourceButton) && (actualSourceButton != IMAGE_NAME_DOWN)) {
+ String buttonIconPath = VpeStyleUtil.addFullPathToImgSrc(actualSourceButton, pageContext, true);
+ buttonIconPath = buttonIconPath.replace('\\', '/');
+ String style = "background-image: url(" + buttonIconPath + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ buttonIcon.setAttribute(HTML.ATTR_STYLE, buttonIcon.getAttribute(HTML.ATTR_STYLE) + style);
+ }
final nsIDOMElement forthEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
forthEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("forthEmptyDiv")); //$NON-NLS-1$
forthEmptyDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
@@ -260,9 +297,9 @@
if (isToggle) {
comboBoxDiv.appendChild(createToogleDiv(pageContext, source, visualDocument));
}
- thirdDiv.appendChild(firstInput);
- thirdDiv.appendChild(secondInput);
- thirdDiv.appendChild(thirdInput);
+ thirdDiv.appendChild(textField);
+ thirdDiv.appendChild(buttonBackground);
+ thirdDiv.appendChild(buttonIcon);
thirdDiv.appendChild(forthEmptyDiv);
final VpeCreationData creationData = new VpeCreationData(rootDiv);
@@ -287,7 +324,7 @@
thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE, this.sourceListStyle + Constants.SEMICOLON
+ " z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
- thirdEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("thirdEmptyDiv") + " " + this.sourceListClass); //$NON-NLS-1$ //$NON-NLS-2$
+ thirdEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(THIRD_EMPTY_DIV) + " " + this.sourceListClass); //$NON-NLS-1$ //$NON-NLS-2$
thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE, "z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
final nsIDOMElement shadovDiv = visualDocument.createElement(HTML.TAG_DIV);
@@ -567,12 +604,12 @@
* Inits the default classes.
*/
private void initDefaultClasses() {
- styleClasess.put("secondDiv", "rich-combobox-font rich-combobox"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put("thirdDiv", "rich-combobox-font rich-combobox-shell"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put("thirdEmptyDiv", "rich-combobox-list-cord"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put("firstInput", "rich-combobox-font-disabled rich-combobox-input-inactive"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put(SECOND_INPUT, "rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"); //$NON-NLS-1$
- styleClasess.put("thirdInput", "rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive"); //$NON-NLS-1$ //$NON-NLS-2$
+ styleClasess.put(SECOND_DIV, "rich-combobox-font rich-combobox"); //$NON-NLS-1$ //$NON-NLS-2$
+ styleClasess.put(THIRD_DIV, "rich-combobox-font rich-combobox-shell"); //$NON-NLS-1$ //$NON-NLS-2$
+ styleClasess.put(THIRD_EMPTY_DIV, "rich-combobox-list-cord"); //$NON-NLS-1$ //$NON-NLS-2$
+ styleClasess.put(TEXT_FIELD, "rich-combobox-font-disabled rich-combobox-input-inactive"); //$NON-NLS-1$ //$NON-NLS-2$
+ styleClasess.put(BUTTON_BACKGROUND, "rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"); //$NON-NLS-1$
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES); //$NON-NLS-1$ //$NON-NLS-2$
styleClasess.put("forthEmptyDiv", "rich-combobox-strut rich-combobox-font"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -602,24 +639,31 @@
* @param source the source
*/
private void prepareData(Element source) {
- this.sourceAlign = source.getAttribute(RichFaces.ATTR_ALIGN);
- if (ComponentUtil.isBlank(this.sourceAlign)) {
- this.sourceAlign = DEFAULT_ALIGN;
- }
- this.sourceListWidth = source.getAttribute(RichFaces.ATTR_LIST_WIDTH);
+ AttributeMap attributeMap = new AttributeMap(source);
- if (ComponentUtil.isBlank(this.sourceListWidth)) {
- this.sourceListWidth = DEFAULT_LIST_WIDTH;
+ // Commented because of not working alignment in RichFaces implementation
+ // if (attributeMap.isBlank(RichFaces.ATTR_ALIGN)) {
+ // this.sourceAlign = DEFAULT_ALIGN;
+ // } else {
+ // this.sourceAlign = attributeMap.getString(RichFaces.ATTR_ALIGN);
+ // }
+
+ if (attributeMap.isBlank(RichFaces.ATTR_LIST_WIDTH)) {
+ this.sourceListWidth = DEFAULT_LIST_WIDTH;
+ } else {
+ this.sourceListWidth = attributeMap.getString(RichFaces.ATTR_LIST_WIDTH);
}
- this.sourceListHeight = source.getAttribute(RichFaces.ATTR_LIST_HEIGHT);
-
- this.sourceWidth = source.getAttribute(RichFaces.ATTR_WIDTH);
+ this.sourceListHeight = attributeMap.getString(RichFaces.ATTR_LIST_HEIGHT);
- if (ComponentUtil.isBlank(this.sourceWidth)) {
- this.sourceWidth = DEFAULT_LIST_WIDTH;
- }else if(ComponentUtil.isNotBlank(this.sourceWidth) && (this.sourceListWidth == DEFAULT_LIST_WIDTH)){
- this.sourceListWidth = this.sourceWidth;
+ if (attributeMap.isBlank(RichFaces.ATTR_WIDTH)) {
+ this.sourceWidth = DEFAULT_LIST_WIDTH;
+ } else {
+ this.sourceWidth = attributeMap.getString(RichFaces.ATTR_WIDTH);
+
+ if(this.sourceListWidth == DEFAULT_LIST_WIDTH) {
+ this.sourceListWidth = this.sourceWidth;
+ }
}
if (ComponentUtil.isNotBlank(this.sourceWidth) && (this.sourceWidth != DEFAULT_LIST_WIDTH)) {
@@ -633,26 +677,29 @@
}
}
- this.sourceDefaultLabel = ComponentUtil.getAttribute(source, "defaultLabel"); //$NON-NLS-1$
- this.sourceValue = ComponentUtil.getAttribute(source, RichFaces.ATTR_VALUE);
+ this.sourceDefaultLabel = attributeMap.getString("defaultLabel"); //$NON-NLS-1$
+ this.sourceValue = attributeMap.getString( RichFaces.ATTR_VALUE);
- this.sourceButtonStyle = ComponentUtil.getAttribute(source, "buttonStyle"); //$NON-NLS-1$
+ this.sourceButtonStyle = attributeMap.getString("buttonStyle"); //$NON-NLS-1$
- final String sourceStyleClasess = ComponentUtil.getAttribute(source, RichFaces.ATTR_STYLE_CLASS);
+ final String sourceStyleClasess = attributeMap.getString(RichFaces.ATTR_STYLE_CLASS);
if (ComponentUtil.isNotBlank(sourceStyleClasess)) {
- styleClasess.put("secondDiv", styleClasess.get("secondDiv") + " " + sourceStyleClasess); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ styleClasess.put(SECOND_DIV, styleClasess.get(SECOND_DIV) + " " + sourceStyleClasess); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- this.sourceStyle = ComponentUtil.getAttribute(source, HTML.ATTR_STYLE);
- this.sourceInputStyle = ComponentUtil.getAttribute(source, "inputStyle"); //$NON-NLS-1$
- this.sourceInputClass = ComponentUtil.getAttribute(source, "inputClass"); //$NON-NLS-1$
- this.sourceListClass = ComponentUtil.getAttribute(source, "listClass"); //$NON-NLS-1$
- this.sourceListStyle = ComponentUtil.getAttribute(source, "listStyle"); //$NON-NLS-1$
- this.sourceItemClass = ComponentUtil.getAttribute(source, "itemClass"); //$NON-NLS-1$
+ this.sourceStyle = attributeMap.getString(HTML.ATTR_STYLE);
+ this.sourceInputStyle = attributeMap.getString("inputStyle"); //$NON-NLS-1$
+ this.sourceInputClass = attributeMap.getString("inputClass"); //$NON-NLS-1$
+ this.sourceListClass = attributeMap.getString("listClass"); //$NON-NLS-1$
+ this.sourceListStyle = attributeMap.getString("listStyle"); //$NON-NLS-1$
+ this.sourceItemClass = attributeMap.getString("itemClass"); //$NON-NLS-1$
- this.sourceButtonIcon = ComponentUtil.getAttribute(source, "buttonIcon"); //$NON-NLS-1$
-
+ this.sourceButtonIcon = attributeMap.getString(BUTTON_ICON); //$NON-NLS-1$
+ this.sourceButtonIconInactive = attributeMap.getString("buttonIconInactive"); //$NON-NLS-1$
+ this.sourceButtonIconDisabled = attributeMap.getString("buttonIconDisabled"); //$NON-NLS-1$
+ this.disabled = (attributeMap.getBoolean("disabled") == Boolean.TRUE); //$NON-NLS-1$
+
if(ComponentUtil.isBlank(this.sourceButtonIcon)){
this.sourceButtonIcon = IMAGE_NAME_DOWN;
}
@@ -764,7 +811,6 @@
*/
public void stopToggling(Node sourceNode) {
isToggle = false;
-
}
/**
@@ -775,8 +821,11 @@
* @param toggleId the toggle id
*/
public void toggle(VpeVisualDomBuilder builder, Node sourceNode, String toggleId) {
- isToggle = !isToggle;
+ if (disabled) {
+ isToggle = false;
+ } else {
+ isToggle = !isToggle;
+ }
}
-
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml 2008-10-10 14:37:12 UTC (rev 10776)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml 2008-10-10 15:25:59 UTC (rev 10777)
@@ -18,5 +18,35 @@
<f:selectItem itemValue="suggestion 4" />
<f:selectItem itemValue="suggestion 5" />
</rich:comboBox>
+
+<rich:comboBox value="#{bean.cbString}" defaultLabel="Select Any Value"
+ buttonIconInactive="../../pictures/clickme.gif"
+ style="width:250px" id="comboBox-JBIDE-2856-buttonIconInactive">
+ <f:selectItem itemValue="suggestion 1" />
+ <f:selectItem itemValue="suggestion 2" />
+ <f:selectItem itemValue="suggestion 3" />
+ <f:selectItem itemValue="suggestion 4" />
+ <f:selectItem itemValue="suggestion 5" />
+</rich:comboBox>
+
+<rich:comboBox value="#{bean.cbString}" defaultLabel="Select Any Value" disabled="true"
+ style="width:250px" id="comboBox-JBIDE-2856-disabled">
+ <f:selectItem itemValue="suggestion 1" />
+ <f:selectItem itemValue="suggestion 2" />
+ <f:selectItem itemValue="suggestion 3" />
+ <f:selectItem itemValue="suggestion 4" />
+ <f:selectItem itemValue="suggestion 5" />
+</rich:comboBox>
+
+<rich:comboBox value="#{bean.cbString}" defaultLabel="Select Any Value" disabled="true"
+ buttonIconDisabled="../../pictures/clickme.gif"
+ style="width:250px" id="comboBox-JBIDE-2856-buttonIconDisabled">
+ <f:selectItem itemValue="suggestion 1" />
+ <f:selectItem itemValue="suggestion 2" />
+ <f:selectItem itemValue="suggestion 3" />
+ <f:selectItem itemValue="suggestion 4" />
+ <f:selectItem itemValue="suggestion 5" />
+</rich:comboBox>
+
</body>
</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml.xml 2008-10-10 14:37:12 UTC (rev 10776)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml.xml 2008-10-10 15:25:59 UTC (rev 10777)
@@ -1,22 +1,86 @@
<tests>
<test id="comboBox">
<DIV STYLE="width: 150px;">
- <DIV ALIGN="left" CLASS="rich-combobox-font rich-combobox"
- STYLE="position: static; z-index: 0; width: 250px;">
- <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width: 150px; z-index: 1;">
- <INPUT TYPE="text"
- CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
- AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select Any Value" />
- <INPUT TYPE="text"
- CLASS="rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"
- READONLY="true" VPE-USER-TOGGLE-ID="0" />
- <INPUT TYPE="text"
- CLASS="rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive"
- READONLY="true" VPE-USER-TOGGLE-ID="0" />
- <DIV CLASS="rich-combobox-strut rich-combobox-font" STYLE="width: 140px;">
- Struts</DIV>
+ <DIV STYLE="width: 150px; position: static; z-index: 0;">
+ <DIV CLASS="rich-combobox-font rich-combobox" STYLE="position: static; z-index: 0; width: 250px;">
+ <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width: 150px; z-index: 1;">
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
+ AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select Any Value" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE="" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE="" />
+ <DIV CLASS="rich-combobox-strut rich-combobox-font" STYLE="width: 140px;">
+ Struts</DIV>
+ </DIV>
</DIV>
</DIV>
</DIV>
</test>
+ <test id="comboBox-JBIDE-2856-buttonIconInactive">
+ <DIV STYLE="width: 150px;">
+ <DIV STYLE="width: 150px; position: static; z-index: 0;">
+ <DIV CLASS="rich-combobox-font rich-combobox" STYLE="position: static; z-index: 0; width: 250px;">
+ <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width: 150px; z-index: 1;">
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
+ AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select Any Value" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE="" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" />
+ <DIV CLASS="rich-combobox-strut rich-combobox-font" STYLE="width: 140px;">
+ Struts</DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </test>
+ <test id="comboBox-JBIDE-2856-disabled">
+ <DIV STYLE="width: 150px;">
+ <DIV STYLE="width: 150px; position: static; z-index: 0;">
+ <DIV CLASS="rich-combobox-font rich-combobox" STYLE="position: static; z-index: 0; width: 250px;">
+ <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width: 150px; z-index: 1;">
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
+ AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select Any Value" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE="" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-icon-disabled rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" />
+ <DIV CLASS="rich-combobox-strut rich-combobox-font" STYLE="width: 140px;">
+ Struts</DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </test>
+ <test id="comboBox-JBIDE-2856-buttonIconDisabled">
+ <DIV STYLE="width: 150px;">
+ <DIV STYLE="width: 150px; position: static; z-index: 0;">
+ <DIV CLASS="rich-combobox-font rich-combobox" STYLE="position: static; z-index: 0; width: 250px;">
+ <DIV CLASS="rich-combobox-font rich-combobox-shell" STYLE="width: 150px; z-index: 1;">
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-disabled rich-combobox-input-inactive"
+ AUTOCOMPLETE="off" STYLE="width: 133px;" VALUE="Select Any Value" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" STYLE="" />
+ <INPUT TYPE="text"
+ CLASS="rich-combobox-font-inactive rich-combobox-button-icon-disabled rich-combobox-button-inactive"
+ READONLY="true" VPE-USER-TOGGLE-ID="0" />
+ <DIV CLASS="rich-combobox-strut rich-combobox-font" STYLE="width: 140px;">
+ Struts</DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </test>
</tests>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java 2008-10-10 14:37:12 UTC (rev 10776)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java 2008-10-10 15:25:59 UTC (rev 10777)
@@ -95,12 +95,11 @@
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_DIV);
- nsIDOMElement divOne = (nsIDOMElement) elements.get(4).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ nsIDOMElement divOne = (nsIDOMElement) elements.get(5).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
assertTrue("Style classes should be contains ",divOne.getAttribute(HTML.ATTR_CLASS).contains("rich-combobox-font rich-combobox")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue("Default style should be contains " + width, divOne.getAttribute(HTML.ATTR_STYLE).indexOf(width) > 1); //$NON-NLS-1$
assertTrue("Default style should be contains " + width, divOne.getAttribute(HTML.ATTR_STYLE).contains("width")); //$NON-NLS-1$ //$NON-NLS-2$
// Check input
-
return rst;
}
@@ -128,9 +127,8 @@
*/
public void testComboBoxWithAttributes() throws PartInitException, Throwable {
final nsIDOMElement rst = baseTableCheck(COMPONENTS_COMBO_WITH_ATTR_TEMPLATE, _250PX);
-
+
checkValueInInput(rst, SELECT_ANY_VALUE);
-
}
/**
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java 2008-10-10 14:37:12 UTC (rev 10776)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java 2008-10-10 15:25:59 UTC (rev 10777)
@@ -137,5 +137,4 @@
iTransferable.getAnyTransferData(aFlavor, aData, aDataLen);
return aData[0];
}
-
}
16 years, 3 months
JBoss Tools SVN: r10776 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: templates and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-10-10 10:37:12 -0400 (Fri, 10 Oct 2008)
New Revision: 10776
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2761
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java 2008-10-10 14:37:12 UTC (rev 10776)
@@ -0,0 +1,559 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Displays template for extendedDataTable
+ *
+ * @author dsakovich(a)exadel.com
+ *
+ */
+public class RichFacesExtendedDataTableTemplate extends VpeAbstractTemplate {
+
+ final static String DEFAULT_HEIGHT = "500px";
+ final static String DEFAULT_WIDTH = "100%";
+ final static String HEADER = "header";
+ final static String HEADER_CLASS = "headerClass";
+ final static String FOOTER = "footer";
+ final static String FOOTER_CLASS = "footerClass";
+ final static String CAPTION_CLASS = "captionClass";
+ final static String CAPTION_STYLE = "captionStyle";
+ final static String SPACE = " ";
+
+ private static String STYLE_FOR_LOW_SCROLL = "overflow: scroll; width: 100%; height: 17px;";
+ private static String STYLE_FOR_RIGHT_SCROLL = "overflow: scroll; width: 17px; height: 100%;";
+
+ private static final int NUM_ROW = 5;
+
+ /**
+ * Creates a node of the visual tree on the node of the source tree. This
+ * visual node should not have the parent node This visual node can have
+ * child nodes.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @return The information on the created node of the visual tree.
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ Element sourceElement = (Element) sourceNode;
+
+ String width = sourceElement.getAttribute(HTML.ATTR_WIDTH);
+ String height = sourceElement.getAttribute(HTML.ATTR_HEIGHT);
+
+ // -----------CommonTable
+ nsIDOMElement tableCommon = visualDocument
+ .createElement(HTML.TAG_TABLE);
+
+ VpeCreationData creationData = new VpeCreationData(tableCommon);
+
+ nsIDOMElement tr1 = visualDocument.createElement(HTML.TAG_TR);
+
+ nsIDOMElement tr2 = visualDocument.createElement(HTML.TAG_TR);
+
+ tableCommon.appendChild(tr1);
+ tableCommon.appendChild(tr2);
+
+ // ---------tr2
+ nsIDOMElement tr2_TD = visualDocument.createElement(HTML.TAG_TD);
+ tr2.appendChild(tr2_TD);
+
+ nsIDOMElement tr2_td_DIV = visualDocument.createElement(HTML.TAG_DIV);
+ tr2_td_DIV.setAttribute(HTML.ATTR_STYLE, STYLE_FOR_LOW_SCROLL);
+ tr2_TD.appendChild(tr2_td_DIV);
+
+ // --------------------------------------------
+
+ // ---------------------tr1------------------------
+ nsIDOMElement tr1_TD1 = visualDocument.createElement(HTML.TAG_TD);
+ tr1.appendChild(tr1_TD1);
+
+ nsIDOMElement tr1_TD2 = visualDocument.createElement(HTML.TAG_TD);
+ tr1.appendChild(tr1_TD2);
+
+ nsIDOMElement tr1_td2_DIV = visualDocument.createElement(HTML.TAG_DIV);
+ tr1_td2_DIV.setAttribute(HTML.ATTR_STYLE, STYLE_FOR_RIGHT_SCROLL);
+ tr1_TD2.appendChild(tr1_td2_DIV);
+
+ // -------------------------------------------------------
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ tr1_TD1.appendChild(div);
+ div.setAttribute(HTML.ATTR_CLASS, "dr-table-hidden");
+
+ String divStyle = HTML.ATTR_WIDTH + " : "
+ + (width == null ? DEFAULT_WIDTH : width) + ";"
+ + HTML.ATTR_HEIGHT + " : "
+ + (height == null ? DEFAULT_HEIGHT : height) + ";";
+
+ div.setAttribute(HTML.ATTR_STYLE, divStyle);
+
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ ComponentUtil.copyAttributes(sourceNode, table);
+ table.removeAttribute(HTML.ATTR_HEIGHT);
+ div.appendChild(table);
+
+ ComponentUtil.setCSSLink(pageContext,
+ "scrollableDataTable/scrollableDataTable.css",
+ "richFacesDataTable");
+ String tableClass = sourceElement
+ .getAttribute(RichFaces.ATTR_STYLE_CLASS);
+ table.setAttribute(HTML.ATTR_CLASS, "dr-table rich-table "
+ + (tableClass == null ? "" : tableClass));
+
+ // Encode colgroup definition.
+ ArrayList<Element> columns = getColumns(sourceElement);
+ int columnsLength = getColumnsCount(sourceElement, columns);
+ nsIDOMElement colgroup = visualDocument
+ .createElement(HTML.TAG_COLGROUP);
+ colgroup.setAttribute(HTML.TAG_SPAN, String.valueOf(columnsLength));
+ table.appendChild(colgroup);
+
+ // Encode Caption
+ encodeCaption(creationData, sourceElement, visualDocument, table);
+
+ // Encode Header
+ Element header = ComponentUtil.getFacet(sourceElement, HEADER);
+ ArrayList<Element> columnsHeaders = getColumnsWithFacet(columns, HEADER);
+ if (header != null || !columnsHeaders.isEmpty()) {
+ nsIDOMElement thead = visualDocument.createElement(HTML.TAG_THEAD);
+ table.appendChild(thead);
+ String headerClass = (String) sourceElement
+ .getAttribute(HEADER_CLASS);
+ if (header != null) {
+ encodeTableHeaderOrFooterFacet(creationData, thead,
+ columnsLength, visualDocument, header,
+ "dr-table-header rich-table-header",
+ "dr-table-header-continue rich-table-header-continue",
+ "dr-table-headercell rich-table-headercell",
+ headerClass, HTML.TAG_TD);
+ }
+ if (!columnsHeaders.isEmpty()) {
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ thead.appendChild(tr);
+ String styleClass = encodeStyleClass(null,
+ "dr-table-subheader rich-table-subheader", null,
+ headerClass);
+ if (styleClass != null) {
+ tr.setAttribute(HTML.ATTR_CLASS, styleClass);
+ }
+ encodeHeaderOrFooterFacets(creationData, tr, visualDocument,
+ columnsHeaders,
+ "dr-table-subheadercell rich-table-subheadercell",
+ headerClass, HEADER, HTML.TAG_TD);
+ }
+ }
+
+ // Encode Footer
+ Element footer = ComponentUtil.getFacet(sourceElement, FOOTER);
+ ArrayList<Element> columnsFooters = getColumnsWithFacet(columns, FOOTER);
+ if (footer != null || !columnsFooters.isEmpty()) {
+ nsIDOMElement tfoot = visualDocument.createElement(HTML.TAG_TFOOT);
+ table.appendChild(tfoot);
+ String footerClass = (String) sourceElement
+ .getAttribute(FOOTER_CLASS);
+ if (!columnsFooters.isEmpty()) {
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ tfoot.appendChild(tr);
+ String styleClass = encodeStyleClass(null,
+ "dr-table-subfooter rich-table-subfooter", null,
+ footerClass);
+ if (styleClass != null) {
+ tr.setAttribute(HTML.ATTR_CLASS, styleClass);
+ }
+ encodeHeaderOrFooterFacets(creationData, tr, visualDocument,
+ columnsFooters,
+ "dr-table-subfootercell rich-table-subfootercell",
+ footerClass, FOOTER, HTML.TAG_TD);
+ }
+ if (footer != null) {
+ encodeTableHeaderOrFooterFacet(creationData, tfoot,
+ columnsLength, visualDocument, footer,
+ "dr-table-footer rich-table-footer",
+ "dr-table-footer-continue rich-table-footer-continue",
+ "dr-table-footercell rich-table-footercell",
+ footerClass, HTML.TAG_TD);
+ }
+ }
+
+ nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
+ table.appendChild(tbody);
+
+ // Create mapping to Encode body
+ for (int i = 0; i < NUM_ROW; i++) {
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+ boolean firstRow = true;
+ nsIDOMElement tr = null;
+ VpeChildrenInfo trInfo = null;
+ for (Node child : children) {
+ if (child.getNodeName().endsWith(":column")) {
+ String breakBefore = ((Element) child)
+ .getAttribute("breakBefore");
+ if (breakBefore != null
+ && breakBefore.equalsIgnoreCase("true")) {
+ tr = null;
+ }
+ if (tr == null) {
+ tr = visualDocument.createElement(HTML.TAG_TR);
+ if (firstRow) {
+ tr.setAttribute(HTML.ATTR_CLASS,
+ "dr-table-firstrow rich-table-firstrow");
+ firstRow = false;
+ } else {
+ tr.setAttribute(HTML.ATTR_CLASS,
+ "dr-table-row rich-table-row");
+ }
+ trInfo = new VpeChildrenInfo(tr);
+ tbody.appendChild(tr);
+ creationData.addChildrenInfo(trInfo);
+ }
+ trInfo.addSourceChild(child);
+ } else if (child.getNodeName().endsWith(":columnGroup")) {
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(
+ creationData, (Element) child, visualDocument,
+ tbody);
+ tr = null;
+ } else if (child.getNodeName().endsWith(":subTable")) {
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(
+ creationData, (Element) child, visualDocument,
+ tbody);
+ tr = null;
+ } else {
+ VpeChildrenInfo childInfo = new VpeChildrenInfo(tbody);
+ childInfo.addSourceChild(child);
+ creationData.addChildrenInfo(childInfo);
+ tr = null;
+ }
+ }
+ }
+
+ return creationData;
+ }
+
+ /**
+ *
+ * @param creationData
+ * @param sourceElement
+ * @param visualDocument
+ * @param table
+ */
+ protected void encodeCaption(VpeCreationData creationData,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement table) {
+ // Encode caption
+ Element captionFromFacet = ComponentUtil.getFacet(sourceElement,
+ HTML.TAG_CAPTION);
+ if (captionFromFacet != null) {
+ String captionClass = (String) table.getAttribute(CAPTION_CLASS);
+ String captionStyle = (String) table.getAttribute(CAPTION_STYLE);
+
+ nsIDOMElement caption = visualDocument
+ .createElement(HTML.TAG_CAPTION);
+ table.appendChild(caption);
+ if (captionClass != null && captionClass.length() > 0) {
+ captionClass = "dr-table-caption rich-table-caption "
+ + captionClass;
+ } else {
+ captionClass = "dr-table-caption rich-table-caption";
+ }
+ caption.setAttribute(HTML.ATTR_CLASS, captionClass);
+ if (captionStyle != null && captionStyle.length() > 0) {
+ caption.setAttribute(HTML.ATTR_STYLE, captionStyle);
+ }
+
+ VpeChildrenInfo cap = new VpeChildrenInfo(caption);
+ cap.addSourceChild(captionFromFacet);
+ creationData.addChildrenInfo(cap);
+ }
+
+ }
+
+ /**
+ *
+ * @param creationData
+ * @param parentTr
+ * @param visualDocument
+ * @param headersOrFooters
+ * @param skinCellClass
+ * @param headerClass
+ * @param facetName
+ * @param element
+ */
+ public static void encodeHeaderOrFooterFacets(VpeCreationData creationData,
+ nsIDOMElement parentTr, nsIDOMDocument visualDocument,
+ ArrayList<Element> headersOrFooters, String skinCellClass,
+ String headerClass, String facetName, String element) {
+ for (Element column : headersOrFooters) {
+ String classAttribute = facetName + "Class";
+ String columnHeaderClass = column.getAttribute(classAttribute);
+ nsIDOMElement td = visualDocument.createElement(element);
+ parentTr.appendChild(td);
+ String styleClass = encodeStyleClass(null, skinCellClass,
+ headerClass, columnHeaderClass);
+ td.setAttribute(HTML.ATTR_CLASS, styleClass);
+ td.setAttribute("scop", "col");
+ String colspan = column.getAttribute(HTML.ATTR_COLSPAN);
+ if (colspan != null && colspan.length() > 0) {
+ td.setAttribute(HTML.ATTR_COLSPAN, colspan);
+ }
+ Element facetBody = ComponentUtil.getFacet(column, facetName);
+
+ VpeChildrenInfo child = new VpeChildrenInfo(td);
+ child.addSourceChild(facetBody);
+ creationData.addChildrenInfo(child);
+ }
+ }
+
+ /**
+ *
+ * @param creationData
+ * @param parentTheadOrTfood
+ * @param columns
+ * @param visualDocument
+ * @param facetBody
+ * @param skinFirstRowClass
+ * @param skinRowClass
+ * @param skinCellClass
+ * @param facetBodyClass
+ * @param element
+ */
+ protected void encodeTableHeaderOrFooterFacet(VpeCreationData creationData,
+ nsIDOMElement parentTheadOrTfood, int columns,
+ nsIDOMDocument visualDocument, Element facetBody,
+ String skinFirstRowClass, String skinRowClass,
+ String skinCellClass, String facetBodyClass, String element) {
+ boolean isColumnGroup = facetBody.getNodeName()
+ .endsWith(":columnGroup");
+ boolean isSubTable = facetBody.getNodeName().endsWith(":subTable");
+ if (isColumnGroup) {
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(creationData,
+ facetBody, visualDocument, parentTheadOrTfood);
+ } else if (isSubTable) {
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData,
+ facetBody, visualDocument, parentTheadOrTfood);
+ } else {
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ parentTheadOrTfood.appendChild(tr);
+
+ String styleClass = encodeStyleClass(null, skinFirstRowClass,
+ facetBodyClass, null);
+ if (styleClass != null) {
+ tr.setAttribute(HTML.ATTR_CLASS, styleClass);
+ }
+ String style = ComponentUtil.getHeaderBackgoundImgStyle();
+ tr.setAttribute(HTML.ATTR_STYLE, style);
+
+ nsIDOMElement td = visualDocument.createElement(element);
+ tr.appendChild(td);
+
+ styleClass = encodeStyleClass(null, skinCellClass, facetBodyClass,
+ null);
+ if (styleClass != null) {
+ td.setAttribute(HTML.ATTR_CLASS, styleClass);
+ }
+
+ if (columns > 0) {
+ td.setAttribute(HTML.ATTR_COLSPAN, String.valueOf(columns));
+ }
+ td.setAttribute(HTML.ATTR_SCOPE, HTML.TAG_COLGROUP);
+
+ VpeChildrenInfo child = new VpeChildrenInfo(td);
+ child.addSourceChild(facetBody);
+ creationData.addChildrenInfo(child);
+ }
+ }
+
+ /**
+ *
+ * @param parentSourceElement
+ * @return list of columns
+ */
+ public static ArrayList<Element> getColumns(Element parentSourceElement) {
+ ArrayList<Element> columns = new ArrayList<Element>();
+ NodeList children = parentSourceElement.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if ((child instanceof Element)
+ && child.getNodeName().endsWith(":column")) {
+ columns.add((Element) child);
+ }
+ }
+ return columns;
+ }
+
+ /**
+ *
+ * @param columns
+ * @param facetName
+ * @return list of columns with facet
+ */
+ public static ArrayList<Element> getColumnsWithFacet(
+ ArrayList<Element> columns, String facetName) {
+ ArrayList<Element> columnsWithFacet = new ArrayList<Element>();
+ for (Element column : columns) {
+ Element body = ComponentUtil.getFacet(column, facetName);
+ if (body != null) {
+ columnsWithFacet.add(column);
+ }
+ }
+ return columnsWithFacet;
+ }
+
+ /**
+ *
+ * @param parentPredefined
+ * @param predefined
+ * @param parent
+ * @param custom
+ * @return
+ */
+ public static String encodeStyleClass(Object parentPredefined,
+ Object predefined, Object parent, Object custom) {
+ StringBuffer styleClass = new StringBuffer();
+ // Construct predefined classes
+ if (null != parentPredefined) {
+ styleClass.append(parentPredefined).append(SPACE);
+ } else if (null != predefined) {
+ styleClass.append(predefined).append(SPACE);
+ }
+ // Append class from parent component.
+ if (null != parent) {
+ styleClass.append(parent).append(SPACE);
+ }
+ if (null != custom) {
+ styleClass.append(custom);
+ }
+ if (styleClass.length() > 0) {
+ return styleClass.toString();
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param sourceElement
+ * @param columns
+ * @return
+ */
+ protected int getColumnsCount(Element sourceElement,
+ ArrayList<Element> columns) {
+ int count = 0;
+ // check for exact value in component
+ try {
+ int span = Integer.parseInt(sourceElement.getAttribute("columns"));
+ count = count > 0 ? span : calculateRowColumns(sourceElement,
+ columns);
+ } catch (NumberFormatException e) {
+ count = calculateRowColumns(sourceElement, columns);
+ }
+ return count;
+ }
+
+ /*
+ * Calculate max number of columns per row. For rows, recursive calculate
+ * max length.
+ */
+ private int calculateRowColumns(Element sourceElement,
+ ArrayList<Element> columns) {
+ int count = 0;
+ int currentLength = 0;
+ for (Element column : columns) {
+ if (ComponentUtil.isRendered(column)) {
+ if (column.getNodeName().endsWith(":columnGroup")) {
+ // Store max calculated value of previsous rows.
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ // Calculate number of columns in row.
+ currentLength = calculateRowColumns(sourceElement,
+ getColumns(column));
+ // Store max calculated value
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ currentLength = 0;
+ } else if (column.getNodeName().equals(
+ sourceElement.getPrefix() + ":column")) {
+ String breakBeforeStr = column.getAttribute("breakBefore");
+ // For new row, save length of previsous.
+ if (Boolean.getBoolean(breakBeforeStr)) {
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ currentLength = 0;
+ }
+ String colspanStr = column.getAttribute(HTML.ATTR_COLSPAN);
+ try {
+ int colspan = Integer.parseInt(colspanStr);
+ currentLength += colspan > 0 ? colspan : 1;
+ } catch (NumberFormatException e) {
+ currentLength++;
+ }
+ } else if (column.getNodeName().endsWith(":column")) {
+ // UIColumn always have colspan == 1.
+ currentLength++;
+ }
+
+ }
+ }
+ if (currentLength > count) {
+ count = currentLength;
+ }
+ return count;
+ }
+
+ /**
+ * Checks, whether it is necessary to re-create an element at change of
+ * attribute
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Attribute name
+ * @param value
+ * Attribute value
+ * @return <code>true</code> if it is required to re-create an element at a
+ * modification of attribute, <code>false</code> otherwise.
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-10-10 13:58:48 UTC (rev 10775)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-10-10 14:37:12 UTC (rev 10776)
@@ -358,6 +358,25 @@
</vpe:textFormatting>
<vpe:pseudoContent defaultText="yes"/>
</vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="rich:extendedDataTable" case-sensitive="yes">
+ <vpe:template children="yes" modify="no" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesExtendedDataTableTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="width" />
+ <vpe:height height-attr="height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes">
+ <vpe:container-child tag-name="column"/>
+ </vpe:drop>
+ </vpe:dnd>
+ <vpe:textFormatting use-default-formats="yes">
+ <vpe:format type="BlockFormat" addChildren="deny"/>
+ </vpe:textFormatting>
+ <vpe:pseudoContent defaultText="yes"/>
+ </vpe:template>
</vpe:tag>
<vpe:tag name="rich:orderingList" case-sensitive="yes">
16 years, 3 months
JBoss Tools SVN: r10775 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-10-10 09:58:48 -0400 (Fri, 10 Oct 2008)
New Revision: 10775
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2345
https://jira.jboss.org/jira/browse/JBIDE-2344
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-10-10 13:52:31 UTC (rev 10774)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2008-10-10 13:58:48 UTC (rev 10775)
@@ -109,6 +109,9 @@
}
public void widgetSelected(SelectionEvent e) {
+ consoleConfigurationName.setEnabled(selectMethod.getSelection());
+ connectionProfileName.setEnabled(!selectMethod.getSelection());
+ schemaName.setEnabled(!selectMethod.getSelection());
dialogChanged();
}});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -183,10 +186,7 @@
}
- protected void dialogChanged() {
- consoleConfigurationName.setEnabled(selectMethod.getSelection());
- connectionProfileName.setEnabled(!selectMethod.getSelection());
- schemaName.setEnabled(!selectMethod.getSelection());
+ protected void dialogChanged() {
if (selectMethod.getSelection() && (StringHelper.isEmpty(getConfigurationName()))){
setPageComplete(false);
16 years, 3 months
JBoss Tools SVN: r10774 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: resources/menuGroup and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-10-10 09:52:31 -0400 (Fri, 10 Oct 2008)
New Revision: 10774
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dropDownMenu/dropDownMenu.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/menuGroup.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/menuItem.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
Log:
JBIDE-2497, dropping down was implemented through css and html only, code style was reviewed.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dropDownMenu/dropDownMenu.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dropDownMenu/dropDownMenu.css 2008-10-10 13:52:12 UTC (rev 10773)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dropDownMenu/dropDownMenu.css 2008-10-10 13:52:31 UTC (rev 10774)
@@ -3,14 +3,12 @@
font-size:11px;
height:auto;
left:0pt;
- padding:2px 5px;
top:0pt;
white-space:nowrap;
width:auto;
}
.rich-ddmenu-label-unselect {
border:0pt solid transparent;
- padding:3px 6px;
}
.rich-ddmenu-label-select {
@@ -28,51 +26,34 @@
}
-.dr-menu-list-border {
- border : 1px solid #bfbfc0;
- background-color : #e7f2fb;
- float : left;
- position : absolute;
+[vpe-ddm-menu-ul] {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ width: 150px;
+ display: block;
}
-.dr-menu-list-bg {
- border-top : 1px solid #e7f2fb;
- border-left : 1px solid #e7f2fb;
- border-right : 1px solid #e7f2fb;
- background : url(menu_list_bg.gif) repeat-y left;
+[vpe-ddm-menu-li] {
+ position: relative;
+ height: 30px;
}
-.dr-menu-label {
- padding : 2px 5px 2px 5px;
- white-space : nowrap;
- position: relative;
- width : 75px;
- height : 18px;
+[vpe-ddm-menu-li] ul {
+ position: absolute;
+ left: 149px; /* Set 1px less than menu width */
+ top: 0;
+ display: none;
}
-.dr-menu-label-unselect {
- border : 1px solid transparent;
+[vpe-ddm-menu-li] div { /* ddm item/group div */
+
}
-.dr-menu-label-select {
- border : 1px solid #bfbfc0;
- cursor : pointer;
- background : #a9c5e7;
- color : #FFFFFF;
+[vpe-ddm-menu-li] div:hover {
+
}
-.dr-label-text-decor {
- font-weight : bold;
+[vpe-ddm-menu-ul]:hover {
+
}
-.underneath_iframe{
- position: absolute;
- z-index: 90;
- visibility:hidden;
- left:0px;
- top:0px;
- height:1px;
- width:1px;
+/*drop-down mechanism*/
+[vpe-ddm-menu-li]:hover > ul,
+[vpe-ddm-menu-li]:hover > li {
+ display: block;
}
-.dr-menu-list-border{
-border-color:#C4C0B9;background-color:#F1EEE9;}
-.dr-menu-list-bg{
-border-top-color:#F1EEE9;border-left-color:#F1EEE9;border-right-color:#F1EEE9;}
-.dr-menu-label{
-font-family:Arial, Verdana, sans-serif ;font-size:11px;}
-.dr-menu-label-select{
-border-color:#C4C0B9;background-color:#D4CFC7;color:#000000;}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/menuGroup.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/menuGroup.css 2008-10-10 13:52:12 UTC (rev 10773)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/menuGroup.css 2008-10-10 13:52:31 UTC (rev 10774)
@@ -4,7 +4,7 @@
font-size:11px;
}
.rich-menu-group-label {
-
+ padding-left: 10px; /*padding for group icon*/
}
.rich-menu-group-folder {
@@ -32,7 +32,7 @@
}
.rich-menu-item-icon-enabled {
border:0pt solid transparent;
- padding:2px 10px 2px 2px;
+ /*padding:2px 10px 2px 2px;*/
}
.rich-menu-item-icon-selected {
@@ -40,13 +40,13 @@
.rich-menu-list-border {
font-family:Arial,Verdana,sans-serif;
background-color:#F1EEE9;
- background-color:#F1EEE9;
border-color:#C4C0B9;
border:1px solid;
}
.rich-menu-list-bg {
background:transparent none repeat-y scroll left center;
background-image:url(list-bg.png);
+ background-color:#F1EEE9;
border-left-color:#C4C0B9;
border-right-color:#C4C0B9;
border-top-color:#C4C0B9;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/menuItem.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/menuItem.css 2008-10-10 13:52:12 UTC (rev 10773)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/menuItem.css 2008-10-10 13:52:31 UTC (rev 10774)
@@ -1,12 +1,14 @@
.rich-menu-item {
-
+ font-family:Arial,Verdana,sans-serif;
+ border-color:#C4C0B9;
+ border:1px solid;
}
.rich-menu-item-label {
-
+ /*padding-left: 10px;*/ /*padding for item icon*/
}
.rich-menu-item-icon {
+ padding:2px 10px 2px 2px;
border:0pt solid transparent;
- padding:2px 10px 2px 2px;
}
.rich-menu-item-disabled {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-10-10 13:52:12 UTC (rev 10773)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-10-10 13:52:31 UTC (rev 10774)
@@ -10,22 +10,18 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
-import java.util.ArrayList;
import java.util.List;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
-import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.mozilla.interfaces.nsIDOMNodeList;
import org.mozilla.interfaces.nsIDOMText;
-import org.mozilla.xpcom.XPCOMException;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -33,6 +29,12 @@
public class RichFacesDropDownMenuTemplate extends VpeAbstractTemplate {
/*
+ * Public constants for drop down mechanism.
+ */
+ public final static String MENU_PARENT_ID = "vpe-ddm-menu-ul"; //$NON-NLS-1$
+ public final static String MENU_CHILD_ID = "vpe-ddm-menu-li"; //$NON-NLS-1$
+
+ /*
* rich:dropDownMenu constants
*/
private final static String COMPONENT_NAME = "dropDownMenu"; //$NON-NLS-1$
@@ -51,9 +53,9 @@
private static final String CSS_RICH_LABEL_TEXT_DECOR = "rich-label-text-decor"; //$NON-NLS-1$
private static final String CSS_RICH_MENU_LIST_BORDER = "rich-menu-list-border"; //$NON-NLS-1$
private static final String CSS_RICH_MENU_LIST_BG = "rich-menu-list-bg"; //$NON-NLS-1$
- private static final String CSS_RICH_DDEMENU_LIST_DIV_STYLE = "position: relative; z-index: 100; display: table;"; //$NON-NLS-1$
- private static final String CSS_RICH_DDEMENU_BORDER_DIV_STYLE = "position: relative; z-index: 2; display: table;"; //$NON-NLS-1$
-
+ private static final String CSS_RICH_DDEMENU_LIST_DIV_STYLE = ""; //$NON-NLS-1$
+ private static final String CSS_RICH_DDEMENU_BORDER_DIV_STYLE = ""; //$NON-NLS-1$
+
/*
* rich:dropDownMenu attributes names
*/
@@ -97,27 +99,21 @@
private String ddm_style;
private String ddm_styleClass;
- private nsIDOMElement storedVisualMenu = null;
- private int ddmId = 1;
-
public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
VpeCreationData creationData = null;
Element sourceElement = (Element)sourceNode;
- Element srcNode = null;
-
- if ((sourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE) != null)
- && (sourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE) instanceof Element)) {
- srcNode = (Element) sourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE);
- }
ComponentUtil.setCSSLink(pageContext, STYLE_PATH, COMPONENT_NAME);
readDropDownMenuAttributes(sourceElement);
-
/*
* DropDownMenu component structure.
* In order of nesting.
*/
+ nsIDOMElement ddmMainUL;
+ nsIDOMElement ddmMainLI;
+ nsIDOMElement ddmChildrenUL;
+
nsIDOMElement ddmLabelDiv;
nsIDOMElement ddmTextSpan;
nsIDOMText ddmLabelText;
@@ -128,25 +124,42 @@
/*
* Creating visual elements
*/
- ddmLabelDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- ddmTextSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- ddmLabelText = visualDocument.createTextNode(""); //$NON-NLS-1$
- ddmListDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- ddmListBorderDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- ddmListBgDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- creationData = new VpeCreationData(ddmLabelDiv);
- storedVisualMenu = ddmLabelDiv;
+
+ ddmMainUL = visualDocument.createElement(HTML.TAG_UL);
+ ddmMainLI = visualDocument.createElement(HTML.TAG_LI);
+ ddmChildrenUL = visualDocument.createElement(HTML.TAG_UL);
+ ddmLabelDiv = visualDocument.createElement(HTML.TAG_DIV);
+ ddmTextSpan = visualDocument.createElement(HTML.TAG_SPAN);
+ ddmLabelText = visualDocument.createTextNode(EMPTY);
+ ddmListDiv = visualDocument.createElement(HTML.TAG_DIV);
+ ddmListBorderDiv = visualDocument.createElement(HTML.TAG_DIV);
+ ddmListBgDiv = visualDocument.createElement(HTML.TAG_DIV);
+ creationData = new VpeCreationData(ddmMainUL);
/*
* Nesting elements
*/
ddmLabelDiv.appendChild(ddmTextSpan);
ddmTextSpan.appendChild(ddmLabelText);
- ddmLabelDiv.appendChild(ddmListDiv);
+// ddmLabelDiv.appendChild(ddmListDiv);
ddmListDiv.appendChild(ddmListBorderDiv);
ddmListBorderDiv.appendChild(ddmListBgDiv);
+
+ ddmMainUL.appendChild(ddmMainLI);
+ ddmMainLI.appendChild(ddmLabelDiv);
+ /*
+ * Children <ul> will be added only if there are some of them.
+ */
+// ddmMainLI.appendChild(ddmChildrenUL);
/*
+ * Setting attributes for the drop-down mechanism
+ */
+ ddmMainUL.setAttribute(MENU_PARENT_ID, EMPTY);
+ ddmMainLI.setAttribute(MENU_CHILD_ID, EMPTY);
+ ddmChildrenUL.setAttribute(MENU_PARENT_ID, EMPTY);
+
+ /*
* Setting css classes
*/
String labelDivClass = EMPTY;
@@ -160,11 +173,12 @@
listBorderDivClass += SPACE + ddm_styleClass;
}
- ddmLabelDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, labelDivClass);
- ddmTextSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_RICH_LABEL_TEXT_DECOR);
- ddmListBorderDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, listBorderDivClass);
- ddmListBgDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_RICH_MENU_LIST_BG);
-
+// ddmLabelDiv.setAttribute(HTML.CLASS_ATTR, labelDivClass);
+ ddmMainLI.setAttribute(HTML.ATTR_CLASS, labelDivClass);
+ ddmTextSpan.setAttribute(HTML.ATTR_CLASS, CSS_RICH_LABEL_TEXT_DECOR);
+// ddmListBorderDiv.setAttribute(HTML.ATTR_CLASS, listBorderDivClass);
+// ddmListBgDiv.setAttribute(HTML.ATTR_CLASS, CSS_RICH_MENU_LIST_BG);
+ ddmChildrenUL.setAttribute(HTML.ATTR_CLASS, listBorderDivClass + SPACE + CSS_RICH_MENU_LIST_BG);
/*
* Setting css styles
*/
@@ -179,107 +193,50 @@
cssLabelDivStyle += SPACE + ddm_style;
}
- ddmListDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, cssListDivStyle);
- ddmListBorderDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, cssListBorderDivStyle);
- ddmLabelDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, cssLabelDivStyle);
-
+// ddmListDiv.setAttribute(HTML.STYLE_ATTR, cssListDivStyle);
+// ddmListBorderDiv.setAttribute(HTML.STYLE_ATTR, cssListBorderDivStyle);
+// ddmLabelDiv.setAttribute(HTML.STYLE_ATTR, cssLabelDivStyle);
+ ddmMainLI.setAttribute(HTML.ATTR_STYLE, cssListDivStyle + SPACE + cssListBorderDivStyle + SPACE + cssLabelDivStyle);
+ ddmChildrenUL.setAttribute(HTML.ATTR_STYLE, cssListDivStyle + SPACE + cssListBorderDivStyle + SPACE + cssLabelDivStyle);
/*
* Encoding label value
*/
- final Element passedElement = (srcNode != null ? srcNode : sourceElement);
- final Element labelFacet = ComponentUtil.getFacet(passedElement, LABEL_FACET_NAME);
+ Element labelFacet = ComponentUtil.getFacet(sourceElement, LABEL_FACET_NAME);
if (null != labelFacet) {
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(ddmTextSpan);
childrenInfo.addSourceChild(labelFacet);
creationData.addChildrenInfo(childrenInfo);
} else {
- Attr valueAttr = sourceElement.getAttributeNode(HtmlComponentUtil.HTML_VALUE_ATTR);
+ Attr valueAttr = sourceElement.getAttributeNode(HTML.ATTR_VALUE);
String labelValue = valueAttr != null && valueAttr.getValue() != null
? valueAttr.getValue()
: EMPTY;
ddmLabelText.setNodeValue(labelValue);
}
-
/*
* Adding child nodes
*/
- List<Node> children = ComponentUtil.getChildren(passedElement);
- int groupCount = 1;
- for (Node child : children) {
- if (child.getNodeType() == Node.ELEMENT_NODE
- && child.getNodeName().endsWith(":menuGroup")) { //$NON-NLS-1$
- child.setUserData(RichFacesMenuGroupTemplate.MENU_GROUP_ID,
- String.valueOf(groupCount), null);
- groupCount++;
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+ if (children.size() > 0) {
+ /*
+ * Add children <ul> and children in it.
+ */
+ ddmMainLI.appendChild(ddmChildrenUL);
+ for (Node child : children) {
+// nsIDOMElement childDiv = visualDocument
+// .createElement(HTML.TAG_DIV);
+// ddmListBgDiv.appendChild(childDiv);
+ VpeChildrenInfo childDivInfo = new VpeChildrenInfo(ddmChildrenUL);
+ childDivInfo.addSourceChild(child);
+ creationData.addChildrenInfo(childDivInfo);
}
- nsIDOMElement childDiv = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- ddmListBgDiv.appendChild(childDiv);
- VpeChildrenInfo childDivInfo = new VpeChildrenInfo(childDiv);
- childDivInfo.addSourceChild(child);
- creationData.addChildrenInfo(childDivInfo);
- }
+ }
return creationData;
}
-
- @Override
- public void validate(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument, VpeCreationData data) {
- super.validate(pageContext, sourceNode, visualDocument, data);
- List<nsIDOMElement> children = getChildren(storedVisualMenu);
-// storedVisualMenu.setAttribute(VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_ID, String.valueOf(ddmId));
-// applyAttributeValueOnChildren(VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_ID, String.valueOf(ddmId), children);
-// applyAttributeValueOnChildren(
-// VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_LOOKUP_PARENT,
-// "true", children); //$NON-NLS-1$
- }
-
/**
- * Sets the attribute to element children
- * @param attrName attribute name
- * @param attrValue attribute value
- * @param children children
- */
- private void applyAttributeValueOnChildren(String attrName, String attrValue, List<nsIDOMElement> children) {
- if (children == null || attrName == null || attrValue == null) {
- return;
- }
- for (nsIDOMElement child : children) {
- child.setAttribute(attrName, attrValue);
- applyAttributeValueOnChildren(attrName, attrValue, getChildren(child));
- }
- }
-
- /**
- * Gets element children
- * @param element the element
- * @return children
- */
- private List<nsIDOMElement> getChildren(nsIDOMElement element) {
- List<nsIDOMElement> result = new ArrayList<nsIDOMElement>();
- if (element.hasChildNodes()) {
- nsIDOMNodeList children = element.getChildNodes();
- if (null != children) {
- long len = children.getLength();
- for (int i = 0; i < len; i++) {
- nsIDOMNode item = children.item(i);
- try {
- nsIDOMElement elem = (nsIDOMElement) item
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- result.add(elem);
- } catch (XPCOMException ex) {
- // just ignore this exception
- }
- }
- }
- }
- return result;
- }
-
- /**
* Read attributes from the source element.
*
* @param sourceNode the source node
@@ -290,7 +247,7 @@
}
ddm_direction = sourceElement.getAttribute(DIRECTION);
- ddm_disabled = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATTR_DISABLED);
+ ddm_disabled = sourceElement.getAttribute(HTML.ATTR_DISABLED);
ddm_horizontalOffset = sourceElement.getAttribute(HORIZONTAL_OFFCET);
ddm_jointPoint = sourceElement.getAttribute(JOINT_POINT);
ddm_popupWidth = sourceElement.getAttribute(POPUP_WIDTH);
@@ -303,8 +260,8 @@
ddm_itemStyle = sourceElement.getAttribute(ITEM_STYLE);
ddm_selectedLabelClass = sourceElement.getAttribute(SELECED_LABEL_CLASS);
ddm_selectItemClass = sourceElement.getAttribute(SELECT_ITEM_CLASS);
- ddm_style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
- ddm_styleClass = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+ ddm_style = sourceElement.getAttribute(HTML.ATTR_STYLE);
+ ddm_styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
}
/**
@@ -317,16 +274,11 @@
private static boolean attrPresents(String attr) {
return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
}
-
- public void onMouseOver(VpeVisualDomBuilder visualDomBuilder, Node sourceNode, String mouseOverId) {
- // TODO Auto-generated method stub
-// visualDomBuilder.updateNode(sourceNode);
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
}
-
- public void stopMouseOver(Node sourceNode) {
- // TODO Auto-generated method stub
-
- }
-
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-10-10 13:52:12 UTC (rev 10773)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-10-10 13:52:31 UTC (rev 10774)
@@ -13,12 +13,12 @@
import java.util.List;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
-import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -59,8 +59,8 @@
private static final String CSS_RICH_MENU_ITEM_ICON_SELECTED = "rich-menu-item-icon-selected"; //$NON-NLS-1$
private static final String CSS_RICH_MENU_LIST_BORDER = "rich-menu-list-border"; //$NON-NLS-1$
private static final String CSS_RICH_MENU_LIST_BG = "rich-menu-list-bg"; //$NON-NLS-1$
- private static final String CSS_RICH_LIST_FOLDER_DIV_STYLE = "position: relative; z-index: 100; display: table;"; //$NON-NLS-1$
- private static final String CSS_RICH_LIST_BORDER_DIV_STYLE = "position: relative; z-index: 2; display: table;"; //$NON-NLS-1$
+ private static final String CSS_RICH_LIST_FOLDER_DIV_STYLE = ""; //$NON-NLS-1$
+ private static final String CSS_RICH_LIST_BORDER_DIV_STYLE = ""; //$NON-NLS-1$
/*
* rich:menuGroup attributes names
@@ -113,6 +113,11 @@
* MenuGroup component structure.
* In order of nesting.
*/
+ nsIDOMElement ddmMainUL;
+ nsIDOMElement grMainLI;
+ nsIDOMElement grChildrenUL;
+ nsIDOMElement ddmChildrenLI;
+
nsIDOMElement grTopDiv;
nsIDOMElement grImgSpan;
nsIDOMElement grImg;
@@ -125,15 +130,17 @@
/*
* Creating visual elements
*/
- grTopDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- grImgSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- grImg = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
- grLabelSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ grMainLI = visualDocument.createElement(HTML.TAG_LI);
+ grChildrenUL = visualDocument.createElement(HTML.TAG_UL);
+ grTopDiv = visualDocument.createElement(HTML.TAG_DIV);
+ grImgSpan = visualDocument.createElement(HTML.TAG_SPAN);
+ grImg = visualDocument.createElement(HTML.TAG_IMG);
+ grLabelSpan = visualDocument.createElement(HTML.TAG_SPAN);
grLabelText = visualDocument.createTextNode(EMPTY);
- grFolderDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- grListBorderDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- grListBgDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- creationData = new VpeCreationData(grTopDiv);
+ grFolderDiv = visualDocument.createElement(HTML.TAG_DIV);
+ grListBorderDiv = visualDocument.createElement(HTML.TAG_DIV);
+ grListBgDiv = visualDocument.createElement(HTML.TAG_DIV);
+ creationData = new VpeCreationData(grMainLI);
/*
* Nesting elements
@@ -141,14 +148,24 @@
grTopDiv.appendChild(grImgSpan);
grTopDiv.appendChild(grLabelSpan);
grLabelSpan.appendChild(grLabelText);
- grTopDiv.appendChild(grFolderDiv);
- grFolderDiv.appendChild(grListBorderDiv);
- grListBorderDiv.appendChild(grListBgDiv);
+// grTopDiv.appendChild(grFolderDiv);
+// grFolderDiv.appendChild(grListBorderDiv);
+// grListBorderDiv.appendChild(grListBgDiv);
+ grMainLI.appendChild(grTopDiv);
+ /*
+ * Children <ul> will be added only if there are some of them.
+ */
+// grMainLI.appendChild(grChildrenUL);
/*
+ * Setting attributes for the drop-down mechanism
+ */
+ grMainLI.setAttribute(RichFacesDropDownMenuTemplate.MENU_CHILD_ID, EMPTY);
+ grChildrenUL.setAttribute(RichFacesDropDownMenuTemplate.MENU_PARENT_ID, EMPTY);
+
+ /*
* Setting css classes
*/
-
String topDivClass = EMPTY;
String imgSpanClass = EMPTY;
String labelSpanClass = EMPTY;
@@ -170,13 +187,14 @@
labelSpanClass += SPACE + mg_labelClass;
}
- grTopDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, topDivClass);
- grImgSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, imgSpanClass);
- grLabelSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, labelSpanClass);
- grFolderDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, folderDivClass);
- grListBorderDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_RICH_MENU_LIST_BORDER);
- grListBgDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_RICH_MENU_LIST_BG);
-
+// grTopDiv.setAttribute(HTML.CLASS_ATTR, topDivClass);
+ grMainLI.setAttribute(HTML.ATTR_CLASS, topDivClass);
+ grImgSpan.setAttribute(HTML.ATTR_CLASS, imgSpanClass);
+ grLabelSpan.setAttribute(HTML.ATTR_CLASS, labelSpanClass);
+// grFolderDiv.setAttribute(HTML.ATTR_CLASS, folderDivClass);
+// grListBorderDiv.setAttribute(HTML.ATTR_CLASS, CSS_RICH_MENU_LIST_BORDER);
+// grListBgDiv.setAttribute(HTML.ATTR_CLASS, CSS_RICH_MENU_LIST_BG);
+ grChildrenUL.setAttribute(HTML.ATTR_CLASS, folderDivClass + SPACE + CSS_RICH_MENU_LIST_BORDER + SPACE + CSS_RICH_MENU_LIST_BG);
/*
* Setting css styles
*/
@@ -186,14 +204,16 @@
topDivStyle += SPACE + mg_style;
}
- grTopDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, topDivStyle);
- grFolderDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, CSS_RICH_LIST_FOLDER_DIV_STYLE);
- grListBorderDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, CSS_RICH_LIST_BORDER_DIV_STYLE);
+// grTopDiv.setAttribute(HTML.STYLE_ATTR, topDivStyle);
+ grMainLI.setAttribute(HTML.ATTR_STYLE, topDivStyle);
+// grFolderDiv.setAttribute(HTML.ATTR_STYLE, CSS_RICH_LIST_FOLDER_DIV_STYLE);
+// grListBorderDiv.setAttribute(HTML.ATTR_STYLE, CSS_RICH_LIST_BORDER_DIV_STYLE);
+ grChildrenUL.setAttribute(HTML.ATTR_STYLE, CSS_RICH_LIST_FOLDER_DIV_STYLE + SPACE + CSS_RICH_LIST_BORDER_DIV_STYLE);
/*
* Encode label value
*/
- Attr valueAttr = sourceElement.getAttributeNode(HtmlComponentUtil.HTML_VALUE_ATTR);
+ Attr valueAttr = sourceElement.getAttributeNode(HTML.ATTR_VALUE);
String labelValue = valueAttr != null
&& valueAttr.getValue() != null ? valueAttr.getValue() : EMPTY;
grLabelText.setNodeValue(labelValue);
@@ -202,7 +222,7 @@
* Encode icon facets
*/
Element iconFacet = ComponentUtil.getFacet(sourceElement, ICON_FACET_NAME);
- Element iconDisabledFacet = ComponentUtil.getFacet(sourceElement, ICON_DISABLED_FACET_NAME);
+// Element iconDisabledFacet = ComponentUtil.getFacet(sourceElement, ICON_DISABLED_FACET_NAME);
if (null != iconFacet) {
VpeChildrenInfo childInfo = new VpeChildrenInfo(grImgSpan);
childInfo.addSourceChild(iconFacet);
@@ -214,7 +234,7 @@
* Add path to specified image
*/
String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(iconPath, pageContext, true);
- grImg.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, imgFullPath);
+ grImg.setAttribute(HTML.ATTR_SRC, imgFullPath);
} else {
/*
* Create spacer image
@@ -228,20 +248,27 @@
}
- String menuGroupId = (String) sourceNode.getUserData(MENU_GROUP_ID);
+// String menuGroupId = (String) sourceNode.getUserData(MENU_GROUP_ID);
/*
* Adding child nodes
*/
List<Node> children = ComponentUtil.getChildren(sourceElement);
- for (Node child : children) {
- nsIDOMElement childDiv = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- grListBgDiv.appendChild(childDiv);
- VpeChildrenInfo childDivInfo = new VpeChildrenInfo(childDiv);
- childDivInfo.addSourceChild(child);
- creationData.addChildrenInfo(childDivInfo);
+ if (children.size() > 0) {
+ /*
+ * Add children <ul> and children in it.
+ */
+ grMainLI.appendChild(grChildrenUL);
+ for (Node child : children) {
+// nsIDOMElement childDiv = visualDocument
+// .createElement(HTML.TAG_DIV);
+// grListBgDiv.appendChild(childDiv);
+// VpeChildrenInfo childDivInfo = new VpeChildrenInfo(childDiv);
+ VpeChildrenInfo childDivInfo = new VpeChildrenInfo(grChildrenUL);
+ childDivInfo.addSourceChild(child);
+ creationData.addChildrenInfo(childDivInfo);
+ }
}
-
+
return creationData;
}
@@ -255,20 +282,20 @@
return;
}
mg_direction = sourceElement.getAttribute(DIRECTION);
- mg_disabled = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATTR_DISABLED);
+ mg_disabled = sourceElement.getAttribute(HTML.ATTR_DISABLED);
mg_icon = sourceElement.getAttribute(ICON);
mg_iconDisabled = sourceElement.getAttribute(ICON_DISABLED);
mg_iconFolder = sourceElement.getAttribute(ICON_FOLDER);
mg_iconFolderDisabled = sourceElement.getAttribute(ICON_FOLDER_DISABLED);
- mg_value = sourceElement.getAttribute(HtmlComponentUtil.HTML_VALUE_ATTR);
+ mg_value = sourceElement.getAttribute(HTML.ATTR_VALUE);
mg_iconClass = sourceElement.getAttribute(ICON_CLASS);
mg_iconStyle = sourceElement.getAttribute(ICON_STYLE);
mg_labelClass = sourceElement.getAttribute(LABEL_CLASS);
mg_selectClass = sourceElement.getAttribute(SELECT_CLASS);
mg_selectStyle = sourceElement.getAttribute(SELECT_STYLE);
- mg_style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
- mg_styleClass = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+ mg_style = sourceElement.getAttribute(HTML.ATTR_STYLE);
+ mg_styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
}
/**
* Checks is attribute have some value.
@@ -287,15 +314,5 @@
nsIDOMElement visualNode, Object data, String name, String value) {
return true;
}
-
- public void onMouseOver(VpeVisualDomBuilder visualDomBuilder, Node sourceNode, String mouseOverId) {
- // TODO Auto-generated method stub
-// visualDomBuilder.updateNode(sourceNode);
- }
-
- public void stopMouseOver(Node sourceNode) {
- // TODO Auto-generated method stub
-
- }
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-10-10 13:52:12 UTC (rev 10773)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-10-10 13:52:31 UTC (rev 10774)
@@ -13,12 +13,12 @@
import java.util.List;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
-import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -101,6 +101,8 @@
* MenuItem component structure.
* In order of nesting.
*/
+ nsIDOMElement itemMainLI;
+
nsIDOMElement itemTopDiv;
nsIDOMElement itemIconImgSpan;
nsIDOMElement itemIconImg;
@@ -110,12 +112,13 @@
/*
* Creating visual elements
*/
- itemTopDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- itemIconImgSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- itemIconImg = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
- itemLabelSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
- itemLabelText = visualDocument.createTextNode(""); //$NON-NLS-1$
- creationData = new VpeCreationData(itemTopDiv);
+ itemMainLI = visualDocument.createElement(HTML.TAG_LI);
+ itemTopDiv = visualDocument.createElement(HTML.TAG_DIV);
+ itemIconImgSpan = visualDocument.createElement(HTML.TAG_SPAN);
+ itemIconImg = visualDocument.createElement(HTML.TAG_IMG);
+ itemLabelSpan = visualDocument.createElement(HTML.TAG_SPAN);
+ itemLabelText = visualDocument.createTextNode(EMPTY);
+ creationData = new VpeCreationData(itemMainLI);
/*
* Nesting elements
@@ -123,8 +126,14 @@
itemTopDiv.appendChild(itemIconImgSpan);
itemTopDiv.appendChild(itemLabelSpan);
itemLabelSpan.appendChild(itemLabelText);
+ itemMainLI.appendChild(itemTopDiv);
/*
+ * Setting attributes for the drop-down mechanism
+ */
+ itemMainLI.setAttribute(RichFacesDropDownMenuTemplate.MENU_CHILD_ID, EMPTY);
+
+ /*
* Setting css classes
*/
String topDivClass = EMPTY;
@@ -145,9 +154,11 @@
labelSpanClass += SPACE + mi_labelClass;
}
- itemTopDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, topDivClass);
- itemIconImgSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, iconImgSpanClass);
- itemLabelSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, labelSpanClass);
+// itemTopDiv.setAttribute(HTML.ATTR_CLASS, topDivClass);
+ itemMainLI.setAttribute(HTML.ATTR_CLASS, topDivClass);
+ itemIconImgSpan.setAttribute(HTML.ATTR_CLASS, iconImgSpanClass);
+ itemLabelSpan.setAttribute(HTML.ATTR_CLASS, labelSpanClass);
+
/*
* Setting css styles
@@ -158,21 +169,22 @@
topDivStyle += SPACE + mi_style;
}
- itemTopDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, topDivStyle);
+// itemTopDiv.setAttribute(HTML.ATTR_STYLE, topDivStyle);
+ itemMainLI.setAttribute(HTML.ATTR_STYLE, topDivStyle);
/*
* Encode label and icon value
*/
- Attr valueAttr = sourceElement.getAttributeNode(HtmlComponentUtil.HTML_VALUE_ATTR);
+ Attr valueAttr = sourceElement.getAttributeNode(HTML.ATTR_VALUE);
String labelValue = valueAttr != null
- && valueAttr.getValue() != null ? valueAttr.getValue() : ""; //$NON-NLS-1$
+ && valueAttr.getValue() != null ? valueAttr.getValue() : EMPTY;
itemLabelText.setNodeValue(labelValue);
/*
* Encode icon facets
*/
Element iconFacet = ComponentUtil.getFacet(sourceElement, ICON_FACET_NAME);
- Element iconDisabledFacet = ComponentUtil.getFacet(sourceElement, ICON_DISABLED_FACET_NAME);
+// Element iconDisabledFacet = ComponentUtil.getFacet(sourceElement, ICON_DISABLED_FACET_NAME);
if (null != iconFacet) {
VpeChildrenInfo childInfo = new VpeChildrenInfo(itemIconImgSpan);
childInfo.addSourceChild(iconFacet);
@@ -184,7 +196,7 @@
* Add path to specified image
*/
String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(iconPath, pageContext, true);
- itemIconImg.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, imgFullPath);
+ itemIconImg.setAttribute(HTML.ATTR_SRC, imgFullPath);
} else {
/*
* Create spacer image
@@ -221,9 +233,9 @@
if (null == sourceElement) {
return;
}
- mi_disabled = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATTR_DISABLED);
+ mi_disabled = sourceElement.getAttribute(HTML.ATTR_DISABLED);
mi_icon = sourceElement.getAttribute(ICON);
- mi_value = sourceElement.getAttribute(HtmlComponentUtil.HTML_VALUE_ATTR);
+ mi_value = sourceElement.getAttribute(HTML.ATTR_VALUE);
mi_iconClass = sourceElement.getAttribute(ICON_CLASS);
mi_iconDisabled = sourceElement.getAttribute(ICON_DISABLED);
@@ -231,8 +243,8 @@
mi_labelClass = sourceElement.getAttribute(LABEL_CLASS);
mi_selectClass = sourceElement.getAttribute(SELECT_CLASS);
mi_selectStyle = sourceElement.getAttribute(SELECT_STYLE);
- mi_style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
- mi_styleClass = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+ mi_style = sourceElement.getAttribute(HTML.ATTR_STYLE);
+ mi_styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
}
/**
@@ -252,14 +264,5 @@
nsIDOMElement visualNode, Object data, String name, String value) {
return true;
}
-
- public void onMouseOver(VpeVisualDomBuilder visualDomBuilder, Node sourceNode, String mouseOverId) {
- // TODO Auto-generated method stub
-// visualDomBuilder.updateNode(sourceNode);
- }
- public void stopMouseOver(Node sourceNode) {
- // TODO Auto-generated method stub
-
- }
}
16 years, 3 months