2
0
Fork 0

wip commit with working vasc demo tech

This commit is contained in:
Willem Cazander 2012-05-06 06:50:29 +02:00
parent a25e98f5d5
commit c23d14522f
100 changed files with 4356 additions and 1220 deletions

9
authors.txt Normal file
View file

@ -0,0 +1,9 @@
Vasc was written by:
Willem Cazander <w.cazander@gmail.com>
Contributors:
...

21
licence.txt Normal file
View file

@ -0,0 +1,21 @@
Copyright (c) 2007-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -99,6 +99,8 @@
<jbosssx-client.version>3.0.0.CR2</jbosssx-client.version> <jbosssx-client.version>3.0.0.CR2</jbosssx-client.version>
<jboss-as-tomcat.version>6.0.0.Final</jboss-as-tomcat.version> <jboss-as-tomcat.version>6.0.0.Final</jboss-as-tomcat.version>
<!-- Application lib versions in tech demos -->
<bsaf.version>1.9.2</bsaf.version>
</properties> </properties>
<dependencies> <dependencies>

35
readme.txt Normal file
View file

@ -0,0 +1,35 @@
=== Welcome in Vasc ===
Vasc is a framework to provided all crud operations on different
data backends like databases to csv files. With multiple frontends
like swing/jsf and swt.
=== Files in this package ===
authors.txt - Contributors listing.
build.txt - Developer build guide.
licence.txt - The licence of PulseFire.
pom.xml - Maven specific build file.
readme.txt - This file.
todo.txt - Small todo list.
versions.txt - Versions history.
vasc-* - Maven java packages for vasc.
src - site source.
=== Licenced binary files ===
./src/site/resources/images/site-logo.png
./src/site/vasc.jks
The binary files in the above listing fall all under
the licence terms described in the licence.txt file.
=== External licenced binary files ===
None.
#EOF

View file

@ -1,35 +0,0 @@
TODO LIST
+--
- (30%) X4O client/server config
- fix frontend event system
- make event channels work
- config prefix (and rest of default in finalizer)
- (10%) update SWT frontend
- create JSF frontend
- Make annotations work.
- Multiple SelectItems for addable null's etc.
- make sorting work
- make searching work
- made options work
- auto text converts
- Plugin validation
- Plugin Role Parser
- Finalizer plugins
- Check user roles in frontend
- Default/Full Table and templating
- Ckeck all validators
- Bind to x18n
- MetaQuery support
- create JSF-extJS frontend
- create XML-RPC frontend
- export interface + exports
- graphs of numeric value columns
=== DONE ===
+--

34
todo.txt Normal file
View file

@ -0,0 +1,34 @@
== TODO ==
- xml file as argument
- x4o template
- swing readonly field editor
- order by list and edit.
- vasc AUTO ID
- textarea size in xml & swing.
- new NULL vs "" setting global+per entity
- date format list and edit per field.
- readonly field icm auto fill field from code/xml
- meta query xpql support
- page sum line
- total sum line
- graphs support
- mongo backend paging
- meta model backend paging
- mongo missing field == string gives; VascBackendProxySort$1.compare(VascBackendProxySort.java:102)
- disable i18n
- load FILE resource bundle (in xml?)
- make event channels work
- auto text converts
- Plugin validation
- Plugin Role Parser
- Finalizer plugins
- Check user roles in frontend
- Default/Full Table and templating
- Ckeck all validators
- Bind to x18n
- MetaQuery support
- create JSF-extJS frontend
- create XML-RPC frontend
- export interface + exports
- graphs of numeric value columns

View file

@ -0,0 +1,90 @@
package net.forwardfire.vasc.backend.metamodel;
import java.sql.Connection;
import java.sql.DriverManager;
import org.eobjects.metamodel.DataContext;
import org.eobjects.metamodel.jdbc.JdbcDataContext;
public class MetaModelDataContextJdbc implements MetaModelDataContextProvider {
private String driverClass = null;
private String connectUrl = null;
private String username = null;
private String password = null;
public DataContext getDataContext() {
JdbcDataContext dataContext = new JdbcDataContext(getConnection());
return dataContext;
}
public Connection getConnection() {
synchronized (this) {
try {
Class.forName(getDriverClass());
Connection connection = DriverManager.getConnection(getConnectUrl(),getUsername(),getPassword());
return connection;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the connectUrl
*/
public String getConnectUrl() {
return connectUrl;
}
/**
* @param connectUrl the connectUrl to set
*/
public void setConnectUrl(String connectUrl) {
this.connectUrl = connectUrl;
}
/**
* @return the driverClass
*/
public String getDriverClass() {
return driverClass;
}
/**
* @param driverClass the driverClass to set
*/
public void setDriverClass(String driverClass) {
this.driverClass = driverClass;
}
}

View file

@ -19,8 +19,8 @@ public class MetaModelDataContextMongodb implements MetaModelDataContextProvider
private String password = null; private String password = null;
private boolean readonly = false; private boolean readonly = false;
protected static Mongo mongo = null; protected Mongo mongo = null;
protected static DB db = null; //protected DB db = null;
public DataContext getDataContext() { public DataContext getDataContext() {
MongoDbDataContext dataContext = new MongoDbDataContext(getMongodbConnection()); MongoDbDataContext dataContext = new MongoDbDataContext(getMongodbConnection());
@ -28,9 +28,6 @@ public class MetaModelDataContextMongodb implements MetaModelDataContextProvider
} }
public DB getMongodbConnection() { public DB getMongodbConnection() {
if (db!=null) {
return db;
}
synchronized (this) { synchronized (this) {
ServerAddress server; ServerAddress server;
try { try {
@ -40,7 +37,7 @@ public class MetaModelDataContextMongodb implements MetaModelDataContextProvider
} }
MongoOptions options = new MongoOptions(); MongoOptions options = new MongoOptions();
mongo = new Mongo(server,options); mongo = new Mongo(server,options);
db = mongo.getDB(database); DB db = mongo.getDB(database);
if (username!=null && password!=null) { if (username!=null && password!=null) {
boolean auth = db.authenticate(username, password.toCharArray()); boolean auth = db.authenticate(username, password.toCharArray());
if (auth==false) { if (auth==false) {
@ -50,10 +47,9 @@ public class MetaModelDataContextMongodb implements MetaModelDataContextProvider
if (readonly) { if (readonly) {
db.setReadOnly(true); db.setReadOnly(true);
} }
//logger.info("Connection to: "+db.getName());
}
return db; return db;
} }
}
/** /**
* @return the hostname * @return the hostname

View file

@ -23,8 +23,9 @@
package net.forwardfire.vasc.backend.metamodel; package net.forwardfire.vasc.backend.metamodel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -33,8 +34,11 @@ import org.eobjects.metamodel.UpdateScript;
import org.eobjects.metamodel.UpdateableDataContext; import org.eobjects.metamodel.UpdateableDataContext;
import org.eobjects.metamodel.data.DataSet; import org.eobjects.metamodel.data.DataSet;
import org.eobjects.metamodel.data.Row; import org.eobjects.metamodel.data.Row;
import org.eobjects.metamodel.insert.RowInsertionBuilder;
import org.eobjects.metamodel.query.Query; import org.eobjects.metamodel.query.Query;
import org.eobjects.metamodel.query.SelectItem; import org.eobjects.metamodel.query.SelectItem;
import org.eobjects.metamodel.query.builder.SatisfiedQueryBuilder;
import org.eobjects.metamodel.query.builder.SatisfiedWhereBuilder;
import org.eobjects.metamodel.schema.Schema; import org.eobjects.metamodel.schema.Schema;
import org.eobjects.metamodel.schema.Table; import org.eobjects.metamodel.schema.Table;
import org.eobjects.metamodel.update.RowUpdationBuilder; import org.eobjects.metamodel.update.RowUpdationBuilder;
@ -74,7 +78,51 @@ public class MetaModelVascBackend extends AbstractVascBackend {
UpdateableDataContext dataContext = getUpdateableDataContext(); UpdateableDataContext dataContext = getUpdateableDataContext();
Schema schema = dataContext.getDefaultSchema(); Schema schema = dataContext.getDefaultSchema();
Table t = schema.getTableByName(table); Table t = schema.getTableByName(table);
Query q = dataContext.query().from(t).select(t.getColumns()).toQuery();
Object qWhere = dataContext.query().from(t).select(t.getColumns());
Iterator<String> keys = state.getDataParameterKeys().iterator();
boolean first = true;
while (keys.hasNext()) {
String key = keys.next();
Object value = state.getDataParameter(key); /// TODO: redo this nasty code
if (value instanceof Number) {
if (first) {
qWhere = ((SatisfiedQueryBuilder<?>)qWhere).where(key).equals((Number)value);
} else {
qWhere = ((SatisfiedWhereBuilder<?>)qWhere).and(key).equals((Number)value);
}
} else if (value instanceof Date) {
if (first) {
qWhere = ((SatisfiedQueryBuilder<?>)qWhere).where(key).equals((Date)value);
} else {
qWhere = ((SatisfiedWhereBuilder<?>)qWhere).and(key).equals((Date)value);
}
} else if (value instanceof Boolean) {
if (first) {
qWhere = ((SatisfiedQueryBuilder<?>)qWhere).where(key).equals((Boolean)value);
} else {
qWhere = ((SatisfiedWhereBuilder<?>)qWhere).and(key).equals((Boolean)value);
}
} else {
if (value==null) {
if (first) {
qWhere = ((SatisfiedQueryBuilder<?>)qWhere).where(key).isNull();
} else {
qWhere = ((SatisfiedWhereBuilder<?>)qWhere).and(key).isNull();
}
} else {
if (first) {
qWhere = ((SatisfiedQueryBuilder<?>)qWhere).where(key).equals(value.toString());
} else {
qWhere = ((SatisfiedWhereBuilder<?>)qWhere).and(key).equals(value.toString());
}
}
}
first = false;
}
Query q = ((SatisfiedQueryBuilder<?>)qWhere).toQuery();
DataSet ds = dataContext.executeQuery(q); DataSet ds = dataContext.executeQuery(q);
List<Object> result = new ArrayList<Object>(50); List<Object> result = new ArrayList<Object>(50);
while (ds.next()) { while (ds.next()) {
@ -87,27 +135,23 @@ public class MetaModelVascBackend extends AbstractVascBackend {
} }
result.add(map); result.add(map);
} }
ds.close();
return result; return result;
} }
@SuppressWarnings("unchecked")
public void persist(Object object) throws VascException { public void persist(Object object) throws VascException {
final Map<String,Object> map = (Map<String,Object>)object;
UpdateableDataContext dataContext = getUpdateableDataContext(); UpdateableDataContext dataContext = getUpdateableDataContext();
dataContext.executeUpdate(new UpdateScript() { dataContext.executeUpdate(new UpdateScript() {
public void run(UpdateCallback backendImpl) { public void run(UpdateCallback backendImpl) {
Table table = backendImpl.createTable(null, "some_entries").withColumn("foo").withColumn("bar") RowInsertionBuilder query = backendImpl.insertInto(table);
.withColumn("baz").withColumn("list").execute(); for (String key:map.keySet()) {
Object value = map.get(key);
backendImpl.insertInto(table).value("foo", 1).value("bar", "hello").execute(); query.value(key, value);
backendImpl.insertInto(table).value("foo", 2).value("bar", "world").execute(); }
backendImpl.insertInto(table).value("foo", 3).value("bar", "hi").execute(); query.execute();
Map<String, Object> nestedObj = new HashMap<String, Object>();
nestedObj.put("foo", "bar");
nestedObj.put("123", 456);
backendImpl.insertInto(table).value("foo", 4).value("bar", "there").value("baz", nestedObj)
.value("list", Arrays.asList(1, 2, 3)).execute();
} }
}); });
} }
@ -118,8 +162,17 @@ public class MetaModelVascBackend extends AbstractVascBackend {
UpdateableDataContext dataContext = getUpdateableDataContext(); UpdateableDataContext dataContext = getUpdateableDataContext();
dataContext.executeUpdate(new UpdateScript() { dataContext.executeUpdate(new UpdateScript() {
public void run(UpdateCallback backendImpl) { public void run(UpdateCallback backendImpl) {
RowUpdationBuilder query = backendImpl.update(table).where(tableId).equals(""+map.get(tableId));
RowUpdationBuilder query = null;
if (map.get(tableId) instanceof Number) {
query = backendImpl.update(table).where(tableId).equals((Number)map.get(tableId));
} else {
query = backendImpl.update(table).where(tableId).equals(map.get(tableId).toString());
}
for (String key:map.keySet()) { for (String key:map.keySet()) {
if (key.equals(tableId)) {
continue; // skip id;
}
Object value = map.get(key); Object value = map.get(key);
query.value(key, value); query.value(key, value);
} }
@ -135,7 +188,11 @@ public class MetaModelVascBackend extends AbstractVascBackend {
UpdateableDataContext dataContext = getUpdateableDataContext(); UpdateableDataContext dataContext = getUpdateableDataContext();
dataContext.executeUpdate(new UpdateScript() { dataContext.executeUpdate(new UpdateScript() {
public void run(UpdateCallback backendImpl) { public void run(UpdateCallback backendImpl) {
backendImpl.deleteFrom(table).where(tableId).in(""+map.get(tableId)).execute(); if (map.get(tableId) instanceof Number) {
backendImpl.deleteFrom(table).where(tableId).equals((Number)map.get(tableId)).execute();
} else {
backendImpl.deleteFrom(table).where(tableId).equals(map.get(tableId).toString()).execute();
}
} }
}); });
} }

View file

@ -169,11 +169,11 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
for (Object o:back.execute(state)) { for (Object o:back.execute(state)) {
Object keyId = key.getVascEntryFieldValue().getValue(key, o); Object keyId = key.getVascEntryFieldValue().getValue(key, o);
String nameId = dis.getVascEntryFieldValue().getDisplayValue(dis, o); String nameId = dis.getVascEntryFieldValue().getDisplayValue(dis, o);
if (returnKeyValue!=null && true==returnKeyValue) { if (returnKeyValue!=null && false==returnKeyValue) {
VascSelectItem item = new VascSelectItem(nameId,keyId,""+keyId); VascSelectItem item = new VascSelectItem(nameId,o,""+keyId);
result.add(item); result.add(item);
} else { } else {
VascSelectItem item = new VascSelectItem(nameId,o,""+keyId); VascSelectItem item = new VascSelectItem(nameId,keyId,""+keyId); // per default return keyID object.
result.add(item); result.add(item);
} }
} }

View file

@ -13,6 +13,6 @@
<description>vasc-demo</description> <description>vasc-demo</description>
<modules> <modules>
<module>vasc-demo-petstore-j2ee5</module> <module>vasc-demo-petstore-j2ee5</module>
<module>vasc-demo-swing</module> <module>vasc-demo-tech</module>
</modules> </modules>
</project> </project>

View file

@ -1,640 +0,0 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.demo.swing;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.SpringLayout;
import javax.swing.SwingUtilities;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import org.eobjects.metamodel.DataContext;
import org.eobjects.metamodel.schema.Column;
import org.eobjects.metamodel.schema.Table;
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
import net.forwardfire.vasc.backend.VascBackendFilter;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextProvider;
import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryController;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascEntryFieldSet;
import net.forwardfire.vasc.core.VascLinkEntry;
import net.forwardfire.vasc.frontends.swing.SwingPanelIntegration;
import net.forwardfire.vasc.frontends.swing.SwingPanelTabbed;
import net.forwardfire.vasc.impl.DefaultVascEntry;
import net.forwardfire.vasc.impl.DefaultVascEntryField;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.validators.VascValidator;
public class JMainFrame extends JFrame {
VascManager vascManager = null;
SwingPanelIntegration spi = null;
JTabbedPane tabPane = null;
JTree vascTree = null;
JMenu fileMenu = new JMenu("File");
JMenu connMenu = new JMenu("Connection");
JMenu vascMenu = new JMenu("Entries");
public JMainFrame(VascManager vascManager ) {
this.vascManager=vascManager;
setTitle("Vasc Swing Demo");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setLayout(new BorderLayout());
add(createTreePane(), BorderLayout.LINE_START);
add(createContentPane(), BorderLayout.LINE_END);
add(createLogPane(), BorderLayout.PAGE_END);
createMenuItems();
JMenuBar menubar = new JMenuBar();
menubar.add(fileMenu);
menubar.add(connMenu);
menubar.add(vascMenu);
// view
setJMenuBar(menubar);
setMinimumSize(new Dimension(1111,888));
pack();
//setVisible(true);
//spi.createNewVascView(ve);
}
class VascTreeModel extends DefaultTreeModel {
public VascTreeModel(TreeNode root) {
super(root);
}
private static final long serialVersionUID = -7436681803506994277L;
@Override
public void addTreeModelListener(TreeModelListener l) {
super.addTreeModelListener(l);
}
}
private JPanel createTreePane() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.NONE,null));
vascTree = new JTree(new VascTreeModel(root));
vascTree.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
if (e.getClickCount() == 2 && vascTree.getSelectionModel().isSelectionEmpty()==false) {
try {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)vascTree.getSelectionModel().getSelectionPath().getLastPathComponent();
if (node.getUserObject() instanceof String) {
return;
}
VascTreeNode vascNode = (VascTreeNode)node.getUserObject();
if (vascNode != null) {
if (vascNode.type == VascTreeNodeType.ENTRY) {
VascEntry ee = vascManager.getVascController().getVascEntryController().getVascEntryById(vascNode.id).clone();
DefaultVascFactory.fillVascEntryFrontend(ee, vascManager.getVascController(), DefaultVascFactory.getDefaultVascFrontendData(null));
spi.createNewVascView(ee);
} else if (vascNode.type == VascTreeNodeType.ENTRY_FIELD) {
VascEntryField vef = vascManager.getVascController().getVascEntryController().getVascEntryById(vascNode.entryId).getVascEntryFieldById(vascNode.id);
JDialogVascEntryField d = new JDialogVascEntryField(JMainFrame.this,vef);
d.setVisible(true);
}
}
} catch (Exception ee) {
ee.printStackTrace();
}
}
}
});
JPanel treePanel = new JPanel();
treePanel.setBorder(BorderFactory.createLineBorder(Color.PINK));
treePanel.add(vascTree);
return treePanel;
}
private JPanel createContentPane() {
JPanel contentPane = new JPanel();
tabPane = new JTabbedPane();
spi = new SwingPanelTabbed(tabPane);
contentPane.add(tabPane);
return contentPane;
}
private JPanel createLogPane() {
JPanel logPanel = new JPanel();
logPanel.add(new JLabel("log"));
return logPanel;
}
class VascTreeNode {
public VascTreeNode() {}
public VascTreeNode(VascTreeNodeType type,String id) { this.type=type;this.id=id; }
public VascTreeNode(VascTreeNodeType type,String id,String entryId) { this.type=type;this.id=id;this.entryId=entryId; }
VascTreeNodeType type;
String id;
String entryId;
@Override
public String toString() {
return id;
}
}
enum VascTreeNodeType {
NONE,
BACKEND,
ENTRY,
ENTRY_FIELD,
ENTRY_FIELD_SET
}
private void rebuildTree() {
DefaultMutableTreeNode root = (DefaultMutableTreeNode)vascTree.getModel().getRoot();
root.removeAllChildren();
DefaultMutableTreeNode backends = new DefaultMutableTreeNode("VascBackends");
for (String id:vascManager.getVascController().getVascBackendController().getVascBackendIds()) {
DefaultMutableTreeNode backendNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.BACKEND,id));
backends.add(backendNode);
}
root.add(backends);
DefaultMutableTreeNode entries = new DefaultMutableTreeNode("VascEntries");
for (String id:vascManager.getVascController().getVascEntryController().getVascEntryIds()) {
VascEntry ve = vascManager.getVascController().getVascEntryController().getVascEntryById(id);
DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY,id));
entries.add(entryNode);
DefaultMutableTreeNode fields = new DefaultMutableTreeNode("Fields");
for (VascEntryField vef:ve.getVascEntryFields()) {
DefaultMutableTreeNode vefNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD,vef.getId(),id));
fields.add(vefNode);
/*
DefaultMutableTreeNode validators = new DefaultMutableTreeNode("Validators");
for (VascValidator vv:vef.getVascValidators()) {
DefaultMutableTreeNode vNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD,vv.getClass().getSimpleName()));
validators.add(vNode);
}
vefNode.add(validators);
*/
}
entryNode.add(fields);
DefaultMutableTreeNode fieldSets = new DefaultMutableTreeNode("FieldSets");
for (VascEntryFieldSet vefs:ve.getVascEntryFieldSets()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vefs.getId(),id));
fieldSets.add(vefsNode);
}
entryNode.add(fieldSets);
DefaultMutableTreeNode links = new DefaultMutableTreeNode("Links");
for (VascLinkEntry vle:ve.getVascLinkEntries()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vle.getId()));
links.add(vefsNode);
}
entryNode.add(links);
DefaultMutableTreeNode filters = new DefaultMutableTreeNode("Backend Filters");
for (VascBackendFilter vbf:ve.getVascBackendFilters()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vbf.getClass().getSimpleName()));
filters.add(vefsNode);
}
entryNode.add(links);
DefaultMutableTreeNode param = new DefaultMutableTreeNode("Backend Parameters");
for (String key:ve.getEntryParameterKeys()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,key));
param.add(vefsNode);
}
entryNode.add(param);
DefaultMutableTreeNode options = new DefaultMutableTreeNode("List Options");
for (VascEntryField vef:ve.getListOptions()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vef.getId()));
options.add(vefsNode);
}
entryNode.add(options);
}
root.add(entries);
SwingUtilities.updateComponentTreeUI(vascTree);
}
private void createMenuItems() {
JMenuItem openXmlItem = new JMenuItem("Open Xml");
openXmlItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
final JFileChooser fc = new JFileChooser();
//fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
vascManager.openFile(file);
rebuildTree();
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
fileMenu.add(openXmlItem);
JMenuItem closeXmlItem = new JMenuItem("Close");
fileMenu.add(closeXmlItem);
fileMenu.addSeparator();
JMenuItem exitItem = new JMenuItem("Exit");
fileMenu.add(exitItem);
JMenuItem connectVascItem = new JMenuItem("Add Vasc");
connectVascItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
connMenu.add(connectVascItem);
JMenuItem connectMongoItem = new JMenuItem("Connect Mongo");
connectMongoItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
connMenu.add(connectMongoItem);
JMenuItem connectPgItem = new JMenuItem("Add Postgres");
connMenu.add(connectPgItem);
JMenuItem connectMysqlItem = new JMenuItem("Add Mysql");
connMenu.add(connectMysqlItem);
JMenuItem connectLdapItem = new JMenuItem("Add Ldap");
connMenu.add(connectLdapItem);
connMenu.addSeparator();
JMenuItem connectMetaCsvItem = new JMenuItem("Add meta csv");
connectMetaCsvItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialogMetaCsv d = new JDialogMetaCsv(JMainFrame.this);
d.setVisible(true);
}
});
connMenu.add(connectMetaCsvItem);
JMenuItem connectMetaXmlItem = new JMenuItem("Add meta xml");
connMenu.add(connectMetaXmlItem);
JMenuItem connectMetaMongoItem = new JMenuItem("Add meta mongo");
connectMetaMongoItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialogMetaMongodb d = new JDialogMetaMongodb(JMainFrame.this);
d.setVisible(true);
}
});
connMenu.add(connectMetaMongoItem);
JMenuItem connectMetaJdbcItem = new JMenuItem("Add meta jdbc");
connMenu.add(connectMetaJdbcItem);
/*
for (final String id:ve.getVascFrontendData().getVascController().getVascEntryController().getVascEntryIds()) {
JMenuItem item = new JMenuItem(id);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
VascEntry ee = ve.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(id).clone();
DefaultVascFactory.fillVascEntryFrontend(ee, ve.getVascFrontendData().getVascController(), DefaultVascFactory.getDefaultVascFrontendData(null));
spi.createNewVascView(ee);
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
vascMenu.add(item);
}
*/
JMenuItem item = new JMenuItem("Close tab.");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (tabPane.getSelectedIndex()>=0) {
tabPane.removeTabAt(tabPane.getSelectedIndex()); // todo release vasc frontend
}
}
});
vascMenu.add(item);
}
public class JDialogMetaCsv extends JDialog implements ActionListener {
private static final long serialVersionUID = -8638394652416472734L;
public JDialogMetaCsv(Frame aFrame) {
setTitle("Add csv file");
setMinimumSize(new Dimension(640,480));
setPreferredSize(new Dimension(999,666));
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
clearAndHide();
}
});
JPanel mainPanel = new JPanel();
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setLayout(new BorderLayout());
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
getContentPane().add(mainPanel);
pack();
setLocationRelativeTo(aFrame);
}
public void clearAndHide() {
setVisible(false);
}
public JPanel createPanelCenter() {
JPanel result = new JPanel();
//result.setLayout(new SpringLayout());
result.add(new JLabel("File"));
JButton fileButton = new JButton("Open");
fileButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog((JButton)e.getSource());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
MetaModelDataContextCsv ds = new MetaModelDataContextCsv();
ds.setFile(file.getAbsolutePath());
createMetaEntry(ds,file.getName(),null);
}
}
});
result.add(fileButton);
return result;
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
public class JDialogMetaMongodb extends JDialog implements ActionListener {
private static final long serialVersionUID = -8638394652416472734L;
private JTextField hostname = null;
private JTextField database = null;
public JDialogMetaMongodb(Frame aFrame) {
setTitle("Add mongodb");
setMinimumSize(new Dimension(800,600));
setPreferredSize(new Dimension(999,666));
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
clearAndHide();
}
});
JPanel mainPanel = new JPanel();
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setLayout(new BorderLayout());
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
getContentPane().add(mainPanel);
pack();
setLocationRelativeTo(aFrame);
}
public void clearAndHide() {
setVisible(false);
}
public JPanel createPanelCenter() {
JPanel result = new JPanel();
//result.setLayout(new SpringLayout());
result.add(new JLabel("Hostname"));
hostname = new JTextField("localhost");
result.add(hostname);
result.add(new JLabel("Database"));
database = new JTextField("lefiona");
result.add(database);
JButton fileButton = new JButton("Connect");
fileButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MetaModelDataContextMongodb ds = new MetaModelDataContextMongodb();
ds.setHostname(hostname.getText());
ds.setDatabase(database.getText());
DataContext metaDs = ds.getDataContext();
for (String table:metaDs.getDefaultSchema().getTableNames()) {
createMetaEntry(ds,table,table);
}
}
});
result.add(fileButton);
return result;
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
public class JDialogVascEntryField extends JDialog implements ActionListener {
private static final long serialVersionUID = -8638394652416472734L;
private JButton okButton = null;
private JButton cancelButton = null;
private JTextField idField = null;
private JTextField backendNameField = null;
private JComboBox fieldTypeBox = null;
private VascEntryField field = null;
public JDialogVascEntryField(Frame aFrame,VascEntryField field) {
this.field = field;
setTitle("Vasc Entry Field");
setMinimumSize(new Dimension(800,600));
setPreferredSize(new Dimension(999,666));
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
clearAndHide();
}
});
JPanel mainPanel = new JPanel();
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setLayout(new BorderLayout());
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
getContentPane().add(mainPanel);
pack();
setLocationRelativeTo(aFrame);
}
public void clearAndHide() {
setVisible(false);
}
public JPanel createPanelCenter() {
JPanel result = new JPanel();
//result.setLayout(new SpringLayout());
result.add(new JLabel("id"));
idField = new JTextField(field.getId());
result.add(idField);
result.add(new JLabel("backendName"));
backendNameField = new JTextField(field.getBackendName());
result.add(backendNameField);
result.add(new JLabel("type"));
fieldTypeBox = new JComboBox(vascManager.getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeIds().toArray());
fieldTypeBox.setSelectedItem(field.getVascEntryFieldType().getId());
result.add(fieldTypeBox);
return result;
}
private JPanel createPanelBottom() {
JPanel result = new JPanel();
okButton = new JButton("ok");
okButton.addActionListener(this);
cancelButton = new JButton("cancel");
cancelButton.addActionListener(this);
result.add(okButton);
result.add(cancelButton);
return result;
}
public void actionPerformed(ActionEvent e) {
if (e.getSource()==cancelButton) {
clearAndHide();
return;
}
if (e.getSource()==okButton) {
VascEntryField vef = ((VascEntryControllerLocal)vascManager.getVascController().getVascEntryController()).getMasterVascEntryById(field.getVascEntry().getId()).getVascEntryFieldById(field.getId());
vef.setVascEntryFieldType(vascManager.getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById((String)fieldTypeBox.getSelectedItem()));
clearAndHide();
return;
}
}
}
private void createMetaEntry(MetaModelDataContextProvider ds,String id,String tableName) {
DataContext metaDs = ds.getDataContext();
Table metaTable = null;
if (tableName==null) {
metaTable = metaDs.getDefaultSchema().getTable(0);
} else {
metaTable = metaDs.getDefaultSchema().getTableByName(tableName);
}
Column[] keys = metaTable.getPrimaryKeys();
Column[] cols = metaTable.getColumns();
if (cols.length==0) {
return; // vasc needs at least one column
}
MetaModelVascBackend backend = new MetaModelVascBackend();
backend.setId(id+"_backend");
backend.setDataContextProvider(ds);
backend.setTable(metaTable.getName());
if (keys.length>0) {
backend.setTableId(keys[0].getName());
} else {
backend.setTableId(cols[0].getName());
//TODO backend.setRequestReadOnly(true);
}
VascEntry ve = new DefaultVascEntry();
ve.setId(id);
ve.setBackendId(id+"_backend");
for (Column c:cols) {
VascEntryField vef = new DefaultVascEntryField(c.getName());
vef.setVascEntryFieldType(vascManager.getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeByClass(c.getType().getJavaEquivalentClass()));
ve.addVascEntryField(vef);
}
try {
((VascBackendControllerLocal)vascManager.getVascController().getVascBackendController()).addVascBackend(backend);
((VascEntryControllerLocal)vascManager.getVascController().getVascEntryController()).addVascEntry(ve, vascManager.getVascController());
// mm TODO rm this fill which adds the global actions ... and show updated tree in editor
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascManager.getVascController().getVascEntryController(), vascManager.getVascController());
rebuildTree();
} catch (Exception ee) {
ee.printStackTrace();
}
}
}

