JBoss Tools SVN: r11913 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-20 11:20:12 -0500 (Thu, 20 Nov 2008)
New Revision: 11913
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesConfigLoader.java
Log:
JBIDE-3085
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesConfigLoader.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesConfigLoader.java 2008-11-20 16:18:37 UTC (rev 11912)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesConfigLoader.java 2008-11-20 16:20:12 UTC (rev 11913)
@@ -25,12 +25,17 @@
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jst.web.model.*;
-public class FacesConfigLoader implements WebProcessLoader, JSFConstants {
+public class FacesConfigLoader extends AbstractWebDiagramLoader implements WebProcessLoader, JSFConstants {
public static String AUXILIARY_FILE_EXTENSION = "jsfdia";
- private FileAuxiliary aux = new FileAuxiliary(AUXILIARY_FILE_EXTENSION, false);
- XModelObjectLoaderUtil util = new SFUtil();
- boolean isLight = false;
+ protected FileAuxiliary createFileAuxiliary() {
+ return new FileAuxiliary(AUXILIARY_FILE_EXTENSION, false);
+ }
+
+ protected XModelObjectLoaderUtil createUtil() {
+ return new SFUtil();
+ }
+
public void load(XModelObject object) {
// String entity = object.getModelEntity().getName();
@@ -58,7 +63,6 @@
}
Element element = doc.getDocumentElement();
util.load(element, object);
- String loadingError = util.getError();
((FileFacesConfigImpl)object).updateRuleIndices();
@@ -76,9 +80,10 @@
}
}
}
+ String loadingError = util.getError();
reloadProcess(object);
+
object.set("actualBodyTimeStamp", "" + object.getTimeStamp());
-
((AbstractXMLFileImpl)object).setLoaderError(loadingError);
if(!hasErrors && loadingError != null) {
object.setAttributeValue("isIncorrect", "yes");
@@ -87,12 +92,6 @@
}
}
- protected void setEncoding(XModelObject object, String body) {
- String encoding = XModelObjectLoaderUtil.getEncoding(body);
- if(encoding == null) encoding = "";
- object.setAttributeValue(XModelObjectConstants.ATTR_NAME_ENCODING, encoding);
- }
-
public void reloadProcess(XModelObject object) {
FacesProcessImpl process = (FacesProcessImpl)object.getChildByPath(ELM_PROCESS);
if(process == null) return;
@@ -111,36 +110,7 @@
process.firePrepared();
}
- public boolean update(XModelObject object) throws XModelException {
- XModelObject p = object.getParent();
- if (p == null) return true;
- FolderLoader fl = (FolderLoader)p;
- String body = fl.getBodySource(FileAnyImpl.toFileName(object)).get();
- AbstractExtendedXMLFileImpl f = (AbstractExtendedXMLFileImpl)object;
- f.setUpdateLock();
- try {
- f.edit(body, true);
- } finally {
- f.releaseUpdateLock();
- }
- object.setModified(false);
- XModelObjectLoaderUtil.updateModifiedOnSave(object);
- return true;
- }
-
- public boolean save(XModelObject object) {
- if (!object.isModified()) return true;
- FileAnyImpl file = (FileAnyImpl)object;
- String text = file.getAsText();
- XModelObjectLoaderUtil.setTempBody(object, text);
- if("yes".equals(object.get("isIncorrect"))) {
- return true;
- }
- return saveLayout(object);
- }
-
public boolean saveLayout(XModelObject object) {
- if(isLight) return true;
if(object == null || !object.isActive()) return false;
XModelObjectLoaderUtil util = new XModelObjectLoaderUtil();
try {
@@ -194,18 +164,6 @@
}
}
- public String mainObjectToString(XModelObject object) {
- return "" + serializeMainObject(object);
- }
-
- public String serializeObject(XModelObject object) {
- return serializeMainObject(object);
- }
-
- public void loadFragment(XModelObject object, Element element) {
- util.load(element, object);
- }
-
}
class SFUtil extends XModelObjectLoaderUtil {
17 years, 5 months
JBoss Tools SVN: r11912 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-20 11:18:37 -0500 (Thu, 20 Nov 2008)
New Revision: 11912
Added:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/AbstractWebDiagramLoader.java
Log:
JBIDE-3085
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/AbstractWebDiagramLoader.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/AbstractWebDiagramLoader.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/AbstractWebDiagramLoader.java 2008-11-20 16:18:37 UTC (rev 11912)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.model;
+
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.XModelObjectConstants;
+import org.jboss.tools.common.model.filesystems.FileAuxiliary;
+import org.jboss.tools.common.model.filesystems.impl.AbstractExtendedXMLFileImpl;
+import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
+import org.jboss.tools.common.model.filesystems.impl.FolderLoader;
+import org.jboss.tools.common.model.loaders.AuxiliaryLoader;
+import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+import org.w3c.dom.Element;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public abstract class AbstractWebDiagramLoader implements WebProcessLoader, AuxiliaryLoader {
+ protected FileAuxiliary aux = createFileAuxiliary();
+ protected XModelObjectLoaderUtil util = createUtil();
+
+ public AbstractWebDiagramLoader() {
+
+ }
+
+ abstract protected FileAuxiliary createFileAuxiliary();
+
+ abstract protected XModelObjectLoaderUtil createUtil();
+
+ abstract public String serializeMainObject(XModelObject object);
+
+ protected void setEncoding(XModelObject object, String body) {
+ String encoding = XModelObjectLoaderUtil.getEncoding(body);
+ if(encoding == null) encoding = "";
+ object.setAttributeValue(XModelObjectConstants.ATTR_NAME_ENCODING, encoding);
+ }
+
+ public boolean update(XModelObject object) throws XModelException {
+ XModelObject p = object.getParent();
+ if (p == null) return true;
+ FolderLoader fl = (FolderLoader)p;
+ String body = fl.getBodySource(FileAnyImpl.toFileName(object)).get();
+// String encoding = XModelObjectLoaderUtil.getEncoding(body);
+// body = FileUtil.encode(body, encoding);
+ AbstractExtendedXMLFileImpl f = (AbstractExtendedXMLFileImpl)object;
+ f.setUpdateLock();
+ try {
+ f.edit(body, true);
+ } finally {
+ f.releaseUpdateLock();
+ }
+ object.setModified(false);
+ XModelObjectLoaderUtil.updateModifiedOnSave(object);
+ return true;
+ }
+
+ public boolean save(XModelObject object) {
+ if (!object.isModified()) return true;
+ FileAnyImpl file = (FileAnyImpl)object;
+ String text = file.getAsText();
+ XModelObjectLoaderUtil.setTempBody(object, text);
+ if("yes".equals(object.get("isIncorrect"))) {
+ return true;
+ }
+ return saveLayout(object);
+ }
+
+ abstract protected boolean saveLayout(XModelObject object);
+
+ public void bind(XModelObject main) {
+ aux.getAuxiliaryFile(main.getParent(), main, false);
+ }
+
+ public String mainObjectToString(XModelObject object) {
+ return "" + serializeMainObject(object);
+ }
+
+ public String serializeObject(XModelObject object) {
+ return serializeMainObject(object);
+ }
+
+ public void loadFragment(XModelObject object, Element element) {
+ util.load(element, object);
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r11911 - trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-20 11:14:02 -0500 (Thu, 20 Nov 2008)
New Revision: 11911
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
Log:
JBIDE-3238
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2008-11-20 16:03:02 UTC (rev 11910)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2008-11-20 16:14:02 UTC (rev 11911)
@@ -274,7 +274,7 @@
</XModelAttribute>
</XModelAttributes>
<XActionItem kind="list">
- <XActionItem kind="list" name="CreateActions">
+ <XActionItem displayName="New" group="1" kind="list" name="CreateActions">
<XActionItemReference entity="ESBAction101" name="AddProperty" path="CreateActions/AddProperty"/>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
17 years, 5 months
JBoss Tools SVN: r11910 - trunk/common/plugins/org.jboss.tools.common.model/resources/help.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-20 11:03:02 -0500 (Thu, 20 Nov 2008)
New Revision: 11910
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model-lists.properties
trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model-menu.properties
Log:
Test values removed
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model-lists.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model-lists.properties 2008-11-20 14:26:47 UTC (rev 11909)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model-lists.properties 2008-11-20 16:03:02 UTC (rev 11910)
@@ -1,6 +1,6 @@
#Global values
-lists.true=tru1e
-lists.false=fals1e
+lists.true=true
+lists.false=false
lists.yes=yes
lists.no=no
lists.default_true_=default(true)
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model-menu.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model-menu.properties 2008-11-20 14:26:47 UTC (rev 11909)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model-menu.properties 2008-11-20 16:03:02 UTC (rev 11910)
@@ -3,7 +3,7 @@
Edit.menu=Edit
Rename.menu=Rename
RenameEclipse.menu=Rename
-Copy.menu=Copy 2
+Copy.menu=Copy
Cut.menu=Cut
Paste.menu=Paste
Delete.menu=Delete
17 years, 5 months
JBoss Tools SVN: r11909 - trunk/seam/tests/org.jboss.tools.seam.core.test/projects.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-20 09:26:47 -0500 (Thu, 20 Nov 2008)
New Revision: 11909
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/template.txt
Log:
Template for SeamBigProjectTest.testBigProject
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/template.txt
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/template.txt 2008-11-20 14:21:25 UTC (rev 11908)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/template.txt 2008-11-20 14:26:47 UTC (rev 11909)
@@ -40,4 +40,8 @@
this.%t% = t;
}
+ public %T% getValue() {
+ return this;
+ }
+
}
17 years, 5 months
JBoss Tools SVN: r11908 - trunk/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-11-20 09:21:25 -0500 (Thu, 20 Nov 2008)
New Revision: 11908
Modified:
trunk/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java
Log:
https://jira.jboss.org/jira/browse/JBDS-371
Modified: trunk/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java 2008-11-20 14:20:25 UTC (rev 11907)
+++ trunk/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java 2008-11-20 14:21:25 UTC (rev 11908)
@@ -121,7 +121,7 @@
}
JstFirstRunPlugin.getDefault().getPreferenceStore().setValue(FIRST_START_PREFERENCE_NAME, false);
String pluginLocation = FileLocator.resolve(JstFirstRunPlugin.getDefault().getBundle().getEntry("/")).getPath();
- File serversFile = new File(pluginLocation, SERVERS_FILE);
+ File serversFile = new File(pluginLocation, SERVERS_FILE).getCanonicalFile();
if(serversFile.exists()){
String str = FileUtil.readFile(serversFile);
int position = 0;
@@ -187,7 +187,7 @@
String jbossASLocation = null;
- File jbossASDir = new File(pluginLocation, JBOSS_AS_HOME);
+ File jbossASDir = new File(pluginLocation, JBOSS_AS_HOME).getCanonicalFile();
if (jbossASDir.isDirectory()) {
jbossASLocation = jbossASDir.getAbsolutePath();
} else {
@@ -332,6 +332,15 @@
// Don't create the driver a few times
return;
}
+ String driverPath;
+ try {
+ driverPath = new File(jbossASLocation + "/server/default/lib/hsqldb.jar").getCanonicalPath();
+ } catch (IOException e) {
+ JstFirstRunPlugin.getPluginLog().log(new Status(IStatus.ERROR,
+ JstFirstRunPlugin.PLUGIN_ID, "Can't create new HSQL DB Driver.", e));
+ return;
+ }
+
DriverInstance driver = DriverManager.getInstance().getDriverInstanceByName(HSQL_DRIVER_NAME);
if (driver == null) {
TemplateDescriptor descr = TemplateDescriptor.getDriverTemplateDescriptor(HSQL_DRIVER_TEMPLATE_ID);
@@ -350,7 +359,7 @@
}
props.setProperty(DTP_DB_URL_PROPERTY_ID, "jdbc:hsqldb:.");
props.setProperty(IDriverMgmtConstants.PROP_DEFN_TYPE, descr.getId());
- props.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, jbossASLocation + "/server/default/lib/hsqldb.jar");
+ props.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, driverPath);
instance.setBaseProperties(props);
DriverManager.getInstance().removeDriverInstance(instance.getID());
17 years, 5 months
JBoss Tools SVN: r11905 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources: jsfTest/.settings and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-20 09:11:33 -0500 (Thu, 20 Nov 2008)
New Revision: 11905
Removed:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/.settings/org.jboss.tools.jst.web.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/.settings/org.jboss.tools.jst.web.xml
Log:
JBIDE-2894
Deleted: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/.settings/org.jboss.tools.jst.web.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/.settings/org.jboss.tools.jst.web.xml 2008-11-20 14:02:57 UTC (rev 11904)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/.settings/org.jboss.tools.jst.web.xml 2008-11-20 14:11:33 UTC (rev 11905)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<file-systems VERSION="2.0.0.GA" application-name="example_1_2_w_f"
- model-entity="FileSystems" workspace-home="./WebContent/WEB-INF">
- <file-system NAME="WEB-INF" location="%workspace.home%" model-entity="FileSystemFolder"/>
- <file-system NAME="WEB-ROOT" info="Content-Type=Web"
- location="%workspace.home%/.." model-entity="FileSystemFolder"/>
- <file-system NAME="src" location="%workspace.home%/../../JavaSource" model-entity="FileSystemFolder"/>
- <file-system NAME="lib" location="%workspace.home%/lib" model-entity="FileSystemFolder"/>
- <file-system NAME="classes" location="%workspace.home%/classes" model-entity="FileSystemFolder"/>
- <file-system NAME="build" location="%workspace.home%/../../ant" model-entity="FileSystemFolder"/>
- <file-system NAME="lib-jsf-api.jar"
- location="D:\doc\prj\jboss\svn\trunk\jsf\tests\org.jboss.tools.jsf.vpe.jsf.test\resources\jsf2test\WebContent\WEB-INF\lib\jsf-api.jar" model-entity="FileSystemJar"/>
- <file-system NAME="lib-jsf-impl.jar"
- location="D:\doc\prj\jboss\svn\trunk\jsf\tests\org.jboss.tools.jsf.vpe.jsf.test\resources\jsf2test\WebContent\WEB-INF\lib\jsf-impl.jar" model-entity="FileSystemJar"/>
- <web SERVLET_VERSION="2.5" model-entity="JstWeb" model-path="/web.xml">
- <module URI="/WEB-INF/faces-config.xml" model-entity="WebJSFModule"
- model-path="/faces-config.xml" src="src" web-root="WEB-ROOT"/>
- </web>
-</file-systems>
Deleted: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/.settings/org.jboss.tools.jst.web.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/.settings/org.jboss.tools.jst.web.xml 2008-11-20 14:02:57 UTC (rev 11904)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/.settings/org.jboss.tools.jst.web.xml 2008-11-20 14:11:33 UTC (rev 11905)
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<FILESYSTEMS APPLICATION_NAME="example_1_2_w_f" ENTITY="FileSystems"
- VERSION="2.0.0.GA" WORKSPACE_HOME="./WebContent/WEB-INF">
- <FILESYSTEM ENTITY="FileSystemFolder" LOCATION="%workspace.home%" NAME="WEB-INF"/>
- <FILESYSTEM ENTITY="FileSystemFolder" INFO="Content-Type=Web"
- LOCATION="%workspace.home%/.." NAME="WEB-ROOT"/>
- <FILESYSTEM ENTITY="FileSystemFolder"
- LOCATION="%workspace.home%/../../JavaSource" NAME="src"/>
- <FILESYSTEM ENTITY="FileSystemFolder" LOCATION="%workspace.home%/lib" NAME="lib"/>
- <FILESYSTEM ENTITY="FileSystemFolder"
- LOCATION="%workspace.home%/classes" NAME="classes"/>
- <FILESYSTEM ENTITY="FileSystemFolder"
- LOCATION="%workspace.home%/../../ant" NAME="build"/>
- <FILESYSTEM ENTITY="FileSystemJar" INFO="hidden=yes"
- LOCATION="%workspace.home%/lib/jsf-tlds.jar" NAME="lib-jsf-tlds.jar"/>
- <FILESYSTEM ENTITY="FileSystemJar" INFO="hidden=yes"
- LOCATION="%workspace.home%/lib/commons-collections.jar" NAME="lib-commons-collections.jar"/>
- <FILESYSTEM ENTITY="FileSystemJar" INFO="hidden=yes"
- LOCATION="%workspace.home%/lib/commons-digester.jar" NAME="lib-commons-digester.jar"/>
- <FILESYSTEM ENTITY="FileSystemJar" INFO="hidden=yes"
- LOCATION="%workspace.home%/lib/common-annotations.jar" NAME="lib-common-annotations.jar"/>
- <FILESYSTEM ENTITY="FileSystemJar" INFO="hidden=yes"
- LOCATION="%workspace.home%/lib/standard.jar" NAME="lib-standard.jar"/>
- <FILESYSTEM ENTITY="FileSystemJar" INFO="hidden=yes"
- LOCATION="%workspace.home%/lib/jstl.jar" NAME="lib-jstl.jar"/>
- <FILESYSTEM ENTITY="FileSystemJar" INFO="hidden=yes"
- LOCATION="%workspace.home%/lib/commons-logging.jar" NAME="lib-commons-logging.jar"/>
- <FILESYSTEM ENTITY="FileSystemJar" INFO="hidden=yes"
- LOCATION="%workspace.home%/lib/commons-beanutils.jar" NAME="lib-commons-beanutils.jar"/>
- <WEB ENTITY="JstWeb" MODEL_PATH="/web.xml" SERVLET_VERSION="2.5">
- <MODULE ENTITY="WebJSFModule" MODEL_PATH="/faces-config.xml"
- ROOT="WEB-ROOT" SRC="src" URI="/WEB-INF/faces-config.xml"/>
- </WEB>
-</FILESYSTEMS>
17 years, 5 months
JBoss Tools SVN: r11904 - in trunk/jsf: plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-11-20 09:02:57 -0500 (Thu, 20 Nov 2008)
New Revision: 11904
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractRadioSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfCheckboxSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfCheckboxSelectItemsTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfOptionSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfOptionSelectItemsTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfRadioSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfRadioSelectItemsTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/SelectItemType.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOptionSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSelectOneRadioTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItem.jsp.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItems.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItems.jsp.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectOneRadio.jsp.xml
Log:
RESOLVED - issue JBIDE-3026: Components with unworked <f:selectItem> nested tag.
https://jira.jboss.org/jira/browse/JBIDE-3026
- Item #2 has been fixed: "<h:selectOneMenu>, <h:selectManyMenu> disabledClass and enabledClass don't work correctly"
- JUnit tests have been fixed
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java 2008-11-20 13:58:18 UTC (rev 11903)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -1,169 +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.jsf.template;
-
-import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
-import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * @author dmaliarevich
- *
- */
-public class JsfCheckboxSelectItemTemplate extends AbstractOutputJsfTemplate {
-
- private static final String TYPE_CHECKBOX = "checkbox"; //$NON-NLS-1$
-
- // style of span
- private static final String SPAN_STYLE_VALUE = "-moz-user-modify: read-write;"; //$NON-NLS-1$
-
- private String dir;
- private String disabled;
- private String enabledClass;
- private String disabledClass;
-
- /**
- *
- */
- public JsfCheckboxSelectItemTemplate() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
- * org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
-
- readParentAttributes(sourceNode.getParentNode());
-
- Element element = (Element) sourceNode;
-
- nsIDOMElement input = visualDocument.createElement(HTML.TAG_INPUT);
- nsIDOMElement label = visualDocument.createElement(HTML.TAG_LABEL);
- // create span element
- nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
- nsIDOMElement labelSpan = visualDocument.createElement(HTML.TAG_SPAN);
-
- VpeCreationData creationData = new VpeCreationData(span);
-
- // add title attribute to span
- span.setAttribute(HTML.ATTR_TITLE, getTitle(sourceNode));
- span.setAttribute(HTML.ATTR_STYLE, SPAN_STYLE_VALUE);
-
- input.setAttribute(HTML.ATTR_TYPE, TYPE_CHECKBOX);
-
- if (attrPresents(dir)) {
- input.setAttribute(HTML.ATTR_DIR, dir);
- }
-
- if (attrPresents(disabled) && Constants.TRUE.equalsIgnoreCase(disabled)) {
- label.setAttribute(HTML.ATTR_CLASS, disabledClass);
- } else if (attrPresents(enabledClass)) {
- label.setAttribute(HTML.ATTR_CLASS, enabledClass);
- }
-
- label.appendChild(labelSpan);
- span.appendChild(input);
- span.appendChild(label);
-
- processOutputAttribute(pageContext, visualDocument, element, labelSpan,
- creationData);
-
- return creationData;
- }
-
- /**
- * Checks is attribute presents.
- *
- * @param attr
- * the attribute
- *
- * @return true, if successful
- */
- private boolean attrPresents(String attr) {
- return ((null != attr) && (attr.length() != 0));
- }
-
- /**
- * generate title of element
- *
- * @param sourceNode
- * @return
- */
- private String getTitle(Node sourceNode) {
-
- String tagString = " <" + sourceNode.getNodeName(); //$NON-NLS-1$
- NamedNodeMap attrs = sourceNode.getAttributes();
- if (attrs != null) {
- tagString += attrs.getLength() > 0 ? " " : ""; //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; i < attrs.getLength(); i++) {
- Node attr = attrs.item(i);
- tagString += attr.getNodeName() + "=\"" + attr.getNodeValue() //$NON-NLS-1$
- + "\"" + (i < (attrs.getLength() - 1) ? " " : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- tagString += (sourceNode.hasChildNodes() ? "" : "/") + "> "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- return tagString;
- }
-
- /**
- * Read attributes from the h:SelectManyCheckbox element.
- *
- * @param sourceNode
- * the source node
- */
- private void readParentAttributes(Node sourceNode) {
- if (null == sourceNode) {
- return;
- }
- Element source = (Element) sourceNode;
- dir = source.getAttribute(JSF.ATTR_DIR);
- disabled = source.getAttribute(JSF.ATTR_DISABLED);
- enabledClass = source.getAttribute(JSF.ATTR_ENABLED_CLASS);
- disabledClass = source.getAttribute(JSF.ATTR_DISABLED_CLASS);
- }
-
- @Override
- public void setSourceAttributeSelection(VpePageContext pageContext,
- Element sourceElement, int offset, int length, Object data) {
- VpeSourceDomBuilder sourceBuilder = pageContext.getSourceBuilder();
- sourceBuilder.setSelection(sourceElement, 0, 0);
- }
-
- @Override
- public Attr getOutputAttributeNode(Element element) {
-
- if (element.hasAttribute(JSF.ATTR_ITEM_LABEL))
- return element.getAttributeNode(JSF.ATTR_ITEM_LABEL);
- return null;
- }
-
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext,
- Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMElement visualNode, Object data, String name, String value) {
- return true;
- }
-
-}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOptionSelectItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOptionSelectItemTemplate.java 2008-11-20 13:58:18 UTC (rev 11903)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOptionSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -1,212 +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.jsf.template;
-
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
-import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
-import org.jboss.tools.jsf.vpe.jsf.template.util.model.VpeElementProxyData;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.AttributeData;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
-import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMText;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * @author dmaliarevich
- *
- */
-public class JsfOptionSelectItemTemplate extends AbstractOutputJsfTemplate /* VpeAbstractTemplate */{
-
- /* "escape" attribute of f:selectItem */
-
- private String escape;
- private String disabled;
- private String enabledClass;
- private String disabledClass;
-
- /**
- *
- */
- public JsfOptionSelectItemTemplate() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools
- * .vpe.editor.context.VpePageContext, org.w3c.dom.Node,
- * org.mozilla.interfaces.nsIDOMDocument)
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
-
- readParentAttributes(sourceNode.getParentNode());
- readAttributes(sourceNode);
- Element element = (Element) sourceNode;
- boolean disabledItem = ComponentUtil.string2boolean(ComponentUtil
- .getAttribute(element, JSF.ATTR_ITEM_DISABLED));
- nsIDOMElement option = visualDocument.createElement(HTML.TAG_OPTION);
-
- if (disabledItem) {
- option.setAttribute(HTML.ATTR_DISABLED, Constants.TRUE);
- }
- VpeCreationData creationData = new VpeCreationData(option);
-
- if (attrPresents(disabled) && Constants.TRUE.equalsIgnoreCase(disabled)) {
- option.setAttribute(HTML.ATTR_CLASS, disabledClass);
- } else if (attrPresents(enabledClass)) {
- option.setAttribute(HTML.ATTR_CLASS, enabledClass);
- }
-
- processOutputAttribute(pageContext, visualDocument, element, option,
- creationData);
-
- return creationData;
- }
-
- protected void processOutputAttribute(VpePageContext pageContext,
- nsIDOMDocument visualDocument, Element sourceElement,
- nsIDOMElement targetVisualElement, VpeCreationData creationData) {
-
- VpeElementProxyData elementData = new VpeElementProxyData();
-
- Attr outputAttr = getOutputAttributeNode(sourceElement);
-
- if (outputAttr != null) {
-
- // prepare value
- String newValue = outputAttr.getValue();
-
- // if escape then contents of value (or other attribute) is only
- // text
- if (!sourceElement.hasAttribute(JSF.ATTR_ESCAPE)
- || Constants.TRUE.equalsIgnoreCase(sourceElement
- .getAttribute(JSF.ATTR_ESCAPE))) {
-
- String value = outputAttr.getNodeValue();
-
- nsIDOMText text;
- // if bundleValue differ from value then will be represent
- // bundleValue, but text will be not edit
- boolean isEditable = value.equals(newValue);
-
- text = visualDocument.createTextNode(newValue);
- // add attribute for ability of editing
-
- elementData.addNodeData(new AttributeData(outputAttr,
- targetVisualElement, isEditable));
-
- targetVisualElement.appendChild(text);
-
- }
- // then text can be html code
- else {
-
- // create info
- VpeChildrenInfo targetVisualInfo = new VpeChildrenInfo(
- targetVisualElement);
-
- // get atribute's offset
- int offset = ((IDOMAttr) outputAttr)
- .getValueRegionStartOffset();
-
- // reparse attribute's value
- NodeList list = NodeProxyUtil.reparseAttributeValue(
- elementData, newValue, offset + 1);
-
- // add children to info
- for (int i = 0; i < list.getLength(); i++) {
-
- Node child = list.item(i);
-
- // add info to creation data
- targetVisualInfo.addSourceChild(child);
- }
-
- elementData.addNodeData(new AttributeData(outputAttr,
- targetVisualElement, false));
-
- creationData.addChildrenInfo(targetVisualInfo);
-
- }
-
- }
-
- creationData.setElementData(elementData);
- }
-
- /**
- * Checks is attribute presents.
- *
- * @param attr
- * the attribute
- *
- * @return true, if successful
- */
- private boolean attrPresents(String attr) {
- return ((null != attr) && (!Constants.EMPTY.equals(attr)));
- }
-
- /**
- * Read attributes from the h:SelectManyCheckbox element.
- *
- * @param sourceNode
- * the source node
- */
- private void readParentAttributes(Node sourceNode) {
- if (null == sourceNode) {
- return;
- }
- Element source = (Element) sourceNode;
- disabled = source.getAttribute(HTML.ATTR_DISABLED);
- enabledClass = source.getAttribute(JSF.ATTR_ENABLED_CLASS);
- disabledClass = source.getAttribute(JSF.ATTR_DISABLED_CLASS);
- }
-
- /**
- * Read attributes from the source element.
- *
- * @param sourceNode
- * the source node
- */
- private void readAttributes(Node sourceNode) {
- if (null == sourceNode) {
- return;
- }
- Element source = (Element) sourceNode;
- escape = source.getAttribute(JSF.ATTR_ESCAPE);
- }
-
- @Override
- public Attr getOutputAttributeNode(Element element) {
- Attr outputAttributeNode;
-
- if (element.hasAttribute(JSF.ATTR_ITEM_LABEL)) {
- outputAttributeNode = element.getAttributeNode(JSF.ATTR_ITEM_LABEL);
- } else if (element.hasAttribute(JSF.ATTR_ITEM_VALUE)) {
- outputAttributeNode = element.getAttributeNode(JSF.ATTR_ITEM_VALUE);
- } else {
- outputAttributeNode = null;
- }
- return outputAttributeNode;
- }
-}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java 2008-11-20 13:58:18 UTC (rev 11903)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.jsf.template;
-
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
-import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
-import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * @author sdzmitrovich
- *
- * template for radio select item
- *
- */
-public class JsfRadioSelectItemTemplate extends AbstractOutputJsfTemplate {
-
- /* "itemDisabled" attribute of f:selectItem */
- public static final String ITEM_DISABLED = "itemDisabled"; //$NON-NLS-1$
-
- // type of input tag
- private static final String ATTR_TYPE_VALUE = "radio"; //$NON-NLS-1$
-
- // common part of the name of element
- private static final String ATTR_NAME_VALUE = "radio_name_"; //$NON-NLS-1$
-
- // style of span
- private static final String SPAN_STYLE_VALUE = "-moz-user-modify: read-write;"; //$NON-NLS-1$
-
- private String dir;
-
- /**
- *
- */
- public JsfRadioSelectItemTemplate() {
-
- // TODO Auto-generated constructor stub
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
- * org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
-
- Element element = (Element) sourceNode;
-
- // create table element
- nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
- boolean disabledItem = ComponentUtil.string2boolean(ComponentUtil
- .getAttribute(element, ITEM_DISABLED));
-
- // add title attribute to span
- table.setAttribute(HTML.ATTR_TITLE, getTitle(sourceNode));
- nsIDOMElement radio = visualDocument.createElement(HTML.TAG_INPUT);
- if (disabledItem)
- radio.setAttribute(ITEM_DISABLED, Constants.TRUE);
- nsIDOMElement label = visualDocument.createElement(HTML.TAG_LABEL);
- if (disabledItem)
- label.setAttribute(ITEM_DISABLED, Constants.TRUE);
- table.appendChild(radio);
- table.appendChild(label);
-
- if (null != element) {
- dir = element.getAttribute(JSF.ATTR_DIR);
- }
-
- VpeCreationData creationData = new VpeCreationData(table);
-
- // set attributes
- table.setAttribute(HTML.ATTR_STYLE, SPAN_STYLE_VALUE);
- radio.setAttribute(HTML.ATTR_TYPE, ATTR_TYPE_VALUE);
- radio.setAttribute(HTML.ATTR_TITLE, getTitle(sourceNode));
- radio.setAttribute(HTML.ATTR_NAME, ATTR_NAME_VALUE
- + getNameSuffix(sourceNode));
-
- if (attrPresents(dir)) {
- radio.setAttribute(HTML.ATTR_DIR, dir);
- }
-
- processOutputAttribute(pageContext, visualDocument, element, label,
- creationData);
-
- return creationData;
- }
-
- /**
- * generate title of element
- *
- * @param sourceNode
- * @return
- */
- private String getTitle(Node sourceNode) {
-
- String tagString = " <" + sourceNode.getNodeName(); //$NON-NLS-1$
- NamedNodeMap attrs = sourceNode.getAttributes();
- if (attrs != null) {
- tagString += attrs.getLength() > 0 ? " " : ""; //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; i < attrs.getLength(); i++) {
- Node attr = attrs.item(i);
- tagString += attr.getNodeName() + "=\"" + attr.getNodeValue() //$NON-NLS-1$
- + "\"" + (i < (attrs.getLength() - 1) ? " " : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- tagString += (sourceNode.hasChildNodes() ? "" : "/") + "> "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- return tagString;
- }
-
- /**
- * generate unique suffix of name for radio as unique suffix use start
- * position of parent tag ( "h:selectOneRadio" or "x:selectOneRadio")
- *
- * @param sourceNode
- * @return
- */
- private String getNameSuffix(Node sourceNode) {
-
- String name_suffix = ""; //$NON-NLS-1$
-
- // get parent element
- Node parent = sourceNode.getParentNode();
-
-// if ((parent == null) && (sourceNode instanceof Element)
-// && (((Element) sourceNode).getAttribute(VpeVisualDomBuilder.PARENT) != null)) {
-// parent = (Node) ((Element) sourceNode).getAttributeNode(VpeVisualDomBuilder.PARENT).getUserData(VpeVisualDomBuilder.PARENT);
-// }
- if ((parent != null) && (parent.getNodeType() == Node.ELEMENT_NODE)) {
-
- ElementImpl element = (ElementImpl) parent;
-
- // get start position of parent
- name_suffix = String.valueOf(element.getStartOffset());
- }
-
- return name_suffix;
-
- }
-
- /**
- * Checks is attribute presents.
- *
- * @param attr
- * the attribute
- *
- * @return true, if successful
- */
- private boolean attrPresents(String attr) {
- return ((null != attr) && (attr.length()!=0));
- }
-
- @Override
- public Attr getOutputAttributeNode(Element element) {
-
- if (element.hasAttribute(JSF.ATTR_ITEM_LABEL))
- return element.getAttributeNode(JSF.ATTR_ITEM_LABEL);
- return null;
- }
-
- @Override
- 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.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSelectOneRadioTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSelectOneRadioTemplate.java 2008-11-20 13:58:18 UTC (rev 11903)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSelectOneRadioTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.template;
+import org.jboss.tools.jsf.vpe.jsf.template.selectitem.AbstractRadioSelectItemTemplate;
import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
@@ -157,7 +158,7 @@
.string2boolean(ComponentUtil
.getAttribute(
element,
- JsfRadioSelectItemTemplate.ITEM_DISABLED)))
+ AbstractRadioSelectItemTemplate.ITEM_DISABLED)))
element.setAttribute(HTML.ATTR_DISABLED,
ATTR_DISABLED_VALUE);
@@ -170,7 +171,7 @@
.string2boolean(ComponentUtil
.getAttribute(
element,
- JsfRadioSelectItemTemplate.ITEM_DISABLED))) ? ComponentUtil
+ AbstractRadioSelectItemTemplate.ITEM_DISABLED))) ? ComponentUtil
.getAttribute(sourceElement,
ATTR_DISABLED_CLASS)
: ComponentUtil.getAttribute(
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java (from rev 11768, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java)
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
+import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * @author dmaliarevich
+ *
+ */
+abstract public class AbstractCheckboxSelectItemTemplate extends AbstractSelectItemTemplate {
+
+ private static final String TYPE_CHECKBOX = "checkbox"; //$NON-NLS-1$
+
+ // style of span
+ private static final String SPAN_STYLE_VALUE = "-moz-user-modify: read-write;"; //$NON-NLS-1$
+
+ private String dir;
+ private String disabled;
+ private String enabledClass;
+ private String disabledClass;
+
+ protected AbstractCheckboxSelectItemTemplate(SelectItemType selectItemType) {
+ super(selectItemType);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ readParentAttributes(sourceNode.getParentNode());
+
+ Element element = (Element) sourceNode;
+
+ nsIDOMElement input = visualDocument.createElement(HTML.TAG_INPUT);
+ nsIDOMElement label = visualDocument.createElement(HTML.TAG_LABEL);
+ // create span element
+ nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
+ nsIDOMElement labelSpan = visualDocument.createElement(HTML.TAG_SPAN);
+
+ VpeCreationData creationData = new VpeCreationData(span);
+
+ // add title attribute to span
+ span.setAttribute(HTML.ATTR_TITLE, getTitle(sourceNode));
+ span.setAttribute(HTML.ATTR_STYLE, SPAN_STYLE_VALUE);
+
+ input.setAttribute(HTML.ATTR_TYPE, TYPE_CHECKBOX);
+
+ if (attrPresents(dir)) {
+ input.setAttribute(HTML.ATTR_DIR, dir);
+ }
+
+ if (attrPresents(disabled) && Constants.TRUE.equalsIgnoreCase(disabled)) {
+ label.setAttribute(HTML.ATTR_CLASS, disabledClass);
+ } else if (attrPresents(enabledClass)) {
+ label.setAttribute(HTML.ATTR_CLASS, enabledClass);
+ }
+
+ label.appendChild(labelSpan);
+ span.appendChild(input);
+ span.appendChild(label);
+
+ processOutputAttribute(pageContext, visualDocument, element, labelSpan,
+ creationData);
+
+ return creationData;
+ }
+
+ /**
+ * Checks is attribute presents.
+ *
+ * @param attr
+ * the attribute
+ *
+ * @return true, if successful
+ */
+ private boolean attrPresents(String attr) {
+ return ((null != attr) && (attr.length() != 0));
+ }
+
+ /**
+ * generate title of element
+ *
+ * @param sourceNode
+ * @return
+ */
+ private String getTitle(Node sourceNode) {
+
+ String tagString = " <" + sourceNode.getNodeName(); //$NON-NLS-1$
+ NamedNodeMap attrs = sourceNode.getAttributes();
+ if (attrs != null) {
+ tagString += attrs.getLength() > 0 ? " " : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Node attr = attrs.item(i);
+ tagString += attr.getNodeName() + "=\"" + attr.getNodeValue() //$NON-NLS-1$
+ + "\"" + (i < (attrs.getLength() - 1) ? " " : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+ tagString += (sourceNode.hasChildNodes() ? "" : "/") + "> "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ return tagString;
+ }
+
+ /**
+ * Read attributes from the h:SelectManyCheckbox element.
+ *
+ * @param sourceNode
+ * the source node
+ */
+ private void readParentAttributes(Node sourceNode) {
+ if (null == sourceNode) {
+ return;
+ }
+ Element source = (Element) sourceNode;
+ dir = source.getAttribute(JSF.ATTR_DIR);
+ disabled = source.getAttribute(JSF.ATTR_DISABLED);
+ enabledClass = source.getAttribute(JSF.ATTR_ENABLED_CLASS);
+ disabledClass = source.getAttribute(JSF.ATTR_DISABLED_CLASS);
+ }
+
+ @Override
+ public void setSourceAttributeSelection(VpePageContext pageContext,
+ Element sourceElement, int offset, int length, Object data) {
+ VpeSourceDomBuilder sourceBuilder = pageContext.getSourceBuilder();
+ sourceBuilder.setSelection(sourceElement, 0, 0);
+ }
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java (from rev 11879, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOptionSelectItemTemplate.java)
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.jboss.tools.jsf.vpe.jsf.template.AbstractOutputJsfTemplate;
+import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
+import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.model.VpeElementProxyData;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.mapping.AttributeData;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author dmaliarevich
+ *
+ */
+public abstract class AbstractOptionSelectItemTemplate extends AbstractSelectItemTemplate /* VpeAbstractTemplate */{
+
+ /* "escape" attribute of f:selectItem */
+ private String escape = null;
+ private String disabled = null;
+ private String enabledClass = null;
+ private String disabledClass = null;
+
+ protected AbstractOptionSelectItemTemplate(SelectItemType selectItemType) {
+ super(selectItemType);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools
+ * .vpe.editor.context.VpePageContext, org.w3c.dom.Node,
+ * org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ readParentAttributes(sourceNode.getParentNode());
+ readAttributes(sourceNode);
+ Element element = (Element) sourceNode;
+
+ nsIDOMElement option = visualDocument.createElement(HTML.TAG_OPTION);
+
+ if (selectItemType.isDisabledItem(element)) {
+ option.setAttribute(HTML.ATTR_DISABLED, Constants.TRUE);
+ }
+ VpeCreationData creationData = new VpeCreationData(option);
+
+ if (attrPresents(disabled) && Constants.TRUE.equalsIgnoreCase(disabled)) {
+ option.setAttribute(HTML.ATTR_CLASS, disabledClass);
+ } else if (attrPresents(enabledClass)) {
+ option.setAttribute(HTML.ATTR_CLASS, enabledClass);
+ }
+
+ processOutputAttribute(pageContext, visualDocument, element, option,
+ creationData);
+
+ return creationData;
+ }
+
+ protected void processOutputAttribute(VpePageContext pageContext,
+ nsIDOMDocument visualDocument, Element sourceElement,
+ nsIDOMElement targetVisualElement, VpeCreationData creationData) {
+
+ VpeElementProxyData elementData = new VpeElementProxyData();
+
+ Attr outputAttr = getOutputAttributeNode(sourceElement);
+
+ if (outputAttr != null) {
+
+ // prepare value
+ String newValue = outputAttr.getValue();
+
+ // if escape then contents of value (or other attribute) is only
+ // text
+ if (!sourceElement.hasAttribute(JSF.ATTR_ESCAPE)
+ || Constants.TRUE.equalsIgnoreCase(sourceElement
+ .getAttribute(JSF.ATTR_ESCAPE))) {
+
+ String value = outputAttr.getNodeValue();
+
+ nsIDOMText text;
+ // if bundleValue differ from value then will be represent
+ // bundleValue, but text will be not edit
+ boolean isEditable = value.equals(newValue);
+
+ text = visualDocument.createTextNode(newValue);
+ // add attribute for ability of editing
+
+ elementData.addNodeData(new AttributeData(outputAttr,
+ targetVisualElement, isEditable));
+
+ targetVisualElement.appendChild(text);
+
+ }
+ // then text can be html code
+ else {
+
+ // create info
+ VpeChildrenInfo targetVisualInfo = new VpeChildrenInfo(
+ targetVisualElement);
+
+ // get atribute's offset
+ int offset = ((IDOMAttr) outputAttr)
+ .getValueRegionStartOffset();
+
+ // reparse attribute's value
+ NodeList list = NodeProxyUtil.reparseAttributeValue(
+ elementData, newValue, offset + 1);
+
+ // add children to info
+ for (int i = 0; i < list.getLength(); i++) {
+
+ Node child = list.item(i);
+
+ // add info to creation data
+ targetVisualInfo.addSourceChild(child);
+ }
+
+ elementData.addNodeData(new AttributeData(outputAttr,
+ targetVisualElement, false));
+
+ creationData.addChildrenInfo(targetVisualInfo);
+
+ }
+
+ }
+
+ creationData.setElementData(elementData);
+ }
+
+ /**
+ * Checks is attribute presents.
+ *
+ * @param attr
+ * the attribute
+ *
+ * @return true, if successful
+ */
+ private boolean attrPresents(String attr) {
+ return ((null != attr) && (!Constants.EMPTY.equals(attr)));
+ }
+
+ /**
+ * Read attributes from the h:SelectManyCheckbox element.
+ *
+ * @param sourceNode
+ * the source node
+ */
+ private void readParentAttributes(Node sourceNode) {
+ if (null == sourceNode) {
+ return;
+ }
+ Element source = (Element) sourceNode;
+ disabled = source.getAttribute(HTML.ATTR_DISABLED);
+ enabledClass = source.getAttribute(JSF.ATTR_ENABLED_CLASS);
+ disabledClass = source.getAttribute(JSF.ATTR_DISABLED_CLASS);
+ }
+
+ /**
+ * Read attributes from the source element.
+ *
+ * @param sourceNode
+ * the source node
+ */
+ private void readAttributes(Node sourceNode) {
+ if (null == sourceNode) {
+ return;
+ }
+ Element source = (Element) sourceNode;
+ escape = source.getAttribute(JSF.ATTR_ESCAPE);
+ }
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractRadioSelectItemTemplate.java (from rev 11768, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java)
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractRadioSelectItemTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractRadioSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template.selectitem;
+
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * @author sdzmitrovich
+ *
+ * template for radio select item
+ *
+ */
+abstract public class AbstractRadioSelectItemTemplate extends AbstractSelectItemTemplate {
+
+ /* "itemDisabled" attribute of f:selectItem */
+ public static final String ITEM_DISABLED = "itemDisabled"; //$NON-NLS-1$
+
+ // type of input tag
+ private static final String ATTR_TYPE_VALUE = "radio"; //$NON-NLS-1$
+
+ // common part of the name of element
+ private static final String ATTR_NAME_VALUE = "radio_name_"; //$NON-NLS-1$
+
+ // style of span
+ private static final String SPAN_STYLE_VALUE = "-moz-user-modify: read-write;"; //$NON-NLS-1$
+
+ private String dir;
+
+ protected AbstractRadioSelectItemTemplate(SelectItemType selectItemType) {
+ super(selectItemType);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ Element element = (Element) sourceNode;
+
+ // create container element
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ final boolean disabledItem = selectItemType.isDisabledItem(element);
+
+ // add title attribute to div
+ div.setAttribute(HTML.ATTR_TITLE, getTitle(sourceNode));
+ nsIDOMElement radio = visualDocument.createElement(HTML.TAG_INPUT);
+ if (disabledItem)
+ radio.setAttribute(ITEM_DISABLED, Constants.TRUE);
+ nsIDOMElement label = visualDocument.createElement(HTML.TAG_LABEL);
+ if (disabledItem)
+ label.setAttribute(ITEM_DISABLED, Constants.TRUE);
+ div.appendChild(radio);
+ div.appendChild(label);
+
+ if (null != element) {
+ dir = element.getAttribute(JSF.ATTR_DIR);
+ }
+
+ VpeCreationData creationData = new VpeCreationData(div);
+
+ // set attributes
+ div.setAttribute(HTML.ATTR_STYLE, SPAN_STYLE_VALUE);
+ radio.setAttribute(HTML.ATTR_TYPE, ATTR_TYPE_VALUE);
+ radio.setAttribute(HTML.ATTR_TITLE, getTitle(sourceNode));
+ radio.setAttribute(HTML.ATTR_NAME, ATTR_NAME_VALUE
+ + getNameSuffix(sourceNode));
+
+ if (attrPresents(dir)) {
+ radio.setAttribute(HTML.ATTR_DIR, dir);
+ }
+
+ processOutputAttribute(pageContext, visualDocument, element, label,
+ creationData);
+
+ return creationData;
+ }
+
+ /**
+ * generate title of element
+ *
+ * @param sourceNode
+ * @return
+ */
+ private String getTitle(Node sourceNode) {
+
+ String tagString = " <" + sourceNode.getNodeName(); //$NON-NLS-1$
+ NamedNodeMap attrs = sourceNode.getAttributes();
+ if (attrs != null) {
+ tagString += attrs.getLength() > 0 ? " " : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Node attr = attrs.item(i);
+ tagString += attr.getNodeName() + "=\"" + attr.getNodeValue() //$NON-NLS-1$
+ + "\"" + (i < (attrs.getLength() - 1) ? " " : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+ tagString += (sourceNode.hasChildNodes() ? "" : "/") + "> "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ return tagString;
+ }
+
+ /**
+ * generate unique suffix of name for radio as unique suffix use start
+ * position of parent tag ( "h:selectOneRadio" or "x:selectOneRadio")
+ *
+ * @param sourceNode
+ * @return
+ */
+ private String getNameSuffix(Node sourceNode) {
+
+ String name_suffix = ""; //$NON-NLS-1$
+
+ // get parent element
+ Node parent = sourceNode.getParentNode();
+
+// if ((parent == null) && (sourceNode instanceof Element)
+// && (((Element) sourceNode).getAttribute(VpeVisualDomBuilder.PARENT) != null)) {
+// parent = (Node) ((Element) sourceNode).getAttributeNode(VpeVisualDomBuilder.PARENT).getUserData(VpeVisualDomBuilder.PARENT);
+// }
+ if ((parent != null) && (parent.getNodeType() == Node.ELEMENT_NODE)) {
+
+ ElementImpl element = (ElementImpl) parent;
+
+ // get start position of parent
+ name_suffix = String.valueOf(element.getStartOffset());
+ }
+
+ return name_suffix;
+
+ }
+
+ /**
+ * Checks is attribute presents.
+ *
+ * @param attr
+ * the attribute
+ *
+ * @return true, if successful
+ */
+ private boolean attrPresents(String attr) {
+ return ((null != attr) && (attr.length()!=0));
+ }
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractRadioSelectItemTemplate.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+import org.jboss.tools.jsf.vpe.jsf.template.AbstractOutputJsfTemplate;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * This class is the base class for all templates of
+ * {@code <h:selectItem>} and {@code <h:selectItems>}.
+ *
+ * @author yradtsevich
+ */
+public abstract class AbstractSelectItemTemplate extends AbstractOutputJsfTemplate {
+
+ /**
+ * This field is used to differ templates of
+ * {@code <h:selectItem>} and {@code <h:selectItems>}.
+ *
+ * @see SelectItemType
+ */
+ protected final SelectItemType selectItemType;
+
+ protected AbstractSelectItemTemplate(SelectItemType selectItemType) {
+ this.selectItemType = selectItemType;
+ }
+
+ @Override
+ public final Attr getOutputAttributeNode(Element element) {
+ return selectItemType.getOutputAttributeNode(element);
+ }
+}
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfCheckboxSelectItemTemplate.java (from rev 11768, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java)
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfCheckboxSelectItemTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfCheckboxSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+
+/**
+ * @author yradtsevich
+ *
+ */
+public class JsfCheckboxSelectItemTemplate extends
+ AbstractCheckboxSelectItemTemplate {
+
+ public JsfCheckboxSelectItemTemplate() {
+ super(SelectItemType.SELECT_ITEM);
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfCheckboxSelectItemTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfCheckboxSelectItemsTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfCheckboxSelectItemsTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfCheckboxSelectItemsTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+
+/**
+ * @author yradtsevich
+ *
+ */
+public class JsfCheckboxSelectItemsTemplate extends
+ AbstractCheckboxSelectItemTemplate {
+
+ public JsfCheckboxSelectItemsTemplate() {
+ super(SelectItemType.SELECT_ITEMS);
+ }
+
+}
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfOptionSelectItemTemplate.java (from rev 11879, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOptionSelectItemTemplate.java)
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfOptionSelectItemTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfOptionSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+/**
+ * @author yradtsevich
+ *
+ */
+public class JsfOptionSelectItemTemplate extends
+ AbstractOptionSelectItemTemplate {
+
+ public JsfOptionSelectItemTemplate() {
+ super(SelectItemType.SELECT_ITEM);
+ }
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfOptionSelectItemTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfOptionSelectItemsTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfOptionSelectItemsTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfOptionSelectItemsTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+/**
+ * @author yradtsevich
+ *
+ */
+public class JsfOptionSelectItemsTemplate extends
+ AbstractOptionSelectItemTemplate {
+
+ public JsfOptionSelectItemsTemplate() {
+ super(SelectItemType.SELECT_ITEMS);
+ }
+}
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfRadioSelectItemTemplate.java (from rev 11768, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java)
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfRadioSelectItemTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfRadioSelectItemTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+
+/**
+ * @author yradtsevich
+ *
+ */
+public class JsfRadioSelectItemTemplate extends
+ AbstractRadioSelectItemTemplate {
+
+ public JsfRadioSelectItemTemplate() {
+ super(SelectItemType.SELECT_ITEM);
+ }
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfRadioSelectItemTemplate.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfRadioSelectItemsTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfRadioSelectItemsTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/JsfRadioSelectItemsTemplate.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+
+/**
+ * @author yradtsevich
+ *
+ */
+public class JsfRadioSelectItemsTemplate extends
+ AbstractRadioSelectItemTemplate {
+
+ public JsfRadioSelectItemsTemplate() {
+ super(SelectItemType.SELECT_ITEMS);
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/SelectItemType.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/SelectItemType.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/SelectItemType.java 2008-11-20 14:02:57 UTC (rev 11904)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.jsf.template.selectitem;
+
+import org.jboss.tools.jsf.vpe.jsf.template.AbstractOutputJsfTemplate;
+import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+/**
+ * @author yradtsevich
+ */
+public enum SelectItemType {
+ /**
+ * Reflects the tag-type {@code <h:selectItem>} and provides operations on it.
+ */
+ SELECT_ITEM {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Attr getOutputAttributeNode(Element element) {
+ Attr outputAttributeNode;
+
+ if (element.hasAttribute(JSF.ATTR_ITEM_LABEL)) {
+ outputAttributeNode = element.getAttributeNode(JSF.ATTR_ITEM_LABEL);
+ } else if (element.hasAttribute(JSF.ATTR_ITEM_VALUE)) {
+ outputAttributeNode = element.getAttributeNode(JSF.ATTR_ITEM_VALUE);
+ } else if (element.hasAttribute(JSF.ATTR_VALUE)) {
+ outputAttributeNode = element.getAttributeNode(JSF.ATTR_VALUE);
+ } else {
+ outputAttributeNode = null;
+ }
+ return outputAttributeNode;
+ }
+
+ /**
+ * Returns value of the attribute {@code disabledItem} of the {@code element}
+ */
+ @Override
+ public boolean isDisabledItem(Element element) {
+ return ComponentUtil.string2boolean(ComponentUtil
+ .getAttribute(element, JSF.ATTR_ITEM_DISABLED));
+ }
+ },
+
+ /**
+ * Reflects the tag-type {@code <h:selectItems>} and provides operations on it.
+ */
+ SELECT_ITEMS {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Attr getOutputAttributeNode(Element element) {
+ Attr outputAttributeNode;
+
+ if (element.hasAttribute(JSF.ATTR_VALUE)) {
+ outputAttributeNode = element.getAttributeNode(JSF.ATTR_VALUE);
+ } else {
+ outputAttributeNode = null;
+ }
+ return outputAttributeNode;
+ }
+
+ /**
+ * As the tag {@code <h:selectItems>} does not support attribute {@code disabledItem},
+ * it always returns {@code true}
+ */
+ @Override
+ public boolean isDisabledItem(Element element) {
+ return false;
+ }
+ };
+
+ /**
+ * @see AbstractOutputJsfTemplate#getOutputAttributeNode(Element)
+ */
+ public abstract Attr getOutputAttributeNode(Element element);
+ /**
+ * Returns {@code true} if the {@code element} should be disabled
+ * according to its {@code disabledItem} attribute.
+ */
+ public abstract boolean isDisabledItem(Element element);
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-11-20 13:58:18 UTC (rev 11903)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-11-20 14:02:57 UTC (rev 11904)
@@ -506,19 +506,19 @@
<vpe:tag name="f:selectItem" case-sensitive="yes">
<vpe:if test="hasinparents('h:selectManyCheckbox')">
<vpe:template children="yes" modify="yes"
- class="org.jboss.tools.jsf.vpe.jsf.template.JsfCheckboxSelectItemTemplate">
+ class="org.jboss.tools.jsf.vpe.jsf.template.selectitem.JsfCheckboxSelectItemTemplate">
</vpe:template>
</vpe:if>
<vpe:if
test="hasinparents('h:selectManyListbox')|hasinparents('h:selectManyMenu')|hasinparents('h:selectOneListbox')|hasinparents('h:selectOneMenu')|hasinparents('rich:pickList')">
<vpe:template children="yes" modify="yes"
- class="org.jboss.tools.jsf.vpe.jsf.template.JsfOptionSelectItemTemplate">
+ class="org.jboss.tools.jsf.vpe.jsf.template.selectitem.JsfOptionSelectItemTemplate">
</vpe:template>
</vpe:if>
<vpe:if
test="hasinparents('h:selectOneRadio')|hasinparents('x:selectOneRadio')">
<vpe:template children="yes" modify="yes"
- class="org.jboss.tools.jsf.vpe.jsf.template.JsfRadioSelectItemTemplate">
+ class="org.jboss.tools.jsf.vpe.jsf.template.selectitem.JsfRadioSelectItemTemplate">
</vpe:template>
</vpe:if>
<vpe:if
@@ -548,41 +548,44 @@
</vpe:tag>
<vpe:tag name="f:selectItems" case-sensitive="yes">
+ <vpe:if test="hasinparents('h:selectManyCheckbox')">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.jsf.template.selectitem.JsfCheckboxSelectItemsTemplate">
+ </vpe:template>
+ </vpe:if>
<vpe:if
- test="hasinparents('h:selectManyCheckbox')|hasinparents('x:selectManyCheckbox')">
-<!-- added x: 8.02.05 --><!-- Gavr -->
- <vpe:template children="no" modify="yes">
- <span title="{tagstring()}">
- <input type="checkbox" />
- <vpe:value expr="{jsfvalue(@itemLabel)}" />
- </span>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- </vpe:dnd>
+ test="hasinparents('h:selectManyListbox')|hasinparents('h:selectManyMenu')|hasinparents('h:selectOneListbox')|hasinparents('h:selectOneMenu')|hasinparents('rich:pickList')">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.jsf.template.selectitem.JsfOptionSelectItemsTemplate">
</vpe:template>
</vpe:if>
- <vpe:if test="hasinparents('h:selectOneRadio')">
+ <vpe:if
+ test="hasinparents('h:selectOneRadio')|hasinparents('x:selectOneRadio')">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.jsf.template.selectitem.JsfRadioSelectItemsTemplate">
+ </vpe:template>
+ </vpe:if>
+ <vpe:if
+ test="hasinparents('x:selectManyCheckbox')|hasinparents('t:selectManyCheckbox')">
<vpe:template children="no" modify="yes">
<span title="{tagstring()}">
- <input type="radio" />
+ <input type="checkbox" />
<vpe:value expr="{jsfvalue(@itemLabel)}" />
</span>
<vpe:dnd>
<vpe:drag start-enable="yes" />
</vpe:dnd>
+ <vpe:breaker type="selectItem" />
</vpe:template>
</vpe:if>
<vpe:if
- test="hasinparents('h:selectOneListbox')|
- hasinparents('h:selectManyListbox')|
- hasinparents('h:selectOneMenu')|
- hasinparents('h:selectManyMenu')|
- hasinparents('x:selectOneMenu')|
- hasinparents('rich:pickList')">
-<!-- Gavr -->
+ test="hasinparents('t:selectManyMenu')|
+ hasinparents('x:selectOneRadio')|
+ hasinparents('x:selectOneMenu')">
+ <!-- Gavr --><!-- added x: 8.02.05 -->
<vpe:template children="no" modify="yes">
<option value="{@itemValue}" title="{tagstring()}">
- <vpe:value expr="{jsfvalue(@value)}" />
+ <vpe:value expr="{jsfvalue(@itemLabel)}" />
</option>
</vpe:template>
</vpe:if>
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItem.jsp.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItem.jsp.xml 2008-11-20 13:58:18 UTC (rev 11903)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItem.jsp.xml 2008-11-20 14:02:57 UTC (rev 11904)
@@ -11,9 +11,9 @@
<OPTION> value1</OPTION>
</test>
<test id="selectItem3">
- <TABLE>
- <INPUT TYPE="radio" NAME="radio_name_507" />
+ <DIV>
+ <INPUT TYPE="radio" />
<LABEL> value1</LABEL>
- </TABLE>
+ </DIV>
</test>
</tests>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItems.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItems.jsp 2008-11-20 13:58:18 UTC (rev 11903)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItems.jsp 2008-11-20 14:02:57 UTC (rev 11904)
@@ -7,7 +7,7 @@
<body>
<f:view>
- <h1><h:outputText value="selecItems" /></h1>
+ <h1><h:outputText value="selectItems" /></h1>
<h:outputText value="selectitems:" />
@@ -21,6 +21,9 @@
<h:selectOneRadio>
<f:selectItems value="someValue" id="selectItems3" />
+ <f:selectItems value="someValue" id="selectItems3" />
+ <f:selectItems value="someValue" id="selectItems3" />
+ <f:selectItems value="someValue" id="selectItems3" />
</h:selectOneRadio>
</f:view>
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItems.jsp.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItems.jsp.xml 2008-11-20 13:58:18 UTC (rev 11903)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectItems.jsp.xml 2008-11-20 14:02:57 UTC (rev 11904)
@@ -1,15 +1,19 @@
<tests>
<test id="selectItems1">
- <SPAN>
- <INPUT TYPE="checkbox" />
+ <SPAN STYLE="-moz-user-modify: read-write;">
+ <INPUT TYPE="checkbox"/>
+ <LABEL>
+ <SPAN>someValue</SPAN>
+ </LABEL>
</SPAN>
</test>
<test id="selectItems2">
<OPTION>someValue</OPTION>
</test>
<test id="selectItems3">
- <SPAN>
- <INPUT TYPE="radio" />
- </SPAN>
+ <DIV>
+ <INPUT TYPE="radio" />
+ <LABEL>someValue</LABEL>
+ </DIV>
</test>
</tests>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectOneRadio.jsp.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectOneRadio.jsp.xml 2008-11-20 13:58:18 UTC (rev 11903)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/selectOneRadio.jsp.xml 2008-11-20 14:02:57 UTC (rev 11904)
@@ -3,34 +3,34 @@
<TABLE BORDER="1">
<TR>
<TD>
- <TABLE>
- <INPUT TYPE="radio" NAME="radio_name_253" DIR="" SIZE="" />
+ <DIV>
+ <INPUT TYPE="radio" DIR="" SIZE="" />
<LABEL> value1</LABEL>
- </TABLE>
+ </DIV>
</TD>
</TR>
<TR>
<TD>
- <TABLE>
- <INPUT TYPE="radio" NAME="radio_name_253" DIR="" SIZE="" />
+ <DIV>
+ <INPUT TYPE="radio" DIR="" SIZE="" />
<LABEL> value2</LABEL>
- </TABLE>
+ </DIV>
</TD>
</TR>
<TR>
<TD>
- <TABLE>
- <INPUT TYPE="radio" NAME="radio_name_253" DIR="" SIZE="" />
+ <DIV>
+ <INPUT TYPE="radio" DIR="" SIZE="" />
<LABEL> value3</LABEL>
- </TABLE>
+ </DIV>
</TD>
</TR>
<TR>
<TD>
- <TABLE>
- <INPUT TYPE="radio" NAME="radio_name_253" DIR="" SIZE="" />
+ <DIV>
+ <INPUT TYPE="radio" DIR="" SIZE="" />
<LABEL> value4</LABEL>
- </TABLE>
+ </DIV>
</TD>
</TR>
</TABLE>
@@ -39,28 +39,28 @@
<TABLE>
<TR>
<TD>
- <TABLE>
- <INPUT TYPE="radio" NAME="radio_name_506" DIR="ltr" />
+ <DIV>
+ <INPUT TYPE="radio" DIR="ltr" />
<LABEL> value1</LABEL>
- </TABLE>
+ </DIV>
</TD>
<TD>
- <TABLE>
- <INPUT TYPE="radio" NAME="radio_name_506" DIR="ltr" />
+ <DIV>
+ <INPUT TYPE="radio" DIR="ltr" />
<LABEL> value2</LABEL>
- </TABLE>
+ </DIV>
</TD>
<TD>
- <TABLE>
- <INPUT TYPE="radio" NAME="radio_name_506" DIR="ltr" />
+ <DIV>
+ <INPUT TYPE="radio" DIR="ltr" />
<LABEL> value3</LABEL>
- </TABLE>
+ </DIV>
</TD>
<TD>
- <TABLE>
- <INPUT TYPE="radio" NAME="radio_name_506" DIR="ltr" />
+ <DIV>
+ <INPUT TYPE="radio" DIR="ltr" />
<LABEL> value4</LABEL>
- </TABLE>
+ </DIV>
</TD>
</TR>
</TABLE>
17 years, 5 months