JBoss Tools SVN: r10812 - trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-10-13 16:11:18 -0400 (Mon, 13 Oct 2008)
New Revision: 10812
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings/org.eclipse.jdt.core.prefs
Log:
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings/org.eclipse.jdt.core.prefs 2008-10-13 19:08:40 UTC (rev 10811)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings/org.eclipse.jdt.core.prefs 2008-10-13 20:11:18 UTC (rev 10812)
@@ -1,7 +1,12 @@
-#Tue Jul 15 11:36:35 CEST 2008
+#Mon Oct 13 16:08:45 EDT 2008
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.5
16 years, 3 months
JBoss Tools SVN: r10811 - in trunk/seam/plugins: org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-10-13 15:08:40 -0400 (Mon, 13 Oct 2008)
New Revision: 10811
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
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/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2731
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2008-10-13 18:41:55 UTC (rev 10810)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2008-10-13 19:08:40 UTC (rev 10811)
@@ -12,26 +12,13 @@
import java.io.File;
-import org.apache.tools.ant.types.FilterSet;
-import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
import org.eclipse.jst.javaee.web.WebApp;
-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.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.project.facet.SeamRuntime;
-import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
// TODO: why not just *one* global filter set to avoid any missing names ? (assert for it in our unittests!
public class Seam2FacetInstallDelegate extends SeamFacetAbstractInstallDelegate{
@@ -100,186 +87,25 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForWar(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, org.eclipse.wst.common.frameworks.datamodel.IDataModel, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#copyFilesToWarProject(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, org.eclipse.wst.common.frameworks.datamodel.IDataModel, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- protected void doExecuteForWar(final IProject project, IProjectFacetVersion fv,
+ protected void copyFilesToWarProject(final IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
-
- // get WebContents folder path from DWP model
- IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- final IVirtualFolder srcRootFolder = component.getRootFolder().getFolder(new Path("/WEB-INF/classes")); //$NON-NLS-1$
- IContainer webRootFolder = webRootVirtFolder.getUnderlyingFolder();
-
- model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
-
- Boolean dbExists = (Boolean)model.getProperty(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS);
- Boolean dbRecreate = (Boolean)model.getProperty(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY);
- if(!dbExists && !dbRecreate) {
- model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"update"); //$NON-NLS-1$
- } else if(dbExists && !dbRecreate) {
- model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"validate"); //$NON-NLS-1$
- } else if(dbRecreate) {
- model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"create-drop"); //$NON-NLS-1$
- }
-
- final File webContentFolder = webRootFolder.getLocation().toFile();
- final File webInfFolder = new File(webContentFolder,"WEB-INF"); //$NON-NLS-1$
- final File webInfClasses = new File(webInfFolder,"classes"); //$NON-NLS-1$
- final File webInfClassesMetaInf = new File(webInfClasses, "META-INF"); //$NON-NLS-1$
- webInfClassesMetaInf.mkdirs();
- final File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
- final File srcFolder = isWarConfiguration(model)?new File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(),"model"):srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
- final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
-
- final String seamHomePath = selectedRuntime.getHomeDir();
-
- final File seamHomeFolder = new File(seamHomePath);
- final File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
- final File seamGenResFolder = new File(seamHomePath,"seam-gen/resources"); //$NON-NLS-1$
-
- final File droolsLibFolder = new File(seamHomePath,DROOLS_LIB_SEAM_RELATED_PATH);
- final File seamGenHomeFolder = new File(seamHomePath,"seam-gen"); //$NON-NLS-1$
- final File seamGenViewSource = new File(seamGenHomeFolder,"view"); //$NON-NLS-1$
- final File dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml"); //$NON-NLS-1$
- final File componentsFile = new File(seamGenResFolder,"WEB-INF/components"+(isWarConfiguration(model)?"-war":"")+".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- final File hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
- final File hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
- //final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs"); //$NON-NLS-1$
- final File persistenceFile = new File(seamGenResFolder,"META-INF/persistence-" + (isWarConfiguration(model)?DEV_WAR_PROFILE:DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //final File applicationFile = new File(seamGenResFolder,"META-INF/application.xml"); //$NON-NLS-1$
-
- final FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
- final FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
- final FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
-
- // ****************************************************************
- // Copy view folder from seam-gen installation to WebContent folder
- // ****************************************************************
- final AntCopyUtils.FileSet viewFileSet = new AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
- final FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
- viewFilterSetCollection.addFilterSet(jdbcFilterSet);
- viewFilterSetCollection.addFilterSet(projectFilterSet);
- viewFilterSetCollection.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
-
- AntCopyUtils.copyFilesAndFolders(
- seamGenViewSource,
- webContentFolder,
- new AntCopyUtils.FileSetFileFilter(viewFileSet),
- viewFilterSetCollection,
- true);
-
- // *******************************************************************
- // Copy manifest and configuration resources the same way as view
- // *******************************************************************
- AntCopyUtils.FileSet webInfSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEBINF_SET).dir(seamGenResFolder);
-
- configureWebXml(project);
-
- AntCopyUtils.copyFileToFile(
- componentsFile,
- new File(webInfFolder,"components.xml"), //$NON-NLS-1$
- new FilterSetCollection(projectFilterSet), true);
-
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder,webContentFolder,new AntCopyUtils.FileSetFileFilter(webInfSet), viewFilterSetCollection, true);
-
- final FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
- hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
- hibernateDialectFilterSet.addFilterSet(projectFilterSet);
- hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
-
- // ********************************************************************************************
- // Handle WAR configurations
- // ********************************************************************************************
+ super.copyFilesToWarProject(project, fv, model, monitor);
+ final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
if(isWarConfiguration(model)) {
- AntCopyUtils.FileSet webInfClassesSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder,srcFolder,new AntCopyUtils.FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
-
- createComponentsProperties(srcFolder, "", false); //$NON-NLS-1$ //$NON-NLS-2$
-
- /*AntCopyUtils.copyFileToFolder(
- hibernateConsolePref,
- new File(project.getLocation().toFile(),".settings"), //$NON-NLS-1$
- new FilterSetCollection(projectFilterSet), true);*/
-
- // In case of WAR configuration
- AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
-
- // ********************************************************************************************
- // Copy seam project indicator
- // ********************************************************************************************
+ AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
final IContainer source = srcRootFolder.getUnderlyingFolder();
-
- IPath actionSrcPath = new Path(source.getFullPath().removeFirstSegments(1)+"/action"); //$NON-NLS-1$
- IPath modelSrcPath = new Path(source.getFullPath().removeFirstSegments(1)+"/model"); //$NON-NLS-1$
-
- srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
- WtpUtils.createSourceFolder(project, actionSrcPath, source.getFullPath().removeFirstSegments(1), webRootFolder.getFullPath().removeFirstSegments(1).append("WEB-INF/dev")); //$NON-NLS-1$
- WtpUtils.createSourceFolder(project, modelSrcPath, source.getFullPath().removeFirstSegments(1), null);
-
- srcRootFolder.createLink(actionSrcPath, 0, null);
- srcRootFolder.createLink(modelSrcPath, 0, null);
-
File actionsSrc = new File(project.getLocation().toFile(), source.getFullPath().removeFirstSegments(1) + "/action/");
-
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "seam.properties"), actionsSrc, true); //$NON-NLS-1$
-
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
- new File(actionsSrc, model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new FilterSetCollection(filtersFilterSet), true);
-
- AntCopyUtils.copyFileToFile(
- persistenceFile,
- new File(srcFolder,"META-INF/persistence.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- File resources = new File(project.getLocation().toFile(),"resources");
- AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(resources,project.getName()+"-ds.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- // to fix seam2 tests for war deployment
-// File srcModelMetaInf = new File(project.getLocation().append(modelSrcPath).toFile(),"META-INF");
-// AntCopyUtils.copyFileToFile(
-// dataSourceDsFile,
-// new File(srcModelMetaInf,project.getName()+"-ds.xml"), //$NON-NLS-1$
-// viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFile(
- hibernateConsoleLaunchFile,
- new File(project.getLocation().toFile(),project.getName()+".launch"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePropsFile,
- project.getLocation().toFile(),
- hibernateDialectFilterSet, true);
-
- WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
+ AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
} else {
- // In case of EAR configuration
AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
- AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "messages_en.properties"), srcFolder, true); //$NON-NLS-1$
}
-
- ClasspathHelper.addClasspathEntries(project, fv);
-
- createSeamProjectPreferenes(project, model);
-
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
-
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
/*
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-10-13 18:41:55 UTC (rev 10810)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-13 19:08:40 UTC (rev 10811)
@@ -17,9 +17,12 @@
import java.util.List;
import java.util.Properties;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener;
@@ -33,6 +36,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
import org.eclipse.jst.j2ee.model.IModelProvider;
import org.eclipse.jst.j2ee.model.ModelProviderManager;
import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
@@ -59,8 +63,12 @@
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
@@ -238,6 +246,26 @@
}
}
+ protected IVirtualFolder srcRootFolder;
+ protected File seamHomeFolder;
+ protected String seamHomePath;
+ protected File seamLibFolder;
+ protected File seamGenResFolder;
+ protected File srcFolder;
+ protected File webContentFolder;
+ protected File webLibFolder;
+ protected IContainer webRootFolder;
+ protected File seamGenHomeFolder;
+ protected File seamGenViewSource;
+ protected File dataSourceDsFile;
+ protected File componentsFile;
+ protected File webInfFolder;
+ protected File webInfClasses;
+ protected File webInfClassesMetaInf;
+ protected File persistenceFile;
+ protected File hibernateConsoleLaunchFile;
+ protected File hibernateConsolePropsFile;
+
/**
*
* @param project
@@ -246,9 +274,60 @@
* @param monitor
* @throws CoreException
*/
- protected abstract void doExecuteForWar(IProject project, IProjectFacetVersion fv,
- IDataModel model, IProgressMonitor monitor) throws CoreException;
+ protected void doExecuteForWar(IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException {
+ // get WebContents folder path from DWP model
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+ srcRootFolder = component.getRootFolder().getFolder(new Path("/WEB-INF/classes")); //$NON-NLS-1$
+ webRootFolder = webRootVirtFolder.getUnderlyingFolder();
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
+
+ Boolean dbExists = (Boolean) model.getProperty(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS);
+ Boolean dbRecreate = (Boolean) model.getProperty(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY);
+ if (!dbExists && !dbRecreate) {
+ model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO, "update"); //$NON-NLS-1$
+ } else if (dbExists && !dbRecreate) {
+ model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO, "validate"); //$NON-NLS-1$
+ } else if (dbRecreate) {
+ model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO, "create-drop"); //$NON-NLS-1$
+ }
+
+ webContentFolder = webRootFolder.getLocation().toFile();
+ webInfFolder = new File(webContentFolder, "WEB-INF"); //$NON-NLS-1$
+ webInfClasses = new File(webInfFolder, "classes"); //$NON-NLS-1$
+ webInfClassesMetaInf = new File(webInfClasses, "META-INF"); //$NON-NLS-1$
+ webInfClassesMetaInf.mkdirs();
+ webLibFolder = new File(webContentFolder, WEB_LIBRARIES_RELATED_PATH);
+ srcFolder = isWarConfiguration(model) ? new File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(), "model") : srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
+ Object runtimeName = model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME);
+ final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName.toString());
+
+ seamHomePath = selectedRuntime.getHomeDir();
+
+ seamHomeFolder = new File(seamHomePath);
+ seamLibFolder = new File(seamHomePath, SEAM_LIB_RELATED_PATH);
+ seamGenResFolder = new File(seamHomePath, "seam-gen/resources"); //$NON-NLS-1$
+
+ seamGenHomeFolder = new File(seamHomePath, "seam-gen"); //$NON-NLS-1$
+ seamGenViewSource = new File(seamGenHomeFolder, "view"); //$NON-NLS-1$
+ dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml"); //$NON-NLS-1$
+ componentsFile = new File(seamGenResFolder, "WEB-INF/components" + (isWarConfiguration(model) ? "-war" : "") + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
+ hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
+ //final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs"); //$NON-NLS-1$
+ persistenceFile = new File(seamGenResFolder, "META-INF/persistence-" + (isWarConfiguration(model) ? DEV_WAR_PROFILE : DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ copyFilesToWarProject(project, fv, model, monitor);
+
+ ClasspathHelper.addClasspathEntries(project, fv);
+ createSeamProjectPreferenes(project, model);
+ EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ }
+
/**
*
* @param project
@@ -257,6 +336,124 @@
* @param monitor
* @throws CoreException
*/
+ protected void copyFilesToWarProject(IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException {
+ final FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
+ final FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
+ final FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
+
+ // ****************************************************************
+ // Copy view folder from seam-gen installation to WebContent folder
+ // ****************************************************************
+ final AntCopyUtils.FileSet viewFileSet = new AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
+ final FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
+ viewFilterSetCollection.addFilterSet(jdbcFilterSet);
+ viewFilterSetCollection.addFilterSet(projectFilterSet);
+ viewFilterSetCollection.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenViewSource,
+ webContentFolder,
+ new AntCopyUtils.FileSetFileFilter(viewFileSet),
+ viewFilterSetCollection,
+ true);
+
+ // *******************************************************************
+ // Copy manifest and configuration resources the same way as view
+ // *******************************************************************
+ AntCopyUtils.FileSet webInfSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEBINF_SET).dir(seamGenResFolder);
+
+ configureWebXml(project);
+
+ AntCopyUtils.copyFileToFile(
+ componentsFile,
+ new File(webInfFolder, "components.xml"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);
+
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder, webContentFolder, new AntCopyUtils.FileSetFileFilter(webInfSet), viewFilterSetCollection, true);
+
+ final FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
+ hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
+ hibernateDialectFilterSet.addFilterSet(projectFilterSet);
+ hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+
+ // ********************************************************************************************
+ // Handle WAR configurations
+ // ********************************************************************************************
+ if (isWarConfiguration(model)) {
+ AntCopyUtils.FileSet webInfClassesSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder, srcFolder, new AntCopyUtils.FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
+
+ createComponentsProperties(srcFolder, "", false); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /*AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(project.getLocation().toFile(),".settings"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);*/
+
+ // ********************************************************************************************
+ // Copy seam project indicator
+ // ********************************************************************************************
+
+ final IContainer source = srcRootFolder.getUnderlyingFolder();
+
+ IPath actionSrcPath = new Path(source.getFullPath().removeFirstSegments(1) + "/action"); //$NON-NLS-1$
+ IPath modelSrcPath = new Path(source.getFullPath().removeFirstSegments(1) + "/model"); //$NON-NLS-1$
+
+ srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
+ WtpUtils.createSourceFolder(project, actionSrcPath, source.getFullPath().removeFirstSegments(1), webRootFolder.getFullPath().removeFirstSegments(1).append("WEB-INF/dev")); //$NON-NLS-1$
+ WtpUtils.createSourceFolder(project, modelSrcPath, source.getFullPath().removeFirstSegments(1), null);
+
+ srcRootFolder.createLink(actionSrcPath, 0, null);
+ srcRootFolder.createLink(modelSrcPath, 0, null);
+
+ File actionsSrc = new File(project.getLocation().toFile(), source.getFullPath().removeFirstSegments(1) + "/action/");
+
+ //AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "seam.properties"), actionsSrc, true); //$NON-NLS-1$
+
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder, "src/Authenticator.java"), //$NON-NLS-1$
+ new File(actionsSrc,model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME).toString().replace('.', '/') + "/" + "Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FilterSetCollection(filtersFilterSet), true);
+
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(srcFolder, "META-INF/persistence.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ File resources = new File(project.getLocation().toFile(), "resources");
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(resources, project.getName() + "-ds.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(project.getLocation().toFile(), project.getName() + ".launch"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePropsFile,
+ project.getLocation().toFile(),
+ hibernateDialectFilterSet, true);
+
+ WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
+ } else {
+ // In case of EAR configuration
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "messages_en.properties"), srcFolder, true); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ * @param project
+ * @param fv
+ * @param model
+ * @param monitor
+ * @throws CoreException
+ */
protected abstract void doExecuteForEar(IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2008-10-13 18:41:55 UTC (rev 10810)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2008-10-13 19:08:40 UTC (rev 10811)
@@ -19,8 +19,12 @@
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
/**
* Data model provider for Seam facet wizard page
@@ -140,6 +144,22 @@
"/templates")).getPath()); //$NON-NLS-1$
}
+ /**
+ * Returns default seam runtime name.
+ * @param seamModel
+ * @return
+ */
+ public static String getSeamRuntimeDefaultValue(IDataModel seamModel) {
+ String seamFacetVersion = seamModel.getProperty(IFacetDataModelProperties.FACET_VERSION_STR).toString();
+ SeamVersion seamVersion = SeamVersion.parseFromString(seamFacetVersion);
+
+ SeamRuntime defaultRuntime = SeamRuntimeManager.getInstance().getDefaultRuntime(seamVersion);
+ if(defaultRuntime==null) {
+ return "";
+ }
+ return defaultRuntime.getName();
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider#init()
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-10-13 18:41:55 UTC (rev 10810)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-10-13 19:08:40 UTC (rev 10811)
@@ -12,32 +12,15 @@
import java.io.File;
-import org.apache.tools.ant.types.FilterSet;
-import org.apache.tools.ant.types.FilterSetCollection;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.jst.javaee.core.DisplayName;
import org.eclipse.jst.javaee.core.JavaeeFactory;
import org.eclipse.jst.javaee.web.Filter;
import org.eclipse.jst.javaee.web.WebApp;
-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.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.project.facet.SeamRuntime;
-import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
/**
* Install delegate for seam facet version 1.2
@@ -133,177 +116,22 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForWar(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, org.eclipse.wst.common.frameworks.datamodel.IDataModel, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#copyFilesToWarProject(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, org.eclipse.wst.common.frameworks.datamodel.IDataModel, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- protected void doExecuteForWar(final IProject project, IProjectFacetVersion fv,
+ protected void copyFilesToWarProject(final IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
-
- // get WebContents folder path from DWP model
- IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- final IVirtualFolder srcRootFolder = component.getRootFolder().getFolder(new Path("/WEB-INF/classes")); //$NON-NLS-1$
- IContainer webRootFolder = webRootVirtFolder.getUnderlyingFolder();
-
- model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
-
- Boolean dbExists = (Boolean) model.getProperty(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS);
- Boolean dbRecreate = (Boolean) model.getProperty(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY);
- if (!dbExists && !dbRecreate) {
- model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO, "update"); //$NON-NLS-1$
- } else if (dbExists && !dbRecreate) {
- model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO, "validate"); //$NON-NLS-1$
- } else if (dbRecreate) {
- model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO, "create-drop"); //$NON-NLS-1$
- }
-
- final File webContentFolder = webRootFolder.getLocation().toFile();
- final File webInfFolder = new File(webContentFolder, "WEB-INF"); //$NON-NLS-1$
- final File webInfClasses = new File(webInfFolder, "classes"); //$NON-NLS-1$
- final File webInfClassesMetaInf = new File(webInfClasses, "META-INF"); //$NON-NLS-1$
- webInfClassesMetaInf.mkdirs();
- final File webLibFolder = new File(webContentFolder, WEB_LIBRARIES_RELATED_PATH);
- final File srcFolder = isWarConfiguration(model) ? new File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(), "model") : srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
- final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
-
- final String seamHomePath = selectedRuntime.getHomeDir();
-
- final File seamHomeFolder = new File(seamHomePath);
- final File seamLibFolder = new File(seamHomePath, SEAM_LIB_RELATED_PATH);
- final File seamGenResFolder = new File(seamHomePath, "seam-gen/resources"); //$NON-NLS-1$
-
+ super.copyFilesToWarProject(project, fv, model, monitor);
final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
- final File seamGenHomeFolder = new File(seamHomePath, "seam-gen"); //$NON-NLS-1$
- final File seamGenViewSource = new File(seamGenHomeFolder, "view"); //$NON-NLS-1$
- final File dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml"); //$NON-NLS-1$
- final File componentsFile = new File(seamGenResFolder, "WEB-INF/components" + (isWarConfiguration(model) ? "-war" : "") + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- final File hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
- final File hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
- //final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs"); //$NON-NLS-1$
- final File persistenceFile = new File(seamGenResFolder, "META-INF/persistence-" + (isWarConfiguration(model) ? DEV_WAR_PROFILE : DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
-
- final FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
- final FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
- final FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
-
- // ****************************************************************
- // Copy view folder from seam-gen installation to WebContent folder
- // ****************************************************************
- final AntCopyUtils.FileSet viewFileSet = new AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
- final FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
- viewFilterSetCollection.addFilterSet(jdbcFilterSet);
- viewFilterSetCollection.addFilterSet(projectFilterSet);
-
- AntCopyUtils.copyFilesAndFolders(
- seamGenViewSource,
- webContentFolder,
- new AntCopyUtils.FileSetFileFilter(viewFileSet),
- viewFilterSetCollection,
- true);
-
- // *******************************************************************
- // Copy manifest and configuration resources the same way as view
- // *******************************************************************
- AntCopyUtils.FileSet webInfSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEBINF_SET).dir(seamGenResFolder);
-
- configureWebXml(project);
-
- AntCopyUtils.copyFileToFile(
- componentsFile,
- new File(webInfFolder, "components.xml"), //$NON-NLS-1$
- new FilterSetCollection(projectFilterSet), true);
-
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder, webContentFolder, new AntCopyUtils.FileSetFileFilter(webInfSet), viewFilterSetCollection, true);
-
- final FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
- hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
- hibernateDialectFilterSet.addFilterSet(projectFilterSet);
- hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
-
- // ********************************************************************************************
- // Handle WAR configurations
- // ********************************************************************************************
if (isWarConfiguration(model)) {
- AntCopyUtils.FileSet webInfClassesSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder, srcFolder, new AntCopyUtils.FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
-
- createComponentsProperties(srcFolder, "", false); //$NON-NLS-1$ //$NON-NLS-2$
-
- /*AntCopyUtils.copyFileToFolder(
- hibernateConsolePref,
- new File(project.getLocation().toFile(),".settings"), //$NON-NLS-1$
- new FilterSetCollection(projectFilterSet), true);*/
-
- // In case of WAR configuration
AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
-
- // ********************************************************************************************
- // Copy seam project indicator
- // ********************************************************************************************
-
- final IContainer source = srcRootFolder.getUnderlyingFolder();
-
- IPath actionSrcPath = new Path(source.getFullPath().removeFirstSegments(1) + "/action"); //$NON-NLS-1$
- IPath modelSrcPath = new Path(source.getFullPath().removeFirstSegments(1) + "/model"); //$NON-NLS-1$
-
- srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
- WtpUtils.createSourceFolder(project, actionSrcPath, source.getFullPath().removeFirstSegments(1), webRootFolder.getFullPath().removeFirstSegments(1).append("WEB-INF/dev")); //$NON-NLS-1$
- WtpUtils.createSourceFolder(project, modelSrcPath, source.getFullPath().removeFirstSegments(1), null);
-
- srcRootFolder.createLink(actionSrcPath, 0, null);
- srcRootFolder.createLink(modelSrcPath, 0, null);
-
- File actionsSrc = new File(project.getLocation().toFile(), source.getFullPath().removeFirstSegments(1) + "/action/");
-
- //AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "seam.properties"), actionsSrc, true); //$NON-NLS-1$
-
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder, "src/Authenticator.java"), //$NON-NLS-1$
- new File(actionsSrc,model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME).toString().replace('.', '/') + "/" + "Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new FilterSetCollection(filtersFilterSet), true);
-
- AntCopyUtils.copyFileToFile(
- persistenceFile,
- new File(srcFolder, "META-INF/persistence.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- File resources = new File(project.getLocation().toFile(), "resources");
- AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(resources, project.getName() + "-ds.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFile(
- hibernateConsoleLaunchFile,
- new File(project.getLocation().toFile(), project.getName() + ".launch"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePropsFile,
- project.getLocation().toFile(),
- hibernateDialectFilterSet, true);
-
- WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
} else {
- // In case of EAR configuration
AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
- AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "messages_en.properties"), srcFolder, true); //$NON-NLS-1$
}
-
- ClasspathHelper.addClasspathEntries(project, fv);
-
- createSeamProjectPreferenes(project, model);
-
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
-
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
/*
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2008-10-13 18:41:55 UTC (rev 10810)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2008-10-13 19:08:40 UTC (rev 10811)
@@ -61,6 +61,7 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
import org.jboss.tools.seam.ui.SeamUIMessages;
import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
@@ -213,21 +214,6 @@
return names;
}
- /**
- *
- * @return
- */
- private Object getSeamRuntimeDefaultValue() {
- String seamFacetVersion = model.getProperty(IFacetDataModelProperties.FACET_VERSION_STR).toString();
- SeamVersion seamVersion = SeamVersion.parseFromString(seamFacetVersion);
-
- SeamRuntime defaultRuntime = SeamRuntimeManager.getInstance().getDefaultRuntime(seamVersion);
- if(defaultRuntime==null) {
- return "";
- }
- return defaultRuntime.getName();
- }
-
private DataModelSynchronizer sync;
/**
@@ -308,7 +294,7 @@
* Creates Seam Facet Wizard Page contents
*/
public void createControl(Composite parent) {
- jBossSeamHomeEditor = SeamWizardFactory.createSeamRuntimeSelectionFieldEditor(new SeamVersion[0], getSeamRuntimeDefaultValue().toString(), new NewSeamRuntimeAction());
+ jBossSeamHomeEditor = SeamWizardFactory.createSeamRuntimeSelectionFieldEditor(new SeamVersion[0], SeamFacetInstallDataModelProvider.getSeamRuntimeDefaultValue(model), new NewSeamRuntimeAction());
initializeDialogUnits(parent);
@@ -479,7 +465,7 @@
List<String> runtimes = getRuntimeNames(model.getProperty(
IFacetDataModelProperties.FACET_VERSION_STR).toString());
if (oldValue == null || !runtimes.contains(oldValue)) {
- Object defaultRnt = getSeamRuntimeDefaultValue();
+ Object defaultRnt = SeamFacetInstallDataModelProvider.getSeamRuntimeDefaultValue(model);
if (defaultRnt != null && runtimes.contains(defaultRnt)) {
newValue = defaultRnt;
} else if (runtimes.size() > 0) {
@@ -581,13 +567,12 @@
if(wizard instanceof NewProjectDataModelFacetWizard) {
return new DeploymentTypeValidator(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, ((NewProjectDataModelFacetWizard)wizard).getDataModel());
}
- return new DeploymentTypeValidator(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, model);
-// return new IValidator() {
-// public Map<String, String> validate(Object value, Object context) {
-// SeamInstallWizardPage.this.validate();
-// return ValidatorFactory.NO_ERRORS;
-// }
-// };
+// return new DeploymentTypeValidator(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, model);
+ return new IValidator() {
+ public Map<String, String> validate(Object value, Object context) {
+ return ValidatorFactory.NO_ERRORS;
+ }
+ };
}
static class DeploymentTypeValidator implements IValidator {
16 years, 3 months
JBoss Tools SVN: r10810 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: src/org/jboss/tools/jsf/vpe/richfaces/template and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-10-13 14:41:55 -0400 (Mon, 13 Oct 2008)
New Revision: 10810
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/extendedDataTable.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2761
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/extendedDataTable.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/extendedDataTable.css 2008-10-13 18:26:27 UTC (rev 10809)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/extendedDataTable/extendedDataTable.css 2008-10-13 18:41:55 UTC (rev 10810)
@@ -24,6 +24,13 @@
font-family: Arial, Verdana, sans-serif;
}
+.extendedTable-input {
+ border-color:#C4C0B9;
+ border-style: inset;
+ border-width:1px;
+ width:100%;
+}
+
.dr-table-header {
background-color: #D4CFC7;
background-position: top left;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java 2008-10-13 18:26:27 UTC (rev 10809)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java 2008-10-13 18:41:55 UTC (rev 10810)
@@ -34,6 +34,11 @@
*/
public class RichFacesExtendedDataTableTemplate extends VpeAbstractTemplate {
+ private static final String DISPLAY_NONE = "display : none"; //$NON-NLS-1$
+ private static final String FILTER_BY = "filterBy"; //$NON-NLS-1$
+ private static final String DIV_STYLE = "padding : 4px"; //$NON-NLS-1$
+ private static final String EXTENDED_TABLE_INPUT = "extendedTable-input"; //$NON-NLS-1$
+ private static final String INPUT_TYPE_ATTR = "text"; //$NON-NLS-1$
private static final String COLUMNS = "columns"; //$NON-NLS-1$
private static final String FALSE = "false"; //$NON-NLS-1$
private static final String SCOP = "scop"; //$NON-NLS-1$
@@ -77,7 +82,8 @@
final static String ZERRO = "0"; //$NON-NLS-1$
final static String SORTABLE_PATH = "extendedDataTable/sortable.gif"; //$NON-NLS-1$
- private static String STYLE_FOR_RIGHT_SCROLL = "overflow: scroll; width: 17px; height: 100%;"; //$NON-NLS-1$
+ private static String STYLE_FOR_RIGHT_SCROLL = "height: 100%; overflow-y: scroll"; //$NON-NLS-1$
+ private static String TD_STYLE_FOR_RIGHT_SCROLL = "height: 100%;width : 17px;"; //$NON-NLS-1$
private static final int NUM_ROW = 5;
@@ -116,6 +122,7 @@
tr1.appendChild(tr1_TD1);
nsIDOMElement tr1_TD2 = visualDocument.createElement(HTML.TAG_TD);
+ tr1_TD2.setAttribute(HTML.ATTR_STYLE, TD_STYLE_FOR_RIGHT_SCROLL);
tr1.appendChild(tr1_TD2);
nsIDOMElement tr1_td2_DIV = visualDocument.createElement(HTML.TAG_DIV);
@@ -177,17 +184,22 @@
}
if (!columnsHeaders.isEmpty()) {
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement filterTR = visualDocument.createElement(HTML.TAG_TR);
thead.appendChild(tr);
+ thead.appendChild(filterTR);
String styleClass = encodeStyleClass(null,
DR_TABLE_SUBHEADER_RICH_TABLE_SUBHEADER, null,
headerClass);
if (styleClass != null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
+ filterTR.setAttribute(HTML.ATTR_CLASS, styleClass);
}
- encodeHeaderOrFooterFacets(creationData, tr, visualDocument,
+ encodeHeaderFacets(creationData, tr, filterTR, visualDocument,
columnsHeaders,
DR_TABLE_SUBHEADERCELL_RICH_TABLE_SUBHEADERCELL,
- headerClass, HEADER, HTML.TAG_TD);
+ headerClass);
+
+
}
}
@@ -208,10 +220,10 @@
if (styleClass != null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
- encodeHeaderOrFooterFacets(creationData, tr, visualDocument,
+ encodeFooterFacets(creationData, tr, visualDocument,
columnsFooters,
DR_TABLE_SUBFOOTERCELL_RICH_TABLE_SUBFOOTERCELL,
- footerClass, FOOTER, HTML.TAG_TD);
+ footerClass);
}
if (footer != null) {
encodeTableHeaderOrFooterFacet(creationData, tfoot,
@@ -319,23 +331,35 @@
*
* @param creationData
* @param parentTr
+ * @param filterTR
* @param visualDocument
- * @param headersOrFooters
+ * @param headers
* @param skinCellClass
* @param headerClass
- * @param facetName
- * @param element
*/
- public static void encodeHeaderOrFooterFacets(VpeCreationData creationData,
- nsIDOMElement parentTr, nsIDOMDocument visualDocument,
- ArrayList<Element> headersOrFooters, String skinCellClass,
- String headerClass, String facetName, String element) {
- String extClass = "Class"; //$NON-NLS-1$
- for (Element column : headersOrFooters) {
- String classAttribute = facetName + extClass;
+ public static void encodeHeaderFacets(VpeCreationData creationData,
+ nsIDOMElement parentTr, nsIDOMElement filterTR,
+ nsIDOMDocument visualDocument, ArrayList<Element> headers,
+ String skinCellClass, String headerClass) {
+ String classAttribute = "headerClass"; //$NON-NLS-1$
+ // Check filter
+ boolean existFilters = false;
+ for (Element column : headers) {
+ if (ComponentUtil.getAttribute(column, FILTER_BY).length() > 0) {
+ existFilters = true;
+ break;
+ }
+ }
+
+ // Not filters
+ if (!existFilters) {
+ filterTR.setAttribute(HTML.ATTR_STYLE, DISPLAY_NONE);
+ }
+
+ for (Element column : headers) {
String columnHeaderClass = column.getAttribute(classAttribute);
- nsIDOMElement td = visualDocument.createElement(element);
-
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+
nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
td.appendChild(table);
table.setAttribute(HTML.ATTR_BORDER, ZERRO);
@@ -347,7 +371,7 @@
table.appendChild(tr);
tr.appendChild(trTd1);
tr.appendChild(trTd2);
-
+
parentTr.appendChild(td);
String styleClass = encodeStyleClass(null, skinCellClass,
headerClass, columnHeaderClass);
@@ -357,11 +381,36 @@
if (colspan != null && colspan.length() > 0) {
td.setAttribute(HTML.ATTR_COLSPAN, colspan);
}
- Element facetBody = ComponentUtil.getFacet(column, facetName);
+ Element facetBody = ComponentUtil.getFacet(column, HEADER);
VpeChildrenInfo child = new VpeChildrenInfo(trTd1);
child.addSourceChild(facetBody);
creationData.addChildrenInfo(child);
+ // Add filter
+ if (existFilters) {
+ nsIDOMElement filterTD = visualDocument
+ .createElement(HTML.TAG_TD);
+
+ filterTR.appendChild(filterTD);
+ filterTD.setAttribute(HTML.ATTR_CLASS, styleClass);
+ filterTD.setAttribute(SCOP, COL);
+ if (colspan != null && colspan.length() > 0) {
+ filterTD.setAttribute(HTML.ATTR_COLSPAN, colspan);
+ }
+ // Check current filter
+ if(ComponentUtil.getAttribute(column, FILTER_BY).length() > 0) {
+ // Add input
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ div.setAttribute(HTML.ATTR_STYLE, DIV_STYLE);
+ filterTD.appendChild(div);
+ nsIDOMElement input = visualDocument.createElement(HTML.TAG_INPUT);
+ div.appendChild(input);
+ input.setAttribute(HTML.ATTR_TYPE, INPUT_TYPE_ATTR);
+ input.setAttribute(HTML.ATTR_CLASS, EXTENDED_TABLE_INPUT);
+ }
+
+
+ }
// Add sortable attribute
String sortable = ComponentUtil.getAttribute(column, ATTR_SORTABLE);
if (sortable.equalsIgnoreCase(FALSE)) {
@@ -372,7 +421,41 @@
trTd2.appendChild(img);
}
}
+
+ /**
+ *
+ * @param creationData
+ * @param parentTr
+ * @param visualDocument
+ * @param footers
+ * @param skinCellClass
+ * @param footerClass
+ */
+ public static void encodeFooterFacets(VpeCreationData creationData,
+ nsIDOMElement parentTr, nsIDOMDocument visualDocument,
+ ArrayList<Element> footers, String skinCellClass, String footerClass) {
+ String classAttribute = "footerClass"; //$NON-NLS-1$
+ for (Element column : footers) {
+ String columnHeaderClass = column.getAttribute(classAttribute);
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ parentTr.appendChild(td);
+ String styleClass = encodeStyleClass(null, skinCellClass,
+ footerClass, columnHeaderClass);
+ td.setAttribute(HTML.ATTR_CLASS, styleClass);
+ td.setAttribute(SCOP, COL);
+ String colspan = column.getAttribute(HTML.ATTR_COLSPAN);
+ if (colspan != null && colspan.length() > 0) {
+ td.setAttribute(HTML.ATTR_COLSPAN, colspan);
+ }
+ Element facetBody = ComponentUtil.getFacet(column, FOOTER);
+
+ VpeChildrenInfo child = new VpeChildrenInfo(td);
+ child.addSourceChild(facetBody);
+ creationData.addChildrenInfo(child);
+ }
+ }
+
/**
*
* @param creationData
16 years, 3 months
JBoss Tools SVN: r10809 - trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-10-13 14:26:27 -0400 (Mon, 13 Oct 2008)
New Revision: 10809
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EndState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/StartState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/State.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SuperState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Transition.java
Log:
jpdl initial serialization experiment
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EndState.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EndState.java 2008-10-13 18:26:06 UTC (rev 10808)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EndState.java 2008-10-13 18:26:27 UTC (rev 10809)
@@ -3,5 +3,9 @@
import org.jboss.tools.flow.common.model.DefaultNode;
public class EndState extends DefaultNode {
+
+ public EndState() {
+ setMetaData("xml", "end-state");
+ }
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java 2008-10-13 18:26:06 UTC (rev 10808)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java 2008-10-13 18:26:27 UTC (rev 10809)
@@ -7,6 +7,11 @@
public class Process extends DefaultFlow {
+ public Process() {
+ super();
+ setMetaData("xml", "process-definition");
+ }
+
public StartState getStartState() {
for (Iterator<Node> iterator = getNodes().iterator(); iterator.hasNext(); ) {
Node node = iterator.next();
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/StartState.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/StartState.java 2008-10-13 18:26:06 UTC (rev 10808)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/StartState.java 2008-10-13 18:26:27 UTC (rev 10809)
@@ -3,5 +3,9 @@
import org.jboss.tools.flow.common.model.DefaultNode;
public class StartState extends DefaultNode {
+
+ public StartState() {
+ setMetaData("xml", "start-state");
+ }
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/State.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/State.java 2008-10-13 18:26:06 UTC (rev 10808)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/State.java 2008-10-13 18:26:27 UTC (rev 10809)
@@ -3,5 +3,8 @@
import org.jboss.tools.flow.common.model.DefaultNode;
public class State extends DefaultNode {
-
+
+ public State() {
+ setMetaData("xml", "state");
+ }
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SuperState.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SuperState.java 2008-10-13 18:26:06 UTC (rev 10808)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SuperState.java 2008-10-13 18:26:27 UTC (rev 10809)
@@ -4,4 +4,7 @@
public class SuperState extends DefaultContainer {
+ public SuperState() {
+ setMetaData("xml", "super-state");
+ }
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Transition.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Transition.java 2008-10-13 18:26:06 UTC (rev 10808)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Transition.java 2008-10-13 18:26:27 UTC (rev 10809)
@@ -5,8 +5,13 @@
public class Transition extends DefaultConnection {
+ public Transition() {
+ this(null, null);
+ }
+
public Transition(Node from, Node to) {
super(from, to);
+ setMetaData("xml", "transition");
}
}
16 years, 3 months
JBoss Tools SVN: r10808 - trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-10-13 14:26:06 -0400 (Mon, 13 Oct 2008)
New Revision: 10808
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java
Log:
jpdl initial serialization experiment
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java 2008-10-13 18:24:33 UTC (rev 10807)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java 2008-10-13 18:26:06 UTC (rev 10808)
@@ -3,12 +3,18 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.List;
import org.eclipse.gef.EditPartFactory;
import org.eclipse.gef.palette.PaletteRoot;
import org.jboss.tools.flow.common.editor.GenericModelEditor;
import org.jboss.tools.flow.common.editpart.DefaultEditPartFactory;
+import org.jboss.tools.flow.common.model.Element;
import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.flow.common.wrapper.ConnectionWrapper;
+import org.jboss.tools.flow.common.wrapper.ContainerWrapper;
+import org.jboss.tools.flow.common.wrapper.NodeWrapper;
+import org.jboss.tools.flow.common.wrapper.Wrapper;
public class JpdlEditor extends GenericModelEditor {
@@ -24,8 +30,34 @@
return ElementRegistry.createWrapper("org.jboss.tools.flow.jpdl4.process");
}
+ private void write(Wrapper wrapper, OutputStream os) {
+ Object object = wrapper.getElement();
+ if (object instanceof Element) {
+ Element element = (Element)object;
+ String xml = (String)element.getMetaData("xml");
+ System.out.println(xml);
+ }
+ if (wrapper instanceof ContainerWrapper) {
+ ContainerWrapper containerWrapper = (ContainerWrapper)wrapper;
+ List<NodeWrapper> children = containerWrapper.getElements();
+ for (NodeWrapper nodeWrapper : children) {
+ write(nodeWrapper, os);
+ }
+ }
+ if (wrapper instanceof NodeWrapper) {
+ NodeWrapper nodeWrapper = (NodeWrapper)wrapper;
+ List<ConnectionWrapper> children = nodeWrapper.getOutgoingConnections();
+ for (ConnectionWrapper connectionWrapper : children) {
+ write(connectionWrapper, os);
+ }
+ }
+ }
+
protected void writeModel(OutputStream os) throws IOException {
- // TODO
+ Object object = getModel();
+ if (object instanceof Wrapper) {
+ write((Wrapper)object, os);
+ }
}
protected void createModel(InputStream is) {
16 years, 3 months
JBoss Tools SVN: r10807 - trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-10-13 14:24:33 -0400 (Mon, 13 Oct 2008)
New Revision: 10807
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
Log:
file formatting
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2008-10-13 18:22:12 UTC (rev 10806)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2008-10-13 18:24:33 UTC (rev 10807)
@@ -74,7 +74,8 @@
<node>
<figure>
<rounded-rectangle></rounded-rectangle>
- </figure></node>
+ </figure>
+ </node>
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.Transition"
16 years, 3 months
JBoss Tools SVN: r10806 - in trunk: jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-10-13 14:22:12 -0400 (Mon, 13 Oct 2008)
New Revision: 10806
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxCreator.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/AttributeMap.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
Log:
Bug fix https://jira.jboss.org/jira/browse/JBIDE-2856 (Part 3)
- Now value of listHeight define max-height in rich:comboBox and it does not affect the height of comboBox's list if sum of heights of items less than the value
- Created class RichFacesComboBoxCreator. It instantiated every time when new rich:comboBox created in VPE, so its attributes like 'styleClass' are never shared between different views.
- Toggling now works better.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java 2008-10-13 18:03:55 UTC (rev 10805)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java 2008-10-13 18:22:12 UTC (rev 10806)
@@ -21,6 +21,7 @@
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxCreator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxCreator.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxCreator.java 2008-10-13 18:22:12 UTC (rev 10806)
@@ -0,0 +1,580 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.AttributeMap;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+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.editor.util.VpeStyleUtil;
+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;
+
+import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;
+
+/**
+ * @author yradtsevich
+ *
+ */
+public class RichFacesComboBoxCreator {
+ private static final String EXPANDED_ATTR_NAME = "expanded"; //$NON-NLS-1$
+ private static final WeakHashMap<Node, Object> expandedComboBoxes = new WeakHashMap<Node, Object>();
+ private static final String DISABLED_ATTR_NAME = "disabled"; //$NON-NLS-1$
+ private static final String BUTTON_ICON_CLASSES_DISABLED =
+ "rich-combobox-font-inactive rich-combobox-button-icon-disabled rich-combobox-button-inactive"; //$NON-NLS-1$
+ private static final String BUTTON_ICON_CLASSES =
+ "rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive"; //$NON-NLS-1$
+ private static final String SECOND_DIV = "secondDiv"; //$NON-NLS-1$
+ private static final String THIRD_DIV = "thirdDiv"; //$NON-NLS-1$
+ private static final String THIRD_EMPTY_DIV = "thirdEmptyDiv"; //$NON-NLS-1$
+ private static final String TEXT_FIELD = "textField"; //$NON-NLS-1$
+ private static final String BUTTON_ICON = "buttonIcon"; //$NON-NLS-1$
+
+ /** CSS_FILE_NAME. */
+ private static final String CSS_FILE_NAME = "comboBox/comboBox.css"; //$NON-NLS-1$
+
+ /** The Constant DEFAULT_LIST_WIDTH. */
+ private static final String DEFAULT_LIST_WIDTH = "150px"; //$NON-NLS-1$
+
+ /** IMAGE_NAME_DOWN. */
+ private static final String IMAGE_NAME_DOWN = "/comboBox/down.gif"; //$NON-NLS-1$
+
+ /** The Constant BUTTON_BACKGROUND. */
+ private static final String BUTTON_BACKGROUND = "buttonBackground"; //$NON-NLS-1$
+
+ /** The Constant STYLE_EXT. */
+ private static final String STYLE_EXT = "richFacesComboBox"; //$NON-NLS-1$
+
+ private static final int LIST_ITEM_HEIGHT_DEFAULT_VALUE = 18;
+
+ /** The style clasess. */
+ private final Map<String, String> styleClasess = new HashMap<String, String>();
+
+ /** The source align. */
+ // Commented because of not working alignment in RichFaces implementation
+ // private String sourceAlign;
+
+ /** The source button style. */
+ private String sourceButtonStyle;
+
+ /** The source default label. */
+ private String sourceDefaultLabel = null;
+
+ /** The source list height. */
+ private String sourceListHeight;
+
+ /** The source list width. */
+ private String sourceListWidth;
+
+ /** The source value. */
+ private String sourceValue;
+
+ /** The source width. */
+ private String sourceWidth;
+
+ /** The source style. */
+ private String sourceStyle;
+
+ /** The source input style. */
+ private String sourceInputStyle;
+
+ /** The source input class. */
+ private String sourceInputClass;
+
+ /** The source list style. */
+ private String sourceListStyle;
+
+ /** The source list class. */
+ private String sourceListClass;
+
+ /** The source item class. */
+ private String sourceItemClass;
+
+
+ /** Source button icon **/
+ private String sourceButtonIcon;
+
+ private String sourceButtonIconInactive;
+
+ private String sourceButtonIconDisabled;
+
+ private boolean disabled;
+ private boolean expanded;
+
+ private final VpePageContext pageContext;
+ private final Node sourceNode;
+ private final nsIDOMDocument visualDocument;
+ private final VpeCreationData vpeCreationData;
+
+ /**
+ * The Constructor.
+ */
+ public RichFacesComboBoxCreator(final VpePageContext pageContext, final Node sourceNode,
+ final nsIDOMDocument visualDocument) {
+ this.pageContext = pageContext;
+ this.sourceNode = sourceNode;
+ this.visualDocument = visualDocument;
+ initDefaultClasses();
+ vpeCreationData = create();
+ }
+
+ /**
+ * Calculate with for div.
+ *
+ * @param with the with
+ * @param minus the minus
+ *
+ * @return the string
+ */
+ private static String calculateWithForDiv(final String with, final int minus) {
+ try {
+ Integer intValue = 0;
+ if (with.endsWith("px")) { //$NON-NLS-1$
+ intValue = Integer.parseInt(with.substring(0, with.length() - 2));
+ } else {
+ intValue = Integer.parseInt(with);
+ }
+ return String.valueOf((intValue - minus)) + "px"; //$NON-NLS-1$
+ } catch (final NumberFormatException e) {
+ return with;
+ }
+
+ }
+ public VpeCreationData getVpeCreationData() {
+ return vpeCreationData;
+ }
+
+ /**
+ * Create.
+ *
+ * @param visualDocument the visual document
+ * @param sourceNode the source node
+ * @param pageContext the page context
+ *
+ * @return the vpe creation data
+ */
+ private VpeCreationData create() {
+ ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME, STYLE_EXT);
+
+ final Element source = (Element) sourceNode;
+
+ prepareData(source);
+ final nsIDOMElement rootDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ //Fix https://jira.jboss.org/jira/browse/JBIDE-2430 issue with resizement.
+ rootDiv.setAttribute(HTML.ATTR_STYLE,
+ HTML.STYLE_PARAMETER_WIDTH + Constants.COLON+sourceWidth);
+ final nsIDOMElement comboBoxDiv = visualDocument.createElement(HTML.TAG_DIV);
+ final nsIDOMElement secondDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ // Commented because of not working alignment in RichFaces implementation
+ // comboBoxDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+ // secondDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+
+
+ //comboBoxDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("secondDiv")); //$NON-NLS-1$
+ secondDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(SECOND_DIV));
+ String secondDivSubStyle = "; position: {0}; z-index: {1} ;"; //$NON-NLS-1$
+
+ if (expanded) {
+ secondDivSubStyle = MessageFormat.format(secondDivSubStyle, "relative", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ secondDivSubStyle = MessageFormat.format(secondDivSubStyle, "static", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ comboBoxDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceListWidth
+ + Constants.SEMICOLON + secondDivSubStyle);
+ secondDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceListWidth
+ + Constants.SEMICOLON + secondDivSubStyle + sourceStyle);
+ final nsIDOMElement thirdDiv = visualDocument.createElement(HTML.TAG_DIV);
+ thirdDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(THIRD_DIV));
+ thirdDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceWidth
+ + "; z-index: 1;"); //$NON-NLS-1$
+ final nsIDOMElement textField = visualDocument.createElement(HTML.TAG_INPUT);
+ textField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+
+ textField.setAttribute(HTML.ATTR_CLASS,
+ styleClasess.get(TEXT_FIELD) + Constants.WHITE_SPACE + sourceInputClass);
+ textField.setAttribute("autocomplete", "off"); //$NON-NLS-1$ //$NON-NLS-2$
+ textField.setAttribute(HTML.ATTR_STYLE,
+ HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + calculateWithForDiv(sourceWidth, 17)
+ + Constants.SEMICOLON + sourceInputStyle);
+ String value = null;
+ if (ComponentUtil.isNotBlank(sourceDefaultLabel)) {
+ value = sourceDefaultLabel;
+ } else if (ComponentUtil.isNotBlank(sourceValue) && ComponentUtil.isBlank(sourceDefaultLabel)) {
+ value = sourceValue;
+ }
+
+ if (value != null) {
+ textField.setAttribute(RichFaces.ATTR_VALUE, value);
+ }
+ final nsIDOMElement buttonBackground = visualDocument.createElement(HTML.TAG_INPUT);
+ buttonBackground.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+
+ if (disabled) {
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES_DISABLED);
+ } else {
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES);
+ }
+
+ buttonBackground.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_BACKGROUND));
+ buttonBackground.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
+ buttonBackground.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ if (sourceButtonStyle != null) {
+ buttonBackground.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ }
+ //
+ final nsIDOMElement buttonIcon = visualDocument.createElement(HTML.TAG_INPUT);
+ buttonIcon.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ ;
+ buttonIcon.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_ICON));
+ buttonIcon.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
+ buttonIcon.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ if (sourceButtonStyle != null) {
+ buttonIcon.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ }
+
+ String actualSourceButton;
+ if (disabled) {
+ actualSourceButton = sourceButtonIconDisabled;
+ } else if (expanded) {
+ actualSourceButton = sourceButtonIcon;
+ } else {
+ actualSourceButton = sourceButtonIconInactive;
+ }
+
+ if (ComponentUtil.isNotBlank(actualSourceButton) && (actualSourceButton != IMAGE_NAME_DOWN)) {
+ String buttonIconPath = VpeStyleUtil.addFullPathToImgSrc(actualSourceButton, pageContext, true);
+ buttonIconPath = buttonIconPath.replace('\\', '/');
+ final String style = "background-image: url(" + buttonIconPath + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ buttonIcon.setAttribute(HTML.ATTR_STYLE, buttonIcon.getAttribute(HTML.ATTR_STYLE) + style);
+ }
+ final nsIDOMElement forthEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
+ forthEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("forthEmptyDiv")); //$NON-NLS-1$
+ forthEmptyDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
+ + calculateWithForDiv(sourceWidth, 10));
+ forthEmptyDiv.appendChild(visualDocument.createTextNode("Struts")); //$NON-NLS-1$
+
+ rootDiv.appendChild(comboBoxDiv);
+ comboBoxDiv.appendChild(secondDiv);
+
+ secondDiv.appendChild(thirdDiv);
+ if (expanded) {
+ comboBoxDiv.appendChild(createToogleDiv());
+ }
+ thirdDiv.appendChild(textField);
+ thirdDiv.appendChild(buttonBackground);
+ thirdDiv.appendChild(buttonIcon);
+ thirdDiv.appendChild(forthEmptyDiv);
+
+ final VpeCreationData creationData = new VpeCreationData(rootDiv);
+
+ return creationData;
+ }
+
+ /**
+ * Creates the toogle div.
+ *
+ * @param visualDocument the visual document
+ * @param pageContext the page context
+ * @param source the source
+ *
+ * @return the ns IDOM node
+ */
+ private nsIDOMNode createToogleDiv() {
+
+ final nsIDOMElement thirdEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE, sourceListStyle + Constants.SEMICOLON
+ + " z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
+ thirdEmptyDiv.setAttribute(HTML.ATTR_CLASS,
+ styleClasess.get(THIRD_EMPTY_DIV) + " " + sourceListClass); //$NON-NLS-1$
+ thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE,
+ "z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
+
+ final nsIDOMElement shadovDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ final nsIDOMElement positionDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ positionDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-position"); //$NON-NLS-1$
+
+ final nsIDOMElement decorationDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ decorationDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-decoration"); //$NON-NLS-1$
+ // decorationDiv.setAttribute(HTML.ATTR_STYLE,
+ // "height: 54px; width: 208px;");
+
+ final nsIDOMElement scrollDiv = visualDocument.createElement(HTML.TAG_DIV);
+ scrollDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-scroll"); //$NON-NLS-1$
+ final List<Element> items = ComponentUtil.getSelectItems(sourceNode.getChildNodes());
+ int defaultHeight = LIST_ITEM_HEIGHT_DEFAULT_VALUE;
+
+ if((items!=null) && (items.size() > 1)){
+ defaultHeight = ((items.size() - 1)* LIST_ITEM_HEIGHT_DEFAULT_VALUE);
+ }
+
+ final String listHeight = ComponentUtil.isNotBlank(sourceListHeight)
+ ? sourceListHeight
+ : String.valueOf(defaultHeight) + "px"; //$NON-NLS-1$
+ scrollDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_MAX_HEIGHT
+ + Constants.COLON + listHeight + Constants.SEMICOLON
+ + HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
+ + calculateWithForDiv(sourceListWidth, 2));
+
+ final List<Element> selectItems = ComponentUtil.getSelectItems(sourceNode.getChildNodes());
+
+ if (selectItems.size() > 0) {
+ for (final Element e : selectItems) {
+ scrollDiv.appendChild(createSelectItem(e));
+ }
+ }
+
+ shadovDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow"); //$NON-NLS-1$
+
+ final nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
+ String width = Constants.EMPTY;
+ try {
+
+ int w = ComponentUtil.parseWidthHeightValue(sourceListWidth);
+ w += 7;
+ width = String.valueOf(w);
+ } catch (final ParseException e) {
+ width = "217"; //$NON-NLS-1$
+ }
+ table.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH
+ + Constants.COLON + width + Constants.PIXEL
+ + Constants.SEMICOLON + HTML.STYLE_PARAMETER_HEIGHT
+ + Constants.COLON + "63px;"); //$NON-NLS-1$
+
+ final nsIDOMElement tr1 = visualDocument.createElement(HTML.TAG_TR);
+ final nsIDOMElement tr2 = visualDocument.createElement(HTML.TAG_TR);
+
+ final nsIDOMElement tr1_td1 = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement tr1_td2 = visualDocument.createElement(HTML.TAG_TD);
+
+ final nsIDOMElement tr2_td1 = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement tr2_td2 = visualDocument.createElement(HTML.TAG_TD);
+
+ final nsIDOMElement tr1_td1_img = visualDocument.createElement(HTML.TAG_IMG);
+ final nsIDOMElement tr1_td2_img = visualDocument.createElement(HTML.TAG_IMG);
+
+ final nsIDOMElement tr2_td1_img = visualDocument.createElement(HTML.TAG_IMG);
+ final nsIDOMElement tr2_td2_img = visualDocument.createElement(HTML.TAG_IMG);
+
+ tr1_td1.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-tl"); //$NON-NLS-1$
+ tr1_td2.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-tr"); //$NON-NLS-1$
+
+ tr2_td1.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-bl"); //$NON-NLS-1$
+ tr2_td2.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-br"); //$NON-NLS-1$
+
+ setUpImg(tr1_td1_img, 10, 1, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
+ setUpImg(tr1_td2_img, 1, 10, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
+ setUpImg(tr2_td1_img, 1, 10, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
+ setUpImg(tr2_td2_img, 10, 1, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
+
+ thirdEmptyDiv.appendChild(shadovDiv);
+ shadovDiv.appendChild(table);
+ thirdEmptyDiv.appendChild(positionDiv);
+ positionDiv.appendChild(decorationDiv);
+ decorationDiv.appendChild(scrollDiv);
+
+ table.appendChild(tr1);
+ table.appendChild(tr2);
+ tr1.appendChild(tr1_td1);
+ tr1.appendChild(tr1_td2);
+
+ tr2.appendChild(tr2_td1);
+ tr2.appendChild(tr2_td2);
+
+ tr1_td1.appendChild(tr1_td1_img);
+ tr1_td1.appendChild(visualDocument.createElement(HTML.TAG_BR));
+
+ tr1_td2.appendChild(tr1_td2_img);
+ tr1_td2.appendChild(visualDocument.createElement(HTML.TAG_BR));
+
+ tr2_td1.appendChild(tr2_td1_img);
+ tr2_td1.appendChild(visualDocument.createElement(HTML.TAG_BR));
+
+ tr2_td2.appendChild(tr2_td2_img);
+ tr2_td2.appendChild(visualDocument.createElement(HTML.TAG_BR));
+
+ return thirdEmptyDiv;
+ }
+
+ /**
+ * Creates the select item.
+ *
+ * @param visualDocument the visual document
+ * @param e the e
+ *
+ * @return the ns IDOM node
+ */
+ private nsIDOMNode createSelectItem(final Element e) {
+ final nsIDOMElement item = visualDocument.createElement(HTML.TAG_SPAN);
+
+ item.setAttribute(HTML.ATTR_CLASS, "rich-combobox-item " + sourceItemClass); //$NON-NLS-1$
+ item.appendChild(visualDocument.createTextNode(ComponentUtil.getSelectItemValue(e)));
+ return item;
+ }
+
+ /**
+ * Inits the default classes.
+ */
+ private void initDefaultClasses() {
+ styleClasess.put(SECOND_DIV, "rich-combobox-font rich-combobox"); //$NON-NLS-1$
+ styleClasess.put(THIRD_DIV, "rich-combobox-font rich-combobox-shell"); //$NON-NLS-1$
+ styleClasess.put(THIRD_EMPTY_DIV, "rich-combobox-list-cord"); //$NON-NLS-1$
+ styleClasess.put(TEXT_FIELD, "rich-combobox-font-disabled rich-combobox-input-inactive"); //$NON-NLS-1$
+ styleClasess.put(BUTTON_BACKGROUND,
+ "rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"); //$NON-NLS-1$
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES);
+ styleClasess.put("forthEmptyDiv", "rich-combobox-strut rich-combobox-font"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Prepare data.
+ *
+ * @param source the source
+ */
+ private void prepareData(final Element source) {
+ final AttributeMap attributeMap = new AttributeMap(source);
+
+ // Commented because of not working alignment in RichFaces implementation
+ // if (attributeMap.isBlank(RichFaces.ATTR_ALIGN)) {
+ // this.sourceAlign = DEFAULT_ALIGN;
+ // } else {
+ // this.sourceAlign = attributeMap.getString(RichFaces.ATTR_ALIGN);
+ // }
+
+ if (attributeMap.isBlank(RichFaces.ATTR_LIST_WIDTH)) {
+ sourceListWidth = DEFAULT_LIST_WIDTH;
+ } else {
+ sourceListWidth = attributeMap.getString(RichFaces.ATTR_LIST_WIDTH);
+ }
+
+ sourceListHeight = attributeMap.getString(RichFaces.ATTR_LIST_HEIGHT);
+
+ if (attributeMap.isBlank(RichFaces.ATTR_WIDTH)) {
+ sourceWidth = DEFAULT_LIST_WIDTH;
+ } else {
+ sourceWidth = attributeMap.getString(RichFaces.ATTR_WIDTH);
+
+ if(sourceListWidth == DEFAULT_LIST_WIDTH) {
+ sourceListWidth = sourceWidth;
+ }
+ }
+
+ if (ComponentUtil.isNotBlank(sourceWidth) && (sourceWidth != DEFAULT_LIST_WIDTH)) {
+ if(!sourceWidth.endsWith(Constants.PIXEL)){
+ try {
+ final int intValue = Integer.parseInt(sourceWidth);
+ sourceWidth = String.valueOf(intValue)+Constants.PIXEL;
+ } catch (final NumberFormatException e) {
+ sourceListWidth = DEFAULT_LIST_WIDTH;
+ }
+ }
+ }
+
+ sourceDefaultLabel = attributeMap.getString("defaultLabel"); //$NON-NLS-1$
+ sourceValue = attributeMap.getString( RichFaces.ATTR_VALUE);
+
+ sourceButtonStyle = attributeMap.getString("buttonStyle"); //$NON-NLS-1$
+
+ final String sourceStyleClasess = attributeMap.getString(RichFaces.ATTR_STYLE_CLASS);
+
+ if (ComponentUtil.isNotBlank(sourceStyleClasess)) {
+ styleClasess.put(SECOND_DIV, styleClasess.get(SECOND_DIV) + " " + sourceStyleClasess); //$NON-NLS-1$
+ }
+
+ sourceStyle = attributeMap.getString(HTML.ATTR_STYLE);
+ sourceInputStyle = attributeMap.getString("inputStyle"); //$NON-NLS-1$
+ sourceInputClass = attributeMap.getString("inputClass"); //$NON-NLS-1$
+ sourceListClass = attributeMap.getString("listClass"); //$NON-NLS-1$
+ sourceListStyle = attributeMap.getString("listStyle"); //$NON-NLS-1$
+ sourceItemClass = attributeMap.getString("itemClass"); //$NON-NLS-1$
+
+ sourceButtonIcon = attributeMap.getString(BUTTON_ICON);
+ sourceButtonIconInactive = attributeMap.getString("buttonIconInactive"); //$NON-NLS-1$
+ sourceButtonIconDisabled = attributeMap.getString("buttonIconDisabled"); //$NON-NLS-1$
+ disabled = isDisabled(attributeMap);
+ expanded = isExpanded(source);
+
+ if(ComponentUtil.isBlank(sourceButtonIcon)){
+ sourceButtonIcon = IMAGE_NAME_DOWN;
+ }
+
+ }
+
+ /**
+ * Sets the up img.
+ *
+ * @param i *
+ * @param width the width
+ * @param height the height
+ * @param img the img
+ * @param j *
+ * @param image the image
+ * @param border the border
+ * @param td1Img */
+ protected static void setUpImg(final nsIDOMElement img, final int width, final int height,
+ final int border, final 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));
+
+ }
+
+ /**
+ * Inverts <code>expanded</code> state of the ComboBox
+ *
+ * @param builder the builder
+ * @param sourceNode the source node
+ * @param toggleId the toggle id
+ */
+ public static void toggle(final VpeVisualDomBuilder builder, final Node sourceNode, final String toggleId) {
+ AttributeMap attributes = new AttributeMap((Element)sourceNode);
+ if (isDisabled(attributes) || isExpanded(sourceNode)) {
+ expandedComboBoxes.remove(sourceNode);
+ } else {
+ expandedComboBoxes.put(sourceNode, null);
+ }
+ }
+
+ public static void stopToggling(final Node sourceNode) {
+ expandedComboBoxes.remove(sourceNode);
+ }
+
+ public static boolean isDisabled(final AttributeMap attributes) {
+ return attributes.getBoolean(DISABLED_ATTR_NAME) == Boolean.TRUE;
+ }
+
+ private static boolean isExpanded(Node node) {
+ return expandedComboBoxes.containsKey(node);
+ }
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-10-13 18:03:55 UTC (rev 10805)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-10-13 18:22:12 UTC (rev 10806)
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -8,824 +8,60 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-
-
package org.jboss.tools.jsf.vpe.richfaces.template;
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.template.util.AttributeMap;
-import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.AttributeData;
-import org.jboss.tools.vpe.editor.mapping.VpeElementData;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;
-
-
/**
* The Class RichFacesComboBoxTemplate.
- *
+ *
* @author Eugene Stherbin
*/
public class RichFacesComboBoxTemplate extends AbstractEditableRichFacesTemplate implements VpeToggableTemplate {
- private static final String BUTTON_ICON_CLASSES_DISABLED = "rich-combobox-font-inactive rich-combobox-button-icon-disabled rich-combobox-button-inactive"; //$NON-NLS-1$
- private static final String BUTTON_ICON_CLASSES = "rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive"; //$NON-NLS-1$
- private static final String SECOND_DIV = "secondDiv"; //$NON-NLS-1$
- private static final String THIRD_DIV = "thirdDiv"; //$NON-NLS-1$
- private static final String THIRD_EMPTY_DIV = "thirdEmptyDiv"; //$NON-NLS-1$
- private static final String TEXT_FIELD = "textField"; //$NON-NLS-1$
- private static final String BUTTON_ICON = "buttonIcon"; //$NON-NLS-1$
+ /**
+ * @see org.jboss.tools.vpe.editor.template.VpeToggableTemplate#stopToggling(org.w3c.dom.Node)
+ */
+ public void stopToggling(final Node sourceNode) {
+ }
- /** CSS_FILE_NAME. */
- private static final String CSS_FILE_NAME = "comboBox/comboBox.css"; //$NON-NLS-1$
+ /**
+ * @see org.jboss.tools.vpe.editor.template.VpeToggableTemplate#toggle(org.jboss.tools.vpe.editor.VpeVisualDomBuilder, org.w3c.dom.Node, java.lang.String)
+ * @see RichFacesComboBoxCreator#toggle(VpeVisualDomBuilder, Node, String)
+ */
+ public void toggle(final VpeVisualDomBuilder builder, final Node sourceNode, final String toggleId) {
+ RichFacesComboBoxCreator.toggle(builder, sourceNode, toggleId);
+ }
- /** The Constant DEFAULT_ALIGN. */
- private static final String DEFAULT_ALIGN = "left"; //$NON-NLS-1$
+ /**
+ * @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ * @see RichFacesComboBoxCreator
+ */
+ public VpeCreationData create(final VpePageContext pageContext, final Node sourceNode,
+ final nsIDOMDocument visualDocument) {
+ final RichFacesComboBoxCreator creator =
+ new RichFacesComboBoxCreator(pageContext, sourceNode, visualDocument);
+
+ return creator.getVpeCreationData();
+ }
- /** DEFAULT_INPUT_SIZE. */
- private static final String DEFAULT_INPUT_SIZE = "10"; //$NON-NLS-1$
-
- /** DEFAULT_INPUT_STYLE. */
- private static final String DEFAULT_INPUT_STYLE = "rich-combobox-default-input"; //$NON-NLS-1$
-
- /** The Constant DEFAULT_LIST_WIDTH. */
- private static final String DEFAULT_LIST_WIDTH = "150px"; //$NON-NLS-1$
-
- /** The Constant DEFAULT_WIDTH. */
- private static final String DEFAULT_WIDTH = "width : 150px"; //$NON-NLS-1$
-
- /** IMAGE_NAME_DOWN. */
- private static final String IMAGE_NAME_DOWN = "/comboBox/down.gif"; //$NON-NLS-1$
-
- /** The Constant RICH_COMBOBOX_BUTTON_STYLE_CLASS. */
- private static final String RICH_COMBOBOX_BUTTON_STYLE_CLASS = "rich-combobox-button"; //$NON-NLS-1$
-
- /** The Constant RICH_COMBOBOX_IMAGE_STYLE_CLASS. */
- private static final String RICH_COMBOBOX_IMAGE_STYLE_CLASS = "rich-combobox-image"; //$NON-NLS-1$
-
- /** The Constant RICH_COMBOBOX_INPUT_CELL_STYLE. */
- private static final String RICH_COMBOBOX_INPUT_CELL_STYLE = "rich-combobox-inputCell"; //$NON-NLS-1$
-
- /** The Constant BUTTON_BACKGROUND. */
- private static final String BUTTON_BACKGROUND = "buttonBackground"; //$NON-NLS-1$
-
- /** The Constant STYLE_EXT. */
- private static final String STYLE_EXT = "richFacesComboBox"; //$NON-NLS-1$
-
- private static final int LIST_ITEM_HEIGHT_DEFAULT_VALUE=18;
-
- /** The style clasess. */
- private Map<String, String> styleClasess = new HashMap<String, String>();
-
- /** The Constant ZERO_STRING. */
- private static final String ZERO_STRING = "0"; //$NON-NLS-1$
-
- /** The source align. */
- // Commented because of not working alignment in RichFaces implementation
- // private String sourceAlign;
-
- /** The source button style. */
- private String sourceButtonStyle;
-
- /** The source default label. */
- private String sourceDefaultLabel = null;
-
- /** The source list height. */
- private String sourceListHeight;
-
- /** The source list width. */
- private String sourceListWidth;
-
- /** The source value. */
- private String sourceValue;
-
- /** The source width. */
- private String sourceWidth;
-
- /** The source style. */
- private String sourceStyle;
-
- /** The source input style. */
- private String sourceInputStyle;
-
- /** The source input class. */
- private String sourceInputClass;
-
- /** The is toggle. */
- private boolean isToggle = false;
-
- /** The source list style. */
- private String sourceListStyle;
-
- /** The source list class. */
- private String sourceListClass;
-
- /** The source item class. */
- private String sourceItemClass;
-
-
- /** Source button icon **/
- private String sourceButtonIcon;
-
- private String sourceButtonIconInactive;
-
- private String sourceButtonIconDisabled;
-
- private boolean disabled;
-
- /**
- * The Constructor.
- */
- public RichFacesComboBoxTemplate() {
- super();
- initDefaultClasses();
- }
-
- /**
- * Calculate with for div.
- *
- * @param with the with
- * @param minus the minus
- *
- * @return the string
- */
- private String calculateWithForDiv(String with, int minus) {
- try {
- Integer intValue = 0;
- if (with.endsWith("px")) { //$NON-NLS-1$
- intValue = Integer.parseInt(with.substring(0, with.length() - 2));
- } else {
- intValue = Integer.parseInt(with);
- }
- return String.valueOf((intValue - minus)) + "px"; //$NON-NLS-1$
- } catch (NumberFormatException e) {
- return with;
- }
-
- }
-
- /**
- * Create.
- *
- * @param visualDocument the visual document
- * @param sourceNode the source node
- * @param pageContext the page context
- *
- * @return the vpe creation data
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
- ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME, STYLE_EXT);
-
- final Element source = (Element) sourceNode;
-
- prepareData(source);
- final nsIDOMElement rootDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- //Fix https://jira.jboss.org/jira/browse/JBIDE-2430 issue with resizement.
- rootDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH+Constants.COLON+sourceWidth);
- final nsIDOMElement comboBoxDiv = visualDocument.createElement(HTML.TAG_DIV);
- final nsIDOMElement secondDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- // Commented because of not working alignment in RichFaces implementation
- // comboBoxDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
- // secondDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
-
-
- //comboBoxDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("secondDiv")); //$NON-NLS-1$
- secondDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(SECOND_DIV)); //$NON-NLS-1$
- String secondDivSubStyle = "; position: {0}; z-index: {1} ;"; //$NON-NLS-1$
-
- if (isToggle) {
- secondDivSubStyle = MessageFormat.format(secondDivSubStyle, "relative", "2"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- secondDivSubStyle = MessageFormat.format(secondDivSubStyle, "static", "0"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- // TODO add ATTR_STYLE.
- comboBoxDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + this.sourceListWidth
- + Constants.SEMICOLON + secondDivSubStyle);
- secondDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + this.sourceListWidth
- + Constants.SEMICOLON + secondDivSubStyle + sourceStyle);
- final nsIDOMElement thirdDiv = visualDocument.createElement(HTML.TAG_DIV);
- thirdDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(THIRD_DIV));
- thirdDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + this.sourceWidth
- + "; z-index: 1;"); //$NON-NLS-1$
- final nsIDOMElement textField = visualDocument.createElement(HTML.TAG_INPUT);
- textField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
-
- textField.setAttribute(HTML.ATTR_CLASS, styleClasess.get(TEXT_FIELD) + Constants.WHITE_SPACE + sourceInputClass); //$NON-NLS-1$
- textField.setAttribute("autocomplete", "off"); //$NON-NLS-1$ //$NON-NLS-2$
- textField.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH+ Constants.COLON + calculateWithForDiv(this.sourceWidth, 17) + Constants.SEMICOLON
- + sourceInputStyle);
- String value = null;
- if (ComponentUtil.isNotBlank(this.sourceDefaultLabel)) {
- value = this.sourceDefaultLabel;
- } else if (ComponentUtil.isNotBlank(this.sourceValue) && ComponentUtil.isBlank(this.sourceDefaultLabel)) {
- value = this.sourceValue;
- }
-
- if (value != null) {
- textField.setAttribute(RichFaces.ATTR_VALUE, value);
- }
- final nsIDOMElement buttonBackground = visualDocument.createElement(HTML.TAG_INPUT);
- buttonBackground.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
-
- if (disabled) {
- styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES_DISABLED); //$NON-NLS-1$
- } else {
- styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES); //$NON-NLS-1$
- }
-
- buttonBackground.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_BACKGROUND));
- buttonBackground.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
- buttonBackground.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
- if (this.sourceButtonStyle != null) {
- buttonBackground.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
- }
- //
- final nsIDOMElement buttonIcon = visualDocument.createElement(HTML.TAG_INPUT);
- buttonIcon.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
- ;
- buttonIcon.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_ICON)); //$NON-NLS-1$
- buttonIcon.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
- buttonIcon.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
- if (this.sourceButtonStyle != null) {
- buttonIcon.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
- }
-
- String actualSourceButton;
- if (disabled) {
- actualSourceButton = sourceButtonIconDisabled;
- } else if (isToggle) {
- actualSourceButton = sourceButtonIcon;
- } else {
- actualSourceButton = sourceButtonIconInactive;
- }
-
- if (ComponentUtil.isNotBlank(actualSourceButton) && (actualSourceButton != IMAGE_NAME_DOWN)) {
- String buttonIconPath = VpeStyleUtil.addFullPathToImgSrc(actualSourceButton, pageContext, true);
- buttonIconPath = buttonIconPath.replace('\\', '/');
- String style = "background-image: url(" + buttonIconPath + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- buttonIcon.setAttribute(HTML.ATTR_STYLE, buttonIcon.getAttribute(HTML.ATTR_STYLE) + style);
- }
- final nsIDOMElement forthEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
- forthEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("forthEmptyDiv")); //$NON-NLS-1$
- forthEmptyDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
- + calculateWithForDiv(this.sourceWidth, 10));
- forthEmptyDiv.appendChild(visualDocument.createTextNode("Struts")); //$NON-NLS-1$
-
- rootDiv.appendChild(comboBoxDiv);
- comboBoxDiv.appendChild(secondDiv);
-
- secondDiv.appendChild(thirdDiv);
- if (isToggle) {
- comboBoxDiv.appendChild(createToogleDiv(pageContext, source, visualDocument));
- }
- thirdDiv.appendChild(textField);
- thirdDiv.appendChild(buttonBackground);
- thirdDiv.appendChild(buttonIcon);
- thirdDiv.appendChild(forthEmptyDiv);
-
- final VpeCreationData creationData = new VpeCreationData(rootDiv);
-// final DOMTreeDumper dumper = new DOMTreeDumper();
-// dumper.dumpToStream(System.err, secondDiv);
-
- return creationData;
- }
-
- /**
- * Creates the toogle div.
- *
- * @param visualDocument the visual document
- * @param pageContext the page context
- * @param source the source
- *
- * @return the ns IDOM node
- */
- private nsIDOMNode createToogleDiv(VpePageContext pageContext, Element source, nsIDOMDocument visualDocument) {
-
- final nsIDOMElement thirdEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE, this.sourceListStyle + Constants.SEMICOLON
- + " z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
- thirdEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(THIRD_EMPTY_DIV) + " " + this.sourceListClass); //$NON-NLS-1$ //$NON-NLS-2$
- thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE, "z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
-
- final nsIDOMElement shadovDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- final nsIDOMElement positionDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- positionDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-position"); //$NON-NLS-1$
-
- final nsIDOMElement decorationDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- decorationDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-decoration"); //$NON-NLS-1$
- // decorationDiv.setAttribute(HTML.ATTR_STYLE,
- // "height: 54px; width: 208px;");
-
- final nsIDOMElement scrollDiv = visualDocument.createElement(HTML.TAG_DIV);
- scrollDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-scroll"); //$NON-NLS-1$
- final List<Element> items = ComponentUtil.getSelectItems(source.getChildNodes());
- int defaultHeight = LIST_ITEM_HEIGHT_DEFAULT_VALUE;
-
- if((items!=null) && (items.size() > 1)){
- defaultHeight = ((items.size() - 1)* LIST_ITEM_HEIGHT_DEFAULT_VALUE);
- }
-
- final String listHeight = ComponentUtil.isNotBlank(this.sourceListHeight) ? this.sourceListHeight : String.valueOf(defaultHeight)
- + "px"; //$NON-NLS-1$
- scrollDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_HEIGHT
- + Constants.COLON + listHeight + Constants.SEMICOLON
- + HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
- + calculateWithForDiv(sourceListWidth, 2));
-
- final List<Element> selectItems = ComponentUtil.getSelectItems(source.getChildNodes());
-
- if (selectItems.size() > 0) {
- for (Element e : selectItems) {
- scrollDiv.appendChild(createSelectItem(e, visualDocument));
- }
- }
-
- shadovDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow"); //$NON-NLS-1$
-
- final nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
- table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
- String width = Constants.EMPTY;
- try {
-
- int w = ComponentUtil.parseWidthHeightValue(sourceListWidth);
- w += 7;
- width = String.valueOf(w);
- } catch (ParseException e) {
- width = "217"; //$NON-NLS-1$
- }
- table.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH
- + Constants.COLON + width + Constants.PIXEL
- + Constants.SEMICOLON + HTML.STYLE_PARAMETER_HEIGHT
- + Constants.COLON + "63px;"); //$NON-NLS-1$
-
- final nsIDOMElement tr1 = visualDocument.createElement(HTML.TAG_TR);
- final nsIDOMElement tr2 = visualDocument.createElement(HTML.TAG_TR);
-
- final nsIDOMElement tr1_td1 = visualDocument.createElement(HTML.TAG_TD);
- final nsIDOMElement tr1_td2 = visualDocument.createElement(HTML.TAG_TD);
-
- final nsIDOMElement tr2_td1 = visualDocument.createElement(HTML.TAG_TD);
- final nsIDOMElement tr2_td2 = visualDocument.createElement(HTML.TAG_TD);
-
- final nsIDOMElement tr1_td1_img = visualDocument.createElement(HTML.TAG_IMG);
- final nsIDOMElement tr1_td2_img = visualDocument.createElement(HTML.TAG_IMG);
-
- final nsIDOMElement tr2_td1_img = visualDocument.createElement(HTML.TAG_IMG);
- final nsIDOMElement tr2_td2_img = visualDocument.createElement(HTML.TAG_IMG);
-
- tr1_td1.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-tl"); //$NON-NLS-1$
- tr1_td2.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-tr"); //$NON-NLS-1$
-
- tr2_td1.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-bl"); //$NON-NLS-1$
- tr2_td2.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-br"); //$NON-NLS-1$
-
- setUpImg(tr1_td1_img, 10, 1, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
- setUpImg(tr1_td2_img, 1, 10, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
- setUpImg(tr2_td1_img, 1, 10, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
- setUpImg(tr2_td2_img, 10, 1, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
-
- thirdEmptyDiv.appendChild(shadovDiv);
- shadovDiv.appendChild(table);
- thirdEmptyDiv.appendChild(positionDiv);
- positionDiv.appendChild(decorationDiv);
- decorationDiv.appendChild(scrollDiv);
-
- table.appendChild(tr1);
- table.appendChild(tr2);
- tr1.appendChild(tr1_td1);
- tr1.appendChild(tr1_td2);
-
- tr2.appendChild(tr2_td1);
- tr2.appendChild(tr2_td2);
-
- tr1_td1.appendChild(tr1_td1_img);
- tr1_td1.appendChild(visualDocument.createElement(HTML.TAG_BR));
-
- tr1_td2.appendChild(tr1_td2_img);
- tr1_td2.appendChild(visualDocument.createElement(HTML.TAG_BR));
-
- tr2_td1.appendChild(tr2_td1_img);
- tr2_td1.appendChild(visualDocument.createElement(HTML.TAG_BR));
-
- tr2_td2.appendChild(tr2_td2_img);
- tr2_td2.appendChild(visualDocument.createElement(HTML.TAG_BR));
-
- return thirdEmptyDiv;
- }
-
- /**
- * Creates the select item.
- *
- * @param visualDocument the visual document
- * @param e the e
- *
- * @return the ns IDOM node
- */
- private nsIDOMNode createSelectItem(Element e, nsIDOMDocument visualDocument) {
- final nsIDOMElement item = visualDocument.createElement(HTML.TAG_SPAN);
-
- item.setAttribute(HTML.ATTR_CLASS, "rich-combobox-item " + sourceItemClass); //$NON-NLS-1$
- item.appendChild(visualDocument.createTextNode(ComponentUtil.getSelectItemValue(e)));
- return item;
- }
-
- /**
- * Creates the button table.
- *
- * @param visualDocument the visual document
- * @param sourceNode the source node
- *
- * @return the ns IDOM element
- */
- private nsIDOMElement createButtonTable(nsIDOMDocument visualDocument, Node sourceNode) {
- nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
- setUpTable(table);
-
- nsIDOMElement rowUp = visualDocument.createElement(HTML.TAG_TR);
-
- table.appendChild(rowUp);
-
- nsIDOMElement rowDown = visualDocument.createElement(HTML.TAG_TR);
- nsIDOMElement cellDown = visualDocument.createElement(HTML.TAG_TD);
-
- nsIDOMElement imageDownElement = visualDocument.createElement(HTML.TAG_INPUT);
-
- imageDownElement.setAttribute(HTML.ATTR_BORDER, ZERO_STRING);
- imageDownElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_IMAGE_TYPE);
- imageDownElement.setAttribute(HTML.ATTR_CLASS, RICH_COMBOBOX_IMAGE_STYLE_CLASS);
- cellDown.appendChild(imageDownElement);
- rowDown.appendChild(cellDown);
- table.appendChild(rowDown);
-
- return table;
- }
-
- /**
- * Create a HTML-part containg input element.
- *
- * @param sourceElement the source element
- * @param visualDocument The current node of the source tree.
- * @param sourceNode The document of the visual tree.
- * @param elementData the element data
- *
- * @return a HTML-part containg input element
- */
- private nsIDOMElement createInputElement(nsIDOMDocument visualDocument, Element sourceElement, VpeElementData elementData) {
- nsIDOMElement inputElement = visualDocument.createElement(HTML.TAG_INPUT);
-
- inputElement.setAttribute(HTML.ATTR_CLASS, getInputClass(sourceElement));
-
- inputElement.setAttribute(HTML.ATTR_STYLE, getInputStyle(sourceElement));
-
- inputElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
-
- inputElement.setAttribute(HTML.ATTR_SIZE, getInputSize(sourceElement));
- inputElement.setAttribute(HTML.ATTR_VALUE, getInputValue(sourceElement));
-
- if ((sourceElement).hasAttribute(RichFaces.ATTR_VALUE)) {
- elementData.addNodeData(new AttributeData(sourceElement.getAttributeNode(RichFaces.ATTR_VALUE), inputElement, true));
- } else {
- elementData.addNodeData(new AttributeData(RichFaces.ATTR_VALUE, inputElement, true));
- }
-
- return inputElement;
- }
-
- /**
- * Gets the default input class.
- *
- * @return the default input class
- */
- public String getDefaultInputClass() {
- return DEFAULT_INPUT_STYLE;
- }
-
- /**
- * Gets the default input size.
- *
- * @return the default input size
- */
- public String getDefaultInputSize() {
- return DEFAULT_INPUT_SIZE;
- }
-
- /**
- * Return a input class.
- *
- * @param sourceElement the source element
- * @param sourceNode a sourceNode
- *
- * @return a input class
- */
- public String getInputClass(Element sourceElement) {
- String returnValue = getDefaultInputClass();
- String tmp = getAttribute(sourceElement, RichFaces.ATTR_INPUT_CLASS);
- if (tmp.length() != 0) {
- returnValue = new StringBuffer().append(returnValue).append(Constants.WHITE_SPACE)
- .append(tmp).toString();
- }
- return returnValue;
- }
-
- /**
- * Return a input size.
- *
- * @param sourceElement the source element
- * @param sourceNode a sourceNode
- *
- * @return a input size
- */
- protected String getInputSize(Element sourceElement) {
- String returnValue = getDefaultInputSize();
- String tmp = getAttribute(sourceElement, RichFaces.ATTR_INPUT_SIZE);
- if (tmp.length() != 0) {
- returnValue = tmp;
- }
- return returnValue;
- }
-
- /**
- * Return a input style.
- *
- * @param sourceElement the source element
- * @param sourceNode a sourceNode
- *
- * @return a input style
- */
- private String getInputStyle(Element sourceElement) {
- String returnValue = getAttribute(sourceElement, RichFaces.ATTR_INPUT_STYLE);
- return returnValue;
- }
-
- /**
- * Return a input value.
- *
- * @param sourceElement the source element
- * @param sourceNode a sourceNode
- *
- * @return a input value
- */
- private String getInputValue(Element sourceElement) {
- String returnValue = getAttribute(sourceElement, RichFaces.ATTR_VALUE);
- final String defaultLabel = getAttribute(sourceElement, RichFaces.ATTR_DEFAULT_LABEL);
-
- if (defaultLabel != null && defaultLabel.length() > 0) {
- returnValue = defaultLabel;
- }
- return returnValue;
- }
-
- /**
- * Inits the default classes.
- */
- private void initDefaultClasses() {
- styleClasess.put(SECOND_DIV, "rich-combobox-font rich-combobox"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put(THIRD_DIV, "rich-combobox-font rich-combobox-shell"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put(THIRD_EMPTY_DIV, "rich-combobox-list-cord"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put(TEXT_FIELD, "rich-combobox-font-disabled rich-combobox-input-inactive"); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put(BUTTON_BACKGROUND, "rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"); //$NON-NLS-1$
- styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES); //$NON-NLS-1$ //$NON-NLS-2$
- styleClasess.put("forthEmptyDiv", "rich-combobox-strut rich-combobox-font"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * 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) {
- // TODO Auto-generated method stub
- return true;
- }
-
- /**
- * Prepare data.
- *
- * @param source the source
- */
- private void prepareData(Element source) {
- AttributeMap attributeMap = new AttributeMap(source);
-
- // Commented because of not working alignment in RichFaces implementation
- // if (attributeMap.isBlank(RichFaces.ATTR_ALIGN)) {
- // this.sourceAlign = DEFAULT_ALIGN;
- // } else {
- // this.sourceAlign = attributeMap.getString(RichFaces.ATTR_ALIGN);
- // }
-
- if (attributeMap.isBlank(RichFaces.ATTR_LIST_WIDTH)) {
- this.sourceListWidth = DEFAULT_LIST_WIDTH;
- } else {
- this.sourceListWidth = attributeMap.getString(RichFaces.ATTR_LIST_WIDTH);
- }
-
- this.sourceListHeight = attributeMap.getString(RichFaces.ATTR_LIST_HEIGHT);
-
- if (attributeMap.isBlank(RichFaces.ATTR_WIDTH)) {
- this.sourceWidth = DEFAULT_LIST_WIDTH;
- } else {
- this.sourceWidth = attributeMap.getString(RichFaces.ATTR_WIDTH);
-
- if(this.sourceListWidth == DEFAULT_LIST_WIDTH) {
- this.sourceListWidth = this.sourceWidth;
- }
- }
-
- if (ComponentUtil.isNotBlank(this.sourceWidth) && (this.sourceWidth != DEFAULT_LIST_WIDTH)) {
- if(!this.sourceWidth.endsWith(Constants.PIXEL)){
- try {
- int intValue = Integer.parseInt(this.sourceWidth);
- this.sourceWidth = String.valueOf(intValue)+Constants.PIXEL;
- } catch (NumberFormatException e) {
- this.sourceListWidth = DEFAULT_LIST_WIDTH;
- }
- }
- }
-
- this.sourceDefaultLabel = attributeMap.getString("defaultLabel"); //$NON-NLS-1$
- this.sourceValue = attributeMap.getString( RichFaces.ATTR_VALUE);
-
- this.sourceButtonStyle = attributeMap.getString("buttonStyle"); //$NON-NLS-1$
-
- final String sourceStyleClasess = attributeMap.getString(RichFaces.ATTR_STYLE_CLASS);
-
- if (ComponentUtil.isNotBlank(sourceStyleClasess)) {
- styleClasess.put(SECOND_DIV, styleClasess.get(SECOND_DIV) + " " + sourceStyleClasess); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- this.sourceStyle = attributeMap.getString(HTML.ATTR_STYLE);
- this.sourceInputStyle = attributeMap.getString("inputStyle"); //$NON-NLS-1$
- this.sourceInputClass = attributeMap.getString("inputClass"); //$NON-NLS-1$
- this.sourceListClass = attributeMap.getString("listClass"); //$NON-NLS-1$
- this.sourceListStyle = attributeMap.getString("listStyle"); //$NON-NLS-1$
- this.sourceItemClass = attributeMap.getString("itemClass"); //$NON-NLS-1$
-
- this.sourceButtonIcon = attributeMap.getString(BUTTON_ICON); //$NON-NLS-1$
- this.sourceButtonIconInactive = attributeMap.getString("buttonIconInactive"); //$NON-NLS-1$
- this.sourceButtonIconDisabled = attributeMap.getString("buttonIconDisabled"); //$NON-NLS-1$
- this.disabled = (attributeMap.getBoolean("disabled") == Boolean.TRUE); //$NON-NLS-1$
-
- if(ComponentUtil.isBlank(this.sourceButtonIcon)){
- this.sourceButtonIcon = IMAGE_NAME_DOWN;
- }
-
- }
-
- /**
- * Sets the attribute.
- *
- * @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
- *
- * @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) {
- // 1. Call super method
- super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name, value);
-
- // nsIDOMElement table = (nsIDOMElement) visualNode.queryInterface(
- // nsIDOMElement.NS_IDOMELEMENT_IID);
- // nsIDOMNodeList listTable = table.getChildNodes();
- // nsIDOMNode nodeTr = listTable.item(0);
- // nsIDOMNodeList listTr = nodeTr.getChildNodes();
- // nsIDOMNode nodeTd = listTr.item(0);
- //
- // nsIDOMNodeList listTd = nodeTd.getChildNodes();
- // nsIDOMNode entry0 = listTd.item(0);
- //
- // nsIDOMElement inputElement = (nsIDOMElement) entry0.queryInterface(
- // nsIDOMElement.NS_IDOMELEMENT_IID);
- //
- // inputElement.setAttribute(HTML.ATTR_CLASS, getInputClass(
- // sourceElement));
- //
- // inputElement.setAttribute(HTML.ATTR_STYLE, getInputStyle(
- // sourceElement));
- // inputElement.setAttribute(HTML.ATTR_SIZE, getInputSize(sourceElement)
- // );
- // inputElement.setAttribute(HTML.ATTR_VALUE, getInputValue(
- // sourceElement));
- //
- // // 3. Set a style for main container
- // String strStyle = getAttribute(sourceElement, RichFaces.ATTR_STYLE);
- // strStyle = ((strStyle.length() == 0) ? DEFAULT_WIDTH : strStyle);
- //
- // table.setAttribute(HTML.ATTR_STYLE, strStyle);
-
- }
-
- /**
- * Sets the up img.
- *
- * @param i *
- * @param width the width
- * @param height the height
- * @param img the img
- * @param j *
- * @param image the image
- * @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 table.
- *
- * @param table the table
- */
- private void setUpTable(final nsIDOMElement table) {
- table.setAttribute(HTML.ATTR_BORDER, ZERO_STRING);
- table.setAttribute(HTML.ATTR_CELLPADDING, ZERO_STRING);
- table.setAttribute(HTML.ATTR_CELLSPACING, ZERO_STRING);
- }
-
- /**
- * Sets the up td.
- *
- * @param visualDocument the visual document
- * @param elementData the element data
- * @param cellInput the cell input
- * @param source the source
- */
- private void setUpTd(nsIDOMDocument visualDocument, final Element source, final VpeElementData elementData,
- final nsIDOMElement cellInput) {
- cellInput.setAttribute(HTML.ATTR_CLASS, RICH_COMBOBOX_INPUT_CELL_STYLE);
- cellInput.setAttribute(HTML.ATTR_VALIGN, HTML.VALUE_TOP_ALIGN);
- cellInput.appendChild(createInputElement(visualDocument, source, elementData));
- }
-
- /**
- * Stop toggling.
- *
- * @param sourceNode the source node
- */
- public void stopToggling(Node sourceNode) {
- isToggle = false;
- }
-
- /**
- * Toggle.
- *
- * @param builder the builder
- * @param sourceNode the source node
- * @param toggleId the toggle id
- */
- public void toggle(VpeVisualDomBuilder builder, Node sourceNode, String toggleId) {
- if (disabled) {
- isToggle = false;
- } else {
- isToggle = !isToggle;
- }
-
- }
+ /* (non-Javadoc)
+ * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument, org.mozilla.interfaces.nsIDOMElement, java.lang.Object, java.lang.String, java.lang.String)
+ */
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/AttributeMap.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/AttributeMap.java 2008-10-13 18:03:55 UTC (rev 10805)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/AttributeMap.java 2008-10-13 18:22:12 UTC (rev 10806)
@@ -15,13 +15,15 @@
/**
* A wrapper of DOM Element that can extract its attributes as objects of different types.
- * The methods of the class never throw exceptions. In case if parsing is impossible they
- * always return a correct value.
+ * The methods of the class never throw any exception. In case if parsing is impossible they
+ * always return a correct value(see methods descriptions).
*
* @author yradtsevich
* @see Element
*/
public class AttributeMap {
+ private static final String FALSE_VALUE = "false"; //$NON-NLS-1$
+ private static final String TRUE_VALUE = "true"; //$NON-NLS-1$
private Element element;
public AttributeMap(Element element) {
@@ -54,9 +56,9 @@
Boolean ret;
- if ("true".equals(attribute)) {
+ if (TRUE_VALUE.equals(attribute)) {
ret = Boolean.TRUE;
- } else if ("false".equals(attribute)) {
+ } else if (FALSE_VALUE.equals(attribute)) {
ret = Boolean.FALSE;
} else {
ret = null;
@@ -65,8 +67,24 @@
return ret;
}
+ public void setAttribute(String name, boolean value) {
+ if (value) {
+ element.setAttribute(name, TRUE_VALUE);
+ } else {
+ element.setAttribute(name, FALSE_VALUE);
+ }
+ }
+
+ /**
+ * Tests if its parameter is blank string
+ *
+ * @param attributeName
+ * @return <code>true</code> if and only if <code>attributeName</code> is
+ * either <code>null</code>, or blank, or contains non-printable characters only
+ */
public boolean isBlank(String attributeName) {
String value = getString(attributeName);
return ComponentUtil.isBlank(value);
}
+
}
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-10-13 18:03:55 UTC (rev 10805)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-10-13 18:22:12 UTC (rev 10806)
@@ -106,5 +106,5 @@
public static final String STYLE_PARAMETER_WIDTH = "width"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_HEIGHT = "height"; //$NON-NLS-1$
-
+ public static final String STYLE_PARAMETER_MAX_HEIGHT = "max-height"; //$NON-NLS-1$
}
\ No newline at end of file
16 years, 3 months
JBoss Tools SVN: r10805 - trunk/seam/plugins/org.jboss.tools.seam.ui.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-10-13 14:03:55 -0400 (Mon, 13 Oct 2008)
New Revision: 10805
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2118 Cleanup/unify the EL code completion used in JSF, Java, Seam completions
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-10-13 17:51:34 UTC (rev 10804)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-10-13 18:03:55 UTC (rev 10805)
@@ -342,16 +342,34 @@
<contentAssistProcessor
class="org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor"
id="org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor">
- <partitiontype id="org.eclipse.wst.xml.XML_DEFAULT" />
- <partitiontype id="org.eclipse.wst.html.HTML_DEFAULT" />
- <partitiontype id="org.eclipse.jst.jsp.DEFAULT_JSP" />
- <partitiontype id="org.eclipse.jst.jsp.JSP_DIRECTIVE" />
- <partitiontype id="org.eclipse.jst.jsp.SCRIPT.DELIMITER" />
- <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
- <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ <contenttype id="org.eclipse.jst.jsp.core.jspsource">
+ <partitiontype id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitiontype id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitiontype id="org.eclipse.jst.jsp.DEFAULT_JSP" />
+ <partitiontype id="org.eclipse.jst.jsp.JSP_DIRECTIVE" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.DELIMITER" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ </contenttype>
+ <contenttype id="org.eclipse.wst.html.core.htmlsource">
+ <partitiontype id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitiontype id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitiontype id="org.eclipse.jst.jsp.DEFAULT_JSP" />
+ <partitiontype id="org.eclipse.jst.jsp.JSP_DIRECTIVE" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.DELIMITER" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ </contenttype>
+ <contenttype id="org.eclipse.core.runtime.xml">
+ <partitiontype id="org.eclipse.wst.xml.XML_DEFAULT" />
+ </contenttype>
+ <contenttype id="org.jboss.tools.common.model.ui.xml">
+ <partitiontype id="org.eclipse.wst.xml.XML_DEFAULT" />
+ </contenttype>
+
</contentAssistProcessor>
- </extension>
+ </extension>
<extension
point="org.eclipse.ui.popupMenus">
16 years, 3 months
JBoss Tools SVN: r10804 - trunk/jst/plugins/org.jboss.tools.jst.jsp.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-10-13 13:51:34 -0400 (Mon, 13 Oct 2008)
New Revision: 10804
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2118 Cleanup/unify the EL code completion used in JSF, Java, Seam completions
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2008-10-13 17:50:52 UTC (rev 10803)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2008-10-13 17:51:34 UTC (rev 10804)
@@ -304,11 +304,11 @@
</extension-->
<extension point="org.jboss.tools.jst.jsp.occurrenceStructureProviders">
- <provider
- class="org.jboss.tools.jst.jsp.text.JSPOccurrenceProvider"
- editorId="org.jboss.tools.jst.jsp"
- name="%defaultOccurrenceStructureProviderName" />
- </extension>
+ <provider
+ class="org.jboss.tools.jst.jsp.text.JSPOccurrenceProvider"
+ editorId="org.jboss.tools.jst.jsp"
+ name="%defaultOccurrenceStructureProviderName" />
+ </extension>
<extension
point="org.eclipse.core.runtime.contentTypes">
<file-association
@@ -341,4 +341,64 @@
class="org.jboss.tools.jst.jsp.outline.VpeProperties"/>
</extension>
+ <extension
+ point="org.jboss.tools.common.text.xml.contentAssistProcessor"
+ id="org.jboss.tools.jst.jsp.contentAssistProcessor"
+ name="org.jboss.tools.jst.jsp.contentAssistProcessor">
+
+ <contentAssistProcessor
+ class="org.jboss.tools.jst.jsp.contentassist.ExtendedJSPContentAssistProcessor"
+ id="org.jboss.tools.jst.jsp.contentassist.ExtendedJSPContentAssistProcessor">
+ <contenttype id="org.eclipse.jst.jsp.core.jspsource">
+ <partitiontype id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitiontype id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitiontype id="org.eclipse.jst.jsp.DEFAULT_JSP" />
+ <partitiontype id="org.eclipse.jst.jsp.JSP_DIRECTIVE" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.DELIMITER" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ </contenttype>
+ <contenttype id="org.eclipse.wst.html.core.htmlsource">
+ <partitiontype id="org.eclipse.wst.xml.XML_DEFAULT" />
+ <partitiontype id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitiontype id="org.eclipse.jst.jsp.DEFAULT_JSP" />
+ <partitiontype id="org.eclipse.jst.jsp.JSP_DIRECTIVE" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.DELIMITER" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" />
+ </contenttype>
+ </contentAssistProcessor>
+
+ <contentAssistProcessor
+ class="org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor"
+ id="org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor">
+ <contenttype id="org.eclipse.jst.jsp.core.jspsource">
+ <partitiontype id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" /> <!-- Is this forgotten? -->
+ </contenttype>
+ <contenttype id="org.eclipse.wst.html.core.htmlsource">
+ <partitiontype id="org.eclipse.wst.html.HTML_DEFAULT" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL" />
+ <partitiontype id="org.eclipse.jst.jsp.SCRIPT.JSP_EL2" /> <!-- Is this forgotten? -->
+ </contenttype>
+ </contentAssistProcessor>
+
+ <!--
+ //added by estherbin
+ //fix http://jira.jboss.com/jira/browse/JBIDE-1791
+ -->
+ <contentAssistProcessor
+ class="org.eclipse.wst.css.ui.internal.contentassist.CSSContentAssistProcessor"
+ id="org.eclipse.wst.css.ui.internal.contentassist.CSSContentAssistProcessor">
+ <contenttype id="org.eclipse.jst.jsp.core.jspsource">
+ <partitiontype id="org.eclipse.wst.css.STYLE" />
+ </contenttype>
+ <contenttype id="org.eclipse.wst.html.core.htmlsource">
+ <partitiontype id="org.eclipse.wst.css.STYLE" />
+ </contenttype>
+ </contentAssistProcessor>
+
+ </extension>
+
</plugin>
\ No newline at end of file
16 years, 3 months