View file

@ -1,91 +0,0 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.demo.swing;
import java.lang.reflect.Method;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
public class SwingStartup {
private JMainFrame mainFrame = null;
private VascManager vascManager = null;
public static void main(String[] argu){
try {
SwingStartup s = new SwingStartup();
s.init();
s.open();
} catch (Exception e) {
e.printStackTrace();
}
}
public void init() throws Exception {
vascManager = new VascManager();
vascManager.start();
mainFrame = new JMainFrame(vascManager);
}
public void open() throws Exception {
mainFrame.setVisible(true);
}
static 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));
}
}
}
}

View file

@ -1,62 +0,0 @@
package net.forwardfire.vasc.demo.swing;
import java.io.File;
import java.io.FileOutputStream;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.impl.x4o.VascParser;
public class VascManager {
VascController vascController = null;
public VascManager() {
}
public void start() {
try {
vascController = DefaultVascFactory.getDefaultVascController(2288L,"forwardfire.net","user","admin");
initEditor();
} catch (VascException e) {
throw new RuntimeException(e);
}
}
public void stop() {
}
private void initEditor() {
try {
VascParser parser = new VascParser(vascController);
parser.addGlobalELBean("vascController", vascController);
parser.parseResource("net/forwardfire/vasc/demo/swing/example/vasc-edit.xml");
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
}
}
public void openFile(File file) {
try {
VascParser parser = new VascParser(vascController);
File f = File.createTempFile("test-vasc", ".xml");
parser.setDebugOutputStream(new FileOutputStream(f));
parser.parseFile(file.getAbsolutePath());
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
}
}
public VascController getVascController() {
return vascController;
}
}

View file

