2
0
Fork 0

Added pdf export support, export servlet support, renamed frontends

without s and made vasc config object.
This commit is contained in:
Willem Cazander 2012-05-12 17:26:21 +02:00
parent efcbdbd519
commit b3923bd2fb
160 changed files with 5001 additions and 2552 deletions

View file

@ -21,6 +21,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-editor</artifactId>
@ -30,7 +35,15 @@
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-web</artifactId>
<version>${project.version}</version>
<!-- <type>war</type> -->
<type>war</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-web</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
@ -47,6 +60,16 @@
<artifactId>vasc-frontend-web-jsf</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-web-export</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-cxf-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-backend-ldap</artifactId>

View file

@ -42,13 +42,14 @@ import org.jdesktop.application.FrameView;
import org.jdesktop.application.SingleFrameApplication;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.demo.tech.core.DemoVascManager;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanelMenuBar;
public class TechUI extends SingleFrameApplication {
private Logger logger = null;
private VascManager vascManager = null;
private DemoVascManager vascManager = null;
private TomcatManager tomcatManager = null;
static public void main(String[] args) {
@ -129,7 +130,7 @@ public class TechUI extends SingleFrameApplication {
long startTime = System.currentTimeMillis();
setupLogging();
logger.info("Starting Vasc-Demo-Tech-UI.");
vascManager = new VascManager();
vascManager = new DemoVascManager();
vascManager.start();
autoLoadVasc();
@ -180,7 +181,7 @@ public class TechUI extends SingleFrameApplication {
return getInstance(TechUI.class);
}
public VascManager getVascManager() {
public DemoVascManager getVascManager() {
return vascManager;
}

View file

@ -1,8 +1,5 @@
package net.forwardfire.vasc.demo.tech.ui;
import java.io.File;
import java.io.FileOutputStream;
import java.lang.reflect.Method;
import java.util.logging.Logger;
import org.eobjects.metamodel.DataContext;
@ -17,118 +14,28 @@ import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.VascLinkEntry;
import net.forwardfire.vasc.core.VascLinkEntryType;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
import net.forwardfire.vasc.impl.DefaultVascEntry;
import net.forwardfire.vasc.impl.DefaultVascEntryField;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.impl.DefaultVascLinkEntry;
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry;
import net.forwardfire.vasc.impl.x4o.VascParser;
public class VascManager {
public class VascAutoSchemaMetaModel {
private Logger logger = null;
private VascController vascController = null;
public VascManager() {
logger = Logger.getLogger(VascManager.class.getName());
public VascAutoSchemaMetaModel(VascController vascController) {
logger = Logger.getLogger(VascAutoSchemaMetaModel.class.getName());
this.vascController=vascController;
}
public void start() {
logger.finer("Starting vascmanager");
try {
vascController = DefaultVascFactory.getDefaultVascController(2288L,"forwardfire.net","user","admin");
initEditor();
} catch (VascException e) {
throw new RuntimeException(e);
}
}
public void stop() {
vascController = null;
logger.info("Stop manager, cleared all.");
}
private void initEditor() {
try {
VascParser parser = new VascParser(vascController);
parser.addGlobalELBean("vascController", vascController);
parser.parseResource("net/forwardfire/vasc/editor/vasc-edit.xml");
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
}
}
public void openFile(File file) {
logger.info("Vasc open file: "+file.getAbsoluteFile());
try {
VascParser parser = new VascParser(vascController);
File f = File.createTempFile("test-vasc", ".xml");
parser.setDebugOutputStream(new FileOutputStream(f));
parser.parseFile(file);
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
}
}
public VascController getVascController() {
private VascController getVascController() {
return vascController;
}
public void printEntries() {
try {
for (String key:getVascController().getVascEntryController().getVascEntryIds()) {
VascEntry ve = getVascController().getVascEntryController().getVascEntryById(key);
printEntry(ve);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private void printEntry(VascEntry e) throws Exception {
System.out.println("");
System.out.println("=== Printing entry ===");
System.out.println("");
for (Method m:e.getClass().getMethods()) {
if (m.getName().startsWith("get")==false) { //a bit dirty
continue;
}
if (m.getParameterTypes().length>0) {
continue;
}
System.out.println("prop: "+m.getName()+" -> "+m.invoke(e));
}
System.out.println("");
System.out.println("=== Fields ===");
for (VascEntryField vef:e.getVascEntryFields()) {
System.out.println("=== Field: "+vef.getId());
for (Method m:vef.getClass().getMethods()) {
if (m.getName().startsWith("get")==false) { //a bit dirty
continue;
}
if (m.getParameterTypes().length>0) {
continue;
}
System.out.println("prop: "+m.getName()+" -> "+m.invoke(vef));
}
}
}
public void createMetaEntry(MetaModelDataContextProvider ds,String id,String tableName) {
logger.info("Creating entry id: "+id+" of table: "+tableName);
@ -175,12 +82,10 @@ public class VascManager {
try {
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backend);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve, getVascController());
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve);
// mm TODO rm this fill which adds the global actions ... and show updated tree in editor
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) getVascController().getVascEntryController(), getVascController());
//rebuildTree();
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
} catch (Exception ee) {
ee.printStackTrace();
}
@ -222,7 +127,7 @@ public class VascManager {
try {
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink, getVascController());
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink);
VascLinkEntry vle = new DefaultVascLinkEntry();
vle.setId(id+"Link");
@ -272,7 +177,7 @@ public class VascManager {
vef.getVascEntryFieldType().setDataObject(itemModel);
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink, getVascController());
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink);
} catch (Exception e) {
e.printStackTrace();
}

View file

@ -18,6 +18,8 @@ import javax.swing.JPanel;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
public class JDialogMetaCsv extends JDialog implements ActionListener {
@ -62,7 +64,9 @@ public class JDialogMetaCsv extends JDialog implements ActionListener {
File file = fc.getSelectedFile();
MetaModelDataContextCsv ds = new MetaModelDataContextCsv();
ds.setFile(file.getAbsolutePath());
TechUI.getInstance().getVascManager().createMetaEntry(ds,file.getName(),null);
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController());
schema.createMetaEntry(ds,file.getName(),null);
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
}
}
});

View file

@ -19,6 +19,8 @@ import javax.swing.SpringLayout;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid;
import org.eobjects.metamodel.DataContext;
@ -89,9 +91,11 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener {
ds.setPassword(passwordField.getText());
DataContext metaDs = ds.getDataContext();
String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController());
for (String table:metaDs.getDefaultSchema().getTableNames()) {
TechUI.getInstance().getVascManager().createMetaEntry(ds,dbName+"_"+table,table);
schema.createMetaEntry(ds,dbName+"_"+table,table);
}
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
}
});
result.add(fileButton);

