JBoss Tools SVN: r12560 - in trunk/vpe/plugins: org.jboss.tools.vpe/ve and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-12-11 14:35:06 -0500 (Thu, 11 Dec 2008)
New Revision: 12560
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
trunk/vpe/plugins/org.jboss.tools.vpe/ve/EditorOverride.css
Log:
RESOLVED - issue JBIDE-2115: VPE can't apply link styles.
https://jira.jboss.org/jira/browse/JBIDE-2115
CSS class 'vpe-text' has been created and used in HtmlTextTemplate .
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-12-11 19:08:03 UTC (rev 12559)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-12-11 19:35:06 UTC (rev 12560)
@@ -61,6 +61,12 @@
public static final String TAG_A = "A"; //$NON-NLS-1$
public static final String TAG_H1 = "H1"; //$NON-NLS-1$
public static final String TAG_FORM = "FORM"; //$NON-NLS-1$
+
+ /**Use this class if you want to wrap a text node in a span that
+ * must not affect visual representation of the text node.
+ * <p/>
+ * See also EditorOverride.css .*/
+ public static final String CLASS_VPE_TEXT = "vpe-text"; //$NON-NLS-1$
public static final String ATTR_ID = "ID"; //$NON-NLS-1$
public static final String ATTR_TYPE = "TYPE"; //$NON-NLS-1$
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/ve/EditorOverride.css
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/ve/EditorOverride.css 2008-12-11 19:08:03 UTC (rev 12559)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/ve/EditorOverride.css 2008-12-11 19:35:06 UTC (rev 12560)
@@ -333,3 +333,67 @@
a[\_moz_anonclass="mozTableRemoveRow"]:active {
background-image: url("resource:/res/table-remove-row-active.gif");
}
+
+span.vpe-text {
+ background :inherit !important;
+ background-image:none !important;
+ border :0px !important;
+ bottom :inherit !important;
+ caption-side :inherit !important;
+ clear :inherit !important;
+ clip :inherit !important;
+ color :inherit !important;
+ content :inherit !important;
+ counter-increment :inherit !important;
+ counter-reset :inherit !important;
+ cursor :inherit !important;
+ direction :inherit !important;
+ /*display :inherit !important;*/
+ empty-cells :inherit !important;
+ float :inherit !important;
+ font :inherit !important;
+ height :inherit !important;
+ left :inherit !important;
+ letter-spacing :inherit !important;
+ line-height :inherit !important;
+ list-style :inherit !important;
+ list-style-image :inherit !important;
+ list-style-position :inherit !important;
+ list-style-type :inherit !important;
+ margin :0 !important;
+ max-height :inherit !important;
+ max-width :inherit !important;
+ min-height :inherit !important;
+ min-width :inherit !important;
+ orphans :inherit !important;
+ outline :none !important; /*ccs3-modsel-162.html*/
+ /*outline-color :inherit !important;
+ outline-width :inherit !important;
+ outline-style :inherit !important;*/
+ overflow :inherit !important;
+ padding :0 !important;
+ page :inherit !important;
+ page-break-after :inherit !important;
+ page-break-before :inherit !important;
+ page-break-inside :inherit !important;
+ /*position :inherit !important;*/
+ quotes :inherit !important;
+ right :inherit !important;
+ size :inherit !important;
+ table-layout :inherit !important;
+ text-align :inherit !important;
+ text-decoration :inherit !important;
+ text-indent :inherit !important;
+ text-transform :inherit !important;
+ top :inherit !important;
+ unicode-bidi :inherit !important;
+ vertical-align :inherit !important;
+ visibility :inherit !important;
+ white-space :inherit !important;
+ widows :inherit !important;
+ width :inherit !important;
+ word-spacing :inherit !important;
+ z-index :inherit !important;
+ font-size-adjust :inherit !important;
+ opacity :inherit !important;
+}
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java 2008-12-11 19:08:03 UTC (rev 12559)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java 2008-12-11 19:35:06 UTC (rev 12560)
@@ -45,6 +45,7 @@
.createTextNode(visualText);
//Max Areshkau without this span, we can't select text element
nsIDOMElement element = visualDocument.createElement(HTML.TAG_SPAN);
+ element.setAttribute(HTML.ATTR_CLASS, HTML.CLASS_VPE_TEXT);
element.appendChild(visualNewTextNode);
VpeElementData textElementData = new VpeElementData();
@@ -52,6 +53,7 @@
textElementData.addNodeData(nodeData);
VpeCreationData result = new VpeCreationData(element);
result.setElementData(textElementData);
+
return result;
}
}
17 years
JBoss Tools SVN: r12559 - in branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-12-11 14:08:03 -0500 (Thu, 11 Dec 2008)
New Revision: 12559
Modified:
branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java
branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3335
Modified: branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java
===================================================================
--- branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java 2008-12-11 19:04:23 UTC (rev 12558)
+++ branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java 2008-12-11 19:08:03 UTC (rev 12559)
@@ -16,6 +16,8 @@
import java.util.jar.JarFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.EarUtilities;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
/**
@@ -113,4 +115,39 @@
}
return packageName;
}
+
+ /**
+ * Finds referencing Seam war project
+ * @param project
+ * @return
+ */
+ public static ISeamProject findReferencingSeamWarProjectForProject(IProject project) {
+ return findReferencingSeamWarProjectForProject(project, true);
+ }
+
+ /**
+ * Finds referencing Seam war project
+ * @param project
+ * @param searchInEARs if "true" then try to search web projects in parent EAR project.
+ * @return
+ */
+ public static ISeamProject findReferencingSeamWarProjectForProject(IProject project, boolean searchInEARs) {
+ IProject[] referencing = J2EEProjectUtilities.getReferencingWebProjects(project);
+ for (int i = 0; i < referencing.length; i++) {
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(referencing[i], false);
+ if(seamProject!=null) {
+ return seamProject;
+ }
+ }
+ if(searchInEARs) {
+ referencing = J2EEProjectUtilities.getReferencingEARProjects(project);
+ for (int i = 0; i < referencing.length; i++) {
+ ISeamProject seamProject = findReferencingSeamWarProjectForProject(referencing[i], false);
+ if(seamProject!=null) {
+ return seamProject;
+ }
+ }
+ }
+ return null;
+ }
}
\ No newline at end of file
Modified: branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2008-12-11 19:04:23 UTC (rev 12558)
+++ branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2008-12-11 19:08:03 UTC (rev 12559)
@@ -163,7 +163,7 @@
public String getParentProjectName() {
IEclipsePreferences p = getSeamPreferences();
- return p == null ? null : p.get("seam.parent.project", null);
+ return p == null ? null : p.get(ISeamFacetDataModelProperties.SEAM_PARENT_PROJECT, null);
}
public ISeamProject getParentProject() {
Modified: branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
--- branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-12-11 19:04:23 UTC (rev 12558)
+++ branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-12-11 19:08:03 UTC (rev 12559)
@@ -76,7 +76,6 @@
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
@@ -852,50 +851,62 @@
final IDataModel model) {
IScopeContext projectScope = new ProjectScope(project);
IEclipsePreferences prefs = projectScope.getNode(SeamCorePlugin.PLUGIN_ID);
-
- prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());
prefs.put(SEAM_SETTINGS_VERSION, SEAM_SETTINGS_VERSION_1_1);
- if(model.getProperty(SEAM_RUNTIME_NAME)!=null) {
- prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
+ boolean standaloneProject = true;
+ if(projectType==ProjectType.EJB) {
+ // Try to find parent web seam project for that ejb project.
+ ISeamProject parentWebProject = SeamUtil.findReferencingSeamWarProjectForProject(project);
+ if(parentWebProject!=null) {
+ // set parent web Seam project.
+ prefs.put(SEAM_PARENT_PROJECT, parentWebProject.getProject().getName());
+ standaloneProject = false;
+ }
}
- if(model.getProperty(SEAM_CONNECTION_PROFILE)!=null) {
- prefs.put(SEAM_CONNECTION_PROFILE, model.getProperty(SEAM_CONNECTION_PROFILE).toString());
- }
- prefs.put(SESSION_BEAN_PACKAGE_NAME, model.getProperty(SESSION_BEAN_PACKAGE_NAME).toString());
- prefs.put(ENTITY_BEAN_PACKAGE_NAME, model.getProperty(ENTITY_BEAN_PACKAGE_NAME).toString());
- prefs.put(TEST_CASES_PACKAGE_NAME, model.getProperty(TEST_CASES_PACKAGE_NAME).toString());
- prefs.put(TEST_CREATING, "false"); //$NON-NLS-1$
- prefs.put(SEAM_TEST_PROJECT, project.getName());
- IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFolder rootFolder = component.getRootFolder();
- IContainer webRootFolder = rootFolder.getFolder(new Path("/")).getUnderlyingFolder(); //$NON-NLS-1$
- String webRootFolderPath = webRootFolder.getFullPath().toString();
- IPath srcRootFolder = null;
- if(projectType == ProjectType.WAR) {
- srcRootFolder = rootFolder.getFolder(new Path("/WEB-INF/classes")).getUnderlyingFolder().getParent().getFullPath(); //$NON-NLS-1$
- } else if(projectType == ProjectType.EJB) {
- try {
- srcRootFolder = getSrcFolder(project).getFullPath();
- } catch (JavaModelException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- srcRootFolder = new Path(""); //$NON-NLS-1$
+ if(standaloneProject) {
+ prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());
+ if(model.getProperty(SEAM_RUNTIME_NAME)!=null) {
+ prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
}
+ if(model.getProperty(SEAM_CONNECTION_PROFILE)!=null) {
+ prefs.put(SEAM_CONNECTION_PROFILE, model.getProperty(SEAM_CONNECTION_PROFILE).toString());
+ }
+ prefs.put(SESSION_BEAN_PACKAGE_NAME, model.getProperty(SESSION_BEAN_PACKAGE_NAME).toString());
+ prefs.put(ENTITY_BEAN_PACKAGE_NAME, model.getProperty(ENTITY_BEAN_PACKAGE_NAME).toString());
+ prefs.put(TEST_CASES_PACKAGE_NAME, model.getProperty(TEST_CASES_PACKAGE_NAME).toString());
+ prefs.put(TEST_CREATING, "false"); //$NON-NLS-1$
+ prefs.put(SEAM_TEST_PROJECT, project.getName());
+
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder rootFolder = component.getRootFolder();
+ IContainer webRootFolder = rootFolder.getFolder(new Path("/")).getUnderlyingFolder(); //$NON-NLS-1$
+ String webRootFolderPath = webRootFolder.getFullPath().toString();
+ IPath srcRootFolder = null;
+ if(projectType == ProjectType.WAR) {
+ srcRootFolder = rootFolder.getFolder(new Path("/WEB-INF/classes")).getUnderlyingFolder().getParent().getFullPath(); //$NON-NLS-1$
+ } else if(projectType == ProjectType.EJB) {
+ try {
+ srcRootFolder = getSrcFolder(project).getFullPath();
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ srcRootFolder = new Path(""); //$NON-NLS-1$
+ }
+ }
+ if(projectType == ProjectType.WAR) {
+ prefs.put(WEB_CONTENTS_FOLDER, webRootFolderPath);
+ } else {
+ prefs.put(WEB_CONTENTS_FOLDER, srcRootFolder.toString());
+ }
+
+ if(!isWarConfiguration(model)) {
+ prefs.put(SEAM_EJB_PROJECT, project.getName());
+ prefs.put(SEAM_EAR_PROJECT, project.getName());
+ }
+ prefs.put(ENTITY_BEAN_SOURCE_FOLDER, srcRootFolder.toString());
+ prefs.put(SESSION_BEAN_SOURCE_FOLDER, srcRootFolder.toString());
+ prefs.put(TEST_SOURCE_FOLDER, srcRootFolder.toString());
}
- if(projectType == ProjectType.WAR) {
- prefs.put(WEB_CONTENTS_FOLDER, webRootFolderPath);
- } else {
- prefs.put(WEB_CONTENTS_FOLDER, srcRootFolder.toString());
- }
- if(!isWarConfiguration(model)) {
- prefs.put(SEAM_EJB_PROJECT, project.getName());
- prefs.put(SEAM_EAR_PROJECT, project.getName());
- }
- prefs.put(ENTITY_BEAN_SOURCE_FOLDER, srcRootFolder.toString());
- prefs.put(SESSION_BEAN_SOURCE_FOLDER, srcRootFolder.toString());
- prefs.put(TEST_SOURCE_FOLDER, srcRootFolder.toString());
-
try {
prefs.flush();
} catch (BackingStoreException e) {
17 years
JBoss Tools SVN: r12558 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-12-11 14:04:23 -0500 (Thu, 11 Dec 2008)
New Revision: 12558
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3335
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java 2008-12-11 17:37:07 UTC (rev 12557)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamUtil.java 2008-12-11 19:04:23 UTC (rev 12558)
@@ -16,6 +16,8 @@
import java.util.jar.JarFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.EarUtilities;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
/**
@@ -113,4 +115,39 @@
}
return packageName;
}
+
+ /**
+ * Finds referencing Seam war project
+ * @param project
+ * @return
+ */
+ public static ISeamProject findReferencingSeamWarProjectForProject(IProject project) {
+ return findReferencingSeamWarProjectForProject(project, true);
+ }
+
+ /**
+ * Finds referencing Seam war project
+ * @param project
+ * @param searchInEARs if "true" then try to search web projects in parent EAR project.
+ * @return
+ */
+ public static ISeamProject findReferencingSeamWarProjectForProject(IProject project, boolean searchInEARs) {
+ IProject[] referencing = J2EEProjectUtilities.getReferencingWebProjects(project);
+ for (int i = 0; i < referencing.length; i++) {
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(referencing[i], false);
+ if(seamProject!=null) {
+ return seamProject;
+ }
+ }
+ if(searchInEARs) {
+ referencing = J2EEProjectUtilities.getReferencingEARProjects(project);
+ for (int i = 0; i < referencing.length; i++) {
+ ISeamProject seamProject = findReferencingSeamWarProjectForProject(referencing[i], false);
+ if(seamProject!=null) {
+ return seamProject;
+ }
+ }
+ }
+ return null;
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2008-12-11 17:37:07 UTC (rev 12557)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2008-12-11 19:04:23 UTC (rev 12558)
@@ -163,7 +163,7 @@
public String getParentProjectName() {
IEclipsePreferences p = getSeamPreferences();
- return p == null ? null : p.get("seam.parent.project", null);
+ return p == null ? null : p.get(ISeamFacetDataModelProperties.SEAM_PARENT_PROJECT, null);
}
public ISeamProject getParentProject() {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-12-11 17:37:07 UTC (rev 12557)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-12-11 19:04:23 UTC (rev 12558)
@@ -76,7 +76,6 @@
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
@@ -852,50 +851,62 @@
final IDataModel model) {
IScopeContext projectScope = new ProjectScope(project);
IEclipsePreferences prefs = projectScope.getNode(SeamCorePlugin.PLUGIN_ID);
-
- prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());
prefs.put(SEAM_SETTINGS_VERSION, SEAM_SETTINGS_VERSION_1_1);
- if(model.getProperty(SEAM_RUNTIME_NAME)!=null) {
- prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
+ boolean standaloneProject = true;
+ if(projectType==ProjectType.EJB) {
+ // Try to find parent web seam project for that ejb project.
+ ISeamProject parentWebProject = SeamUtil.findReferencingSeamWarProjectForProject(project);
+ if(parentWebProject!=null) {
+ // set parent web Seam project.
+ prefs.put(SEAM_PARENT_PROJECT, parentWebProject.getProject().getName());
+ standaloneProject = false;
+ }
}
- if(model.getProperty(SEAM_CONNECTION_PROFILE)!=null) {
- prefs.put(SEAM_CONNECTION_PROFILE, model.getProperty(SEAM_CONNECTION_PROFILE).toString());
- }
- prefs.put(SESSION_BEAN_PACKAGE_NAME, model.getProperty(SESSION_BEAN_PACKAGE_NAME).toString());
- prefs.put(ENTITY_BEAN_PACKAGE_NAME, model.getProperty(ENTITY_BEAN_PACKAGE_NAME).toString());
- prefs.put(TEST_CASES_PACKAGE_NAME, model.getProperty(TEST_CASES_PACKAGE_NAME).toString());
- prefs.put(TEST_CREATING, "false"); //$NON-NLS-1$
- prefs.put(SEAM_TEST_PROJECT, project.getName());
- IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFolder rootFolder = component.getRootFolder();
- IContainer webRootFolder = rootFolder.getFolder(new Path("/")).getUnderlyingFolder(); //$NON-NLS-1$
- String webRootFolderPath = webRootFolder.getFullPath().toString();
- IPath srcRootFolder = null;
- if(projectType == ProjectType.WAR) {
- srcRootFolder = rootFolder.getFolder(new Path("/WEB-INF/classes")).getUnderlyingFolder().getParent().getFullPath(); //$NON-NLS-1$
- } else if(projectType == ProjectType.EJB) {
- try {
- srcRootFolder = getSrcFolder(project).getFullPath();
- } catch (JavaModelException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- srcRootFolder = new Path(""); //$NON-NLS-1$
+ if(standaloneProject) {
+ prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());
+ if(model.getProperty(SEAM_RUNTIME_NAME)!=null) {
+ prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
}
+ if(model.getProperty(SEAM_CONNECTION_PROFILE)!=null) {
+ prefs.put(SEAM_CONNECTION_PROFILE, model.getProperty(SEAM_CONNECTION_PROFILE).toString());
+ }
+ prefs.put(SESSION_BEAN_PACKAGE_NAME, model.getProperty(SESSION_BEAN_PACKAGE_NAME).toString());
+ prefs.put(ENTITY_BEAN_PACKAGE_NAME, model.getProperty(ENTITY_BEAN_PACKAGE_NAME).toString());
+ prefs.put(TEST_CASES_PACKAGE_NAME, model.getProperty(TEST_CASES_PACKAGE_NAME).toString());
+ prefs.put(TEST_CREATING, "false"); //$NON-NLS-1$
+ prefs.put(SEAM_TEST_PROJECT, project.getName());
+
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder rootFolder = component.getRootFolder();
+ IContainer webRootFolder = rootFolder.getFolder(new Path("/")).getUnderlyingFolder(); //$NON-NLS-1$
+ String webRootFolderPath = webRootFolder.getFullPath().toString();
+ IPath srcRootFolder = null;
+ if(projectType == ProjectType.WAR) {
+ srcRootFolder = rootFolder.getFolder(new Path("/WEB-INF/classes")).getUnderlyingFolder().getParent().getFullPath(); //$NON-NLS-1$
+ } else if(projectType == ProjectType.EJB) {
+ try {
+ srcRootFolder = getSrcFolder(project).getFullPath();
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ srcRootFolder = new Path(""); //$NON-NLS-1$
+ }
+ }
+ if(projectType == ProjectType.WAR) {
+ prefs.put(WEB_CONTENTS_FOLDER, webRootFolderPath);
+ } else {
+ prefs.put(WEB_CONTENTS_FOLDER, srcRootFolder.toString());
+ }
+
+ if(!isWarConfiguration(model)) {
+ prefs.put(SEAM_EJB_PROJECT, project.getName());
+ prefs.put(SEAM_EAR_PROJECT, project.getName());
+ }
+ prefs.put(ENTITY_BEAN_SOURCE_FOLDER, srcRootFolder.toString());
+ prefs.put(SESSION_BEAN_SOURCE_FOLDER, srcRootFolder.toString());
+ prefs.put(TEST_SOURCE_FOLDER, srcRootFolder.toString());
}
- if(projectType == ProjectType.WAR) {
- prefs.put(WEB_CONTENTS_FOLDER, webRootFolderPath);
- } else {
- prefs.put(WEB_CONTENTS_FOLDER, srcRootFolder.toString());
- }
- if(!isWarConfiguration(model)) {
- prefs.put(SEAM_EJB_PROJECT, project.getName());
- prefs.put(SEAM_EAR_PROJECT, project.getName());
- }
- prefs.put(ENTITY_BEAN_SOURCE_FOLDER, srcRootFolder.toString());
- prefs.put(SESSION_BEAN_SOURCE_FOLDER, srcRootFolder.toString());
- prefs.put(TEST_SOURCE_FOLDER, srcRootFolder.toString());
-
try {
prefs.flush();
} catch (BackingStoreException e) {
17 years
JBoss Tools SVN: r12557 - trunk/documentation/qa/docs/Test_Cases/Test_Projects.
by jbosstools-commits@lists.jboss.org
Author: anis
Date: 2008-12-11 12:37:07 -0500 (Thu, 11 Dec 2008)
New Revision: 12557
Added:
trunk/documentation/qa/docs/Test_Cases/Test_Projects/StrutsOpenOnsTestProjectZ.rar
Log:
Added a file remotely
Added: trunk/documentation/qa/docs/Test_Cases/Test_Projects/StrutsOpenOnsTestProjectZ.rar
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/docs/Test_Cases/Test_Projects/StrutsOpenOnsTestProjectZ.rar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years
JBoss Tools SVN: r12556 - trunk/documentation/qa/docs/Test_Cases/Test_Projects.
by jbosstools-commits@lists.jboss.org
Author: anis
Date: 2008-12-11 12:36:36 -0500 (Thu, 11 Dec 2008)
New Revision: 12556
Added:
trunk/documentation/qa/docs/Test_Cases/Test_Projects/JSPOpenOnsTestProject.rar
Log:
Added a file remotely
Added: trunk/documentation/qa/docs/Test_Cases/Test_Projects/JSPOpenOnsTestProject.rar
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/docs/Test_Cases/Test_Projects/JSPOpenOnsTestProject.rar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years
JBoss Tools SVN: r12555 - trunk/documentation/qa/docs/Test_Cases/Test_Projects.
by jbosstools-commits@lists.jboss.org
Author: anis
Date: 2008-12-11 12:36:15 -0500 (Thu, 11 Dec 2008)
New Revision: 12555
Added:
trunk/documentation/qa/docs/Test_Cases/Test_Projects/JSFOpenOnsTestProject.rar
Log:
Added a file remotely
Added: trunk/documentation/qa/docs/Test_Cases/Test_Projects/JSFOpenOnsTestProject.rar
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/docs/Test_Cases/Test_Projects/JSFOpenOnsTestProject.rar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years
JBoss Tools SVN: r12553 - branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-12-11 12:27:21 -0500 (Thu, 11 Dec 2008)
New Revision: 12553
Modified:
branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
Log:
JBIDE-3372 java.lang.NullPointerException when try to make openOn on styleClass="name #{invalid?'errors':''}" for seam components.
Issue is fixed
Modified: branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
===================================================================
--- branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2008-12-11 17:05:14 UTC (rev 12552)
+++ branches/jbosstools-3.0.0.CR1/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2008-12-11 17:27:21 UTC (rev 12553)
@@ -284,7 +284,7 @@
}
List<IJavaElement> javaElements = findJavaElements(document, region);
- if (javaElements != null || javaElements.size() > 0) {
+ if (javaElements != null && javaElements.size() > 0) {
return true;
}
17 years
JBoss Tools SVN: r12552 - trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-12-11 12:05:14 -0500 (Thu, 11 Dec 2008)
New Revision: 12552
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
Log:
JBIDE-3372 java.lang.NullPointerException when try to make openOn on styleClass="name #{invalid?'errors':''}" for seam components.
Issue is fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2008-12-11 16:28:37 UTC (rev 12551)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2008-12-11 17:05:14 UTC (rev 12552)
@@ -284,7 +284,7 @@
}
List<IJavaElement> javaElements = findJavaElements(document, region);
- if (javaElements != null || javaElements.size() > 0) {
+ if (javaElements != null && javaElements.size() > 0) {
return true;
}
17 years
JBoss Tools SVN: r12551 - in trunk: jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: izhukov
Date: 2008-12-11 11:28:37 -0500 (Thu, 11 Dec 2008)
New Revision: 12551
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPaint2DTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inplaceInput.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inplaceInput.xhtml.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
Log:
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java 2008-12-11 15:08:09 UTC (rev 12550)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java 2008-12-11 16:28:37 UTC (rev 12551)
@@ -9,19 +9,14 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-
package org.jboss.tools.jsf.vpe.richfaces.template;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
@@ -35,7 +30,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-
/**
* Base class for both {@link RichFacesInplaceInputTemplate} and {@link
* RichFacesInplaceSelectTemplate}.
@@ -46,16 +40,6 @@
*/
public abstract class RichFacesAbstractInplaceTemplate extends AbstractRichFacesTemplate implements VpeToggableTemplate {
- /**
- *
- */
- protected static final String CONTROLS_VERTICAL_POSITION_DEFAULT_VALUE = "center"; //$NON-NLS-1$
-
- /**
- *
- */
- private static final String CONTROLS_HORIZONTAL_POSITION_DEFAULT_VALUE = "right"; //$NON-NLS-1$
-
/** The Constant APPLY_BUTTON_GIF. */
protected static final String APPLY_BUTTON_GIF = "/applyButton.gif"; //$NON-NLS-1$
@@ -68,9 +52,6 @@
/** The Constant DEFAULT_INPUT_WIDTH_VALUE. */
protected static final String DEFAULT_INPUT_WIDTH_VALUE = "66px"; //$NON-NLS-1$
- /** The Constant DEFAULT_NULL_VALUE. */
- protected static final String DEFAULT_NULL_VALUE = " "; //$NON-NLS-1$
-
/** The Constant DEFAULT_VERTICAL_POSITION. */
protected static final String DEFAULT_VERTICAL_POSITION = null;
@@ -88,6 +69,8 @@
private static final String DEFAULT_LAYOUT = "inline"; //$NON-NLS-1$
+ private static final String ALTERNATE_LAYOUT = "block"; //$NON-NLS-1$
+
/** The button images. */
protected final Map<String, String> buttonImages = new HashMap<String, String>();
@@ -105,10 +88,8 @@
/** The edit class. */
protected String editClass;
-
/** The view class. */
protected String viewClass;
-
/** The control class. */
protected String controlClass;
@@ -122,18 +103,16 @@
protected String sourceValue;
/** The Constant SPACER_GIF. */
- protected final String SPACER_GIF = getCssExtension()+"/spacer.gif"; //$NON-NLS-1$
+ protected final String SPACER_GIF = getCssExtension() + "/spacer.gif"; //$NON-NLS-1$
/** The style class. */
protected String styleClass;
-
+
protected String sourceCancelButtonIcon;
-
protected String sourceApplyButtonIcon;
-
+
protected String sourceLayout;
-
-
+
/**
* The Constructor.
*/
@@ -144,18 +123,15 @@
initPositions();
}
-
-
/**
* Creates the root span template method.
- *
+ *
* @param visualDocument the visual document
* @param source the source
- *
* @return the ns IDOM element
*/
protected nsIDOMElement createRootSpanTemplateMethod(Element source, nsIDOMDocument visualDocument) {
- final nsIDOMElement rootSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ final nsIDOMElement rootSpan = visualDocument.createElement(HTML.TAG_SPAN);
// if(!(this.showControls && this.isToggle)){
rootSpan.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(this.isToggle));
// }
@@ -163,110 +139,102 @@
String rootStyleClass = "rich-inplace" + getCssStylesSuffix(); //$NON-NLS-1$
for (String sc : getRootSpanClasses()) {
if (ComponentUtil.isNotBlank(sc)) {
- rootStyleClass += " " + sc; //$NON-NLS-1$
- }
- }
+ rootStyleClass += Constants.WHITE_SPACE + sc;
+ }
+ }
rootSpan.setAttribute(HTML.ATTR_CLASS, rootStyleClass);
- String style = ""; //$NON-NLS-1$
+ String style = Constants.EMPTY;
if (this.isToggle) {
style = "position: relative;"; //$NON-NLS-1$
}
- rootSpan.setAttribute(HTML.ATTR_STYLE, style + "; display:"+this.sourceLayout+"; "); //$NON-NLS-1$ //$NON-NLS-2$
+ rootSpan.setAttribute(HTML.ATTR_STYLE, style + "; display:" + this.sourceLayout + Constants.SEMICOLON); //$NON-NLS-1$
return rootSpan;
-
}
-
/**
* Gets the css extension.
- *
+ *
* @return the css extension
*/
protected abstract String getCssExtension();
/**
* Gets the css style.
- *
+ *
* @return the css style
*/
protected abstract String getCssStyle();
/**
* Gets the css styles suffix.
- *
+ *
* @return the css styles suffix
*/
protected abstract String getCssStylesSuffix();
/**
* Gets the root span classes.
- *
+ *
* @return the root span classes
*/
protected abstract String[] getRootSpanClasses();
/**
* Gets the value.
- *
+ *
* @return the value
*/
protected String getValue() {
- String rst = ""; //$NON-NLS-1$
+ String rst = Constants.EMPTY;
if (ComponentUtil.isNotBlank(this.defaultLabel)) {
rst = this.defaultLabel;
} else if (ComponentUtil.isBlank(this.defaultLabel) && ComponentUtil.isNotBlank(this.sourceValue)) {
rst = this.sourceValue;
} else {
- rst = DEFAULT_NULL_VALUE;
+ rst = Constants.WHITE_SPACE;
}
return rst;
}
/**
- * Inits the default button images.
+ * Initialize the default button images.
*/
protected void initDefaultButtonImages() {
if (defaultButtonImages.isEmpty()) {
defaultButtonImages.put("cancelControlIcon", getCssExtension() + CANCEL_BUTTON_GIF); //$NON-NLS-1$
defaultButtonImages.put("saveControlIcon", getCssExtension() + APPLY_BUTTON_GIF); //$NON-NLS-1$
}
-
}
/**
- * Inits the default style classes.
+ * Initialize the default style classes.
*/
protected void initDefaultStyleClasses() {
if (defaultStyleClasses.isEmpty()) {
defaultStyleClasses.put("rootSpan", "rich-inplace" + getCssStylesSuffix() + " {0} {1}"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
-
}
/**
- * Inits the positions.
+ * Initialize the positions.
*/
protected void initPositions() {
if (controlsVerticalPositions.isEmpty()) {
- controlsVerticalPositions.put("bottom", "18px"); //$NON-NLS-1$ //$NON-NLS-2$
- controlsVerticalPositions.put("top", "-12px"); //$NON-NLS-1$ //$NON-NLS-2$
- controlsVerticalPositions.put(CONTROLS_VERTICAL_POSITION_DEFAULT_VALUE, "0px"); //$NON-NLS-1$
+ controlsVerticalPositions.put(HTML.VALUE_ALIGN_BOTTOM, "18px"); //$NON-NLS-1$
+ controlsVerticalPositions.put(HTML.VALUE_ALIGN_TOP, "-12px"); //$NON-NLS-1$
+ controlsVerticalPositions.put(HTML.VALUE_ALIGN_CENTER, "0px"); //$NON-NLS-1$
}
if (controlsHorizontalPositions.isEmpty()) {
- controlsHorizontalPositions.put("left", "0px"); //$NON-NLS-1$ //$NON-NLS-2$
- controlsHorizontalPositions.put(CONTROLS_VERTICAL_POSITION_DEFAULT_VALUE, "53px"); //$NON-NLS-1$
+ controlsHorizontalPositions.put(HTML.VALUE_ALIGN_LEFT, "0px"); //$NON-NLS-1$
+ controlsHorizontalPositions.put(HTML.VALUE_ALIGN_CENTER, "53px"); //$NON-NLS-1$
}
}
/**
* Checks if is in key set.
- *
- * @param controlsVerticalPosition2 *
- * param value2 the value2
- * @param value2 the value2
+ *
* @param map the map
- * @param controlsVerticalPositions2 *
- *
+ * @param value2 the value2
* @return true, if is in key set
*/
protected boolean isInKeySet(Map<String, String> map, String value2) {
@@ -281,27 +249,8 @@
}
/**
- * Checks if is recreate at attr change.
- *
- * @param sourceElement the source element
- * @param value the value
- * @param visualDocument the visual document
- * @param visualNode the visual node
- * @param data the data
- * @param pageContext the page context
- * @param name the name
- *
- * @return true, if is recreate at attr change
- */
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMElement visualNode, Object data, String name, String value) {
- return true;
- }
-
- /**
* Prepare data.
- *
+ *
* @param source the source
*/
protected void prepareData(VpePageContext pageContext,Element source) {
@@ -312,12 +261,12 @@
this.sourceValue = source.getAttribute(RichFaces.ATTR_VALUE);
this.sourceLayout = ComponentUtil.getAttribute(source, "layout"); //$NON-NLS-1$
if(ComponentUtil.isBlank(this.sourceLayout) || (!this.sourceLayout.equalsIgnoreCase(DEFAULT_LAYOUT) &&
- !this.sourceLayout.equalsIgnoreCase("block")) ){ //$NON-NLS-1$
+ !this.sourceLayout.equalsIgnoreCase(ALTERNATE_LAYOUT)) ) {
this.sourceLayout = DEFAULT_LAYOUT;
}
this.defaultLabel = source.getAttribute("defaultLabel"); //$NON-NLS-1$
if (ComponentUtil.isBlank(this.sourceValue)) {
- this.sourceValue = DEFAULT_NULL_VALUE;
+ this.sourceValue = Constants.WHITE_SPACE;
}
// if ((source.getAttributeNode("value") != null) && ComponentUtil.isNotBlank(this.sourceValue)
// && (this.sourceValue != DEFAULT_NULL_VALUE) && this.sourceValue.startsWith("#{")) {
@@ -332,68 +281,63 @@
this.showControls = Boolean.parseBoolean(source.getAttribute("showControls")); //$NON-NLS-1$
this.controlsVerticalPosition = source.getAttribute("controlsVerticalPosition"); //$NON-NLS-1$
if (ComponentUtil.isBlank(this.controlsVerticalPosition) || !isInKeySet(controlsVerticalPositions, this.controlsVerticalPosition)) {
- this.controlsVerticalPosition = CONTROLS_VERTICAL_POSITION_DEFAULT_VALUE;
+ this.controlsVerticalPosition = HTML.VALUE_ALIGN_CENTER;
}
this.controlsHorizontalPosition = source.getAttribute("controlsHorizontalPosition"); //$NON-NLS-1$
if (ComponentUtil.isBlank(this.controlsHorizontalPosition)
|| !isInKeySet(controlsHorizontalPositions, this.controlsHorizontalPosition)) {
- this.controlsHorizontalPosition = CONTROLS_HORIZONTAL_POSITION_DEFAULT_VALUE;
+ this.controlsHorizontalPosition = HTML.VALUE_ALIGN_RIGHT;
}
prepareImages(source);
-
}
/**
* Prepare images.
- *
+ *
* @param source the source
*/
protected void prepareImages(Element source) {
for (String key : defaultButtonImages.keySet()) {
String value = ComponentUtil.getAttribute(source, key);
- if(ComponentUtil.isNotBlank(value)){
+ if(ComponentUtil.isNotBlank(value)) {
this.buttonImages.put(key, value);
- }else{
+ } else {
this.buttonImages.put(key, defaultButtonImages.get(key));
}
}
-
}
/**
* Read attributes.
- *
+ *
* @param source the source
*/
protected void readAttributes(Element source) {
this.styleClass = ComponentUtil.getAttribute(source, RichFaces.ATTR_STYLE_CLASS);
this.sourceValue = ComponentUtil.getAttribute(source, RichFaces.ATTR_VALUE);
-
}
-
/**
- * Sets the up img.
- *
- * @param i * @param width the width
- * @param height the height
+ * Sets the up image.
+ *
* @param img the img
+ * @param width the width
+ * @param height the height
+ * @param border the border
* @param image the image
- * @param j * @param border the border
- * @param td1Img */
+ */
protected void setUpImg(nsIDOMElement img, int width, int height, int border, String image) {
ComponentUtil.setImg(img, image);
img.setAttribute(HTML.ATTR_WIDTH, String.valueOf(width));
img.setAttribute(HTML.ATTR_HEIGHT, String.valueOf(height));
img.setAttribute(HTML.ATTR_BORDER, String.valueOf(border));
-
}
/**
* Sets the up span root.
- *
+ *
* @param visualDocument the visual document
* @param spanRoot the span root
* @param source the source
@@ -404,23 +348,19 @@
} else {
spanRoot.setAttribute(HTML.ATTR_CLASS, RICH_INPLACE_VIEW_DEFAULT_STYLE_CLASS);
}
- String value = DEFAULT_NULL_VALUE;
+ String value = Constants.WHITE_SPACE;
if (this.sourceValue.length() > 0) {
value = this.sourceValue;
}
final nsIDOMText text = visualDocument.createTextNode(value);
spanRoot.appendChild(text);
}
-
/**
* Stop toggling.
- *
+ *
* @param sourceNode the source node
- *
- * @see
- * org.jboss.tools.vpe.editor.template.VpeToggableTemplate#stopToggling(
- * org.w3c.dom.Node)
+ * @see org.jboss.tools.vpe.editor.template.VpeToggableTemplate#stopToggling(org.w3c.dom.Node)
*/
public void stopToggling(Node sourceNode) {
this.isToggle = false;
@@ -428,36 +368,31 @@
/**
* Toggle.
- *
+ *
* @param builder the builder
* @param sourceNode the source node
* @param toggleId the toggle id
- *
- * @see
- * org.jboss.tools.vpe.editor.template.VpeToggableTemplate#toggle(org.jboss
- * .tools.vpe.editor.VpeVisualDomBuilder, org.w3c.dom.Node,
- * java.lang.String)
+ *
+ * @see org.jboss.tools.vpe.editor.template.VpeToggableTemplate#toggle(
+ * org.jboss.tools.vpe.editor.VpeVisualDomBuilder, org.w3c.dom.Node, java.lang.String)
*/
public void toggle(VpeVisualDomBuilder builder, Node sourceNode, String toggleId) {
isToggle = !isToggle;
-
}
-
+
protected abstract String getCssStylesControlSuffix();
-
-
+
protected abstract String getControlPositionsSubStyles();
-
+
protected abstract String getMainControlsDivCssClass();
-
/**
* Creates the controls div.
- *
+ *
* @param visualDocument the visual document
* @param sourceNode the source node
* @param pageContext the page context
- *
+ * @param creationData the VpeCreationData object
* @return the ns IDOM element
*/
protected nsIDOMElement createControlsDiv(VpePageContext pageContext,
@@ -469,7 +404,7 @@
element.setAttribute(HTML.ATTR_STYLE, "position: absolute; " + getControlPositionsSubStyles()); //$NON-NLS-1$
final nsIDOMElement divShadov = visualDocument.createElement(HTML.TAG_DIV);
- divShadov.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-shadow"); //$NON-NLS-1$ //$NON-NLS-2$
+ divShadov.setAttribute(HTML.ATTR_CLASS, "rich-inplace" + getCssStylesSuffix() + "-shadow"); //$NON-NLS-1$ //$NON-NLS-2$
final nsIDOMElement divShadovTable = visualDocument.createElement(HTML.TAG_TABLE);
divShadovTable.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
divShadovTable.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
@@ -490,11 +425,11 @@
setUpImg(td2Img, 1, 10, 0, SPACER_GIF);
setUpImg(td3Img, 1, 10, 0, SPACER_GIF);
setUpImg(td4Img, 10, 1, 0, SPACER_GIF);
- divShadovTd1.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-shadow-tl"); //$NON-NLS-1$ //$NON-NLS-2$
- divShadovTd2.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-shadow-tr"); //$NON-NLS-1$ //$NON-NLS-2$
+ divShadovTd1.setAttribute(HTML.ATTR_CLASS, "rich-inplace" + getCssStylesSuffix() + "-shadow-tl"); //$NON-NLS-1$ //$NON-NLS-2$
+ divShadovTd2.setAttribute(HTML.ATTR_CLASS, "rich-inplace" + getCssStylesSuffix() + "-shadow-tr"); //$NON-NLS-1$ //$NON-NLS-2$
- divShadovTd1Tr2.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-shadow-bl"); //$NON-NLS-1$ //$NON-NLS-2$
- divShadovTd2Tr2.setAttribute(HTML.ATTR_CLASS, "rich-inplace"+getCssStylesSuffix()+"-shadow-br"); //$NON-NLS-1$ //$NON-NLS-2$
+ divShadovTd1Tr2.setAttribute(HTML.ATTR_CLASS, "rich-inplace" + getCssStylesSuffix() + "-shadow-bl"); //$NON-NLS-1$ //$NON-NLS-2$
+ divShadovTd2Tr2.setAttribute(HTML.ATTR_CLASS, "rich-inplace" + getCssStylesSuffix() + "-shadow-br"); //$NON-NLS-1$ //$NON-NLS-2$
final nsIDOMElement divButtons = visualDocument.createElement(HTML.TAG_DIV);
divButtons.setAttribute(HTML.ATTR_STYLE, "position: relative; height: 18px;"); //$NON-NLS-1$
@@ -502,100 +437,79 @@
/*
* Encoding controls facet
*/
- Element facetElement = ComponentUtil.getFacetElement((Element) sourceNode, "controls");
- if (null != facetElement) {
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(divButtons);
- childrenInfo.addSourceChild(facetElement);
- creationData.addChildrenInfo(childrenInfo);
- } else {
- /*
- * Create "Apply" button
- */
- final nsIDOMElement applyButtonImg = visualDocument
- .createElement(HTML.TAG_INPUT);
- applyButtonImg.setAttribute(HTML.ATTR_TYPE, "image"); //$NON-NLS-1$
+ Element facetElement = ComponentUtil.getFacetElement((Element) sourceNode, "controls", true); //$NON-NLS-1$
+ if (facetElement != null) {
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(divButtons);
+ childrenInfo.addSourceChild(facetElement);
+ creationData.addChildrenInfo(childrenInfo);
+ } else {
+ // Create "Apply" button
+ final nsIDOMElement applyButtonImg = visualDocument.createElement(HTML.TAG_INPUT);
+ applyButtonImg.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_IMAGE);
+
+ String applyButtonClass = "rich-inplace" + getCssStylesSuffix() + "-control"; //$NON-NLS-1$ //$NON-NLS-2$
+ if (ComponentUtil.isNotBlank(controlClass)) {
+ applyButtonClass += Constants.EMPTY + controlClass;
+ }
+ applyButtonImg.setAttribute(HTML.ATTR_CLASS, applyButtonClass);
+
+ final String saveControlIconImg = buttonImages.get("saveControlIcon"); //$NON-NLS-1$
+ if (defaultButtonImages.containsValue(saveControlIconImg)) {
+ // Set default icon from resources
+ ComponentUtil.setImg(applyButtonImg, saveControlIconImg);
+ } else {
+ // Set custom user icon
+ String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(saveControlIconImg, pageContext, true);
+ applyButtonImg.setAttribute(HTML.ATTR_SRC, imgFullPath);
+ }
+ applyButtonImg.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+
+ // Create "Cancel" button
+ final nsIDOMElement cancelButtonImg = visualDocument.createElement(HTML.TAG_INPUT);
+ cancelButtonImg.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_IMAGE);
+
+ String cancelButtonClass = "rich-inplace" + getCssStylesSuffix() + "-control"; //$NON-NLS-1$ //$NON-NLS-2$
+ if (ComponentUtil.isNotBlank(controlClass)) {
+ cancelButtonClass += Constants.EMPTY + controlClass;
+ }
+ cancelButtonImg.setAttribute(HTML.ATTR_CLASS, cancelButtonClass);
+
+ final String cancelControlIconImg = buttonImages.get("cancelControlIcon"); //$NON-NLS-1$
+ if (defaultButtonImages.containsValue(cancelControlIconImg)) {
+ // Set default icon from resources
+ ComponentUtil.setImg(cancelButtonImg, cancelControlIconImg);
+ } else {
+ // Set custom user icon
+ String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(cancelControlIconImg, pageContext, true);
+ cancelButtonImg.setAttribute(HTML.ATTR_SRC, imgFullPath);
+ }
+ cancelButtonImg.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+
+ divButtons.appendChild(applyButtonImg);
+ divButtons.appendChild(cancelButtonImg);
+
+ /*
+ * Adding shadow to controls
+ */
+ element.appendChild(divShadov);
+ divShadov.appendChild(divShadovTable);
+ divShadovTable.appendChild(divShadovTBody);
+ divShadovTBody.appendChild(divShadovTr1);
+ divShadovTr1.appendChild(divShadovTd1);
+ divShadovTd1.appendChild(td1Img);
+ divShadovTr1.appendChild(divShadovTd2);
+ divShadovTd2.appendChild(td2Img);
+
+ divShadovTBody.appendChild(divShadovTr2);
+ divShadovTr2.appendChild(divShadovTd1Tr2);
+ divShadovTd1Tr2.appendChild(td3Img);
+ divShadovTr2.appendChild(divShadovTd2Tr2);
+ divShadovTd2Tr2.appendChild(td4Img);
+ }
- String applyButtonClass = "rich-inplace" + getCssStylesSuffix() + "-control"; //$NON-NLS-1$ //$NON-NLS-2$
- if (ComponentUtil.isNotBlank(controlClass)) {
- applyButtonClass += " " + controlClass; //$NON-NLS-1$
- }
- applyButtonImg.setAttribute(HTML.ATTR_CLASS, applyButtonClass);
-
- final String saveControlIconImg = buttonImages
- .get("saveControlIcon"); //$NON-NLS-1$
- if (defaultButtonImages.containsValue(saveControlIconImg)) {
- /*
- * Set default icon from resources
- */
- ComponentUtil.setImg(applyButtonImg, saveControlIconImg);
- } else {
- /*
- * Set custom user icon
- */
- String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(saveControlIconImg, pageContext, true);
- applyButtonImg.setAttribute(HTML.ATTR_SRC, imgFullPath);
- }
- applyButtonImg.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String
- .valueOf(0));
-
- /*
- * Create "Cancel" button
- */
- final nsIDOMElement cancelButtonImg = visualDocument
- .createElement(HTML.TAG_INPUT);
- cancelButtonImg.setAttribute(HTML.ATTR_TYPE, "image"); //$NON-NLS-1$
-
- String cancelButtonClass = "rich-inplace" + getCssStylesSuffix() + "-control"; //$NON-NLS-1$ //$NON-NLS-2$
- if (ComponentUtil.isNotBlank(controlClass)) {
- cancelButtonClass += " " + controlClass; //$NON-NLS-1$
- }
- cancelButtonImg.setAttribute(HTML.ATTR_CLASS, cancelButtonClass);
-
- final String cancelControlIconImg = buttonImages
- .get("cancelControlIcon"); //$NON-NLS-1$
- if (defaultButtonImages.containsValue(cancelControlIconImg)) {
- /*
- * Set default icon from resources
- */
- ComponentUtil.setImg(cancelButtonImg, cancelControlIconImg);
- } else {
- /*
- * Set custom user icon
- */
- String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(cancelControlIconImg, pageContext, true);
- cancelButtonImg.setAttribute(HTML.ATTR_SRC, imgFullPath);
- }
- cancelButtonImg.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String
- .valueOf(0));
-
- divButtons.appendChild(applyButtonImg);
- divButtons.appendChild(cancelButtonImg);
-
- /*
- * Adding shadow to controls
- */
- element.appendChild(divShadov);
- divShadov.appendChild(divShadovTable);
- divShadovTable.appendChild(divShadovTBody);
- divShadovTBody.appendChild(divShadovTr1);
- divShadovTr1.appendChild(divShadovTd1);
- divShadovTd1.appendChild(td1Img);
- divShadovTr1.appendChild(divShadovTd2);
- divShadovTd2.appendChild(td2Img);
-
- divShadovTBody.appendChild(divShadovTr2);
- divShadovTr2.appendChild(divShadovTd1Tr2);
- divShadovTd1Tr2.appendChild(td3Img);
- divShadovTr2.appendChild(divShadovTd2Tr2);
- divShadovTd2Tr2.appendChild(td4Img);
- }
-
- /*
- * Adding controls
- */
+ // Adding controls
element.appendChild(divButtons);
-
+
return element;
}
-
-}
+}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java 2008-12-11 15:08:09 UTC (rev 12550)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java 2008-12-11 16:28:37 UTC (rev 12551)
@@ -9,7 +9,6 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-
package org.jboss.tools.jsf.vpe.richfaces.template;
@@ -24,83 +23,75 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-
/**
* Template for the <rich:inplaceInput> component.
- *
+ *
* @author Eugene Stherbin
*/
public class RichFacesInplaceInputTemplate extends RichFacesAbstractInplaceTemplate {
/** The input width. */
- protected String inputWidth;
+ protected String inputWidth = null;
/**
* The Constructor.
*/
public RichFacesInplaceInputTemplate() {
super();
-
}
/**
- * Create0.
- *
- * @param visualDocument the visual document
- * @param sourceNode the source node
- * @param pageContext the page context
- *
- * @return the vpe creation data
+ * 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.<br>
+ * <b>Note</b>: all in-line children will be ignored, except <f:facet> tags with name "controls".
+ * In this case save/cancel controls will be replaced with facet content.
+ *
+ * @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) {
VpeCreationData data = null;
// <span id="j_id5" class="rich-inplace rich-inplace-view" style="">
ComponentUtil.setCSSLink(pageContext, getCssStyle(), getCssExtension());
- final Element source = (Element) sourceNode;
- prepareData(pageContext,source);
- final nsIDOMElement rootSpan = createRootSpanTemplateMethod(source, visualDocument);
+ // cast to Element
+ Element sourceElement = (Element) sourceNode;
+
+ // prepare style classes for inplace input controls
+ prepareData(pageContext, sourceElement);
+
+ final nsIDOMElement rootSpan = createRootSpanTemplateMethod(sourceElement, visualDocument);
final nsIDOMElement innerInput1 = visualDocument.createElement(HTML.TAG_INPUT);
- data = new VpeCreationData(rootSpan);
+ data = new VpeCreationData(rootSpan, true);
- String clazz = ""; //$NON-NLS-1$
- if (this.isToggle) {
+ if (isToggle) {
rootSpan.appendChild(innerInput1);
innerInput1.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
innerInput1.setAttribute(HTML.ATTR_CLASS, "rich-inplace-field"); //$NON-NLS-1$
- innerInput1.setAttribute(HTML.ATTR_STYLE, "top: 0px; width: " + this.inputWidth + ";"); //$NON-NLS-1$ //$NON-NLS-2$
- innerInput1.setAttribute(HTML.ATTR_TYPE, "text"); //$NON-NLS-1$
+ innerInput1.setAttribute(HTML.ATTR_STYLE, "top: 0px; width: " + this.inputWidth + Constants.SEMICOLON); //$NON-NLS-1$
+ innerInput1.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
innerInput1.setAttribute("autocomplete", "off"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
if (showControls) {
rootSpan.appendChild(createControlsDiv(pageContext, sourceNode, visualDocument, data));
}
} else {
- innerInput1.setAttribute(HTML.ATTR_STYLE, "width: " + this.inputWidth + "; position: absolute; left: -32767px;"); //$NON-NLS-1$ //$NON-NLS-2$
- innerInput1.setAttribute(HTML.ATTR_TYPE, "button"); //$NON-NLS-1$
-
+ innerInput1.setAttribute(HTML.ATTR_STYLE,
+ "width: " + this.inputWidth + "; position: absolute; left: -32767px;"); //$NON-NLS-1$ //$NON-NLS-2$
+ innerInput1.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_BUTTON);
+
/*
* Add empty children info to avoid children processing.
* Only available child is "controls" facet
*/
data.addChildrenInfo(new VpeChildrenInfo(rootSpan));
}
-
-
if (!isToggle) {
- final String value = getValue();
-//
-// if (value.equals(DEFAULT_NULL_VALUE)) {
-// final nsIDOMElement innerSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
-// rootSpan.appendChild(innerSpan);
-// innerSpan.appendChild(visualDocument.createTextNode(value));
-// innerSpan.setAttribute(HTML.ATTR_STYLE, "display: none");
-// inner
-// innerSpan.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(this.isToggle));
-//// rootSpan.appendChild(visualDocument.createTextNode(value));
-//// rootSpan.setAttribute(HTML.ATTR_STYLE, rootSpan.getAttribute(HTML.ATTR_STYLE) +" ; display:none");
-// } else {
- rootSpan.appendChild(visualDocument.createTextNode(value));
- // }
+ rootSpan.appendChild(visualDocument.createTextNode(getValue()));
} else {
innerInput1.setAttribute(HTML.ATTR_VALUE, this.sourceValue);
}
@@ -110,10 +101,9 @@
return data;
}
-
/**
* Gets the css extension.
- *
+ *
* @return the css extension
*/
protected String getCssExtension() {
@@ -122,7 +112,7 @@
/**
* Gets the css style.
- *
+ *
* @return the css style
*/
protected String getCssStyle() {
@@ -131,27 +121,25 @@
/**
* Gets the css styles suffix.
- *
+ *
* @return the css styles suffix
- *
- * @see org.jboss.tools.jsf.vpe.richfaces.template.
- * RichFacesAbstractInplaceTemplate#getCssStylesSuffix()
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.RichFacesAbstractInplaceTemplate#getCssStylesSuffix()
*/
@Override
protected String getCssStylesSuffix() {
- return ""; //$NON-NLS-1$
+ return Constants.EMPTY;
}
/**
* Gets the root span classes.
- *
+ *
* @return the root span classes
*/
protected String[] getRootSpanClasses() {
String[] rst = new String[3];
- String clazz = ""; //$NON-NLS-1$
+ String clazz = Constants.EMPTY;
- if (this.isToggle) {
+ if (isToggle) {
rst[0] = "rich-inplace-edit"; //$NON-NLS-1$
if (ComponentUtil.isNotBlank(this.editClass)) {
clazz = this.editClass;
@@ -160,8 +148,8 @@
} else {
rst[0] = "rich-inplace-view"; //$NON-NLS-1$
if (ComponentUtil.isNotBlank(this.viewClass)) {
- clazz = this.viewClass;
- rst[1] = clazz;
+ clazz = this.viewClass;
+ rst[1] = clazz;
}
}
if (ComponentUtil.isNotBlank(this.styleClass)) {
@@ -172,20 +160,19 @@
/**
* Prepare data.
- *
+ *
* @param source the source
*/
- protected void prepareData(VpePageContext pageContext,Element source) {
+ protected void prepareData(VpePageContext pageContext, Element source) {
try {
- this.inputWidth = String.valueOf(ComponentUtil
- .parseWidthHeightValue(source.getAttribute("inputWidth"))) + Constants.PIXEL; //$NON-NLS-1$
+ this.inputWidth = String.valueOf(ComponentUtil.parseWidthHeightValue(source.getAttribute("inputWidth"))) + //$NON-NLS-1$
+ Constants.PIXEL;
} catch (NumberFormatException e) {
this.inputWidth = DEFAULT_INPUT_WIDTH_VALUE;
}
this.controlsHorizontalPositions.put("right", this.inputWidth); //$NON-NLS-1$
- this.controlsHorizontalPositions.put(CONTROLS_VERTICAL_POSITION_DEFAULT_VALUE, "18px"); //$NON-NLS-1$
- super.prepareData(pageContext,source);
-
+ this.controlsHorizontalPositions.put(HTML.VALUE_ALIGN_CENTER, "18px"); //$NON-NLS-1$
+ super.prepareData(pageContext, source);
}
/**
@@ -199,12 +186,11 @@
@Override
protected String getControlPositionsSubStyles() {
return "top: " + controlsVerticalPositions.get(this.controlsVerticalPosition) //$NON-NLS-1$
- + ";left:" + " " + controlsHorizontalPositions.get(this.controlsHorizontalPosition) + ";"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ + ";left:" + " " + controlsHorizontalPositions.get(this.controlsHorizontalPosition) + Constants.SEMICOLON; //$NON-NLS-1$//$NON-NLS-2$
}
@Override
protected String getMainControlsDivCssClass() {
return "rich-inplace"+getCssStylesControlSuffix()+"-controls-set"; //$NON-NLS-1$ //$NON-NLS-2$
}
-
-}
+}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java 2008-12-11 15:08:09 UTC (rev 12550)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java 2008-12-11 16:28:37 UTC (rev 12551)
@@ -9,94 +9,91 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-
package org.jboss.tools.jsf.vpe.richfaces.template;
-
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.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.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-
/**
* Template for <rich:inplaceSelect/> tag.
- *
+ *
* @author Eugene Stherbin
*/
public class RichFacesInplaceSelectTemplate extends RichFacesAbstractInplaceTemplate {
- private static final String _24PX = "24px";
+ private static final String SOURCE_LIST_HEIGHT = "24px"; //$NON-NLS-1$
/** The Constant INPLACE_SELECT_CSS. */
- private static final String INPLACE_SELECT_CSS = "inplaceSelect/inplaceSelect.css";
+ private static final String INPLACE_SELECT_CSS = "inplaceSelect/inplaceSelect.css"; //$NON-NLS-1$
/** The Constant INPLACE_SELECT_EXT. */
- private static final String INPLACE_SELECT_EXT = "inplaceSelect";
+ private static final String INPLACE_SELECT_EXT = "inplaceSelect"; //$NON-NLS-1$
- /** The select width. */
- private String selectWidth;
-
protected String sourceListHeight;
-
+
protected String sourceListWidth;
/**
- * Create.
- *
- * @param visualDocument
- * the visual document
- * @param sourceNode
- * the source node
- * @param pageContext
- * the page context
- *
- * @return the vpe creation data
+ * 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) {
VpeCreationData data = null;
// <span id="j_id5" class="rich-inplace rich-inplace-view" style="">
ComponentUtil.setCSSLink(pageContext, getCssStyle(), getCssExtension());
- final Element source = (Element) sourceNode;
- prepareData(pageContext,source);
- final nsIDOMElement rootSpan = createRootSpanTemplateMethod(source, visualDocument);
- data = new VpeCreationData(rootSpan);
+ // cast to Element
+ final Element sourceElement = (Element) sourceNode;
+ // prepare style classes for inplace input controls
+ prepareData(pageContext, sourceElement);
+
+ final nsIDOMElement rootSpan = createRootSpanTemplateMethod(sourceElement, visualDocument);
+ data = new VpeCreationData(rootSpan, true);
+
if (isToggle) {
- final nsIDOMElement innerInput1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
- final nsIDOMElement innerInput2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ final nsIDOMElement innerInput1 = visualDocument.createElement(HTML.TAG_INPUT);
+ final nsIDOMElement innerInput2 = visualDocument.createElement(HTML.TAG_INPUT);
preapareInputBase(innerInput1);
preapareInputBase(innerInput2);
innerInput1.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
- innerInput1.setAttribute("autocomplete", "off");
- innerInput1.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-field");
- innerInput1.setAttribute(HTML.ATTR_VALUE, ((this.defaultLabel == null) ? "" : this.defaultLabel));
+ innerInput1.setAttribute("autocomplete", "off"); //$NON-NLS-1$ //$NON-NLS-2$
+ innerInput1.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-field"); //$NON-NLS-1$
+ innerInput1.setAttribute(HTML.ATTR_VALUE,
+ ((this.defaultLabel == null) ? Constants.EMPTY : this.defaultLabel));
// TODO
- innerInput1.setAttribute(HTML.ATTR_STYLE, "top: 1px ; width:100px");
+ innerInput1.setAttribute(HTML.ATTR_STYLE, "top: 1px ; width:100px"); //$NON-NLS-1$
innerInput1.setAttribute(HTML.ATTR_VALUE, getValue());
- innerInput2.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-arrow");
+ innerInput2.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-arrow"); //$NON-NLS-1$
// TODO
- innerInput2.setAttribute(HTML.ATTR_STYLE, "top: 2px; left: 89px;");
+ innerInput2.setAttribute(HTML.ATTR_STYLE, "top: 2px; left: 89px;"); //$NON-NLS-1$
rootSpan.appendChild(innerInput1);
rootSpan.appendChild(innerInput2);
- if (ComponentUtil.getSelectItems(source.getChildNodes()).size() > 0) {
- final nsIDOMElement selectList = createSelectedList(source, visualDocument);
+ if (ComponentUtil.getSelectItems(sourceElement.getChildNodes()).size() > 0) {
+ final nsIDOMElement selectList = createSelectedList(sourceElement, visualDocument);
rootSpan.appendChild(selectList);
}
- if (this.showControls) {
+ if (showControls) {
rootSpan.appendChild(createControlsDiv(pageContext, sourceNode, visualDocument, data));
}
-
} else {
rootSpan.appendChild(visualDocument.createTextNode(getValue()));
}
@@ -107,86 +104,80 @@
/**
* Creates the selected list.
- *
- * @param visualDocument
- * the visual document
- * @param source
- * the source
- *
+ *
+ * @param visualDocument the visual document
+ * @param source the source
* @return the ns IDOM element
*/
private nsIDOMElement createSelectedList(Element source, nsIDOMDocument visualDocument) {
// rich-inplace-select-width-list
- final nsIDOMElement div = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ final nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
- div.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-width-list");
+ div.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-width-list"); //$NON-NLS-1$
div.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
- div.setAttribute(HTML.ATTR_STYLE, "position: absolute; height: 100px; left: 0px; top: 22px; visibility: visible;");
+ div.setAttribute(HTML.ATTR_STYLE, "position: absolute; height: 100px; left: 0px; top: 22px; visibility: visible;"); //$NON-NLS-1$
- final nsIDOMElement shadowDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ final nsIDOMElement shadowDiv = visualDocument.createElement(HTML.TAG_DIV);
- shadowDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-shadow");
- shadowDiv.setAttribute(HTML.ATTR_STYLE, "");
+ shadowDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-shadow"); //$NON-NLS-1$
+ shadowDiv.setAttribute(HTML.ATTR_STYLE, Constants.EMPTY);
- final nsIDOMElement table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
- final nsIDOMElement tr1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
- final nsIDOMElement tr2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ final nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ final nsIDOMElement tr1 = visualDocument.createElement(HTML.TAG_TR);
+ final nsIDOMElement tr2 = visualDocument.createElement(HTML.TAG_TR);
- final nsIDOMElement td1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- final nsIDOMElement td2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- final nsIDOMElement td3 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- final nsIDOMElement td4 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ final nsIDOMElement td1 = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement td2 = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement td3 = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement td4 = visualDocument.createElement(HTML.TAG_TD);
- td1.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-tl");
- td2.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-tr");
- td3.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-bl");
- td4.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-br");
+ td1.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-tl"); //$NON-NLS-1$
+ td2.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-tr"); //$NON-NLS-1$
+ td3.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-bl"); //$NON-NLS-1$
+ td4.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-shadow-br"); //$NON-NLS-1$
- final nsIDOMElement img1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
- final nsIDOMElement img2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
- final nsIDOMElement img3 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
- final nsIDOMElement img4 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ final nsIDOMElement img1 = visualDocument.createElement(HTML.TAG_IMG);
+ final nsIDOMElement img2 = visualDocument.createElement(HTML.TAG_IMG);
+ final nsIDOMElement img3 = visualDocument.createElement(HTML.TAG_IMG);
+ final nsIDOMElement img4 = visualDocument.createElement(HTML.TAG_IMG);
setUpImg(img1, 10, 1, 0, SPACER_GIF);
setUpImg(img2, 1, 10, 0, SPACER_GIF);
setUpImg(img3, 1, 10, 0, SPACER_GIF);
setUpImg(img4, 10, 10, 0, SPACER_GIF);
- final nsIDOMElement listPositionDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- listPositionDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-position");
+ final nsIDOMElement listPositionDiv = visualDocument.createElement(HTML.TAG_DIV);
+ listPositionDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-position"); //$NON-NLS-1$
listPositionDiv.setAttribute(VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
- final nsIDOMElement listDecarationDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- listDecarationDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-decoration");
+ final nsIDOMElement listDecarationDiv = visualDocument.createElement(HTML.TAG_DIV);
+ listDecarationDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-decoration"); //$NON-NLS-1$
- final nsIDOMElement listScrollDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ final nsIDOMElement listScrollDiv = visualDocument.createElement(HTML.TAG_DIV);
final List<Element> elements = ComponentUtil.getSelectItems(source.getChildNodes());
// added by estherbin
// fix http://jira.jboss.com/jira/browse/JBIDE-2196
// tramanovich comment.
-
- if (this.sourceListHeight == _24PX) {
+ if (this.sourceListHeight == SOURCE_LIST_HEIGHT) {
int height = 24;
-
if ((elements != null) && (elements.size() > 1)) {
height += ((elements.size() - 2) * 24)+1;
}
- this.sourceListHeight = String.valueOf(height) + String.valueOf("px");
+ this.sourceListHeight = String.valueOf(height) + String.valueOf(Constants.PIXEL);
}
- listScrollDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-scroll");
- listScrollDiv.setAttribute(HTML.ATTR_STYLE, "height:" + this.sourceListHeight + "; width: " + this.sourceListWidth);
+ listScrollDiv.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-list-scroll"); //$NON-NLS-1$
+ listScrollDiv.setAttribute(HTML.ATTR_STYLE, "height:" + this.sourceListHeight + "; width: " + this.sourceListWidth); //$NON-NLS-1$ //$NON-NLS-2$
if (elements.size() > 0) {
for (Element e : elements) {
- final nsIDOMElement span = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ final nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
- span.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-item rich-inplace-select-font");
+ span.setAttribute(HTML.ATTR_CLASS, "rich-inplace-select-item rich-inplace-select-font"); //$NON-NLS-1$
span.appendChild(visualDocument.createTextNode(ComponentUtil.getSelectItemValue(e)));
- span.setAttribute(HTML.ATTR_STYLE, "text-align: left;");
+ span.setAttribute(HTML.ATTR_STYLE, "text-align: left;"); //$NON-NLS-1$
listScrollDiv.appendChild(span);
}
-
}
div.appendChild(shadowDiv);
@@ -201,28 +192,26 @@
tr1.appendChild(td2);
td1.appendChild(img1);
- td1.appendChild(visualDocument.createElement(HtmlComponentUtil.HTML_TAG_BR));
+ td1.appendChild(visualDocument.createElement(HTML.TAG_BR));
td2.appendChild(img2);
- td2.appendChild(visualDocument.createElement(HtmlComponentUtil.HTML_TAG_BR));
+ td2.appendChild(visualDocument.createElement(HTML.TAG_BR));
table.appendChild(tr2);
tr2.appendChild(td3);
tr2.appendChild(td4);
td3.appendChild(img3);
- td3.appendChild(visualDocument.createElement(HtmlComponentUtil.HTML_TAG_BR));
+ td3.appendChild(visualDocument.createElement(HTML.TAG_BR));
td4.appendChild(img4);
- td4.appendChild(visualDocument.createElement(HtmlComponentUtil.HTML_TAG_BR));
+ td4.appendChild(visualDocument.createElement(HTML.TAG_BR));
return div;
}
/**
* Gets the css extension.
- *
+ *
* @return the css extension
- *
- * @see org.jboss.tools.jsf.vpe.richfaces.template.
- * RichFacesAbstractInplaceTemplate#getCssExtension()
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.RichFacesAbstractInplaceTemplate#getCssExtension()
*/
@Override
protected String getCssExtension() {
@@ -231,11 +220,9 @@
/**
* Gets the css style.
- *
+ *
* @return the css style
- *
- * @see org.jboss.tools.jsf.vpe.richfaces.template.
- * RichFacesAbstractInplaceTemplate#getCssStyle()
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.RichFacesAbstractInplaceTemplate#getCssStyle()
*/
@Override
protected String getCssStyle() {
@@ -244,34 +231,31 @@
/**
* Gets the css styles suffix.
- *
+ *
* @return the css styles suffix
*/
@Override
protected String getCssStylesSuffix() {
- return "-select";
+ return "-select"; //$NON-NLS-1$
}
/**
* Gets the root span classes.
- *
+ *
* @return the root span classes
- *
- * @see org.jboss.tools.jsf.vpe.richfaces.template.
- * RichFacesAbstractInplaceTemplate#getRootSpanClasses()
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.RichFacesAbstractInplaceTemplate#getRootSpanClasses()
*/
@Override
protected String[] getRootSpanClasses() {
String[] result = new String[2];
- String clazz = "";
-
+ String clazz = Constants.EMPTY;
if (this.isToggle) {
- result[0] = "rich-inplace-select-edit";
+ result[0] = "rich-inplace-select-edit"; //$NON-NLS-1$
if (ComponentUtil.isNotBlank(this.editClass)) {
clazz = this.editClass;
}
} else {
- result[0] = "rich-inplace-select-view";
+ result[0] = "rich-inplace-select-view"; //$NON-NLS-1$
if (ComponentUtil.isNotBlank(this.viewClass)) {
clazz = this.viewClass;
}
@@ -281,45 +265,39 @@
}
/**
- * Preapare input base.
- *
- * @param innerInput
- * the inner input
- * @param innerInput1
+ * Prepare input base.
+ *
+ * @param innerInput the inner input
*/
private void preapareInputBase(nsIDOMElement innerInput) {
- innerInput.setAttribute(HTML.ATTR_TYPE, "text");
- innerInput.setAttribute(HtmlComponentUtil.HTML_READONLY_ATTR, "text");
-
+ innerInput.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
+ innerInput.setAttribute(HTML.ATTR_READONLY, HTML.VALUE_TYPE_TEXT);
}
/**
* Prepare data.
- *
- * @param source
- * the source
+ *
+ * @param pageContext VpePageContext object
+ * @param source the source
*/
@Override
- protected void prepareData(VpePageContext pageContext,Element source) {
-
- this.sourceListHeight = ComponentUtil.getAttribute(source,"listHeight");
- this.sourceListWidth = ComponentUtil.getAttribute(source, "listWidth");
-
+ protected void prepareData(VpePageContext pageContext, Element source) {
+ this.sourceListHeight = ComponentUtil.getAttribute(source, "listHeight"); //$NON-NLS-1$
+ this.sourceListWidth = ComponentUtil.getAttribute(source, "listWidth"); //$NON-NLS-1$
if (ComponentUtil.isBlank(this.sourceListHeight)) {
- this.sourceListHeight = _24PX;
+ this.sourceListHeight = SOURCE_LIST_HEIGHT;
}
if (ComponentUtil.isBlank(this.sourceListWidth)) {
- this.sourceListWidth = String.valueOf("198px");
+ this.sourceListWidth = String.valueOf("198px"); //$NON-NLS-1$
}
-
- super.prepareData(pageContext,source);
+ super.prepareData(pageContext, source);
}
@Override
protected void initPositions() {
- this.controlsVerticalPositions.put("center", "100px");
+ this.controlsVerticalPositions.put(HTML.VALUE_ALIGN_CENTER, "100px"); //$NON-NLS-1$
}
/**
@@ -330,17 +308,20 @@
return this.getCssStylesSuffix();
}
+ /**
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.RichFacesAbstractInplaceTemplate#getControlPositionsSubStyles()
+ */
@Override
protected String getControlPositionsSubStyles() {
-
- return "top:0px ; left: " + controlsVerticalPositions.get(this.controlsVerticalPosition)
- + ";left:" + " " + controlsHorizontalPositions.get(this.controlsHorizontalPosition) + ";";
+ return "top:0px ; left: " + controlsVerticalPositions.get(this.controlsVerticalPosition) //$NON-NLS-1$
+ + ";left: " + controlsHorizontalPositions.get(this.controlsHorizontalPosition) + Constants.SEMICOLON; //$NON-NLS-1$
}
+ /**
+ * @see org.jboss.tools.jsf.vpe.richfaces.template.RichFacesAbstractInplaceTemplate#getMainControlsDivCssClass()
+ */
@Override
protected String getMainControlsDivCssClass() {
- // TODO Auto-generated method stub
- return "rich-inplace"+getCssStylesControlSuffix()+"-control-set";
+ return "rich-inplace" + getCssStylesControlSuffix() + "-control-set"; //$NON-NLS-1$ //$NON-NLS-2$
}
-
-}
+}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPaint2DTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPaint2DTemplate.java 2008-12-11 15:08:09 UTC (rev 12550)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPaint2DTemplate.java 2008-12-11 16:28:37 UTC (rev 12551)
@@ -11,69 +11,33 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+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.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
* Class for creating Paint2D content
- *
+ *
* @author Max Areshkau
- *
*/
public class RichFacesPaint2DTemplate extends VpeAbstractTemplate {
- private String IMAGE_NAME = "/paint2D/paint2D.gif";
+ /** IMAGE_NAME */
+ private static final String IMAGE_NAME = "/paint2D/paint2D.gif"; //$NON-NLS-1$
- private String PAINT2D_CSS_FILE = "/paint2D/paint2D.css";
+ /** PAINT2D_CSS_FILE */
+ private static final String PAINT2D_CSS_FILE = "/paint2D/paint2D.css"; //$NON-NLS-1$
- /*
- * (non-Javadoc)
- *
- * @see com.exadel.vpe.editor.template.VpeAbstractTemplate#removeAttribute(com.exadel.vpe.editor.context.VpePageContext,
- * org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
- * java.lang.Object, java.lang.String)
- */
- @Override
- public void removeAttribute(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
- super.removeAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name);
- nsIDOMElement img = (nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- if (name.equals("styleClass")
- && sourceElement.getAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR) == null
- && sourceElement.getAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR) == null) {
- img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,"imgStyleClass");
- } else
- img.removeAttribute(name);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.exadel.vpe.editor.template.VpeAbstractTemplate#setAttribute(com.exadel.vpe.editor.context.VpePageContext,
- * org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
- * java.lang.Object, java.lang.String, java.lang.String)
- */
- @Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String value) {
- super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name, value);
- nsIDOMElement img = (nsIDOMElement) visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- if (name.equals("styleClass")) {
- img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, value);
- } else
- img.setAttribute(name, value);
- }
-
/**
* Create html instead rich:faces component.
- *
+ *
* @param pageContext
* Contains the information on edited page.
* @param sourceNode
@@ -83,22 +47,20 @@
* @return The information on the created node of the visual tree.
*/
public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
- nsIDOMElement img = visualDocument.createElement("img");
+ ComponentUtil.setCSSLink(pageContext, PAINT2D_CSS_FILE, "paint2d"); //$NON-NLS-1$
+
+ nsIDOMElement img = visualDocument.createElement(HTML.TAG_IMG);
ComponentUtil.setImg(img, IMAGE_NAME);
- ComponentUtil.setCSSLink(pageContext, PAINT2D_CSS_FILE, "paint2d");
- String attrValue = ((Element) sourceNode).getAttribute("styleClass");
+ String attrValue = ((Element) sourceNode).getAttribute(RichFaces.ATTR_STYLE_CLASS);
if (attrValue != null && attrValue.length() != 0) {
- img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, attrValue);
- } else if (((Element) sourceNode)
- .getAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR) == null
- && ((Element) sourceNode)
- .getAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR) == null) {
- img
- .setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "imgStyleClass");
+ img.setAttribute(HTML.ATTR_CLASS, attrValue);
+ } else if (((Element) sourceNode).getAttribute(HTML.ATTR_WIDTH) == null
+ && ((Element) sourceNode).getAttribute(HTML.ATTR_HEIGHT) == null) {
+ img.setAttribute(HTML.ATTR_CLASS, "imgStyleClass"); //$NON-NLS-1$
}
VisualDomUtil.copyAttributes(sourceNode, img);
VpeCreationData creationData = new VpeCreationData(img);
+
return creationData;
}
}
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-12-11 15:08:09 UTC (rev 12550)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-12-11 16:28:37 UTC (rev 12551)
@@ -97,7 +97,7 @@
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:inplaceSelect" case-sensitive="yes">
- <vpe:template children="no" modify="no"
+ <vpe:template children="yes" modify="no"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesInplaceSelectTemplate">
<!--vpe:resize>
<vpe:width width-attr="style.width" />
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inplaceInput.xhtml
===================================================================
(Binary files differ)
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inplaceInput.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inplaceInput.xhtml.xml 2008-12-11 15:08:09 UTC (rev 12550)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inplaceInput.xhtml.xml 2008-12-11 16:28:37 UTC (rev 12551)
@@ -3,4 +3,58 @@
<SPAN VPE-USER-TOGGLE-ID="false" CLASS="rich-inplace rich-inplace-view"
STYLE="display: inline;"> click to enter your name</SPAN>
</test>
+ <!-- test id="inplaceInputWithoutFacet">
+ <SPAN VPE-USER-TOGGLE-ID="true" CLASS="rich-inplace rich-inplace-edit"
+ STYLE="position: relative; display: inline;">
+ <INPUT TYPE="text" VPE-USER-TOGGLE-ID="0" CLASS="rich-inplace-field" STYLE="top: 0px; width: 66px;"
+ AUTOCOMPLETE="off" VALUE="Mama mila ram"/>
+ <DIV CLASS="rich-inplace-input-controls-set" STYLE="position: absolute; top: 0px; left: 66px;">
+ <DIV CLASS="rich-inplace-shadow">
+ <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0">
+ <TBODY>
+ <TR>
+ <TD CLASS="rich-inplace-shadow-tl">
+ <IMG WIDTH="10" HEIGHT="1" BORDER="0" SRC="/.*resources/inplaceInput/spacer.gif/"/>
+ </TD>
+ <TD CLASS="rich-inplace-shadow-tr">
+ <IMG WIDTH="1" HEIGHT="10" BORDER="0" SRC="/.*resources/resources/inplaceInput/spacer.gif/"/>
+ </TD>
+ </TR>
+ <TR>
+ <TD CLASS="rich-inplace-shadow-bl">
+ <IMG WIDTH="1" HEIGHT="10" BORDER="0" SRC="/.*resources/inplaceInput/spacer.gif/"/>
+ </TD>
+ <TD CLASS="rich-inplace-shadow-br">
+ <IMG WIDTH="10" HEIGHT="1" BORDER="0" SRC="/.*resources/inplaceInput/spacer.gif/"/>
+ </TD>
+ </TR>
+ </TBODY>
+ </TABLE>
+ </DIV>
+ <DIV STYLE="position: relative; height: 18px;">
+ <INPUT TYPE="image" CLASS="rich-inplace-control"
+ SRC="/.*resources/inplaceInput/applyButton.gif/" VPE-USER-TOGGLE-ID="0"/>
+ <INPUT TYPE="image" CLASS="rich-inplace-control"
+ SRC="/.*resources/inplaceInput/cancelButton.gif/" VPE-USER-TOGGLE-ID="0"/>
+ </DIV>
+ </DIV>
+ </SPAN>
+ </test>
+ <test id="inplaceInputWithFacet">
+ <SPAN VPE-USER-TOGGLE-ID="true" CLASS="rich-inplace rich-inplace-edit"
+ STYLE="position: relative; display: inline;">
+ <INPUT TYPE="text" VPE-USER-TOGGLE-ID="0" CLASS="rich-inplace-field" STYLE="top: 0px; width: 66px;"
+ AUTOCOMPLETE="off" VALUE="Mama mila ramu"/>
+ <DIV CLASS="rich-inplace-input-controls-set" STYLE="position: absolute; top: 18px; left: 0px;">
+ <DIV STYLE="position: relative; height: 18px;">
+ <DIV>
+ <SPAN TITLE="h:panelGroup" STYLE="-moz-user-modify: read-write;" CLASS="">
+ <INPUT TYPE="button" VALUE="Save" STYLE="-moz-user-modify: read-only;"/>
+ <INPUT TYPE="button" VALUE="Cancel" STYLE="-moz-user-modify: read-only;"/>
+ </SPAN>
+ </DIV>
+ </DIV>
+ </DIV>
+ </SPAN>
+ </test-->
</tests>
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-12-11 15:08:09 UTC (rev 12550)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-12-11 16:28:37 UTC (rev 12551)
@@ -101,11 +101,13 @@
* it will not work with documents without DOCTYPE. It is the reason
* why the value '100' is used.*/
public static final String VALUE_COLSPAN_ALL = "100"; //$NON-NLS-1$
-
+
public static final String VALUE_ALIGN_TOP = "top"; //$NON-NLS-1$
public static final String VALUE_ALIGN_RIGHT = "right"; //$NON-NLS-1$
public static final String VALUE_ALIGN_LEFT = "left"; //$NON-NLS-1$
+ public static final String VALUE_ALIGN_BOTTOM = "bottom"; //$NON-NLS-1$
public static final String VALUE_ALIGN_MIDDLE = "middle"; //$NON-NLS-1$
+ public static final String VALUE_ALIGN_CENTER = "center"; //$NON-NLS-1$
public static final String VALUE_CLASS_DELIMITER = " "; //$NON-NLS-1$
public static final String VALUE_STYLE_DELIMITER = ";"; //$NON-NLS-1$
public static final String VALUE_TYPE_TEXT = "text"; //$NON-NLS-1$
@@ -115,7 +117,6 @@
public static final String VALUE_TYPE_CHECKBOX = "checkbox"; //$NON-NLS-1$
public static final String VALUE_TYPE_HIDDEN = "hidden"; //$NON-NLS-1$
public static final String VALUE_TYPE_BUTTON= "button"; //$NON-NLS-1$
- public static final String VALUE_ALIGN_CENTER = "center"; //$NON-NLS-1$
public static final String VALUE_CLEAR_BOTH = "both"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_DISPLAY = "display"; //$NON-NLS-1$
17 years