@ -1,317 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<x4o:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
xmlns:mm="http://vasc.forwardfire.net/eld/vasc-backend-metamodel.eld"
xmlns:m="http://vasc.forwardfire.net/eld/vasc-backend-mongodb.eld"
xmlns:l="http://vasc.forwardfire.net/eld/vasc-backend-ldap.eld"
xmlns:j="http://vasc.forwardfire.net/eld/vasc-backend-jdbc.eld"
xmlns:x4o="http://eld.x4o.org/eld/x4o-lang.eld"
>
<mm:csvDataContext
el.id="metaDS_csv"
file="/tmp/csv_people.csv"
/>
<mm:metaModelBackend
id="meta_people_backend"
dataContextProvider="${metaDS_csv}"
table="csv_people"
tableId="id"
/>
<v:entry id="meta_people" backendId="meta_people_backend">
<v:field id="id" list="false"/>
<v:field id="name"/>
<v:field id="age"/>
<v:field id="gender" vascEntryFieldType="ListField">
<v:vascSelectItemModelString data="male,female,unknown"/>
</v:field>
</v:entry>
<mm:mongodbDataContext
el.id="metaDS_mongodb"
hostname="localhost"
database="lefiona"
/>
<mm:metaModelBackend
id="meta_profiles_backend"
dataContextProvider="${metaDS_mongodb}"
table="dg2_profiles"
tableId="_id"
/>
<v:entry id="meta_profiles" backendId="meta_profiles_backend">
<v:field id="_id" readOnly="true" list="false"/>
<v:field id="url"/>
<v:field id="name"/>
<v:field id="active" vascEntryFieldType="BooleanField"/>
<v:field id="body_text" list="false" vascEntryFieldType="TextAreaField"/>
<v:field id="profile_type" vascEntryFieldType="ListField">
<v:vascSelectItemModelString data="MALE,FEMALE,BOTH"/>
</v:field>
<v:field id="send_jokers" vascEntryFieldType="IntegerField"/>
<v:field id="run_date" vascEntryFieldType="DateField"/>
</v:entry>
<m:mongodbConnectionProvider
el.id="lefiona_connection"
hostname="localhost"
database="lefiona"
/>
<m:mongodbBackend
id="dg2_smiles_backend"
connectionProvider="${lefiona_connection}"
collection="dg2_smiles"
/>
<v:entry id="dg2_smiles" backendId="dg2_smiles_backend">
<v:field id="_id" readOnly="true" list="false"/>
<v:field id="text" vascEntryFieldType="TextAreaField"/>
<v:field id="profile_type" vascEntryFieldType="ListField">
<v:vascSelectItemModelString data="MALE,FEMALE,BOTH"/>
</v:field>
<v:field id="cron_type" vascEntryFieldType="ListField">
<v:vascSelectItemModelString data="BASE,DAILY,WEEKLY,MONTLY"/>
</v:field>
<v:field id="group"/>
<v:field id="active" vascEntryFieldType="BooleanField"/>
</v:entry>
<m:mongodbBackend
id="dg2_profiles_backend"
connectionProvider="${lefiona_connection}"
collection="dg2_profiles"
/>
<v:entry id="dg2_profiles" backendId="dg2_profiles_backend">
<v:field id="_id" readOnly="true" list="false"/>
<v:field id="url"/>
<v:field id="name"/>
<v:field id="active" vascEntryFieldType="BooleanField"/>
<v:field id="body_text" list="false" vascEntryFieldType="TextAreaField"/>
<v:field id="profile_type" vascEntryFieldType="ListField">
<v:vascSelectItemModelString data="MALE,FEMALE,BOTH"/>
</v:field>
<v:field id="send_jokers" vascEntryFieldType="IntegerField"/>
<v:field id="run_date" vascEntryFieldType="DateField"/>
</v:entry>
<j:jdbcConnectionProvider
el.id="dbRssFeeds"
driverClassName="org.postgresql.Driver"
dbUrl="jdbc:postgresql://localhost/vasc_testpg"
dbUser="test"
dbPassword="test"
/>
<j:jdbcBackend
id="rssChannelDB"
jdbcConnectionProvider="${dbRssFeeds}"
idColumnName="id"
sqlList="SELECT * FROM channel LIMIT 100"
sqlDelete="DELETE FROM channel WHERE id = ?0"
sqlPersist="INSERT INTO channel (name,url,importing,etc) VALUES (?0,?1,?2,?3,?4)"
sqlMerge="UPDATE channel (name,url) VALUE (?0,?1)"
/>
<v:entry id="rssChannel" backendId="rssChannelDB">
<v:field id="id" readOnly="true"/>
<v:field id="name"/>
<v:field id="url"/>
<v:field id="importing" vascEntryFieldType="BooleanField"/>
<v:field id="last_parsed" vascEntryFieldType="DateField" />
<v:field id="last_checked" vascEntryFieldType="DateField"/>
<v:field id="parser_locale" list="false"/>
<v:field id="column_mapping" list="false"/>
</v:entry>
<!--
<l:ldapConnectionProvider
el.id="ldapSudoers"
ldapHost="localhost"
bindUser="uid=admin-sudo,ou=services,dc=example,dc=nl"
bindPass="test"
/>
<l:ldapBackend
id="ldapBackendSudoers"
ldapConnectionProvider="${ldapSudoers}"
baseDN="ou=sudoers,dc=example,dc=nl"
keyAttribute="cn"
ldapFilter="(&amp;(objectClass=sudoRole))"
/>
<v:entry id="sudoers" backendId="ldapBackendSudoers">
<v:field id="user" backendName="cn" readOnly="true"/>
<v:field id="description" rolesEdit="admin" rolesList="all"/>
<v:field id="sudoCommand" vascEntryFieldType="MultiTextField"/>
<v:field id="sudoHost" vascEntryFieldType="MultiTextField"/>
<v:field id="sudoUser" vascEntryFieldType="MultiTextField"/>
-->
<!--
<v:ldapNextIdFunction name="nextUidNumber" ldapFilter="(&(objectClass=posixGroup))" ldapAttribute="gidnumber"/>
<v:listeners hook="post_create">
<etc:loginToFtpServer/>
</v:listeners>
<v:link fieldName="user" viewController="ldapUsers" parameterName="user_cn"/>
<v:link fieldName="gidNumber" viewController="ldapGroups" parameterName="group_key,${baseDn}"/>
<v:detail fieldName="gidNumber" detailController="${ldapGroups}"/>
-->
<!--
</v:entry>
<l:ldapConnectionProvider
el.id="ldapUsers"
ldapHost="10.11.12.96"
bindUser="uid=libnss,ou=services,dc=example,dc=nl"
bindPass="test"
/>
<l:ldapBackend
id="ldapBackendUsers"
ldapConnectionProvider="${ldapUsers}"
baseDN="ou=users,dc=example,dc=nl"
keyAttribute="uid"
ldapFilter="(&amp;(objectClass=posixAccount))"
/>
<v:entry id="users" backendId="ldapBackendUsers">
<v:field id="uid" />
<v:field id="uidNumber" vascEntryFieldType="IntegerField"/>
<v:field id="gidNumber" vascEntryFieldType="IntegerField"/>
<v:field id="loginShell" list="false"/>
<v:field id="homeDirectory" list="false"/>
<v:field id="cn" list="false"/>
<v:field id="givenName" />
<v:field id="sn" />
<v:field id="mailbox" list="false"/>
<v:field id="mail" vascEntryFieldType="EmailField"/>
<v:field id="mailActive" vascEntryFieldType="BooleanField"/>
<v:field id="alias" vascEntryFieldType="MultiTextField" list="false"/>
<v:field id="autoResponseActive" vascEntryFieldType="BooleanField" />
<v:field id="autoresponseMessage" vascEntryFieldType="TextAreaField" list="false"/>
<v:field id="sambaAcctFlags" list="false"/>
<v:field id="sambaPrimaryGroupSID" list="false"/>
<v:field id="sambaSID" list="false"/>
</v:entry>
<l:ldapConnectionProvider
el.id="ldapMachines"
ldapHost="localhost"
bindUser="uid=samba,ou=services,dc=example,dc=nl"
bindPass="test"
/>
<l:ldapBackend
id="ldapBackendMachines"
ldapConnectionProvider="${ldapMachines}"
baseDN="ou=machines,dc=example,dc=nl"
keyAttribute="uid"
ldapFilter="(&amp;(objectClass=sambaSamAccount))"
/>
<v:entry id="machines" backendId="ldapBackendMachines">
<v:field id="uid" />
<v:field id="sambaAcctFlags"/>
<v:field id="sambaSID" />
<v:field id="uidNumber" />
</v:entry>
-->
<!--
- View
- States
- Tables
- Columns
Master
- Details
-->
<!--
<x4o:bean el.id="dataSource" bean.class="com.id.."/>
<x4o:bean el.id="tableController" bean.class="com.id.."/>
<v:vascView name="test1">
<v:vascTableController>
</v:vascTableController>
<v:vascBackendController>
<v:vascJDBCQueryController>
<x4o:property name="list">select id,name,blog_status_id,description,slug from blog_post</x4o:property>
<x4o:property name="update">update (id,name,blog_status_id,description,slug) values(?,?,?,?,?) from blog_post where id=?</x4o:property>
<x4o:property name="create">instert into (id,name,blog_status_id,description,slug) values(?,?,?,?,?) from blog_post where id=?</x4o:property>
<x4o:property name="delete">delete from blog_post where id=?</x4o:property>
</v:vascJDBCQueryController>
</v:vascBackendController>
<v:vascField name="">
<v:vascFieldOptions/>
<v:vascFieldChoises/>
</v:vascField>
<v:vascField name="">
<v:vascUserRoles list="admin"/>
</v:vascField>
</v:vascView>
<x4o:template el.id="ldapServerTemplate">
<v:ldapConnection name="main">
<x4o:property name="connectionUrl" value="ldaps://localhost"/>
</v:ldapConnection>
</x4o:template>
<v:ldapConnection el.id="sudoers" x4o.templates="ldapServerTemplate">
<x4o:property name="user" value="uid=admin-sudo,ou=services,dc=example,dc=nl"/>
<x4o:property name="pass" value="test"/>
<x4o:property name="baseDn" value="ou=sudoers,dc=example,dc=nl"/>
</v:ldapConnection>
<x4o:template el.id="sudoTemplate">
<v:field name="user" backendName="cn" readOnly="true"/>
<v:field name="description" backendName="description"/>
<v:field name="sudoCommand" fieldEditor="listField"/>
<v:field name="sudoHost" fieldEditor="listField"/>
<v:field name="sudoUser" fieldEditor="listField"/>
</x4o:template>
<x4o:template el.id="sambaUserSchema">
<v:field name="sambaSID" fieldEditor="textField" edit="false" list="false" view="false" create="false" defaultValue="S-1-5-21-123523482392-923323723-12323323235-514"/>
<v:field name="sambaGroupType" v.defaultValue="2"/>
</x4o:template>
<v:viewController name="ldapUsers" primaryKey="user">
<x4o:templateTag template="${posixUserSchema}"/>
<x4o:templateTag template="${sambaUserSchema}">
<v:field name="sambaGroupType" v.defaultValue="3"/>
</x4o:templateTag>
<v:field name="sambaGroupType" v.defaultValue="4"/>
</v:viewController>
<vasc:fieldType name="EmailField2">
<vasc:fieldHint key="validate" default="true"/>
<vasc:fieldHint key="timeout" default="200"/>
</vasc:fieldType>
<vasc:fieldType name="listField">
<vasc:fieldHint key="validate" default="true"/>
<vasc:fieldHint key="timeout" default="200"/>
</vasc:fieldType>
-->
</x4o:root>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-demo-tech</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View file

@ -1,4 +1,3 @@
#Sat Dec 31 00:34:57 CET 2011
activeProfiles= activeProfiles=
eclipse.preferences.version=1 eclipse.preferences.version=1
resolveWorkspaceProjects=true resolveWorkspaceProjects=true

View file

@ -0,0 +1,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-demo</artifactId>
<groupId>net.forwardfire.vasc.demo</groupId>
<version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>vasc-demo-tech</artifactId>
<packaging>pom</packaging>
<name>vasc-demo-tech</name>
<description>vasc-demo-tech</description>
<modules>
<module>vasc-demo-tech-build</module>
<module>vasc-demo-tech-editor</module>
<module>vasc-demo-tech-web</module>
<module>vasc-demo-tech-ui</module>
</modules>
</project>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-demo-tech-build</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View file

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View file

@ -0,0 +1,45 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-demo-tech</artifactId>
<groupId>net.forwardfire.vasc.demo</groupId>
<version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>vasc-demo-tech-build</artifactId>
<packaging>pom</packaging>
<name>vasc-demo-tech-build</name>
<description>vasc-demo-tech-build</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<tarLongFileMode>gnu</tarLongFileMode>
</configuration>
<executions>
<execution>
<id>ui-dist-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-ui</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2011, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>bin</id>
<formats>
<format>tar.gz</format>
<format>tar.bz2</format>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>vasc-demo-tech-${project.version}</baseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
<includes>
<include>*</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.parent.parent.parent.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>authors.txt</include>
<include>licence.txt</include>
<!-- <include>versions.txt</include> -->
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/scripts/</directory>
<outputDirectory>/</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,38 @@
::
:: Copyright (c) 2011, Willem Cazander
:: All rights reserved.
::
:: Redistribution and use in source and binary forms, with or without modification, are permitted provided
:: that the following conditions are met:
::
:: * Redistributions of source code must retain the above copyright notice, this list of conditions and the
:: following disclaimer.
:: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
:: the following disclaimer in the documentation and/or other materials provided with the distribution.
::
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
:: EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
:: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
:: THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
:: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
:: OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
:: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
:: TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
:: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
::
@echo off
setlocal enableextensions
:: Run in app dir
cd /d %~dp0
:: Config variables
set JAVA_OPTS=-Xms64m -Xmx256m
set MAIN_CLASS=net.forwardfire.vasc.demo.tech.ui.TechUI
set CP=lib\*
:: Launch application
java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS%
endlocal
:: EOF

View file

@ -0,0 +1,38 @@
#!/bin/sh
#
# Copyright (c) 2011, Willem Cazander
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided
# that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the
# following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
# the following disclaimer in the documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Run in app dir
cd `dirname $0`;
# Config variables
JAVA="java";
JAVA_OPTS="-Xms64m -Xmx256m";
MAIN_CLASS="net.forwardfire.vasc.demo.tech.ui.TechUI";
CP=`echo lib/*.jar | sed 's/ /:/g'`;
# Launch application
$JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS;
# EOF

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-demo-tech-editor</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -1,4 +1,3 @@
#Sat Dec 31 00:55:10 CET 2011
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//src/main/java=UTF-8 encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8 encoding//src/main/resources=UTF-8

View file

@ -1,4 +1,3 @@
#Sat Dec 31 00:34:57 CET 2011
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.compliance=1.5

View file

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View file

@ -0,0 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-demo-tech</artifactId>
<groupId>net.forwardfire.vasc.demo</groupId>
<version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>vasc-demo-tech-editor</artifactId>
<name>vasc-demo-tech-editor</name>
<description>vasc-demo-tech-editor</description>
</project>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>vasc-demo-swing</name> <name>vasc-demo-tech-ui</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>

View file

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View file

@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View file

@ -1,15 +1,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>vasc-demo</artifactId> <artifactId>vasc-demo-tech</artifactId>
<groupId>net.forwardfire.vasc.demo</groupId> <groupId>net.forwardfire.vasc.demo</groupId>
<version>0.3.5-SNAPSHOT</version> <version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
<artifactId>vasc-demo-swing</artifactId> <artifactId>vasc-demo-tech-ui</artifactId>
<name>vasc-demo-swing</name> <name>vasc-demo-tech-ui</name>
<description>vasc-demo-swing</description> <description>vasc-demo-tech-ui</description>
<dependencies> <dependencies>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-editor</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-web</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>net.forwardfire.vasc</groupId> <groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-core</artifactId> <artifactId>vasc-core</artifactId>
@ -41,9 +51,15 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.odysseus.juel</groupId> <groupId>org.jdesktop.bsaf</groupId>
<artifactId>juel</artifactId> <artifactId>bsaf</artifactId>
<version>${juel.version}</version> <version>${bsaf.version}</version>
<exclusions>
<exclusion>
<artifactId>jnlp</artifactId>
<groupId>javax.jnlp</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>postgresql</groupId> <groupId>postgresql</groupId>
@ -55,5 +71,10 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>5.1.19</version> <version>5.1.19</version>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View file

@ -0,0 +1,134 @@
/*
* Copyright (c) 2011, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.demo.tech.ui;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;
/**
* PatternLogFormatter Formats the messages of the logger.
*
* @author Willem Cazander
*/
public class PatternLogFormatter extends Formatter {
private final String lineSeperator;
private final MessageFormat logFormat;
private final MessageFormat logErrorFormat;
private final DateFormat dateFormat;
static private final String DEFAULT_LOG_FORMAT = "%d %l [%C.%s] %m%r";
static private final String DEFAULT_LOG_ERROR_FORMAT = "%d %l [%C.%s] %m%r%S";
static private final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
static private final String[] LOG_OPTIONS = {
"%d", /* Formated date string */
"%l", /* Logger level */
"%n", /* Logger name */
"%m", /* Logger message */
"%t", /* Thread ID */
"%s", /* Source method */
"%c", /* Source Class */
"%C", /* Source Class Simple */
"%S", /* Stacktrace */
"%r", /* Return/newline */
};
public PatternLogFormatter() {
String logFormatStr = LogManager.getLogManager().getProperty(getClass().getName()+".log_pattern");
String logFormatErrorStr = LogManager.getLogManager().getProperty(getClass().getName()+".log_error_pattern");
String logDateStr = LogManager.getLogManager().getProperty(getClass().getName()+".date_pattern");
if (logDateStr!=null && logDateStr.isEmpty()==false) {
dateFormat = new SimpleDateFormat(logDateStr);
} else {
dateFormat = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
}
if (logFormatStr==null || logFormatStr.isEmpty()) {
logFormatStr = DEFAULT_LOG_FORMAT;
}
if (logFormatStr.contains("{") || logFormatStr.contains("}")) {
throw new IllegalArgumentException("Curly braces not allowed in log pattern.");
}
for (int i=0;i<LOG_OPTIONS.length;i++) {
logFormatStr = logFormatStr.replace(LOG_OPTIONS[i], "{"+i+"}");
}
logFormat = new MessageFormat(logFormatStr);
if (logFormatErrorStr==null || logFormatErrorStr.isEmpty()) {
logFormatErrorStr = DEFAULT_LOG_ERROR_FORMAT;
}
if (logFormatErrorStr.contains("{") || logFormatErrorStr.contains("}")) {
throw new IllegalArgumentException("Curly braces not allowed in log pattern.");
}
for (int i=0;i<LOG_OPTIONS.length;i++) {
logFormatErrorStr = logFormatErrorStr.replace(LOG_OPTIONS[i], "{"+i+"}");
}
logErrorFormat = new MessageFormat(logFormatErrorStr);
lineSeperator = String.format("%n"); // Used platform dependent seperator
}
@Override
public String format(LogRecord record) {
String[] logFields = new String[10];
logFields[1] = record.getLevel().toString();
logFields[2] = record.getLoggerName();
logFields[3] = record.getMessage();
if ((logFields[3] == null || logFields[3].isEmpty()) && record.getThrown()!=null) {
logFields[3] = record.getThrown().getMessage();
}
logFields[4] = Integer.toString(record.getThreadID());
logFields[5] = record.getSourceMethodName() != null ? record.getSourceMethodName() : "?";
logFields[6] = record.getSourceClassName() != null ? record.getSourceClassName() : "?";
int dotIdx = logFields[6].lastIndexOf(".") + 1;
if (dotIdx > 0 && dotIdx < logFields[6].length()) {
logFields[7] = logFields[6].substring(dotIdx);
} else {
logFields[7] = logFields[6];
}
logFields[8] = record.getThrown()!=null ? createStackTrace(record.getThrown()) : "";
logFields[9] = lineSeperator;
synchronized (logFormat) {
logFields[0] = dateFormat.format(new Date(record.getMillis())); // dateFormat is guarded by the logFormat lock.
if (record.getThrown()==null) {
return logFormat.format(logFields);
} else {
return logErrorFormat.format(logFields);
}
}
}
private String createStackTrace(Throwable t) {
StringWriter buf = new StringWriter();
t.printStackTrace(new PrintWriter(buf));
return buf.getBuffer().toString();
}
}

View file