View file

@ -18,6 +18,8 @@ import javax.swing.SpringLayout;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid;
import org.eobjects.metamodel.DataContext;
@ -78,9 +80,11 @@ public class JDialogMetaMongodb extends JDialog implements ActionListener {
ds.setPort(new Integer(hostPortField.getText()));
ds.setDatabase(databaseField.getText());
DataContext metaDs = ds.getDataContext();
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController());
for (String table:metaDs.getDefaultSchema().getTableNames()) {
TechUI.getInstance().getVascManager().createMetaEntry(ds,ds.getDatabase()+"_"+table,table);
schema.createMetaEntry(ds,ds.getDatabase()+"_"+table,table);
}
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
}
});
result.add(fileButton);

View file

@ -53,10 +53,10 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.demo.tech.core.DemoVascManager;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
import net.forwardfire.vasc.demo.tech.ui.VascManager;
import net.forwardfire.vasc.frontends.swing.SwingPanelIntegration;
import net.forwardfire.vasc.frontends.swing.SwingPanelTabbed;
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle_en;
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
@ -64,7 +64,7 @@ import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
public class JMainPanel extends JPanel {
private static final long serialVersionUID = 5834715323973411147L;
private VascManager vascManager = null;
private DemoVascManager vascManager = null;
private SwingPanelIntegration spi = null;
private JTabbedPane tabPane = null;
private JTree vascTree = null;

View file

@ -76,10 +76,6 @@ vasc.validator.VascStringZipCodeValidator=Value must be a valid post code.
# Vasc actions labels
vasc.action.addRowAction.description = add a new record
vasc.action.addRowAction.name = Add
vasc.action.csvExportAction.description = CSV
vasc.action.csvExportAction.name = CSV
vasc.action.xmlExportAction.description = XML
vasc.action.xmlExportAction.name = XML
vasc.action.deleteRowAction.description = delete
vasc.action.deleteRowAction.name = delete
vasc.action.downloadAction.description = Select this record.
@ -87,6 +83,26 @@ vasc.action.downloadAction.name = Select
vasc.action.editRowAction.description = edit
vasc.action.editRowAction.name = Edit
vasc.action.csvExportAction.description = CSV
vasc.action.csvExportAction.name = CSV
vasc.action.xmlExportAction.description = XML
vasc.action.xmlExportAction.name = XML
vasc.action.xmltreeExportAction.description = XMLTree
vasc.action.xmltreeExportAction.name = XMLTree
vasc.action.jrPdfLandscapeExportAction.description = jrPdfLandscape
vasc.action.jrPdfLandscapeExportAction.name = PDF-Landscape
vasc.action.jrPdfPortraitExportAction.description = jrPdfPortrait
vasc.action.jrPdfPortraitExportAction.name = PDF-Portrait
vasc.action.jrRtfExportAction.description = RTF
vasc.action.jrRtfExportAction.name = RTF
vasc.action.jrXlsExportAction.description = XLS
vasc.action.jrXlsExportAction.name = XLS
vasc.action.jrXmlExportAction.description = JR-XML
vasc.action.jrXmlExportAction.name = JR-XML
vasc.action.jrCsvExportAction.description = JR-CSV
vasc.action.jrCsvExportAction.name = JR-CSV
# Temp jsf
generic.vasc.jsf.listOption.header = Searchoptions
generic.vasc.jsf.listOption.search = Searh\:
@ -116,3 +132,6 @@ generic.vasc.jsf.action.cancel = Cancel
generic.vasc.jsf.action.back = Back
generic.vasc.jsf.parentSelected = Selected:
vasc.dialog.edit.message = Edit
vasc.dialog.save.name = Save
vasc.dialog.cancel.name = Cancel