001: package com.xoetrope.carousel.install;
002:
003: import com.xoetrope.builder.database.DatabaseFormBuilderDndHelper;
004: import com.xoetrope.builder.pojo.PojoFormBuilderDndHelper;
005: import com.xoetrope.builder.w3c.html.XHtmlComponentFactory;
006: import com.xoetrope.carousel.builder.XEditorHtmlBuilder;
007: import com.xoetrope.carousel.langed.LanguageProjectListener;
008: import com.xoetrope.carousel.services.ProjectRouteManager;
009: import com.xoetrope.carousel.survey.SurveyProjectListener;
010: import com.xoetrope.carousel.visualizer.VisualiserProjectListener;
011: import com.xoetrope.data.DataSourceLoader;
012: import com.xoetrope.editor.lm.XModuleRegistrationDialog;
013: import com.xoetrope.editor.lm.XuiProLicenseManager;
014: import java.net.URL;
015: import net.xoetrope.editor.dnd.PageDesignerTransferHandler;
016: import net.xoetrope.editor.lm.LicenseManager;
017: import net.xoetrope.editor.project.ProjectListener;
018: import net.xoetrope.editor.project.XEditorProject;
019: import net.xoetrope.editor.project.XEditorProjectManager;
020: import net.xoetrope.editor.project.pages.components.XEditorRegisteredComponentFactory;
021: import net.xoetrope.xui.XComponentFactory;
022: import net.xoetrope.xui.style.XStyleFactory;
023:
024: /**
025: * Check the project initialization and set default properties as needed
026: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
027: * the GNU Public License (GPL), please see license.txt for more details. If
028: * you make commercial use of this software you must purchase a commercial
029: * license from Xoetrope.</p>
030: * <p> $Revision: 1.8 $</p>
031: */
032: public class XuiProProjectCheck implements ProjectListener {
033: /**
034: * Creates a new instance of XuiProProjectCheck
035: */
036: public XuiProProjectCheck() {
037: }
038:
039: /**
040: * Check that all the extra properties are configured
041: */
042: public void checkProject(XEditorProject proj) {
043: // Hashtable managerObjects = proj.getManagerObjects();
044: // if ( managerObjects.get( Constants.SERVICES ) == null )
045: // managerObjects.put( Constants.SERVICES, new XEditorProjectProperty( "services.xml" ));
046: // if ( managerObjects.get( Constants.ROUTES ) == null )
047: // managerObjects.put( Constants.ROUTES, new XEditorProjectProperty( "routes.xml" ));
048: }
049:
050: /**
051: * Notification of project initialized.
052: * @param project the editor project just initialized
053: */
054: public void projectInitialized(XEditorProject project) {
055: }
056:
057: /**
058: * Update to reflect the new project state
059: */
060: public void projectUpdated(XEditorProject proj) {
061: }
062:
063: /**
064: * A project has just been loaded
065: * @param cp the project that has just been loaded
066: */
067: public void projectLoaded(XEditorProject project) {
068: XComponentFactory.registerComponentFactory(
069: "XHtmlComponentFactory", new XHtmlComponentFactory());
070: project.getPageManager().addSecondaryLoader(
071: new XEditorHtmlBuilder(project, (XStyleFactory) project
072: .getStyleFactory()));
073: }
074:
075: public void saveProject(XEditorProject project) {
076: }
077:
078: public void resetProject(String moduleName, XEditorProject project) {
079: }
080:
081: public static void initializeModules(ClassLoader classLoader) {
082: LicenseManager licensManager = XEditorProjectManager
083: .getLicenseManager();
084: if (licensManager == null)
085: XEditorProjectManager
086: .setLicenseManager(new XuiProLicenseManager());
087:
088: if (XEditorProjectManager.isUserRegistered(
089: XModuleRegistrationDialog.class.getClassLoader(),
090: "XUI Pro")) {
091: XEditorProjectManager.resetProject("XuiPro");
092: XEditorProjectManager.setClassLoader("XuiPro", classLoader);
093: if (XEditorProjectManager
094: .isUserRegistered("XUI Pro Widgets")) {
095: URL url = classLoader
096: .getResource("com/xoetrope/carousel/resources/xuiProComponents.xml");
097: XEditorRegisteredComponentFactory.addConfigFile(
098: "XuiPro", url, true);
099: }
100: if (XEditorProjectManager
101: .isUserRegistered("XUI Pro SVG Widgets")) {
102: URL url2 = classLoader
103: .getResource("com/xoetrope/carousel/resources/svgComponents.xml");
104: XEditorRegisteredComponentFactory.addConfigFile("Svg",
105: url2, true);
106: }
107: XEditorProjectManager.setDefaultClassLoader(classLoader);
108: XEditorProjectManager.addProjectListener(
109: "XuiProProjectCheck", new XuiProProjectCheck(),
110: true);
111: // XComponentFactory.registerComponentFactory( "XuiProComponentFactory", new XuiProComponentFactory() );
112:
113: XEditorProjectManager.addProjectListener("RouteManager",
114: ProjectRouteManager.getInstance(), true);
115: XEditorProjectManager.addProjectListener("LanguageManager",
116: new LanguageProjectListener(), true);
117: XEditorProjectManager.addProjectListener("SurveyManager",
118: new SurveyProjectListener(), true);
119: XEditorProjectManager.addProjectListener("ModelVisualiser",
120: new VisualiserProjectListener(), true);
121: XEditorProjectManager.addProjectListener(
122: "DataSourceLoader", new DataSourceLoader(), true);
123:
124: PageDesignerTransferHandler
125: .addDndHelper(new PojoFormBuilderDndHelper());
126: PageDesignerTransferHandler
127: .addDndHelper(new DatabaseFormBuilderDndHelper());
128: }
129: }
130:
131: }
|