@ -0,0 +1,187 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.demo.tech.ui;
import java.awt.Dimension;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.EventObject;
import java.util.logging.Handler;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import org.apache.juli.logging.LogFactory;
import org.jdesktop.application.Application;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.SingleFrameApplication;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanelMenuBar;
import net.forwardfire.vasc.demo.tech.web.core.TomcatManager;
public class TechUI extends SingleFrameApplication {
private Logger logger = null;
private VascManager vascManager = null;
private TomcatManager tomcatManager = null;
static public void main(String[] args) {
Application.launch(TechUI.class, args);
}
/**
* Config logging and setup logger object.
*/
private void setupLogging() {
LogFactory.getLog(TechUI.class); // init JULI so reconfig is done once.
File logConfig = new File("logfile.properties");
if (logConfig.exists()) {
InputStream in = null;
try {
in = new FileInputStream(logConfig);
LogManager.getLogManager().readConfiguration(in);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (in!=null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} else {
Logger rootLogger = Logger.getAnonymousLogger();
while (rootLogger.getParent()!=null) {
rootLogger = rootLogger.getParent();
}
for (Handler h:rootLogger.getHandlers()) {
h.setFormatter(new PatternLogFormatter());
}
}
logger = Logger.getLogger(TechUI.class.getName());
}
class ShutdownManager implements ExitListener {
public boolean canExit(EventObject e) {
return true;
}
public void willExit(EventObject event) {
logger.info("Shutdown requested.");
long startTime = System.currentTimeMillis();
try {
tomcatManager.stop();
} catch (Exception e) {
e.printStackTrace();
}
long stopTime = System.currentTimeMillis();
logger.info("TechUI stopped in "+(stopTime-startTime)+" ms.");
}
}
private void autoLoadVasc() {
File autoLoadDir = new File("auto");
if (autoLoadDir.exists()==false) {
return;
}
for (File file:autoLoadDir.listFiles()) {
if (file.canRead()==false) {
continue;
}
if (file.getName().endsWith("xml")==false) {
continue;
}
vascManager.openFile(file);
}
}
protected void initialize(String[] args) {
long startTime = System.currentTimeMillis();
setupLogging();
logger.info("Starting Vasc-Demo-Tech-UI.");
vascManager = new VascManager();
vascManager.start();
autoLoadVasc();
long stopTime = System.currentTimeMillis();
logger.info("TechUI initialized in "+(stopTime-startTime)+" ms.");
}
protected void startup() {
try {
long startTime = System.currentTimeMillis();
addExitListener(new ShutdownManager());
FrameView mainView = getMainView();
mainView.setComponent(new JMainPanel());
mainView.setMenuBar(new JMainPanelMenuBar());
mainView.getFrame().setMinimumSize(new Dimension(1024-64,768-128));
show(mainView);
tomcatManager = new TomcatManager();
tomcatManager.setVascController(vascManager.getVascController());
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
tomcatManager.start();
} catch (Exception e) {
e.printStackTrace();
}
}
});
long stopTime = System.currentTimeMillis();
logger.info("TechUI startup in "+(stopTime-startTime)+" ms total startup in "+(stopTime-startTime)+" ms.");
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
JOptionPane.showMessageDialog(null, "Fatal Startup Error:\n"+sw.getBuffer().toString(), "Vasc Demo Tech Startup Error", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
System.exit(1);
}
}
static public TechUI getInstance() {
return getInstance(TechUI.class);
}
public VascManager getVascManager() {
return vascManager;
}
}

View file

@ -0,0 +1,292 @@
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;
import org.eobjects.metamodel.schema.Column;
import org.eobjects.metamodel.schema.Relationship;
import org.eobjects.metamodel.schema.Table;
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextProvider;
import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend;
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 {
private Logger logger = null;
private VascController vascController = null;
public VascManager() {
logger = Logger.getLogger(VascManager.class.getName());
}
public void start() {
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) {
try {
VascParser parser = new VascParser(vascController);
File f = File.createTempFile("test-vasc", ".xml");
parser.setDebugOutputStream(new FileOutputStream(f));
parser.parseFile(file.getAbsolutePath());
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
}
}
public 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);
DataContext metaDs = ds.getDataContext();
Table metaTable = null;
if (tableName==null) {
metaTable = metaDs.getDefaultSchema().getTable(0);
} else {
metaTable = metaDs.getDefaultSchema().getTableByName(tableName);
}
Column[] keys = metaTable.getPrimaryKeys();
Column[] cols = metaTable.getColumns();
if (cols.length==0) {
return; // vasc needs at least one column
}
MetaModelVascBackend backend = new MetaModelVascBackend();
backend.setId(id+"_backend");
backend.setDataContextProvider(ds);
backend.setTable(metaTable.getName());
if (keys.length>0) {
backend.setTableId(keys[0].getName());
} else {
backend.setTableId(cols[0].getName());
//TODO backend.setRequestReadOnly(true);
}
VascEntry ve = new DefaultVascEntry();
ve.setId(id);
ve.setBackendId(id+"_backend");
ve.setPrimaryKeyFieldId(backend.getTableId());
createFields(ve,cols);
for (Relationship rs:metaTable.getRelationships()) {
logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName());
if (tableName.equals(rs.getForeignTable().getName())==false) {
logger.info("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName());
createLinkEntry(ds,rs,ve,metaTable,id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
} else {
logger.info("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
createListEntry(ds,rs,ve,metaTable,id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
}
}
try {
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backend);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve, getVascController());
// 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();
}
}
private void createLinkEntry(MetaModelDataContextProvider ds,Relationship rs2,VascEntry ve,Table metaTable,String id) {
MetaModelVascBackend backendLink = new MetaModelVascBackend();
backendLink.setId(id+"_backend");
backendLink.setDataContextProvider(ds);
backendLink.setTable(rs2.getForeignTable().getName());
Column[] keys = rs2.getForeignTable().getPrimaryKeys();
Column[] cols = rs2.getForeignTable().getColumns();
if (cols.length==0) {
return;
}
if (keys.length>0) {
backendLink.setTableId(keys[0].getName());
} else {
backendLink.setTableId(cols[0].getName());
}
VascEntry veLink = new DefaultVascEntry();
veLink.setId(id);
veLink.setBackendId(id+"_backend");
veLink.setPrimaryKeyFieldId(backendLink.getTableId());
createFields(veLink,cols);
for (Relationship rs:rs2.getForeignTable().getRelationships()) {
logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName());
if (rs2.getForeignTable().getName().equals(rs.getForeignTable().getName())==false) {
//logger.info("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName());
//createLinkEntry(ds,rs,ve,rs2.getForeignTable(),id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
} else {
logger.info("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
createListEntry(ds,rs,veLink,rs2.getForeignTable(),id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
}
}
try {
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink, getVascController());
VascLinkEntry vle = new DefaultVascLinkEntry();
vle.setId(id+"Link");
vle.setVascLinkEntryType(VascLinkEntryType.DEFAULT_TYPE);
vle.setVascEntryId(id);
vle.addEntryParameterFieldId(rs2.getForeignColumns()[0].getName(), rs2.getPrimaryColumns()[0].getName());
ve.addVascLinkEntry(vle);
} catch (Exception e) {
e.printStackTrace();
}
}
private void createListEntry(MetaModelDataContextProvider ds,Relationship rs,VascEntry ve,Table metaTable,String id) {
MetaModelVascBackend backendLink = new MetaModelVascBackend();
backendLink.setId(id+"_backend");
backendLink.setDataContextProvider(ds);
backendLink.setTable(rs.getPrimaryTable().getName());
Column[] keys = rs.getPrimaryTable().getPrimaryKeys();
Column[] cols = rs.getPrimaryTable().getColumns();
if (cols.length==0) {
return;
}
if (keys.length>0) {
backendLink.setTableId(keys[0].getName());
} else {
backendLink.setTableId(cols[0].getName());
}
VascEntry veLink = new DefaultVascEntry();
veLink.setId(id);
veLink.setBackendId(id+"_backend");
veLink.setPrimaryKeyFieldId(backendLink.getTableId());
createFields(veLink,cols);
try {
VascEntryField vef = ve.getVascEntryFieldById(rs.getForeignColumns()[0].getName());
if (vef==null) {
logger.warning("Could not find: "+rs.getForeignColumns()[0].getName()+" in ve: "+ve.getId());
return;
}
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField"));
VascSelectItemModelEntry itemModel = new VascSelectItemModelEntry();
itemModel.setEntryId(veLink.getId());
itemModel.setDisplayFieldId(veLink.getDisplayNameFieldId());
vef.getVascEntryFieldType().setDataObject(itemModel);
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink, getVascController());
} catch (Exception e) {
e.printStackTrace();
}
}
private void createFields(VascEntry ve,Column[] cols) {
for (Column c:cols) {
VascEntryField vef = new DefaultVascEntryField(c.getName());
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeByClass(c.getType().getJavaEquivalentClass()));
if (c.getName().toLowerCase().contains("desc") || c.getName().toLowerCase().contains("text")) {
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextAreaField"));
}
ve.addVascEntryField(vef);
if (ve.getDisplayNameFieldId()==null && c.getName().equals(ve.getPrimaryKeyFieldId())==false && c.getType().getJavaEquivalentClass()==String.class) {
ve.setDisplayNameFieldId(c.getName());
}
}
}
}

View file

@ -0,0 +1,78 @@
package net.forwardfire.vasc.demo.tech.ui.actions;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
public class JDialogMetaCsv extends JDialog implements ActionListener {
private static final long serialVersionUID = -8638394652416472734L;
public JDialogMetaCsv(Frame aFrame) {
setTitle("Add csv file");
setMinimumSize(new Dimension(640,480));
setPreferredSize(new Dimension(999,666));
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
clearAndHide();
}
});
JPanel mainPanel = new JPanel();
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setLayout(new BorderLayout());
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
getContentPane().add(mainPanel);
pack();
setLocationRelativeTo(aFrame);
}
public void clearAndHide() {
setVisible(false);
}
public JPanel createPanelCenter() {
JPanel result = new JPanel();
//result.setLayout(new SpringLayout());
result.add(new JLabel("File"));
JButton fileButton = new JButton("Open");
fileButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog((JButton)e.getSource());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
MetaModelDataContextCsv ds = new MetaModelDataContextCsv();
ds.setFile(file.getAbsolutePath());
TechUI.getInstance().getVascManager().createMetaEntry(ds,file.getName(),null);
}
}
});
result.add(fileButton);
return result;
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,108 @@
package net.forwardfire.vasc.demo.tech.ui.actions;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
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.components.SpringLayoutGrid;
import org.eobjects.metamodel.DataContext;
public class JDialogMetaJdbc extends JDialog implements ActionListener {
private static final long serialVersionUID = -8638394652416472734L;
private JComboBox driverClassBox = null;
private JTextField connectUrlField = null;
private JTextField usernameField = null;
private JTextField passwordField = null;
public JDialogMetaJdbc(Frame aFrame) {
setTitle("Add jdbc");
setMinimumSize(new Dimension(300,200));
setPreferredSize(new Dimension(500,400));
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
clearAndHide();
}
});
JPanel mainPanel = new JPanel();
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setLayout(new BorderLayout());
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
getContentPane().add(mainPanel);
pack();
setLocationRelativeTo(aFrame);
}
public void clearAndHide() {
setVisible(false);
}
public JPanel createPanelCenter() {
JPanel result = new JPanel();
result.setLayout(new SpringLayout());
result.add(new JLabel("Driver"));
driverClassBox = new JComboBox(new String[] {"org.postgresql.Driver","com.mysql.jdbc.Driver","org.apache.derby.jdbc.EmbeddedDriver","org.hsqldb.jdbcDriver","org.sqlite.JDBC"});
driverClassBox.setSelectedIndex(0);
result.add(driverClassBox);
result.add(new JLabel("Url"));
connectUrlField = new JTextField("jdbc:postgresql://localhost/dellstore2");
result.add(connectUrlField);
result.add(new JLabel("Username"));
usernameField = new JTextField("postgres");
result.add(usernameField);
result.add(new JLabel("Password"));
passwordField = new JTextField("postgresql");
result.add(passwordField);
JButton fileButton = new JButton("Connect");
fileButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String url = connectUrlField.getText();
MetaModelDataContextJdbc ds = new MetaModelDataContextJdbc();
ds.setDriverClass((String)driverClassBox.getSelectedItem());
ds.setConnectUrl(url);
ds.setUsername(usernameField.getText());
ds.setPassword(passwordField.getText());
DataContext metaDs = ds.getDataContext();
String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
for (String table:metaDs.getDefaultSchema().getTableNames()) {
TechUI.getInstance().getVascManager().createMetaEntry(ds,dbName+"_"+table,table);
}
}
});
result.add(fileButton);
result.add(new JLabel(""));
SpringLayoutGrid.makeCompactGrid(result, 5, 2);
return result;
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,97 @@
package net.forwardfire.vasc.demo.tech.ui.actions;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
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.components.SpringLayoutGrid;
import org.eobjects.metamodel.DataContext;
public class JDialogMetaMongodb extends JDialog implements ActionListener {
private static final long serialVersionUID = -8638394652416472734L;
private JTextField hostNameField = null;
private JTextField hostPortField = null;
private JTextField databaseField = null;
public JDialogMetaMongodb(Frame aFrame) {
setTitle("Add mongodb");
setMinimumSize(new Dimension(300,200));
setPreferredSize(new Dimension(400,300));
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
clearAndHide();
}
});
JPanel mainPanel = new JPanel();
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setLayout(new BorderLayout());
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
getContentPane().add(mainPanel);
pack();
setLocationRelativeTo(aFrame);
}
public void clearAndHide() {
setVisible(false);
}
public JPanel createPanelCenter() {
JPanel result = new JPanel();
result.setLayout(new SpringLayout());
result.add(new JLabel("Hostname"));
hostNameField = new JTextField("localhost");
result.add(hostNameField);
result.add(new JLabel("Port"));
hostPortField = new JTextField("27017");
result.add(hostPortField);
result.add(new JLabel("Database"));
databaseField = new JTextField("lefiona");
result.add(databaseField);
JButton fileButton = new JButton("Connect");
fileButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MetaModelDataContextMongodb ds = new MetaModelDataContextMongodb();
ds.setHostname(hostNameField.getText());
ds.setPort(new Integer(hostPortField.getText()));
ds.setDatabase(databaseField.getText());
DataContext metaDs = ds.getDataContext();
for (String table:metaDs.getDefaultSchema().getTableNames()) {
TechUI.getInstance().getVascManager().createMetaEntry(ds,ds.getDatabase()+"_"+table,table);
}
}
});
result.add(fileButton);
result.add(new JLabel(""));
SpringLayoutGrid.makeCompactGrid(result, 4, 2);
return result;
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,153 @@
package net.forwardfire.vasc.demo.tech.ui.components;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.SpringLayout;
import javax.swing.SwingUtilities;
import net.forwardfire.vasc.demo.tech.ui.PatternLogFormatter;
public class JConsolePanel extends JPanel implements ActionListener {
private static final long serialVersionUID = 485766723433479054L;
private UILogHandler logHandler = null;
private JButton clearButton = null;
private JComboBox levelBox = null;
private JTextArea logTextArea = null;
private JCheckBox autoScrollBox = null;
private int logLinesMax = 255;
public JConsolePanel() {
setLayout(new FlowLayout(FlowLayout.LEFT));
JPanel wrap = new JPanel();
wrap.setLayout(new SpringLayout());
wrap.add(createHeader());
wrap.add(createEditor());
SpringLayoutGrid.makeCompactGrid(wrap,2,1);
add(wrap);
Logger rootLogger = Logger.getAnonymousLogger();
while (rootLogger.getParent()!=null) {
rootLogger = rootLogger.getParent();
}
logHandler = new UILogHandler();
logHandler.setFormatter(new PatternLogFormatter());
rootLogger.addHandler(logHandler);
}
/**
* This needs release if playing the the this tab add/removal very multiple times.
*/
public void release() {
Logger rootLogger = Logger.getAnonymousLogger();
while (rootLogger.getParent()!=null) {
rootLogger = rootLogger.getParent();
}
rootLogger.removeHandler(logHandler);
}
private JPanel createHeader() {
JPanel result = new JPanel();
result.setBorder(BorderFactory.createLineBorder(Color.BLUE));
result.setLayout(new FlowLayout(FlowLayout.LEFT));
result.add(new JLabel("Log Level"));
levelBox = new JComboBox(new Level[] {Level.OFF,Level.SEVERE,Level.WARNING,Level.INFO,Level.FINE,Level.FINER,Level.FINEST,Level.ALL});
levelBox.setSelectedItem(Level.INFO);
levelBox.addActionListener(this);
result.add(levelBox);
clearButton = new JButton("Clear");
clearButton.addActionListener(this);
result.add(clearButton);
autoScrollBox = new JCheckBox("Autoscroll");
autoScrollBox.setSelected(true);
result.add(autoScrollBox);
return result;
}
private JPanel createEditor() {
JPanel result = new JPanel();
result.setBorder(BorderFactory.createLineBorder(Color.BLUE));
logTextArea = new JTextArea(5, 80);
logTextArea.setAutoscrolls(true);
logTextArea.setEditable(false);
JScrollPane logScrollPane = new JScrollPane(logTextArea);
logScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
logScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
logScrollPane.getViewport().setOpaque(false);
result.add(logScrollPane);
return result;
}
public void actionPerformed(ActionEvent e) {
if (clearButton.equals(e.getSource())) {
logTextArea.setText("");
} else if (levelBox.equals(e.getSource()) && levelBox.getSelectedIndex()!=-1) {
Level level = (Level)levelBox.getSelectedItem();
logHandler.setLevel(level);
Enumeration<String> loggers = LogManager.getLogManager().getLoggerNames();
while (loggers.hasMoreElements()) {
String name = loggers.nextElement();
Logger logger = LogManager.getLogManager().getLogger(name);
if (logger!=null && name.contains("pulsefire")) {
logger.setLevel(level); // only set pulsefire code loggers
}
}
}
}
class UILogHandler extends Handler {
@Override
public void close() throws SecurityException {
}
@Override
public void flush() {
}
@Override
public void publish(LogRecord record) {
final String recordStr = getFormatter().format(record);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
logTextArea.append(recordStr);
if (logTextArea.getLineCount() > logLinesMax) {
String t = logTextArea.getText();
int l = 0;
int rm = logLinesMax/2;
for (int i=0;i<rm;i++) {
int ll = t.indexOf('\n',l+1);
if (ll==-1) {
break;
}
l = ll;
}
String tt = t.substring(l,t.length());
logTextArea.setText(tt);
}
if (autoScrollBox.isSelected()) {
logTextArea.setCaretPosition(logTextArea.getText().length());
}
}
});
}
}
}

View file

@ -0,0 +1,269 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.demo.tech.ui.components;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTree;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import net.forwardfire.vasc.core.VascEntry;
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.impl.DefaultVascFactory;
public class JMainPanel extends JPanel {
private static final long serialVersionUID = 5834715323973411147L;
private VascManager vascManager = null;
private SwingPanelIntegration spi = null;
private JTabbedPane tabPane = null;
private JTree vascTree = null;
private JSplitPane bottomSplitPane = null;
private JSplitPane treeSplitPane = null;
public JMainPanel() {
this.vascManager=TechUI.getInstance().getVascManager();
setLayout(new BorderLayout());
add(createBottomSplit(), BorderLayout.CENTER);
}
private JSplitPane createBottomSplit() {
JSplitPane sp0 = createTreeSplit();
JPanel sp1 = new JConsolePanel();
bottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,sp0,sp1);
bottomSplitPane.setOneTouchExpandable(true);
bottomSplitPane.setResizeWeight(0.2);
bottomSplitPane.setDividerLocation(750);
sp0.setMinimumSize(new Dimension(400, 400));
sp1.setMinimumSize(new Dimension(400, 150));
return bottomSplitPane;
}
private JSplitPane createTreeSplit() {
JScrollPane sp0 = createTreePane();
JScrollPane sp1 = createContentPane();
treeSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,sp0,sp1);
treeSplitPane.setOneTouchExpandable(true);
treeSplitPane.setResizeWeight(0.7);
treeSplitPane.setDividerLocation(200);
sp0.setMinimumSize(new Dimension(200, 400));
sp1.setMinimumSize(new Dimension(400, 400));
return treeSplitPane;
}
class VascTreeModel extends DefaultTreeModel {
public VascTreeModel(TreeNode root) {
super(root);
}
private static final long serialVersionUID = -7436681803506994277L;
@Override
public void addTreeModelListener(TreeModelListener l) {
super.addTreeModelListener(l);
}
}
private JScrollPane createTreePane() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.NONE,null));
vascTree = new JTree(new VascTreeModel(root));
vascTree.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
if (e.getClickCount() == 2 && vascTree.getSelectionModel().isSelectionEmpty()==false) {
try {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)vascTree.getSelectionModel().getSelectionPath().getLastPathComponent();
if (node.getUserObject() instanceof String) {
return;
}
VascTreeNode vascNode = (VascTreeNode)node.getUserObject();
if (vascNode != null) {
if (vascNode.type == VascTreeNodeType.ENTRY) {
VascEntry ee = vascManager.getVascController().getVascEntryController().getVascEntryById(vascNode.id).clone();
DefaultVascFactory.fillVascEntryFrontend(ee, vascManager.getVascController(), DefaultVascFactory.getDefaultVascFrontendData(null));
spi.createNewVascView(ee);
}
}
} catch (Exception ee) {
ee.printStackTrace();
}
}
}
});
JPanel treePanel = new JPanel();
treePanel.setLayout(new GridLayout(1,0));
JScrollPane p = createJScrollPane(treePanel);
p.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
p.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
treePanel.add(vascTree);
rebuildTree();
return p;
}
private JScrollPane createContentPane() {
JPanel contentPane = new JPanel();
contentPane.setLayout(new GridLayout(1,0));
JScrollPane p = createJScrollPane(contentPane);
tabPane = new JTabbedPane();
spi = new SwingPanelTabbed(tabPane);
contentPane.add(tabPane);
return p;
}
private JScrollPane createJScrollPane(JPanel innerPanel) {
JScrollPane scrollPane = new JScrollPane(innerPanel);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.getVerticalScrollBar().setUnitIncrement(10);
scrollPane.getHorizontalScrollBar().setUnitIncrement(10);
//innerPanel.setParentScrollPane(scrollPane);
return scrollPane;
}
class VascTreeNode {
public VascTreeNode() {}
public VascTreeNode(VascTreeNodeType type,String id) { this.type=type;this.id=id; }
public VascTreeNode(VascTreeNodeType type,String id,String entryId) { this.type=type;this.id=id;this.entryId=entryId; }
VascTreeNodeType type;
String id;
String entryId;
@Override
public String toString() {
return id;
}
}
enum VascTreeNodeType {
NONE,
FIELD_TYPE,
BACKEND,
ENTRY
}
public void rebuildTree() {
DefaultMutableTreeNode root = (DefaultMutableTreeNode)vascTree.getModel().getRoot();
root.removeAllChildren();
DefaultMutableTreeNode fieldTypes = new DefaultMutableTreeNode("FieldTypes");
for (String id:vascManager.getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
DefaultMutableTreeNode typeNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.FIELD_TYPE,id));
fieldTypes.add(typeNode);
}
root.add(fieldTypes);
DefaultMutableTreeNode backends = new DefaultMutableTreeNode("VascBackends");
for (String id:vascManager.getVascController().getVascBackendController().getVascBackendIds()) {
DefaultMutableTreeNode backendNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.BACKEND,id));
backends.add(backendNode);
}
root.add(backends);
DefaultMutableTreeNode entries = new DefaultMutableTreeNode("VascEntries");
for (String id:vascManager.getVascController().getVascEntryController().getVascEntryIds()) {
//VascEntry ve = vascManager.getVascController().getVascEntryController().getVascEntryById(id);
DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY,id));
entries.add(entryNode);
/*
DefaultMutableTreeNode fields = new DefaultMutableTreeNode("Fields");
for (VascEntryField vef:ve.getVascEntryFields()) {
DefaultMutableTreeNode vefNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD,vef.getId(),id));
fields.add(vefNode);
}
entryNode.add(fields);
DefaultMutableTreeNode fieldSets = new DefaultMutableTreeNode("FieldSets");
for (VascEntryFieldSet vefs:ve.getVascEntryFieldSets()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vefs.getId(),id));
fieldSets.add(vefsNode);
}
entryNode.add(fieldSets);
DefaultMutableTreeNode links = new DefaultMutableTreeNode("Links");
for (VascLinkEntry vle:ve.getVascLinkEntries()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vle.getId()));
links.add(vefsNode);
}
entryNode.add(links);
DefaultMutableTreeNode filters = new DefaultMutableTreeNode("Backend Filters");
for (VascBackendFilter vbf:ve.getVascBackendFilters()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vbf.getClass().getSimpleName()));
filters.add(vefsNode);
}
entryNode.add(links);
DefaultMutableTreeNode param = new DefaultMutableTreeNode("Backend Parameters");
for (String key:ve.getEntryParameterKeys()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,key));
param.add(vefsNode);
}
entryNode.add(param);
DefaultMutableTreeNode options = new DefaultMutableTreeNode("List Options");
for (VascEntryField vef:ve.getListOptions()) {
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vef.getId()));
options.add(vefsNode);
}
entryNode.add(options);
*/
}
root.add(entries);
SwingUtilities.updateComponentTreeUI(vascTree);
}
public JTabbedPane getTabPane() {
return tabPane;
}
}

View file

@ -0,0 +1,144 @@
package net.forwardfire.vasc.demo.tech.ui.components;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTabbedPane;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaCsv;
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaJdbc;
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaMongodb;
public class JMainPanelMenuBar extends JMenuBar {
JMenu fileMenu = new JMenu("File");
JMenu connMenu = new JMenu("Connection");
JMenu tabMenu = new JMenu("Tabs");
public JMainPanelMenuBar() {
createMenuItems();
add(fileMenu);
add(connMenu);
add(tabMenu);
}
private void createMenuItems() {
JMenuItem openXmlItem = new JMenuItem("Import Xml");
openXmlItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
final JFileChooser fc = new JFileChooser();
//fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
TechUI.getInstance().getVascManager().openFile(file);
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
fileMenu.add(openXmlItem);
//JMenuItem closeXmlItem = new JMenuItem("Close");
//fileMenu.add(closeXmlItem);
fileMenu.addSeparator();
JMenuItem exitItem = new JMenuItem("Exit");
exitItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
TechUI.getInstance().exit();
}
});
fileMenu.add(exitItem);
JMenuItem connectVascItem = new JMenuItem("Add Vasc");
connectVascItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
connMenu.add(connectVascItem);
JMenuItem connectLdapItem = new JMenuItem("Add Ldap");
connectLdapItem.setEnabled(false);
connMenu.add(connectLdapItem);
connMenu.addSeparator();
JMenuItem connectMetaCsvItem = new JMenuItem("Add meta csv");
connectMetaCsvItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialogMetaCsv d = new JDialogMetaCsv(TechUI.getInstance().getMainFrame());
d.setVisible(true);
}
});
connMenu.add(connectMetaCsvItem);
JMenuItem connectMetaXmlItem = new JMenuItem("Add meta xml");
connMenu.add(connectMetaXmlItem);
JMenuItem connectMetaMongoItem = new JMenuItem("Add meta mongo");
connectMetaMongoItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialogMetaMongodb d = new JDialogMetaMongodb(TechUI.getInstance().getMainFrame());
d.setVisible(true);
}
});
connMenu.add(connectMetaMongoItem);
JMenuItem connectMetaJdbcItem = new JMenuItem("Add meta jdbc");
connectMetaJdbcItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialogMetaJdbc d = new JDialogMetaJdbc(TechUI.getInstance().getMainFrame());
d.setVisible(true);
}
});
connMenu.add(connectMetaJdbcItem);
/*
for (final String id:ve.getVascFrontendData().getVascController().getVascEntryController().getVascEntryIds()) {
JMenuItem item = new JMenuItem(id);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
VascEntry ee = ve.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(id).clone();
DefaultVascFactory.fillVascEntryFrontend(ee, ve.getVascFrontendData().getVascController(), DefaultVascFactory.getDefaultVascFrontendData(null));
spi.createNewVascView(ee);
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
vascMenu.add(item);
}
*/
JMenuItem item = new JMenuItem("Close tab");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTabbedPane tabPane = ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).getTabPane();
if (tabPane.getSelectedIndex()>=0) {
tabPane.removeTabAt(tabPane.getSelectedIndex()); // todo release vasc frontend
}
}
});
tabMenu.add(item);
JMenuItem itemAll = new JMenuItem("Close All tabs");
itemAll.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTabbedPane tabPane = ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).getTabPane();
for (int i=tabPane.getTabCount();i>0;i--) {
tabPane.removeTabAt(i-1); // todo release vasc frontend
}
}
});
tabMenu.add(itemAll);
}
}

View file

@ -0,0 +1,214 @@
/*
* Copyright (c) 2011, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.demo.tech.ui.components;
import java.awt.Component;
import java.awt.Container;
import javax.swing.Spring;
import javax.swing.SpringLayout;
/**
* SpringLayoutGrid, someone should create an JCP to get these functions into
* SpringLayout object because this code is to much duplicated on many projects.
*
* A 1.4 file that provides utility methods for creating form- or grid-style
* layouts with SpringLayout. These utilities are used by several programs, such
* as SpringBox and SpringCompactGrid.
*/
public class SpringLayoutGrid {
/**
* Aligns the first <code>rows</code>*<code>cols</code> components of
* <code>parent</code> in a grid. Each component is as big as the maximum
* preferred width and height of the components. The parent is made just big
* enough to fit them all.
*
* @param rows
* number of rows
* @param cols
* number of columns
* @param initialX
* x location to start the grid at
* @param initialY
* y location to start the grid at
* @param xPad
* x padding between cells
* @param yPad
* y padding between cells
*/
public static void makeGrid(Container parent, int rows, int cols,int initialX, int initialY, int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
throw new IllegalArgumentException("parent container has not StringLayout layoutmanager.");
}
Spring xPadSpring = Spring.constant(xPad);
Spring yPadSpring = Spring.constant(yPad);
Spring initialXSpring = Spring.constant(initialX);
Spring initialYSpring = Spring.constant(initialY);
int max = rows * cols;
//Calculate Springs that are the max of the width/height so that all
//cells have the same size.
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0))
.getWidth();
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0))
.getWidth();
for (int i = 1; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(parent
.getComponent(i));
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
}
//Apply the new width/height Spring. This forces all the
//components to have the same size.
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(parent
.getComponent(i));
cons.setWidth(maxWidthSpring);
cons.setHeight(maxHeightSpring);
}
//Then adjust the x/y constraints of all the cells so that they
//are aligned in a grid.
SpringLayout.Constraints lastCons = null;
SpringLayout.Constraints lastRowCons = null;
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(parent
.getComponent(i));
if (i % cols == 0) { //start of new row
lastRowCons = lastCons;
cons.setX(initialXSpring);
} else { //x position depends on previous component
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
xPadSpring));
}
if (i / cols == 0) { //first row
cons.setY(initialYSpring);
} else { //y position depends on previous row
cons.setY(Spring.sum(lastRowCons
.getConstraint(SpringLayout.SOUTH), yPadSpring));
}
lastCons = cons;
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH, Spring.sum(Spring
.constant(yPad), lastCons.getConstraint(SpringLayout.SOUTH)));
pCons.setConstraint(SpringLayout.EAST, Spring.sum(
Spring.constant(xPad), lastCons
.getConstraint(SpringLayout.EAST)));
}
/* Used by makeCompactGrid. */
private static SpringLayout.Constraints getConstraintsForCell(int row,
int col, Container parent, int cols) {
SpringLayout layout = (SpringLayout) parent.getLayout();
Component c = parent.getComponent(row * cols + col);
return layout.getConstraints(c);
}
public static void makeCompactGrid(Container parent, int rows, int cols) {
makeCompactGrid(parent,rows,cols,6,6,6,6);
}
/**
* Aligns the first <code>rows</code>*<code>cols</code> components of
* <code>parent</code> in a grid. Each component in a column is as wide as
* the maximum preferred width of the components in that column; height is
* similarly determined for each row. The parent is made just big enough to
* fit them all.
*
* @param rows
* number of rows
* @param cols
* number of columns
* @param initialX
* x location to start the grid at
* @param initialY
* y location to start the grid at
* @param xPad
* x padding between cells
* @param yPad
* y padding between cells
*/
public static void makeCompactGrid(Container parent, int rows, int cols,int initialX, int initialY, int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
throw new IllegalArgumentException("parent container has not StringLayout layoutmanager.");
}
//Align all cells in each column and make them the same width.
Spring x = Spring.constant(initialX);
for (int c = 0; c < cols; c++) {
Spring width = Spring.constant(0);
for (int r = 0; r < rows; r++) {
width = Spring.max(width, getConstraintsForCell(r, c, parent,
cols).getWidth());
}
for (int r = 0; r < rows; r++) {
SpringLayout.Constraints constraints = getConstraintsForCell(r,
c, parent, cols);
constraints.setX(x);
constraints.setWidth(width);
}
x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
}
//Align all cells in each row and make them the same height.
Spring y = Spring.constant(initialY);
for (int r = 0; r < rows; r++) {
Spring height = Spring.constant(0);
for (int c = 0; c < cols; c++) {
height = Spring.max(height, getConstraintsForCell(r, c, parent,
cols).getHeight());
}
for (int c = 0; c < cols; c++) {
SpringLayout.Constraints constraints = getConstraintsForCell(r,
c, parent, cols);
constraints.setY(y);
constraints.setHeight(height);
}
y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH, y);
pCons.setConstraint(SpringLayout.EAST, x);
}
}

View file

@ -0,0 +1,118 @@
#
# Copyright (c) 2011, Willem Cazander
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided
# that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the
# following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
# the following disclaimer in the documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Application's properties
Application.name = Vasc Demo Tech
Application.title = VascDemoTech
Application.vendor = Willem Cazander
Application.homepage = http://vasc.forwardfire.org/
Application.vendorId = vasc
Application.id = vascdemotech
Application.lookAndFeel = com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
#Application.icon = images/icon.png
generic.active.labelText = active
generic.active.toolTipText = active
generic.createdDate.labelText = createdDate
generic.createdDate.toolTipText = createdDate
generic.description.labelText = description
generic.description.toolTipText = description
generic.id.labelText = id
generic.id.toolTipText = id
generic.modifiedDate.labelText = modifiedDate
generic.modifiedDate.toolTipText = modifiedDate
generic.name.labelText = name
generic.name.toolTipText = name
generic.orderNumber.labelText = orderNumber
generic.orderNumber.toolTipText = orderNumber
# hibernate validators
validator.assertFalse=assertion failed
validator.assertTrue=assertion failed
validator.future=Date must lie in the future
validator.length=Field must contain between {min} and {max} characters.
validator.max=Value must be equal to or lower than {value}
validator.min=Value must be equal to or higher than {value}
validator.notNull=A value must be entered
validator.past=Date must lie in the future
validator.pattern=Value must conform to "{regex}"
validator.range=Value must lie between {min} and {max}
validator.size=There must be between {min} and {max} characters
validator.email=The value must be a valid e-mail address
# vasc validators
vasc.validator.VascDateFutureValidator=The date must lie in the future.
vasc.validator.VascDatePastValidator=The date must lie in the past.
vasc.validator.VascIntSizeValidator=Value must lie between {0} and {1}
vasc.validator.VascLongSizeValidator=Value must lie between {0} and {1}
vasc.validator.VascObjectNotNullValidator=A value must be entered
vasc.validator.VascObjectNullValidator=No value may be entered
vasc.validator.VascStringEmailValidator=The value must be a valid e-mail address
vasc.validator.VascStringLengthValidator=There must be at least {0} and at most {1} items
vasc.validator.VascStringRegexValidator=Value must conform to "{0}"
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.
vasc.action.downloadAction.name = Select
vasc.action.editRowAction.description = edit
vasc.action.editRowAction.name = Edit
# Temp jsf
generic.vasc.jsf.listOption.header = Searchoptions
generic.vasc.jsf.listOption.search = Searh\:
generic.vasc.jsf.listOption.sumbit = Search
generic.vasc.jsf.pager.previous = Previous
generic.vasc.jsf.pager.next = Next
generic.vasc.jsf.table.rows = Row Numbers\:
generic.vasc.jsf.table.pagerDirect = Go to\:
generic.vasc.jsf.table.downloadDirect = Download\:
generic.vasc.jsf.table.resultText = Results {0}-{1} from {2} rows
generic.vasc.jsf.table.download.img = Save table data.
generic.vasc.jsf.table.printer.img = Shows the table in printer friendly format.
generic.vasc.jsf.table.export.select = ...
generic.vasc.jsf.table.export.select.alt = Select Export
generic.vasc.jsf.table.page.select = ...
generic.vasc.jsf.table.page.select.alt = Select Page
generic.vasc.jsf.table.page.name = Page:
generic.vasc.jsf.table.page.description = Goto page:
generic.vasc.jsf.tableHeader.fields = Fields
generic.vasc.jsf.tableHeader.links = Links
generic.vasc.jsf.tableHeader.actions = Actions
generic.vasc.jsf.multiAction.selectAll = Select all:
generic.vasc.jsf.multiAction.name = ...
generic.vasc.jsf.multiAction.description = Select Action
generic.vasc.jsf.action.save = Save
generic.vasc.jsf.action.cancel = Cancel
generic.vasc.jsf.action.back = Back
generic.vasc.jsf.parentSelected = Selected:

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-demo-tech-web</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View file

@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View file

@ -0,0 +1,77 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-demo-tech</artifactId>
<groupId>net.forwardfire.vasc.demo</groupId>
<version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>vasc-demo-tech-web</artifactId>
<name>vasc-demo-tech-web</name>
<description>vasc-demo-tech-web</description>
<dependencies>
<!-- Vasc dep -->
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-web-jsf</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Tomcat deps -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>7.0.22</version>
</dependency>
<!-- Web tech deps -->
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>1.1.15.B1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2_12</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>1.2_12</version>
</dependency>
<!-- RichFaces libraries -->
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-api</artifactId>
<version>3.3.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-impl</artifactId>
<version>3.3.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-ui</artifactId>
<version>3.3.3-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,72 @@
/*
* Copyright 2009-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.demo.tech.web.beans;
import java.io.Serializable;
import net.forwardfire.vasc.demo.tech.web.models.WebUser;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 1, 2009
*/
public class UserController implements Serializable {
private static final long serialVersionUID = 1L;
private WebUser webUser = null;
public void loginFilter() {
try {
//logUser = loginManager.getUser();
//logRightRoles = loginManager.getClientRoles();
webUser = new WebUser();
webUser.setLoginName( "test123");
webUser.setFullName( "test1234567890");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public void logoutFilter() {
webUser = null;
//logRightRoles = null;
}
public boolean isUserLoggedin() {
if (webUser==null) {
return false;
}
return true;
}
public WebUser getUser() {
return webUser;
}
//public List<LogRightRole> getRightRoles() {
// return logRightRoles;
//}
}

View file

@ -0,0 +1,88 @@
/*
* Copyright 2009-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.demo.tech.web.beans;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.faces.context.FacesContext;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
import net.forwardfire.vasc.demo.tech.web.core.TomcatManager;
import net.forwardfire.vasc.frontend.VascFrontendData;
import net.forwardfire.vasc.frontends.web.jsf.AbstractJSFVascFacesControllerBase;
import net.forwardfire.vasc.impl.DefaultVascFactory;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 1, 2009
*/
public class VascFacesController extends AbstractJSFVascFacesControllerBase {
public List<String> getVascAdminEntries() {
List<String> result = new ArrayList<String>(50);
VascController v = getVascController();
for (String e:v.getVascEntryController().getVascEntryIds()) {
if (e.endsWith("Link")==false) {
result.add(e);
}
}
return result;
}
@Override
public VascFrontendData getNewVascFrontendData() {
Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
// MergedResourceBundle bundle = new MergedResourceBundle();
// bundle.addDataBundle(ResourceBundle.getBundle(getResourceBundleWEB(), locale));
VascFrontendData vascFrontendData = DefaultVascFactory.getDefaultVascFrontendData(ResourceBundle.getBundle("net/forwardfire/vasc/demo/tech/ui/resources/TechUI"));
vascFrontendData.addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
private static final long serialVersionUID = 1L;
public VascFrontendEventType[] getEventTypes() {
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.EXCEPTION};
return result;
}
public void vascEvent(VascEntry entry, Object data) {
if (data instanceof Exception) {
((Exception)data).printStackTrace();
}
}
});
return vascFrontendData;
}
@Override
public VascController getVascController() {
return TomcatManager.getInstance().getVascController();
}
}

View file

@ -0,0 +1,57 @@
package net.forwardfire.vasc.demo.tech.web.core;
import java.io.File;
import net.forwardfire.vasc.core.VascController;
import org.apache.catalina.startup.Tomcat;
public class TomcatManager {
private Tomcat tomcat = null;
private VascController vascController = null;
public void start() throws Exception {
String webappDirLocation = "../vasc-demo-tech-web/src/main/webapp/";
Tomcat tomcat = new Tomcat();
String webPort = System.getenv("PORT");
if(webPort == null || webPort.isEmpty()) {
webPort = "8899";
}
tomcat.setPort(Integer.valueOf(webPort));
tomcat.addWebapp("/demo", new File(webappDirLocation).getAbsolutePath());
System.out.println("configuring app with basedir: " + new File("./" + webappDirLocation).getAbsolutePath());
instance = this;
tomcat.start();
}
public void stop() throws Exception {
if (tomcat==null) {
return;
}
tomcat.stop();
instance = null;
}
static private TomcatManager instance = null;
static public TomcatManager getInstance() {
return instance; // hackje to rm mvn 1-1 dep with ui
}
/**
* @return the vascController
*/
public VascController getVascController() {
return vascController;
}
/**
* @param vascController the vascController to set
*/
public void setVascController(VascController vascController) {
this.vascController = vascController;
}
}

View file

@ -0,0 +1,50 @@
package net.forwardfire.vasc.demo.tech.web.models;
import java.util.ArrayList;
import java.util.List;
public class WebUser {
private String loginName = null;
private String fullName = null;
private List<String> groups = null;
public WebUser() {
groups = new ArrayList<String>(20);
}
/**
* @return the loginName
*/
public String getLoginName() {
return loginName;
}
/**
* @param loginName the loginName to set
*/
public void setLoginName(String loginName) {
this.loginName = loginName;
}
/**
* @return the fullName
*/
public String getFullName() {
return fullName;
}
/**
* @param fullName the fullName to set
*/
public void setFullName(String fullName) {
this.fullName = fullName;
}
/**
* @return the groups
*/
public List<String> getGroups() {
return groups;
}
}

View file

@ -0,0 +1,73 @@
#Colors
headerBackgroundColor=\#EAEAEA
headerGradientColor=\#E0E0E0
headerTextColor=#282828
headerWeightFont=bold
generalBackgroundColor=#FFFFFF
generalTextColor=#282828
generalSizeFont=11px
generalFamilyFont=Arial, Helvetica, sans-serif
controlTextColor=#282828
controlBackgroundColor=#ffffff
additionalBackgroundColor=#ffffff
shadowBackgroundColor=#000000
shadowOpacity=1
panelBorderColor=#BED6F8
subBorderColor=#ffffff
tabBackgroundColor=#C6DEFF
tabDisabledTextColor=#ffffff
trimColor=#D6E6FB
tipBackgroundColor=\#FAE6B0
tipBorderColor=\#E5973E
selectControlColor=#E79A00
generalLinkColor=#004DEB
hoverLinkColor=#004DEB
visitedLinkColor=#004DEB
# Fonts
headerSizeFont=11px
headerFamilyFont=Arial, Helvetica, sans-serif
tabSizeFont=11
tabFamilyFont=Arial, Helvetica, sans-serif
buttonSizeFont=11
buttonFamilyFont=Arial, Verdana, sans-serif
tableBackgroundColor=#FFFFFF
tableFooterBackgroundColor=#FFFFFF
tableSubfooterBackgroundColor=#FFFFFF
#Calendar colors
calendarWeekBackgroundColor=#F5F5F5
calendarHolidaysBackgroundColor=#FFEBDA
calendarHolidaysTextColor=#FF7800
calendarCurrentBackgroundColor=#FF7800
calendarCurrentTextColor=#FFEBDA
calendarSpecBackgroundColor=#E4F5E2
calendarSpecTextColor=#000000
warningColor=#282828
warningBackgroundColor=##EE0000
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain

View file

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN" "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
<managed-bean>
<description>Controls the Users</description>
<managed-bean-name>userController</managed-bean-name>
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.beans.UserController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<description>Controls Vasc Faces</description>
<managed-bean-name>vascFacesController</managed-bean-name>
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.beans.VascFacesController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>

View file

@ -0,0 +1,205 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Vasc Demo Tech Web Application</display-name>
<welcome-file-list>
<welcome-file>/jsp/index_jsp.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>4</session-timeout>
<!-- An 4min session, we increase it after login to 20min. -->
</session-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<web-resource-collection>
<web-resource-name>Include files</web-resource-name>
<description>No direct access to include files.</description>
<url-pattern>/jsp/includes/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<description>No direct browser access to include files.</description>
<role-name>inaccessible</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<!--
<security-constraint>
<display-name>User Required</display-name>
<web-resource-collection>
<web-resource-name>User pages</web-resource-name>
<url-pattern>/jsp/user/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<display-name>Admin User Required</display-name>
<web-resource-collection>
<web-resource-name>Admin pages</web-resource-name>
<url-pattern>/jsp/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin-company</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<display-name>Sytem User Required</display-name>
<web-resource-collection>
<web-resource-name>System pages</web-resource-name>
<url-pattern>/jsp/system/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin-system</role-name>
</auth-constraint>
</security-constraint>
-->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>VascDemoSecurity</realm-name>
<form-login-config>
<form-login-page>/jsp/login/login.jsf</form-login-page>
<form-error-page>/jsp/login/login-error.jsf</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>user</role-name>
</security-role>
<security-role>
<role-name>admin-company</role-name>
</security-role>
<security-role>
<role-name>admin-system</role-name>
</security-role>
<security-role>
<role-name>inaccessible</role-name>
</security-role>
<!-- =============== USER CONFIG ===================================
<filter>
<display-name>User Filter</display-name>
<filter-name>userFilter</filter-name>
<filter-class>net.forwardfire.logstats.web.filters.UserFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>userFilter</filter-name>
<servlet-name>facesServlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
-->
<!-- =============== JSF CONFIG =================================== -->
<context-param>
<description>
Comma separated list of URIs of (additional) faces
config files.(e.g./WEB-INF/my-config.xml) See JSF1.0 PRD 2,10.3.2
</description>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.REFRESH_PERIOD</param-name>
<param-value>2</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<!--
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
-->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<servlet>
<description>The JSF Servlet</description>
<servlet-name>facesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<!-- Plugin our own richfaces skin -->
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>vasc-demo-tech</param-value>
</context-param>
<!-- Making the RichFaces skin spread to standard HTML controls -->
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<!-- Defining and mapping the RichFaces filter -->
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>facesServlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!-- =============== VASC CONFIG =================================== -->
<filter>
<display-name>VASC Filter</display-name>
<filter-name>vascFilter</filter-name>
<filter-class>net.forwardfire.vasc.frontends.web.jsf.VascRequestFacesFilter</filter-class>
<init-param>
<param-name>templateFile</param-name>
<param-value>/jsp/includes/vasc-template.jsf</param-value>
</init-param>
<!--
<init-param>
<param-name>resourceBundle</param-name>
<param-value>net/forwardfire/logstats/resources/i18n/LogstatsBundleWAR</param-value>
</init-param>
-->
</filter>
<filter-mapping>
<filter-name>vascFilter</filter-name>
<url-pattern>/vasc/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
</web-app>

View file

@ -0,0 +1,8 @@
/* CSS fixes for IE6 */
/*
#page_menu_left {
overflow: visible;
}
*/

View file

@ -0,0 +1,8 @@
/* CSS fixes for IE7 */
/*
#page_menu_left {
overflow: visible;
}
*/

View file

@ -0,0 +1,4 @@
/* CSS fixes for IE8 */
/* Yet to come */

View file

@ -0,0 +1,538 @@
/* HTML STYLES */
* {
margin:0px;
padding:0px;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
color: #000000;
margin: 0px;
padding: 0px;
background-color:white;
}
h1 {
font-size:1.2em;
font-weight:bold;
padding-bottom:10px;
}
h2 {
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
display:block;
font-size:1.0em;
font-weight:bold;
padding:10px 10px 10px 10px;
}
a {
color:#004DEB;
text-decoration:underline;
}
p {
margin:10px 10px 10px 10px;
}
img {
border: none;
vertical-align: middle;
}
ul {
margin-left:10px;
}
/* DIVS */
#page_wrap{
margin:10px;
margin-top:0px;
float:none;
}
#page_header{
height:80px;
font-size:18px;
border-bottom:1px solid #DDCCCC;
position:relative;
}
#page_header a img{
border:none;
padding-right:10px;
vertical-align:middle;
}
#page_content {
margin-top:5px;
}
#page_footer {
margin-top:35px;
padding: 5px;
font-size: 12px;
border-color:#e5e5e5;
border-style:solid;
border-width:1px 1px 1px 1px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
}
/* MENU */
#page_menu_left,#page_menu_right {
border-color:#DDCCCC;
border-style:solid;
border-width:0 0 1px 0;
vertical-align:bottom;
display:inline;
}
#page_menu_right {
position:absolute;
bottom:0;
right:0;
}
#page_menu_left a,#page_menu_right a {
border:1px solid #e0e0e0;
background-color:#DDCCCC;
border-bottom-width:0px;
text-align:center;
-moz-border-radius-topleft:3xp;
-moz-border-radius-topright:3xp;
-webkit-border-top-left-radius:3px;
-webkit-border-top-right-radius:3px;
-khtml-border-radius-topleft:3px;
-khtml-border-radius-topright:3px;
color:#000;
margin:0px 5px 0px 0px;
padding:3px 15px 2px 15px;
text-decoration:none;
}
#page_menu_left a:hover,#page_menu_right a:hover {
text-decoration:none;
background-color:#fff;
border-color:#e0e0e0;
}
#page_menu_left a.active,#page_menu_left a.active {
background-color:#fff;
font-weight:700;
}
#page_user_info {
padding:5px;
position:absolute;
right:0;
top:0;
font-size:11px;
}
.actionbox{
background-color:#DDCCCC;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
border:none;
-moz-border-radius-topleft:0;
-webkit-border-top-left-radius:0;
-khtml-border-radius-topleft:0;
clear:both;
padding:3px 0 3px 3px;
display:block;
}
.actionbox label{display:inline;}
ul.actionboxtab{margin:0;padding:0;}
ul.actionboxtab li{list-style-type:none;float:left;margin:0;padding:0;}
ul.actionboxtab li a {
border:solid 1px #ddd;
border-bottom-width:0;
-moz-border-radius-topleft:3px;
-moz-border-radius-topright:3px;
-khtml-border-radius-topright:3px;
-webkit-border-top-left-radius:3px;
-webkit-border-top-right-radius:3px;
-khtml-border-radius-topleft:3px;
font-weight:700;
display:block;
margin-right:5px;color:#000;
padding:3px 15px;
}
ul.actionboxtab li a.active{background-color:#DDCCCC;border:solid 1px #DDCCCC;text-decoration:none;}
ul.actionboxtab li a:hover{background-color:#DDCCCC;border:solid 1px #DDCCCC;text-decoration:none;}
td.tableactions{border-bottom-color:#bbb;text-align:left;}
ul.paging{
clear:both;
margin-bottom:5px;
margin-top:5px;
display:block;
float:left;
padding-top:3px;
padding-bottom:3px;
width:100%;
list-style:none;
}
ul.paging li,ul.paging span{float:left;margin:0 2px 0 2px;}
.paging_thispage{font-weight:700;padding:0 6px;}
ul.paging .paging_atstart{margin-right:10px;}ul.paging .paging_atend{margin-left:10px;}
ul.paging .paging_atstart a,ul.paging .nolink.paging_atstart{
padding-left:15px;
}
ul.paging .paging_atend a,ul.paging .nolink.paging_atend{
padding-right:15px;
}
ul.paging .paging_next{
margin-left:20px;
border:1px solid #DDD;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
padding:2px 6px;
}
ul.paging .paging_prev{
margin-right:20px;
border:1px solid #DDD;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
padding:2px 6px;
}
ul.paging a,ul.paging .paging_link{
border:1px solid #DDD;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
padding:2px 6px;
}
ul.paging .paging_break{
font-weight:700;padding:2px 6px;
}
/* TABLES */
/*
#m_content table {
text-align: left;
}
*/
table.table5, table.rating_table {
border-collapse:collapse;
font-size:11px;
width:100%;
margin-bottom: 30px;
}
table.table5 th, table.rating_table th {
padding-top:5px;
padding-bottom:5px;
font-weight:700;
text-align:left;
vertical-align:top;
padding-left: 3px;
}
table.table5 td, table.rating_table td {
vertical-align:top;
padding-top:5px;
padding-bottom:5px;
padding-left: 3px;
}
.dataTableHeaderRow {
border:1px solid #e0e0e0;
background-color:#e4e4e4;
border-bottom-width:0;
}
.dataTableHeaderRow th, td {
padding-right: 5px;
}
table input,table select {
font-size: 11px;
margin-left:6px;
margin-right:6px;
}
table.table5 tr:nth-child(even) {
background-color:#f0f0f0;
}
.table_options_top {
-moz-border-radius-topleft:3px;
-moz-border-radius-topright:3px;
background-color:#DDCCCC;
font-size:12px;
font-weight:700;
padding:6px 15px;
display: block;
}
.table_options_bottom {
-moz-border-radius-bottomleft:3px;
-moz-border-radius-bottomright:3px;
background-color:#DDCCCC;
font-size:12px;
font-weight:700;
padding:6px 15px;
display: block;
margin-top:5px;
}
.table_sub_header {
-moz-border-radius-topleft:5px;
-moz-border-radius-topright:5px;
background-color:#EEEEEE;
border:1px solid #BBBBBB;
display:block;
font-size:14px;
font-weight:700;
margin:0 2px;
padding:3px 6px;
text-align:center;
}
.rich-table-subheader {
background-color:#DDCCCC;
border-top: 1px solid #C0C0C0;
border-left: 1px solid #C0C0C0;
}
.rich-table {
border-top: none;
border-left: none;
}
.rich-table-row {
border-left: 1px solid #C0C0C0;
}
.rich-table-headercell,.rich-table-footercell {
background-color: #FFF;
border: none;
padding-left: 0px;
padding-right: 0px;
font-weight: none;
}
.rich-table-thead {
border: none;
}
.rich-table-header {
background: none;
}
.homepage_stats {
margin-top:10px;
margin-bottom:10px;
}
.homepage_stats_big {
color:#004DEB;
margin-top:5px;
margin-bottom:5px;
font-size: 20px;
display:block;
font-weight: normal;
}
/* MESSAGES */
.message_info,
.message_1 {
display:block;
font-size: 14px;
font-weight: bold;
border:solid 1px #a0ff7d;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
background-color: #a0ff7d;
padding: 15px 15px;
margin-bottom: 15px;
}
.message_warning,
.message_2 {
display:block;
font-size: 14px;
font-weight: bold;
border:solid 1px #ffae4c;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
background-color: #ffae4c;
padding: 15px 15px;
margin-bottom: 15px;
}
.message_error,
.message_3 {
display:block;
font-size: 14px;
font-weight: bold;
border:solid 1px #ff5b43;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
background-color: #ff5b43;
padding: 15px 15px;
margin-bottom: 15px;
}
.message_4 {
display:block;
font-size: 14px;
font-weight: bold;
border:solid 1px #fc9200;
background-color: #fc9200;
-moz-border-radius-topleft:3px;
-webkit-border-top-left-radius:3px;
-khtml-border-radius-topleft:3px;
-moz-border-radius-topright:3px;
-webkit-border-top-right-radius:3px;
-khtml-border-radius-topright:3px;
padding: 5px;
margin-bottom: 10px;
}
.message_1 input, .message_1 button, .message_2 input, .message_2 button, .message_3 input, .message_3 button {
margin:0px;
}
.message_4 h2 {
margin: 0px;
padding:5px;
}
.message_4 input {
margin: 0px;
font-weight: bold;
font-size: 14px;
padding: 2px 5px;
margin-right: 5px;
}
/* LOGINBOX */
/* Text styles */
.text_justify {
text-align:justify;
}
.text_left {
text-align:left;
}
.text_right {
text-align:right;
}
.text_center {
text-align:center;
}
.text_middle {
vertical-align:middle!important;
}
.text_top {
vertical-align:top;
}
/* OTHER STYLES */
.no_wrap {
white-space: nowrap;
}
.no_border {
border:none;
}
/*
** WIKI styles
*/
#toc,
.toc,
.mw-warning {
border: 1px solid #aaa;
background-color: #f9f9f9;
padding: 5px;
font-size: 95%;
}
#toc h2,
.toc h2 {
display: inline;
border: none;
padding: 0;
font-size: 100%;
font-weight: bold;
}
#toc #toctitle,
.toc #toctitle,
#toc .toctitle,
.toc .toctitle {
text-align: center;
}
#toc ul,
.toc ul {
list-style-type: none;
list-style-image: none;
margin-left: 0;
padding-left: 0;
text-align: left;
}
#toc ul ul,
.toc ul ul {
margin: 0 0 0 2em;
}
#toc .toctoggle,
.toc .toctoggle {
font-size: 94%;
}
.thumbcaption {
border: none;
text-align: left;
line-height: 1.4em;
padding: 3px !important;
font-size: 94%;
}
.location-right {
clear: right;
float: right;
border-width: .5em 0 .8em 1.4em;
}
.location-left {
float: left;
clear: left;
margin-right: .5em;
border-width: .5em 1.4em .8em 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,22 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<ui:composition template="/jsp/includes/layout.xhtml">
<ui:define name="title">Vasc Admin</ui:define>
<ui:define name="content">
<rich:panel style="width:90%;margin-top:2em;">
<f:facet name="header">
<h:outputText value="Vasc Admin" />
</f:facet>
<rich:dataList var="info" value="#{vascFacesController.vascAdminEntries}">
<h:column>
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/vasc/#{info}/list.jsf"><h:outputText value="#{info}"/></h:outputLink>
</h:column>
</rich:dataList>
</rich:panel>
</ui:define>
</ui:composition>
</html>

View file

@ -0,0 +1,10 @@
<ui:composition template="/jsp/includes/layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<ui:define name="title">Help</ui:define>
<ui:define name="content"><h:outputText value="Help"/></ui:define>
</ui:composition>

View file

@ -0,0 +1,15 @@
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<rich:panel header="User Greeter" style="width: 315px">
<h2><h:outputText value="Hello User" /></h2>
<h:outputLink value="user/index.jsf">
<h:outputText value="Login" />
</h:outputLink>
<h:outputText value="Already Loggedin."/>
</rich:panel>
</ui:composition>

View file

@ -0,0 +1,16 @@
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<rich:panel header="User Greeter" style="width: 315px">
<h2><h:outputText value="Hello User" /></h2>
<h:outputText value="Name: " />
<h:outputText value="#{userController.flowUser.username}" />
<rich:dataList value="#{userController.rightRoles}" var="role">
<h:outputText value="#{role.roleKey}" />
</rich:dataList>
</rich:panel>
</ui:composition>

View file

@ -0,0 +1,71 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<meta name="robots" content="noodp"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta name="description" content="vasc"/>
<meta name="keywords" content="demo,forwardfire,x4o,vasc,java"/>
<title><ui:insert name="title">Default title</ui:insert></title>
<link href="#{facesContext.externalContext.requestContextPath}/css/site.css" rel="stylesheet" type="text/css"/>
<!--[if IE 6]><link href="#{facesContext.externalContext.requestContextPath}/css/ie6_fixes.css" rel="stylesheet" type="text/css" /><![endif]-->
<!--[if IE 7]><link href="#{facesContext.externalContext.requestContextPath}/css/ie7_fixes.css" rel="stylesheet" type="text/css" /><![endif]-->
<!--[if IE 8]><link href="#{facesContext.externalContext.requestContextPath}/css/ie8_fixes.css" rel="stylesheet" type="text/css" /><![endif]-->
</head>
<body>
<f:view>
<div id="page_wrap">
<div id="page_header">
<a href="#{facesContext.externalContext.requestContextPath}/jsp/index.jsf"><img src="#{facesContext.externalContext.requestContextPath}/img/logstats-logo.png" alt="Demo Logo" /></a>
<div id="page_menu_left">
</div>
<div id="page_menu_right">
<a href="#{facesContext.externalContext.requestContextPath}/jsp/index.jsf" class="active">Home</a>
<a href="#{facesContext.externalContext.requestContextPath}/jsp/reports.jsf">Reports</a>
<a href="#{facesContext.externalContext.requestContextPath}/jsp/realtime.jsf">Log</a>
<a href="#{facesContext.externalContext.requestContextPath}/jsp/help.jsf">Help</a>
<h:outputLink rendered="#{userController.userLoggedin}" value="#{facesContext.externalContext.requestContextPath}/jsp/admin/index.jsf">
<h:outputText value="Admin"/>
</h:outputLink>
</div>
<div id="page_user_info">
<h:outputLink rendered="#{userController.userLoggedin == false}" value="#{facesContext.externalContext.requestContextPath}/jsp/admin/index.jsf">
<h:outputText value="Login"/>
</h:outputLink>
<h:panelGroup rendered="#{userController.userLoggedin == true}">
<h:outputText value="#{userController.user.username}"/>
<h:outputText value=" - "/>
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/jsp/login/logout.jsf">
<h:outputText value="Logout"/>
</h:outputLink>
</h:panelGroup>
</div>
</div>
<div id="page_content">
<h1><ui:insert name="title" /></h1>
<ui:insert name="content"/>
</div>
<div class="spacer">&nbsp;</div>
<div id="page_footer">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4" class="text_center">Vasc Tech Demo Web.</td>
</tr>
<tr class="copyright">
<td colspan="2" class="text_left">Copyright &copy; none</td>
<td colspan="2" class="text_right">
Versie 0.8Beta -rXxx
<i>(2010-06-26 01:07)</i>
</td>
</tr>
</table>
</div>
</div>
</f:view>
</body>
</html>

View file

@ -0,0 +1,318 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:v="http://vasc.forwardfire.net/vasc.tld"
xmlns:rich="http://richfaces.org/rich"
>
<ui:composition template="/jsp/includes/layout.xhtml">
<ui:define name="title">
<h:outputText value="#{requestScopeVascEntityNameI18n}" />
</ui:define>
<ui:define name="content">
<script language="javascript" type="text/javascript">
<![CDATA[
function selectAllCheckboxes(x) {
for (var i=0,l=x.form.length; i<l; i++) {
if (x.form[i].type == 'checkbox' && (!x.form[i].disabled) && x!=x.form[i] ) {
x.form[i].checked=!x.form[i].checked;
}
}
}
]]>
</script>
<v:vascEntry vascController="#{vascFacesController.vascController}"
vascFrontendData="#{vascFacesController.newVascFrontendData}"
entryName="#{requestScopeVascEntityName}"
entrySupportVar="entrySupport"
tableRecordVar="tableRecord"
injectEditFieldsId="injectEditFieldsId"
injectTableOptionsId="injectTableOptionsId"
injectTableColumnsId="injectTableColumnsId"
disableLinkColumns="true"
>
<f:facet name="deleteView" >
<h:panelGroup>
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
<p>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.deleteDescription]}" escape="false">
<f:param value="#{entrySupport.selectedDisplayName}" />
</h:outputFormat>
</p>
<h:form>
<h:commandButton actionListener="#{entrySupport.deleteAction}" value="#{entrySupport.i18nMap['vasc.action.deleteRowAction.name']}"/>
<h:commandButton actionListener="#{entrySupport.cancelAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.cancel']}" />
</h:form>
</h:panelGroup>
</f:facet>
<f:facet name="exportView" >
<h:panelGroup>
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
<p>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.exportDescription]}" escape="false">
<f:param value="#{entrySupport.vascEntry.name}" />
</h:outputFormat>
</p>
<h:form>
<h:commandButton actionListener="#{entrySupport.cancelAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.cancel']}" />
</h:form>
</h:panelGroup>
</f:facet>
<f:facet name="editView" >
<h:panelGroup>
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
<p>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.editDescription]}" escape="false" rendered="#{!entrySupport.vascEntry.vascFrontendData.vascEntryState.editCreate}">
<f:param value="#{entrySupport.vascEntry.name}" />
</h:outputFormat>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.createDescription]}" escape="false" rendered="#{entrySupport.vascEntry.vascFrontendData.vascEntryState.editCreate}">
<f:param value="#{entrySupport.vascEntry.name}" />
</h:outputFormat>
</p>
<h:form>
<ul class="actionboxtab">
<li><a class="active"><h:outputText value="#{entrySupport.i18nMap['vasc.action.editRowAction.name']}"/></a></li>
<ui:repeat var="link" value="#{entrySupport.vascLinkEntriesEditTab}" rendered="#{!entrySupport.vascEntry.vascFrontendData.vascEntryState.editCreate}">
<li><h:commandLink actionListener="#{entrySupport.linkEditAction}" value="#{entrySupport.i18nMap[link.name]}" type="#{link.id}"/></li>
</ui:repeat>
</ul>
<h:panelGrid columns="1" styleClass="actionbox" width="100%">
<h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
</h:panelGrid>
</h:form>
<br/>
<h:form>
<h:panelGrid columns="3" id="injectEditFieldsId" styleClass="actionbox"/>
<p>
<h:commandButton actionListener="#{entrySupport.saveAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.save']}"/>
<h:commandButton actionListener="#{entrySupport.cancelAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.cancel']}" />
</p>
</h:form>
</h:panelGroup>
</f:facet>
<f:facet name="listView" >
<h:panelGroup>
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
<p>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.listDescription]}" escape="false">
<f:param value="#{entrySupport.vascEntry.name}" />
</h:outputFormat>
</p>
<h:form>
<p>
<h:commandButton actionListener="#{entrySupport.addAction}"
rendered="#{entrySupport.vascEntry.vascAdminCreate}"
value="#{entrySupport.i18nMap['vasc.action.addRowAction.name']}"
title="#{entrySupport.i18nMap['vasc.action.addRowAction.description']}"
/>
<h:commandButton actionListener="#{entrySupport.backAction}"
rendered="#{entrySupport.renderBackAction}"
value="#{entrySupport.i18nMap['generic.vasc.jsf.action.back']}"
/>
</p>
</h:form>
<h:form>
<rich:dataTable id="injectTableColumnsId" var="tableRecord" value="#{entrySupport.tableDataModel}" rowClasses="odd,even">
<f:facet name="header">
<rich:columnGroup>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left">
<ul class="actionboxtab">
<li>
<h:panelGroup rendered="#{!entrySupport.renderBackAction}">
<a class="active"><h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.listOption.header']}"/></a>
</h:panelGroup>
<h:commandLink actionListener="#{entrySupport.backEditAction}" value="#{entrySupport.i18nMap['vasc.action.editRowAction.name']}" rendered="#{entrySupport.renderBackEditAction}"/>
</li>
<ui:repeat var="link" value="#{entrySupport.vascLinkEntriesEditTabParentState}">
<li><h:commandLink actionListener="#{entrySupport.linkListAction}" value="#{entrySupport.i18nMap[link.name]}" type="#{link.id}" styleClass="#{link.vascEntryId==entrySupport.vascEntry.id?'active':''}"/></li>
</ui:repeat>
</ul>
<h:panelGrid columns="1" styleClass="actionbox" width="100%">
<h:panelGrid columns="2" id="injectTableOptionsId"/>
<h:panelGroup>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.listOption.search']}"/>
<h:inputText value="#{entrySupport.searchString}"/>
<h:commandButton actionListener="#{entrySupport.searchAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.listOption.sumbit']}"/>
</h:panelGroup>
</h:panelGrid>
</rich:column>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakBefore="true">
<ul class="paging">
<li class="paging_atstart">
<h:commandLink rendered="#{entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}"
actionListener="#{entrySupport.pagePreviousAction}"/>
<h:outputText rendered="#{!entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}" />
</li>
<ui:repeat var="page" value="#{entrySupport.tablePagesDataModel}" rendered="#{!entrySupport.hasExtendedPageMode}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
<h:panelGroup rendered="#{entrySupport.hasExtendedPageMode}">
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedBegin}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
<h:panelGroup rendered="#{entrySupport.hasExtendedPageModeCenter}">
<li><span class="text">...</span></li>
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedCenter}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
</h:panelGroup>
<li><span class="text">...</span></li>
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedEnd}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
</h:panelGroup>
<li class="paging_atend">
<h:commandLink rendered="#{entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}"
actionListener="#{entrySupport.pageNextAction}"/>
<h:outputText rendered="#{!entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}" />
</li>
</ul>
</rich:column>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakBefore="true">
<h:panelGroup styleClass="table_options_top">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.rows']}" />
<h:inputText required="false" value="#{entrySupport.vascEntry.vascFrontendData.vascEntryState.vascBackendState.pageSize}" size="4"/>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.pagerDirect']}" />
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedDirectPage}" valueChangeListener="#{entrySupport.processDirectPageChange}">
<f:selectItems value="#{entrySupport.directPageItems}" />
</h:selectOneMenu>
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_download.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.download.img']}" width="15" height="15" /><h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.downloadDirect']}" />
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedExporterAction}" valueChangeListener="#{entrySupport.processDirectDownloadChange}">
<f:selectItems value="#{entrySupport.globalExportItems}" />
</h:selectOneMenu>
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_print.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.printer.img']}" width="15" height="15" /><h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:outputFormat value="#{entrySupport.i18nMap['generic.vasc.jsf.table.resultText']}">
<f:param value="#{entrySupport.pageStartCount}" />
<f:param value="#{entrySupport.pageStopCount}" />
<f:param value="#{entrySupport.pageTotalRecordCount}" />
</h:outputFormat>
</h:panelGroup>
</rich:column>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakBefore="true" rendered="#{entrySupport.hasMultiRowActions}">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.multiAction.selectAll']}"/>
<h:selectBooleanCheckbox id="selectAllBox" required="false" onchange="javascript:selectAllCheckboxes(this);return false;" value="#{entrySupport.selectAllValue}"/>
<h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:selectOneMenu id="multiAction" required="false" value="#{entrySupport.selectedMultiRowAction}" onchange="javascript:this.form.submit(); return false;" valueChangeListener="#{entrySupport.processMultiRowActionChange}">
<f:selectItems value="#{entrySupport.multiRowActionItems}" />
</h:selectOneMenu>
</rich:column>
<rich:column colspan="#{entrySupport.totalFieldColumnCount}" breakBefore="true">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.tableHeader.fields']}" styleClass="table_sub_header"/>
</rich:column>
<rich:column colspan="#{entrySupport.totalLinkColumnCount}" rendered="#{entrySupport.totalLinkColumnCount != 0}">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.tableHeader.links']}" styleClass="table_sub_header"/>
</rich:column>
<rich:column colspan="#{entrySupport.totalActionColumnCount}" rendered="#{entrySupport.totalActionColumnCount != 0}">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.tableHeader.actions']}" styleClass="table_sub_header"/>
</rich:column>
</rich:columnGroup>
</f:facet>
<f:facet name="footer">
<rich:columnGroup>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left">
<h:panelGroup styleClass="table_options_bottom">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.rows']}" />
<h:inputText required="false" value="#{entrySupport.vascEntry.vascFrontendData.vascEntryState.vascBackendState.pageSize}" size="4"/>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.pagerDirect']}" />
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedDirectPage}" valueChangeListener="#{entrySupport.processDirectPageChange}">
<f:selectItems value="#{entrySupport.directPageItems}" />
</h:selectOneMenu>
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_download.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.download.img']}" width="15" height="15" /><h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.downloadDirect']}" />
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedExporterAction}" valueChangeListener="#{entrySupport.processDirectDownloadChange}">
<f:selectItems value="#{entrySupport.globalExportItems}" />
</h:selectOneMenu>
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_print.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.printer.img']}" width="15" height="15" /><h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:outputFormat value="#{entrySupport.i18nMap['generic.vasc.jsf.table.resultText']}">
<f:param value="#{entrySupport.pageStartCount}" />
<f:param value="#{entrySupport.pageStopCount}" />
<f:param value="#{entrySupport.pageTotalRecordCount}" />
</h:outputFormat>
</h:panelGroup>
</rich:column>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakBefore="true">
<ul class="paging">
<li class="paging_atstart">
<h:commandLink rendered="#{entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}"
actionListener="#{entrySupport.pagePreviousAction}"/>
<h:outputText rendered="#{!entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}" />
</li>
<ui:repeat var="page" value="#{entrySupport.tablePagesDataModel}" rendered="#{!entrySupport.hasExtendedPageMode}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
<h:panelGroup rendered="#{entrySupport.hasExtendedPageMode}">
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedBegin}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
<h:panelGroup rendered="#{entrySupport.hasExtendedPageModeCenter}">
<li><span class="text">...</span></li>
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedCenter}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
</h:panelGroup>
<li><span class="text">...</span></li>
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedEnd}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
</h:panelGroup>
<li class="paging_atend">
<h:commandLink rendered="#{entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}"
actionListener="#{entrySupport.pageNextAction}"/>
<h:outputText rendered="#{!entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}" />
</li>
</ul>
</rich:column>
</rich:columnGroup>
</f:facet>
</rich:dataTable>
</h:form>
<h:form>
<p>
<h:commandButton actionListener="#{entrySupport.addAction}"
rendered="#{entrySupport.vascEntry.vascAdminCreate}"
value="#{entrySupport.i18nMap['vasc.action.addRowAction.name']}"
title="#{entrySupport.i18nMap['vasc.action.addRowAction.description']}"/>
</p>
</h:form>
</h:panelGroup>
</f:facet>
</v:vascEntry>
</ui:define>
</ui:composition>
</html>

View file

@ -0,0 +1,10 @@
<ui:composition template="/jsp/includes/layout.xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<ui:define name="title">
<h:outputText value="#{wikiPageController.wikiTitle}" />
</ui:define>
<ui:define name="content">
<h:outputText value="#{wikiPageController.wikiContent}" escape="false"/>
</ui:define>
</ui:composition>

View file

@ -0,0 +1,20 @@
<ui:composition template="/jsp/includes/layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<ui:define name="title">Index</ui:define>
<ui:define name="content">
<h:outputText value="Test etsdfjs "/>
<!--
<h:panelGroup rendered="#{userController.userLoggedin == false}">
<ui:include src="/jsp/includes/index-public.xhtml"/>
</h:panelGroup>
<h:panelGroup rendered="#{userController.userLoggedin == true}">
<ui:include src="/jsp/includes/index-user.xhtml"/>
</h:panelGroup
-->
</ui:define>
</ui:composition>

View file

@ -0,0 +1,2 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:redirect url="jsp/index.jsf"/>

View file

@ -0,0 +1,11 @@
<ui:composition template="/jsp/includes/layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<ui:define name="title">Error</ui:define>
<ui:define name="content">
<h:outputText value="Could not login" />
</ui:define>
</ui:composition>

View file

@ -0,0 +1,11 @@
<ui:composition template="/jsp/includes/layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<ui:define name="title">Forgot</ui:define>
<ui:define name="content">
<h:outputText value="Could forgot my login, send it to me" />
</ui:define>
</ui:composition>

View file

@ -0,0 +1,23 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/jsp/includes/layout.xhtml">
<ui:define name="title">Login</ui:define>
<ui:define name="content">
<form method="post" action="j_security_check">
<h:panelGrid columns="2">
<h:column><h:outputText value="Username:" /></h:column>
<h:column><input type="text" name="j_username"/></h:column>
<h:column><h:outputText value="Password:" /></h:column>
<h:column><input type="password" name="j_password"/></h:column>
</h:panelGrid>
<input type="submit" value="Login"/>
</form>
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/jsp/login/login-forgot.jsf">
<h:outputText value="Forgot my login." />
</h:outputLink>
</ui:define>
</ui:composition>
</html>

View file

@ -0,0 +1,11 @@
<ui:composition template="/jsp/includes/layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<ui:define name="title">Logout</ui:define>
<ui:define name="content">
<h:outputText value="Succesfully logged out." />
</ui:define>
</ui:composition>

View file

@ -0,0 +1,56 @@
<ui:composition template="/jsp/includes/layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
>
<ui:define name="title">Realtime Logs</ui:define>
<ui:define name="content">
<a4j:region>
<h:form>
<a4j:poll id="poll" interval="4000" enabled="#{realTimeController.pollEnabled}" reRender="poll,messageLog"/>
</h:form>
</a4j:region>
<h:form>
<h:panelGrid columns="1" id="grid" width="100%">
<h:outputText value="Realtime processed data event log"/>
<rich:separator lineType="none" height="10px"/>
<rich:separator lineType="solid" height="1px"/>
<h:panelGroup>
<h:outputText value="Polling active:"/>
<h:selectBooleanCheckbox value="#{realTimeController.pollEnabled}" required="false" onchange="javascript:this.form.submit(); return false;"/>
<h:outputText value="Reversed tail:"/>
<h:selectBooleanCheckbox value="#{realTimeController.reversedTail}" required="false" onchange="javascript:this.form.submit(); return false;"/>
<h:outputText value="LogHosts:"/>
<h:outputText value="LogLevel:"/>
<h:outputText value="Message regex:"/>
<h:inputText value="#{realTimeController.filterRegex}" required="false"/>
<h:outputText value="Area rows:"/>
<h:selectOneMenu value="#{realTimeController.messageRows}" onchange="javascript:this.form.submit(); return false;">
<f:selectItems value="#{realTimeController.messageRowsSelectItems}"/>
</h:selectOneMenu>
<h:outputText value="cols:"/>
<h:selectOneMenu value="#{realTimeController.messageCols}" onchange="javascript:this.form.submit(); return false;">
<f:selectItems value="#{realTimeController.messageColsSelectItems}"/>
</h:selectOneMenu>
</h:panelGroup>
<h:inputTextarea
id="messageLog"
style="font-size:10px;"
rows="#{realTimeController.messageRows}" cols="#{realTimeController.messageCols}"
enabled="false"
value="#{realTimeController.messageLogData}"
/>
</h:panelGrid>
</h:form>
</ui:define>
</ui:composition>

View file

@ -0,0 +1,10 @@
<ui:composition template="/jsp/includes/layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<ui:define name="title">Reports</ui:define>
<ui:define name="content"><h:outputText value="The report page"/></ui:define>
</ui:composition>

View file

@ -5,9 +5,7 @@
<groupId>net.forwardfire.vasc</groupId> <groupId>net.forwardfire.vasc</groupId>
<version>0.3.5-SNAPSHOT</version> <version>0.3.5-SNAPSHOT</version>
</parent> </parent>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-swing</artifactId> <artifactId>vasc-frontend-swing</artifactId>
<version>0.3.5-SNAPSHOT</version>
<name>vasc-frontend-swing</name> <name>vasc-frontend-swing</name>
<description>vasc-frontend-swing</description> <description>vasc-frontend-swing</description>
<dependencies> <dependencies>

View file

@ -23,10 +23,13 @@
package net.forwardfire.vasc.frontends.swing; package net.forwardfire.vasc.frontends.swing;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -74,17 +77,21 @@ public class SwingVascEditDialog extends JPanel {
add(createBody(), BorderLayout.CENTER); add(createBody(), BorderLayout.CENTER);
add(createFooter(), BorderLayout.SOUTH); add(createFooter(), BorderLayout.SOUTH);
editView.setLayout(new FlowLayout(FlowLayout.LEFT));
editView.add(this); editView.add(this);
} }
protected JPanel createHeader() { protected JPanel createHeader() {
JPanel header = new JPanel(); JPanel header = new JPanel();
header.setLayout(new BoxLayout(header,BoxLayout.PAGE_AXIS));
JLabel l = new JLabel(); JLabel l = new JLabel();
l.setText(swingFrontend.i18n(headerText,headerTextValue)); l.setText(swingFrontend.i18n(headerText,headerTextValue));
l.setFont(new Font(null,Font.BOLD, 14)); l.setFont(new Font(null,Font.BOLD, 14));
//l.setToolTipText(i18n(headerText)); //l.setToolTipText(i18n(headerText));
header.add(l); header.add(l);
JPanel b = new JPanel();
b.setLayout(new SpringLayout());
for (final VascLinkEntry vle:entry.getVascLinkEntries()) { for (final VascLinkEntry vle:entry.getVascLinkEntries()) {
JButton but = new JButton(vle.getName()); JButton but = new JButton(vle.getName());
but.addActionListener(new ActionListener() { but.addActionListener(new ActionListener() {
@ -99,20 +106,20 @@ public class SwingVascEditDialog extends JPanel {
Object selected = bean; Object selected = bean;
for (String parameterName:vle.getEntryParameterFieldIdKeys()) { for (String parameterName:vle.getEntryParameterFieldIdKeys()) {
String fieldId = vle.getEntryParameterFieldId(parameterName); String fieldId = vle.getEntryParameterFieldId(parameterName);
VascEntryField v = ee.getVascEntryFieldById(fieldId); VascEntryField v = entry.getVascEntryFieldById(fieldId);
if (v==null) { if (v==null) {
System.out.println("Could nog get VascEntryField for fieldID: "+fieldId); //System.out.println("Could not get VascEntryField for fieldID: "+fieldId);
continue; continue;
} }
if (v.getVascEntryFieldValue()==null) { if (v.getVascEntryFieldValue()==null) {
System.out.println("Could not get VascEntryFieldValue for fieldID: "+fieldId); //System.out.println("Could not get VascEntryFieldValue for fieldID: "+fieldId);
continue; continue;
} }
Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected); Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
// set data parameter on new vasc entry // set data parameter on new vasc entry
ee.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue); ee.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue);
System.out.println("Setting link parameter: "+parameterName+" with: "+selectedValue); //System.out.println("Setting link parameter: "+parameterName+" with: "+selectedValue);
} }
for (String fieldId:vle.getEntryCreateFieldValueKeys()) { for (String fieldId:vle.getEntryCreateFieldValueKeys()) {
@ -138,8 +145,10 @@ public class SwingVascEditDialog extends JPanel {
} }
} }
}); });
header.add(but); b.add(but);
} }
SpringUtilities.makeCompactGrid(b, b.getComponentCount(),1, 6,6, 6,6);
header.add(b);
return header; return header;
} }

View file

@ -74,6 +74,7 @@ import net.forwardfire.vasc.frontend.VascFrontendData;
import net.forwardfire.vasc.frontends.swing.ui.SwingBoolean; import net.forwardfire.vasc.frontends.swing.ui.SwingBoolean;
import net.forwardfire.vasc.frontends.swing.ui.SwingButton; import net.forwardfire.vasc.frontends.swing.ui.SwingButton;
import net.forwardfire.vasc.frontends.swing.ui.SwingColorChooser; import net.forwardfire.vasc.frontends.swing.ui.SwingColorChooser;
import net.forwardfire.vasc.frontends.swing.ui.SwingDate;
import net.forwardfire.vasc.frontends.swing.ui.SwingLabel; import net.forwardfire.vasc.frontends.swing.ui.SwingLabel;
import net.forwardfire.vasc.frontends.swing.ui.SwingList; import net.forwardfire.vasc.frontends.swing.ui.SwingList;
import net.forwardfire.vasc.frontends.swing.ui.SwingText; import net.forwardfire.vasc.frontends.swing.ui.SwingText;
@ -121,7 +122,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
// optional UI components // optional UI components
vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwingBoolean.class.getName()); vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwingBoolean.class.getName());
//vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwingDate.class.getName()); vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwingDate.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwingTextArea.class.getName()); vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwingTextArea.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_COLOR, SwingColorChooser.class.getName()); vfd.putVascUIComponent(VascUIComponent.VASC_COLOR, SwingColorChooser.class.getName());
} }

View file

@ -36,10 +36,8 @@ import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.ui.VascUIComponent; import net.forwardfire.vasc.core.ui.VascUIComponent;
import net.forwardfire.vasc.core.ui.VascValueModel; import net.forwardfire.vasc.core.ui.VascValueModel;
import com.michaelbaranov.microba.calendar.DatePicker; import com.michaelbaranov.microba.calendar.DatePicker;
/** /**
* *
* *
@ -53,6 +51,7 @@ public class SwingDate implements VascUIComponent {
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
datePicker = new DatePicker(); datePicker = new DatePicker();
orgBackgroundColor = datePicker.getBackground(); orgBackgroundColor = datePicker.getBackground();
try { try {
datePicker.setDate((Date)model.getValue()); datePicker.setDate((Date)model.getValue());

View file

@ -50,6 +50,10 @@ public class SwingText implements VascUIComponent {
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
textField = new JTextField(); textField = new JTextField();
Integer sizeEdit = entryField.getSizeEdit();
if (sizeEdit!=null) {
textField.setColumns(sizeEdit);
}
orgBackgroundColor = textField.getBackground(); orgBackgroundColor = textField.getBackground();
textField.setText(""+model.getValue()); textField.setText(""+model.getValue());
((JComponent)gui).add(textField); ((JComponent)gui).add(textField);

View file

@ -26,7 +26,9 @@ import java.awt.Color;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
@ -36,9 +38,6 @@ import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.ui.VascUIComponent; import net.forwardfire.vasc.core.ui.VascUIComponent;
import net.forwardfire.vasc.core.ui.VascValueModel; import net.forwardfire.vasc.core.ui.VascValueModel;
/** /**
* *
* @author Willem Cazander * @author Willem Cazander
@ -50,20 +49,33 @@ public class SwingTextArea implements VascUIComponent {
private Color orgBackgroundColor = null; private Color orgBackgroundColor = null;
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
textArea = new JTextArea(); int colsNum = 40;
int rowsNum = 8;
String cols = entryField.getVascEntryFieldType().getProperty("editor.columns");
if (cols!=null && cols.isEmpty()==false) {
colsNum = new Integer(cols);
}
String rows = entryField.getVascEntryFieldType().getProperty("editor.rows");
if (rows!=null && rows.isEmpty()==false) {
rowsNum = new Integer(rows);
}
textArea = new JTextArea(rowsNum,colsNum);
textArea.setBorder(BorderFactory.createEtchedBorder()); textArea.setBorder(BorderFactory.createEtchedBorder());
textArea.setRows(8);
//entryField.getVascEntryFieldType().getProperty(name)
//textArea.setRows(rows);
//textArea.setColumns(columns);
orgBackgroundColor = textArea.getBackground(); orgBackgroundColor = textArea.getBackground();
textArea.setText(""+model.getValue()); textArea.setText(""+model.getValue());
((JComponent)gui).add(textArea);
textArea.getDocument().addDocumentListener(new TextAreaListener(model,entry,this)); textArea.getDocument().addDocumentListener(new TextAreaListener(model,entry,this));
return textArea;
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.getVerticalScrollBar().setUnitIncrement(10);
scrollPane.getHorizontalScrollBar().setUnitIncrement(10);
scrollPane.setSize(colsNum*10, rowsNum*20);
((JComponent)gui).add(scrollPane);
return scrollPane; /// TODO: mmm check return this object type
} }
/** /**

View file

@ -0,0 +1,28 @@
en.key.none=none
en.key.today=today
de.key.none=kein
de.key.today=heute
fr.key.none=non
fr.key.today=ajourd'hui
pt.key.none=limpar
pt.key.today=hoje
ru.key.none=\u043D\u0435\u0442
ru.key.today=\u0441\u0435\u0433\u043E\u0434\u043D\u044F
it.key.none=nessuno
it.key.today=oggi
nl.key.none=geen
nl.key.today=vandaag
es.key.none=ninguna
es.key.today=hoy
pl.key.none=\u017Caden
pl.key.today=dzisiaj
by.key.none=\u043Di\u0447\u043E\u0433\u0430
by.key.today=\u0441\u0451\u043D\u043D\u044F
da.key.none=ingen
da.key.today=i dag
ro.key.none=sterge
ro.key.today=azi
sv.key.none=inget
sv.key.today=idag

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

View file

@ -40,8 +40,8 @@ import net.forwardfire.vasc.impl.DefaultVascFactory;
*/ */
public abstract class AbstractJSFVascFacesControllerBase { public abstract class AbstractJSFVascFacesControllerBase {
abstract VascFrontendData getNewVascFrontendData(); abstract public VascFrontendData getNewVascFrontendData();
abstract VascController getVascController(); abstract public VascController getVascController();
public void setVascController(VascController vascController) { public void setVascController(VascController vascController) {
} }

View file

@ -72,16 +72,17 @@ public class VascRequestFacesFilter implements Filter {
*/ */
public void init(FilterConfig config) throws ServletException { public void init(FilterConfig config) throws ServletException {
logger = Logger.getLogger(VascRequestFacesFilter.class.getName()); logger = Logger.getLogger(VascRequestFacesFilter.class.getName());
templateFile=config.getInitParameter("templateFile"); servletContext = config.getServletContext();
templateFile = config.getInitParameter("templateFile");
if (templateFile==null) { if (templateFile==null) {
throw new ServletException("No templateFile init-param found."); throw new ServletException("No templateFile init-param found.");
} }
resourceBundle=config.getInitParameter("resourceBundle"); resourceBundle=config.getInitParameter("resourceBundle");
if (resourceBundle==null) { if (resourceBundle==null) {
throw new ServletException("No resourceBundle init-param found."); return; //throw new ServletException("No resourceBundle init-param found.");
} }
ResourceBundle.getBundle(resourceBundle); // test if it loads ResourceBundle.getBundle(resourceBundle); // test if it loads
servletContext=config.getServletContext();
} }
/** /**
@ -161,9 +162,13 @@ public class VascRequestFacesFilter implements Filter {
locale = new Locale("nl"); locale = new Locale("nl");
} }
try { try {
if (resourceBundle!=null) {
ResourceBundle i18n = ResourceBundle.getBundle(resourceBundle,locale); ResourceBundle i18n = ResourceBundle.getBundle(resourceBundle,locale);
String titleI18n = i18n.getString("vasc.entry."+entityName+".name"); String titleI18n = i18n.getString("vasc.entry."+entityName+".name");
request.setAttribute("requestScopeVascEntityNameI18n" ,titleI18n); request.setAttribute("requestScopeVascEntityNameI18n" ,titleI18n);
} else {
request.setAttribute("requestScopeVascEntityNameI18n" ,entityName);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
request.setAttribute("requestScopeVascEntityNameI18n" ,entityName); request.setAttribute("requestScopeVascEntityNameI18n" ,entityName);

View file

@ -71,6 +71,7 @@ public class TestModelData {
field = new DefaultVascEntryField(); field = new DefaultVascEntryField();
field.setId("description"); field.setId("description");
field.setVascEntryFieldType(vc.getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextAreaField"));
ve.addVascEntryField(field); ve.addVascEntryField(field);
field = new DefaultVascEntryField(); field = new DefaultVascEntryField();