made first demo almost fully working
This commit is contained in:
parent
2a0d992642
commit
01b3b5cc54
104 changed files with 3259 additions and 2181 deletions
|
|
@ -170,11 +170,7 @@
|
|||
<exclusion>
|
||||
<artifactId>myfaces-impl</artifactId>
|
||||
<groupId>org.apache.myfaces.core</groupId>
|
||||
</exclusion><!--
|
||||
<exclusion>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<groupId>org.apache.openejb</groupId>
|
||||
</exclusion> -->
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
|
|
|||
|
|
@ -205,6 +205,7 @@ public class VascTechDemoStartup {
|
|||
serverConfigService.stop();
|
||||
tomcatService.stop();
|
||||
databaseService.stop();
|
||||
swingGuiService.stop();
|
||||
long stopTime = System.currentTimeMillis();
|
||||
logger.info("VascTechDemo shutdown in "+(stopTime-startTime)+" ms.");
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -28,22 +28,29 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sun.faces.application.ApplicationAssociate;
|
||||
import com.sun.faces.application.ApplicationResourceBundle;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryGroup;
|
||||
import net.forwardfire.vasc.core.VascEventChannelControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEventControllerListener;
|
||||
import net.forwardfire.vasc.core.VascEventControllerType;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle;
|
||||
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
|
||||
|
||||
/**
|
||||
|
|
@ -127,6 +134,10 @@ public class VascControllerService {
|
|||
VascEntry ve = vascController.getVascEntryController().getVascEntryById(veId);
|
||||
keys.putAll(checker.generateMissingKeys(ve));
|
||||
}
|
||||
for (String groupId:vascController.getVascEntryController().getVascEntryGroupIds()) {
|
||||
VascEntryGroup veg = vascController.getVascEntryController().getVascEntryGroupById(groupId);
|
||||
keys.putAll(checker.generateMissingKeys(veg));
|
||||
}
|
||||
if (keys.isEmpty()==false) {
|
||||
Properties p = new Properties();
|
||||
File dataDir = new File("data");
|
||||
|
|
@ -150,6 +161,21 @@ public class VascControllerService {
|
|||
writePropertiesFile(p,resourceFile);
|
||||
|
||||
ResourceBundle.clearCache();
|
||||
|
||||
//ApplicationResourceBundle appBundle = ApplicationAssociate.getCurrentInstance().getResourceBundles().get(RootApplicationBundle.class.getName());
|
||||
//Map<Locale, ResourceBundle> resources = getFieldValue(appBundle, "resources");
|
||||
//resources.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T getFieldValue(Object object, String fieldName) {
|
||||
try {
|
||||
Field field = object.getClass().getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
return (T) field.get(object);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ import java.util.jar.JarEntry;
|
|||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.ejb.embeddable.EJBContainer;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
import org.apache.catalina.Container;
|
||||
|
|
|
|||
|
|
@ -22,23 +22,12 @@
|
|||
|
||||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
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 java.util.logging.SimpleFormatter;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
|
@ -52,25 +41,19 @@ import javax.swing.SwingUtilities;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class JConsolePanel extends JPanel implements ActionListener {
|
||||
public class JConsolePanel extends JPanel {
|
||||
|
||||
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);
|
||||
|
||||
setLayout(new SpringLayout());
|
||||
setBorder(new JFireBorder("Console Log",this));
|
||||
add(createEditor());
|
||||
SpringLayoutGrid.makeCompactGrid(this, 1, 1, 6, 6, 6, 6);
|
||||
|
||||
Logger rootLogger = Logger.getAnonymousLogger();
|
||||
while (rootLogger.getParent()!=null) {
|
||||
rootLogger = rootLogger.getParent();
|
||||
|
|
@ -93,53 +76,14 @@ public class JConsolePanel extends JPanel implements ActionListener {
|
|||
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);
|
||||
private JComponent createEditor() {
|
||||
logTextArea = new JTextArea(6, 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
|
||||
}
|
||||
}
|
||||
}
|
||||
JScrollPane scrollPane = new JScrollPane(logTextArea);
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
return scrollPane;
|
||||
}
|
||||
|
||||
class UILogHandler extends Handler {
|
||||
|
|
@ -169,9 +113,7 @@ public class JConsolePanel extends JPanel implements ActionListener {
|
|||
String tt = t.substring(l,t.length());
|
||||
logTextArea.setText(tt);
|
||||
}
|
||||
if (autoScrollBox.isSelected()) {
|
||||
logTextArea.setCaretPosition(logTextArea.getText().length());
|
||||
}
|
||||
logTextArea.setCaretPosition(logTextArea.getText().length());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,148 @@
|
|||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
/**
|
||||
* JFireBorder
|
||||
*
|
||||
* @author Willem Cazander
|
||||
*/
|
||||
public class JFireBorder implements Border,MouseListener {
|
||||
|
||||
private int radius;
|
||||
boolean entered = false;
|
||||
private JComponent comp = null;
|
||||
private String title;
|
||||
static private JFireBorder lastFireBorder = null;
|
||||
private GradientPaint gradientNormal = null;
|
||||
private GradientPaint gradientEntered = null;
|
||||
private int gradientWidth = 0;
|
||||
|
||||
public JFireBorder(String title,JComponent comp) {
|
||||
this.radius = 10;
|
||||
this.comp=comp;
|
||||
this.title = title;
|
||||
comp.addMouseListener(this);
|
||||
}
|
||||
|
||||
public Insets getBorderInsets(Component c) {
|
||||
return new Insets(getTitleHeight(c)+1, 1, radius-2, 1);
|
||||
}
|
||||
|
||||
public boolean isBorderOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
int titleHeight = getTitleHeight(c);
|
||||
|
||||
if (gradientWidth!=width) {
|
||||
gradientNormal = null;
|
||||
gradientEntered = null;
|
||||
}
|
||||
gradientWidth = width;
|
||||
|
||||
Color endColor = UIManager.getColor("control");
|
||||
if (endColor==null) {
|
||||
endColor = c.getBackground();
|
||||
}
|
||||
Color startColor = UIManager.getColor("nimbusBorder");
|
||||
if (startColor==null) {
|
||||
startColor = c.getForeground();
|
||||
}
|
||||
|
||||
//BufferedImage titleImage = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(width, height, Transparency.TRANSLUCENT);
|
||||
if (gradientNormal==null) {
|
||||
gradientNormal = new GradientPaint(
|
||||
0, 0, startColor,
|
||||
titleHeight*5, width/3,endColor,
|
||||
false);
|
||||
}
|
||||
if (gradientEntered==null) {
|
||||
startColor = UIManager.getColor("nimbusFocus");
|
||||
if (startColor==null) {
|
||||
startColor = c.getForeground();
|
||||
}
|
||||
gradientEntered = new GradientPaint(
|
||||
0, 0, startColor,
|
||||
titleHeight*5, width/3,endColor,
|
||||
false);
|
||||
}
|
||||
if (entered) {
|
||||
g2.setPaint(gradientEntered);
|
||||
} else {
|
||||
g2.setPaint(gradientNormal);
|
||||
}
|
||||
g2.fillRoundRect(x, y, width, titleHeight, radius, radius);
|
||||
g2.fillRect(x,titleHeight/2,radius+1, titleHeight/2);
|
||||
g2.drawRoundRect(x,y,width-1,height-1,radius,radius);
|
||||
|
||||
if (title==null) {
|
||||
return;
|
||||
}
|
||||
Font font = UIManager.getFont("TitledBorder.font");
|
||||
g2.setColor(c.getForeground());
|
||||
FontMetrics metrics = c.getFontMetrics(font);
|
||||
g2.setFont(font);
|
||||
g2.drawString(title,x+8,y+(titleHeight-metrics.getHeight())/2 +metrics.getAscent());
|
||||
}
|
||||
|
||||
protected int getTitleHeight(Component c) {
|
||||
Font font = UIManager.getFont("TitledBorder.font");
|
||||
FontMetrics metrics = c.getFontMetrics(font);
|
||||
return (int)(metrics.getHeight() * 1.40);
|
||||
}
|
||||
|
||||
public GradientPaint getGradient() {
|
||||
if (entered) {
|
||||
return gradientEntered;
|
||||
} else {
|
||||
return gradientNormal;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (entered==true && lastFireBorder==this) {
|
||||
return;
|
||||
}
|
||||
entered = true;
|
||||
if (comp!=null) {
|
||||
comp.repaint();
|
||||
if (lastFireBorder!=null) {
|
||||
lastFireBorder.entered = false;
|
||||
lastFireBorder.comp.repaint();
|
||||
}
|
||||
lastFireBorder = this;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
|
||||
public class JStartupPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = -2880272130103870144L;
|
||||
private JProgressBar bar = null;
|
||||
|
||||
public JStartupPanel() {
|
||||
|
||||
JLabel label = new JLabel("Starting up....");
|
||||
add(label);
|
||||
|
||||
bar = new JProgressBar();
|
||||
add(bar);
|
||||
}
|
||||
}
|
||||
|
|
@ -22,262 +22,295 @@
|
|||
|
||||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.Serializable;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.ThreadInfo;
|
||||
import java.lang.management.ThreadMXBean;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
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 javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.catalina.Server;
|
||||
import org.apache.catalina.Service;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.core.service.VascControllerService;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
|
||||
import net.forwardfire.vasc.demo.server.ui.load.JLoadDialog;
|
||||
import net.forwardfire.vasc.demo.server.ui.load.JLoadDialog.LoadType;
|
||||
|
||||
/**
|
||||
* JMainPanel is the main panel/window of this demo.
|
||||
* JStatusPanel is the main panel/window of this demo.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class JStatusPanel extends JPanel {
|
||||
public class JStatusPanel extends JPanel implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = 5834715323973411147L;
|
||||
private VascControllerService vascManager = null;
|
||||
private SwingPanelIntegration spi = null;
|
||||
private JTabbedPane tabPane = null;
|
||||
private JTree vascTree = null;
|
||||
private JSplitPane bottomSplitPane = null;
|
||||
private JSplitPane treeSplitPane = null;
|
||||
private JButton stopButton = null;
|
||||
private JButton playButton = null;
|
||||
private JButton shutdownButton = null;
|
||||
private JButton restartButton = null;
|
||||
private JButton importJdbcButton = null;
|
||||
private JButton importMongoButton = null;
|
||||
private JButton importDataFileButton = null;
|
||||
private JButton importDataPathButton = null;
|
||||
private JLabel infoStatus = null;
|
||||
private JLabel infoThreads = null;
|
||||
private JLabel infoWorkers = null;
|
||||
private JLabel infoSessions = null;
|
||||
private JLabel infoHttpPort = null;
|
||||
private JLabel infoVascGroups = null;
|
||||
private JLabel infoVascEntries = null;
|
||||
private JLabel infoVascBackends= null;
|
||||
|
||||
public JStatusPanel() {
|
||||
this.vascManager=VascTechDemoStartup.getInstance().getVascControllerService();
|
||||
setLayout(new BorderLayout());
|
||||
add(createBottomSplit(), BorderLayout.CENTER);
|
||||
public JStatusPanel() {
|
||||
setLayout(new SpringLayout());
|
||||
|
||||
JPanel main = new JPanel();
|
||||
main.setLayout(new SpringLayout());
|
||||
main.add(createPanelInfoServer());
|
||||
main.add(createPanelInfoVasc());
|
||||
main.add(createPanelAction());
|
||||
main.add(createPanelImport());
|
||||
SpringLayoutGrid.makeCompactGrid(main, 2,2,0,0,6,6);
|
||||
|
||||
JConsolePanel consolePanel = new JConsolePanel();
|
||||
add(main);
|
||||
add(consolePanel);
|
||||
SpringLayoutGrid.makeCompactGrid(this, 2,1,6,6,0,0);
|
||||
}
|
||||
|
||||
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(700);
|
||||
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;
|
||||
private JPanel createPanelInfoVasc() {
|
||||
JPanel statusPanel = new JPanel();
|
||||
statusPanel.setBorder(new JFireBorder("Info Vasc",statusPanel));
|
||||
statusPanel.setLayout(new SpringLayout());
|
||||
|
||||
infoVascGroups = new JLabel("0");
|
||||
infoVascEntries = new JLabel("0");
|
||||
infoVascBackends = new JLabel("0");
|
||||
|
||||
statusPanel.add(new JLabel("Artifact:"));
|
||||
statusPanel.add(new JLabel("vasc-demo-server-core"));
|
||||
|
||||
statusPanel.add(new JLabel("Version:"));
|
||||
statusPanel.add(new JLabel("0.X.X"));
|
||||
|
||||
statusPanel.add(new JLabel("Groups:"));
|
||||
statusPanel.add(infoVascGroups);
|
||||
|
||||
statusPanel.add(new JLabel("Entries:"));
|
||||
statusPanel.add(infoVascEntries);
|
||||
|
||||
statusPanel.add(new JLabel("Backends:"));
|
||||
statusPanel.add(infoVascBackends);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(statusPanel, 5, 2);
|
||||
return statusPanel;
|
||||
}
|
||||
|
||||
private JPanel createPanelInfoServer() {
|
||||
JPanel statusPanel = new JPanel();
|
||||
statusPanel.setBorder(new JFireBorder("Info Server",statusPanel));
|
||||
statusPanel.setLayout(new SpringLayout());
|
||||
|
||||
infoStatus = new JLabel("booting");
|
||||
infoThreads = new JLabel("0");
|
||||
infoWorkers = new JLabel("0");
|
||||
infoSessions = new JLabel("0");
|
||||
infoHttpPort = new JLabel("0");
|
||||
|
||||
statusPanel.add(new JLabel("Running:"));
|
||||
statusPanel.add(infoStatus);
|
||||
|
||||
statusPanel.add(new JLabel("HttpPort:"));
|
||||
statusPanel.add(infoHttpPort);
|
||||
|
||||
statusPanel.add(new JLabel("Threads:"));
|
||||
statusPanel.add(infoThreads);
|
||||
|
||||
statusPanel.add(new JLabel("Workers:"));
|
||||
statusPanel.add(infoWorkers);
|
||||
|
||||
statusPanel.add(new JLabel("Sessions:"));
|
||||
statusPanel.add(infoSessions);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(statusPanel, 5, 2);
|
||||
return statusPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTreeModelListener(TreeModelListener l) {
|
||||
super.addTreeModelListener(l);
|
||||
private JPanel createPanelImport() {
|
||||
JPanel statusPanel = new JPanel();
|
||||
statusPanel.setBorder(new JFireBorder("Import",statusPanel));
|
||||
statusPanel.setLayout(new SpringLayout());
|
||||
|
||||
importJdbcButton = new JButton("Jdbc");
|
||||
importMongoButton = new JButton("Mongo");
|
||||
importDataFileButton = new JButton("DataFile");
|
||||
importDataPathButton = new JButton("DataPath");
|
||||
|
||||
importJdbcButton.addActionListener(this);
|
||||
importMongoButton.addActionListener(this);
|
||||
importDataFileButton.addActionListener(this);
|
||||
importDataPathButton.addActionListener(this);
|
||||
|
||||
importJdbcButton.setEnabled(false);
|
||||
importMongoButton.setEnabled(false);
|
||||
importDataFileButton.setEnabled(false);
|
||||
importDataPathButton.setEnabled(false);
|
||||
|
||||
statusPanel.add(new JLabel("Import Jdbc:"));
|
||||
statusPanel.add(importJdbcButton);
|
||||
|
||||
statusPanel.add(new JLabel("Import Mongo:"));
|
||||
statusPanel.add(importMongoButton);
|
||||
|
||||
statusPanel.add(new JLabel("Import File:"));
|
||||
statusPanel.add(importDataFileButton);
|
||||
|
||||
statusPanel.add(new JLabel("Data Directory:"));
|
||||
statusPanel.add(importDataPathButton);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(statusPanel,2,4,6,6,0,0);
|
||||
return statusPanel;
|
||||
}
|
||||
|
||||
private JPanel createPanelAction() {
|
||||
JPanel actionPanel = new JPanel();
|
||||
actionPanel.setBorder(new JFireBorder("Actions",actionPanel));
|
||||
actionPanel.setLayout(new SpringLayout());
|
||||
|
||||
actionPanel.add(new JLabel("Catalina:"));
|
||||
|
||||
playButton = new JButton("Play");
|
||||
playButton.setEnabled(false);
|
||||
playButton.addActionListener(this);
|
||||
actionPanel.add(playButton);
|
||||
|
||||
stopButton = new JButton("Stop");
|
||||
stopButton.setEnabled(false);
|
||||
stopButton.addActionListener(this);
|
||||
actionPanel.add(stopButton);
|
||||
|
||||
actionPanel.add(new JLabel("Application:"));
|
||||
|
||||
restartButton = new JButton("Restart");
|
||||
restartButton.setEnabled(false);
|
||||
restartButton.addActionListener(this);
|
||||
actionPanel.add(restartButton);
|
||||
|
||||
shutdownButton = new JButton("Shutdown");
|
||||
shutdownButton.setEnabled(false);
|
||||
shutdownButton.addActionListener(this);
|
||||
actionPanel.add(shutdownButton);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(actionPanel,2,3,6,6,0,0);
|
||||
return actionPanel;
|
||||
}
|
||||
|
||||
public void startupDone() {
|
||||
infoStatus.setText("running");
|
||||
|
||||
//restartButton.setEnabled(true);
|
||||
shutdownButton.setEnabled(true);
|
||||
|
||||
importJdbcButton.setEnabled(true);
|
||||
importMongoButton.setEnabled(true);
|
||||
//importDataFileButton.setEnabled(true);
|
||||
//importDataPathButton.setEnabled(true);
|
||||
|
||||
updateInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource().equals(shutdownButton)) {
|
||||
VascTechDemoStartup.getInstance().shutdown();
|
||||
} else if (e.getSource().equals(importJdbcButton)) {
|
||||
JLoadDialog dialog = new JLoadDialog(ServerGuiApplication.getInstance().getMainFrame(),LoadType.JDBC);
|
||||
dialog.setVisible(true);
|
||||
} else if (e.getSource().equals(importMongoButton)) {
|
||||
JLoadDialog dialog = new JLoadDialog(ServerGuiApplication.getInstance().getMainFrame(),LoadType.MONGODB);
|
||||
dialog.setVisible(true);
|
||||
} else if (e.getSource().equals(importDataFileButton)) {
|
||||
JLoadDialog dialog = new JLoadDialog(ServerGuiApplication.getInstance().getMainFrame(),LoadType.JDBC);
|
||||
dialog.setVisible(true);
|
||||
} else if (e.getSource().equals(importDataPathButton)) {
|
||||
JLoadDialog dialog = new JLoadDialog(ServerGuiApplication.getInstance().getMainFrame(),LoadType.JDBC);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
private JScrollPane createTreePane() {
|
||||
public void updateInfo() {
|
||||
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.NONE,null));
|
||||
VascController vc = VascTechDemoStartup.getInstance().getVascControllerService().getVascController();
|
||||
if (vc==null) {
|
||||
return;
|
||||
}
|
||||
Server server = VascTechDemoStartup.getInstance().getTomcatService().getServer();
|
||||
if (server==null) {
|
||||
return; // still booting
|
||||
}
|
||||
Service service = server.findService("Catalina");
|
||||
if (service==null) {
|
||||
return;
|
||||
}
|
||||
Context demoContext = VascTechDemoStartup.getInstance().getTomcatService().getApplicationContext();
|
||||
|
||||
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) {
|
||||
VascEntryLocal ee = (VascEntryLocal)vascManager.getVascController().getVascEntryController().getVascEntryById(vascNode.id);
|
||||
vascManager.getVascController().getVascEntryConfigController().configVascFrontendController(vascManager.getVascController(), ee);
|
||||
spi.createNewVascView(ee);
|
||||
}
|
||||
}
|
||||
} catch (Exception ee) {
|
||||
ee.printStackTrace();
|
||||
infoVascGroups.setText(""+vc.getVascEntryController().getVascEntryGroupIds().size());
|
||||
infoVascEntries.setText(""+vc.getVascEntryController().getVascEntryIds().size());
|
||||
infoVascBackends.setText(""+vc.getVascBackendController().getVascBackendIds().size());
|
||||
|
||||
int httpPort = service.findConnectors()[0].getPort();
|
||||
infoHttpPort.setText(""+httpPort);
|
||||
infoThreads.setText(""+Thread.activeCount());
|
||||
|
||||
int sessions = 0;
|
||||
int workers = 0;
|
||||
|
||||
if (demoContext!=null) {
|
||||
sessions = demoContext.getManager().getActiveSessions();
|
||||
}
|
||||
|
||||
ThreadMXBean man = ManagementFactory.getThreadMXBean();
|
||||
ThreadInfo[] infos = man.getThreadInfo(man.getAllThreadIds());
|
||||
for (ThreadInfo info:infos) {
|
||||
if (info.getThreadName()!=null && info.getThreadName().startsWith("http")) {
|
||||
workers++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
infoWorkers.setText(""+workers);
|
||||
infoSessions.setText(""+sessions);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
||||
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();
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().openFile(file);
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.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 implements Serializable {
|
||||
private static final long serialVersionUID = -1177727401194030822L;
|
||||
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("VascFieldTypes");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void changeEvent() {
|
||||
rebuildTree();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,28 +23,32 @@
|
|||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.CheckboxMenuItem;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import java.awt.Menu;
|
||||
import java.awt.Font;
|
||||
import java.awt.MenuItem;
|
||||
import java.awt.PopupMenu;
|
||||
import java.awt.SystemTray;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.EventObject;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
import org.jdesktop.application.Application;
|
||||
import org.jdesktop.application.FrameView;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
import org.jdesktop.application.Application.ExitListener;
|
||||
|
||||
/**
|
||||
* SwingGuiService Shows the demo swing gui and vasc swing frontend.
|
||||
|
|
@ -54,77 +58,113 @@ import org.jdesktop.application.Application.ExitListener;
|
|||
*/
|
||||
public class ServerGuiApplication extends SingleFrameApplication {
|
||||
|
||||
private Logger logger = null;
|
||||
private JStatusPanel statusPanel = null;
|
||||
private ImageIcon serverIcon = null;
|
||||
|
||||
public ServerGuiApplication() {
|
||||
logger = Logger.getLogger(ServerGuiApplication.class.getName());
|
||||
}
|
||||
|
||||
protected void startup() {
|
||||
addExitListener(new ShutdownManager());
|
||||
installColorsLaF();
|
||||
addExitListener(new CloseWindowExitListener());
|
||||
serverIcon = createImageIcon("/net/forwardfire/vasc/demo/server/ui/resources/icon.png", "Vasc Icon");
|
||||
statusPanel = new JStatusPanel();
|
||||
FrameView mainView = getMainView();
|
||||
|
||||
mainView.setComponent(new JStartupPanel());
|
||||
mainView.getFrame().setMinimumSize(new Dimension(600,200));
|
||||
//mainView.getFrame().setResizable(false);
|
||||
mainView.setComponent(statusPanel);
|
||||
mainView.getFrame().setMinimumSize(new Dimension(640,480));
|
||||
mainView.getFrame().setMaximumSize(new Dimension(800,600));
|
||||
mainView.getFrame().addWindowListener(new UpdateInfoListener());
|
||||
|
||||
show(mainView);
|
||||
|
||||
startSystemTray();
|
||||
}
|
||||
|
||||
public void startupDone() {
|
||||
getMainFrame().setVisible(false);
|
||||
class UpdateInfoListener extends WindowAdapter {
|
||||
@Override
|
||||
public void windowActivated(WindowEvent e) {
|
||||
System.out.println("vis: opened -ac");
|
||||
statusPanel.updateInfo();
|
||||
}
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
System.out.println("vis: closed - ac");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CloseWindowExitListener implements ExitListener {
|
||||
@Override
|
||||
public boolean canExit(EventObject event) {
|
||||
if (event!=null && event.getSource().equals(ServerGuiApplication.this)) {
|
||||
return true;
|
||||
} else {
|
||||
ServerGuiApplication.getInstance().getMainFrame().setVisible(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void willExit(EventObject event) {
|
||||
}
|
||||
}
|
||||
|
||||
public void startupDone() {
|
||||
statusPanel.startupDone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop if requested from service
|
||||
*/
|
||||
public void stop() {
|
||||
exit();
|
||||
//shutdown();
|
||||
exit(new EventObject(this));
|
||||
}
|
||||
|
||||
public ImageIcon getServerIcon() {
|
||||
return serverIcon;
|
||||
}
|
||||
|
||||
static public ServerGuiApplication getInstance() {
|
||||
return getInstance(ServerGuiApplication.class);
|
||||
}
|
||||
|
||||
class ShutdownManager implements ExitListener {
|
||||
public boolean canExit(EventObject e) {
|
||||
return true;
|
||||
}
|
||||
public void willExit(EventObject event) {
|
||||
VascTechDemoStartup.getInstance().shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void startSystemTray() {
|
||||
if (!SystemTray.isSupported()) {
|
||||
return;
|
||||
}
|
||||
final PopupMenu popup = new PopupMenu();
|
||||
final TrayIcon trayIcon = new TrayIcon(createImage("/net/forwardfire/vasc/demo/server/ui/resources/tray-icon.png", "tray icon"));
|
||||
final TrayIcon trayIcon = new TrayIcon(createImageIcon("/net/forwardfire/vasc/demo/server/ui/resources/tray-icon.png", "tray icon").getImage());
|
||||
final SystemTray tray = SystemTray.getSystemTray();
|
||||
|
||||
MenuItem aboutItem = new MenuItem("About");
|
||||
MenuItem statusItem = new MenuItem("View Status");
|
||||
MenuItem logItem = new MenuItem("View Log");
|
||||
|
||||
|
||||
Menu displayMenu = new Menu("Launch");
|
||||
MenuItem errorItem = new MenuItem("Web client");
|
||||
MenuItem warningItem = new MenuItem("Swing client");
|
||||
MenuItem infoItem = new MenuItem("Swt client");
|
||||
MenuItem noneItem = new MenuItem("None");
|
||||
|
||||
aboutItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JOptionPane.showMessageDialog(ServerGuiApplication.getInstance().getMainFrame(), "Vasc Demo Tech Server:\nIs build to test and demo different parts of the vasc package.", "About Vasc Demo", JOptionPane.PLAIN_MESSAGE);
|
||||
}
|
||||
});
|
||||
MenuItem statusItem = new MenuItem("Open Status");
|
||||
statusItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getMainFrame().setVisible(true);
|
||||
}
|
||||
});
|
||||
MenuItem exitItem = new MenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
exit();
|
||||
VascTechDemoStartup.getInstance().shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
popup.add(aboutItem);
|
||||
popup.addSeparator();
|
||||
popup.add(statusItem);
|
||||
popup.add(logItem);
|
||||
popup.addSeparator();
|
||||
popup.add(displayMenu);
|
||||
displayMenu.add(errorItem);
|
||||
displayMenu.add(warningItem);
|
||||
displayMenu.add(infoItem);
|
||||
displayMenu.add(noneItem);
|
||||
|
||||
popup.add(exitItem);
|
||||
popup.addSeparator();
|
||||
popup.add(aboutItem);
|
||||
popup.add(statusItem);
|
||||
|
||||
trayIcon.setPopupMenu(popup);
|
||||
|
||||
|
|
@ -135,11 +175,45 @@ public class ServerGuiApplication extends SingleFrameApplication {
|
|||
}
|
||||
}
|
||||
|
||||
protected static Image createImage(String path, String description) {
|
||||
protected static ImageIcon createImageIcon(String path, String description) {
|
||||
URL imageURL = ServerGuiApplication.class.getResource(path);
|
||||
if (imageURL == null) {
|
||||
throw new NullPointerException("Could not find resource: "+path);
|
||||
}
|
||||
return (new ImageIcon(imageURL, description)).getImage();
|
||||
return new ImageIcon(imageURL, description);
|
||||
}
|
||||
|
||||
private String installColorsLaF() {
|
||||
UIManager.put("TabbedPane.font", Font.decode("SansSerif-BOLD-12"));
|
||||
UIManager.put("TitledBorder.font", Font.decode("SansSerif-BOLD-16"));
|
||||
UIManager.put("FireDial.font", Font.decode("SansSerif-9"));
|
||||
|
||||
String colorName = "laf-colors";
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl==null) {
|
||||
cl = this.getClass().getClassLoader();
|
||||
}
|
||||
InputStream in = cl.getResourceAsStream("net/forwardfire/vasc/demo/server/ui/resources/"+colorName+".properties");
|
||||
if (in==null) {
|
||||
logger.warning("Color schema not found: "+colorName);
|
||||
return "unknown";
|
||||
}
|
||||
try {
|
||||
Properties p = new Properties();
|
||||
p.load(in);
|
||||
for (Object key:p.keySet()) {
|
||||
String value = p.getProperty(key.toString());
|
||||
Color colorValue = Color.decode(value);
|
||||
UIManager.put(key,colorValue);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.warning("Could not load color schema: "+colorName+" error: "+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
return colorName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,241 @@
|
|||
/*
|
||||
* 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.server.ui.load;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Frame;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.eobjects.metamodel.jdbc.JdbcDataContext;
|
||||
import org.eobjects.metamodel.mongodb.MongoDbDataContext;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.ui.JFireBorder;
|
||||
import net.forwardfire.vasc.demo.server.ui.ServerGuiApplication;
|
||||
|
||||
/**
|
||||
* JLoadDialog mini wizzard for loading.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JLoadDialog extends JDialog implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JButton prev = null;
|
||||
private JButton next = null;
|
||||
private JButton cancel = null;
|
||||
private List<LoadStep> steps = null;
|
||||
private int currentStep = 0;
|
||||
private LoadStepData model = null;
|
||||
private JPanel centerPanel = null;
|
||||
private JLabel topLabel = null;
|
||||
|
||||
public enum LoadType {
|
||||
CSV,
|
||||
JDBC,
|
||||
MONGODB
|
||||
}
|
||||
|
||||
public JLoadDialog(Frame aFrame,LoadType type) {
|
||||
setTitle("Load Edit Data");
|
||||
setIconImage(ServerGuiApplication.getInstance().getServerIcon().getImage());
|
||||
setMinimumSize(new Dimension(640,400));
|
||||
setPreferredSize(new Dimension(640,400));
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent we) {
|
||||
clearAndHide();
|
||||
}
|
||||
});
|
||||
JPanel mainPanel = new JPanel();
|
||||
// mainPanel.setBorder();
|
||||
// mainPanel.setLayout(new SpringLayout());
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
mainPanel.add(createPanelTop(),BorderLayout.PAGE_START);
|
||||
|
||||
JPanel wrap = new JPanel();
|
||||
wrap.setLayout(new GridLayout(1,1));
|
||||
wrap.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
|
||||
centerPanel = new JPanel();
|
||||
//centerPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
centerPanel.setLayout(new GridLayout(1,1));
|
||||
centerPanel.setBorder(new JFireBorder(null,centerPanel));
|
||||
|
||||
wrap.add(centerPanel);
|
||||
mainPanel.add(wrap,BorderLayout.CENTER);
|
||||
|
||||
model = new LoadStepData();
|
||||
steps = new ArrayList<LoadStep>(10);
|
||||
|
||||
switch(type) {
|
||||
case CSV:
|
||||
break;
|
||||
case JDBC:
|
||||
steps.add(new JLoadStepMetaJdbc());
|
||||
break;
|
||||
case MONGODB:
|
||||
steps.add(new JLoadStepMetaMongodb());
|
||||
break;
|
||||
}
|
||||
steps.add(new JLoadStepSelectTables());
|
||||
steps.add(new JLoadStepMiscInfo());
|
||||
steps.add(new JLoadStepWriteFile());
|
||||
|
||||
centerPanel.add(steps.get(0).getPanel());
|
||||
|
||||
mainPanel.add(createPanelBottom(),BorderLayout.PAGE_END);
|
||||
//SpringLayoutGrid.makeCompactGrid(mainPanel, 3, 1,6,6,6,6);
|
||||
getContentPane().add(mainPanel);
|
||||
pack();
|
||||
setLocationRelativeTo(aFrame);
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
setVisible(false);
|
||||
|
||||
// clean up connection
|
||||
if (model.dc instanceof JdbcDataContext) {
|
||||
JdbcDataContext dc = (JdbcDataContext)model.dc;
|
||||
try {
|
||||
dc.getConnection().close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (model.dc instanceof MongoDbDataContext) {
|
||||
MongoDbDataContext dc = (MongoDbDataContext)model.dc;
|
||||
dc.getMongoDb().getMongo().close();
|
||||
}
|
||||
}
|
||||
|
||||
public JPanel createPanelTop() {
|
||||
JPanel top = new JPanel();
|
||||
top.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
top.setLayout(new GridLayout(1,1));
|
||||
JPanel wrap = new JPanel();
|
||||
wrap.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
wrap.setBorder(new JFireBorder("Load",top));
|
||||
topLabel = new JLabel("Load data to edit...");
|
||||
wrap.add(topLabel);
|
||||
top.add(wrap);
|
||||
return top;
|
||||
}
|
||||
|
||||
public JPanel createPanelBottom() {
|
||||
JPanel bottom = new JPanel();
|
||||
bottom.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
||||
|
||||
prev = new JButton("Prev");
|
||||
next = new JButton("Next");
|
||||
cancel = new JButton("Cancel");
|
||||
|
||||
prev.addActionListener(this);
|
||||
next.addActionListener(this);
|
||||
cancel.addActionListener(this);
|
||||
|
||||
prev.setEnabled(false);
|
||||
|
||||
bottom.add(prev);
|
||||
bottom.add(next);
|
||||
bottom.add(cancel);
|
||||
|
||||
return bottom;
|
||||
}
|
||||
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource().equals(prev)) {
|
||||
gotoStepPrev();
|
||||
} else if (e.getSource().equals(next)) {
|
||||
gotoStepNext();
|
||||
} if (e.getSource().equals(cancel)) {
|
||||
clearAndHide();
|
||||
}
|
||||
}
|
||||
|
||||
public void gotoStepPrev() {
|
||||
if (currentStep <= 0) {
|
||||
return;
|
||||
}
|
||||
currentStep--;
|
||||
centerPanel.removeAll();
|
||||
LoadStep step = steps.get(currentStep);
|
||||
centerPanel.add(step.getPanel());
|
||||
topLabel.setText(step.getStepTitle());
|
||||
step.setupStep(model);
|
||||
SwingUtilities.updateComponentTreeUI(centerPanel);
|
||||
if (currentStep==0) {
|
||||
prev.setEnabled(false);
|
||||
}
|
||||
next.setText("Next");
|
||||
}
|
||||
|
||||
public void gotoStepNext() {
|
||||
if (currentStep == steps.size()-1) {
|
||||
// perform last step
|
||||
LoadStep step = steps.get(currentStep);
|
||||
boolean result = step.performStep(model);
|
||||
if (result==false) {
|
||||
return;
|
||||
}
|
||||
clearAndHide();
|
||||
return;
|
||||
}
|
||||
if (currentStep > steps.size()-1) {
|
||||
return;
|
||||
}
|
||||
LoadStep step = steps.get(currentStep);
|
||||
boolean result = step.performStep(model);
|
||||
if (result==false) {
|
||||
return;
|
||||
}
|
||||
currentStep++;
|
||||
centerPanel.removeAll();
|
||||
step = steps.get(currentStep);
|
||||
centerPanel.add(step.getPanel());
|
||||
topLabel.setText(step.getStepTitle());
|
||||
step.setupStep(model);
|
||||
SwingUtilities.updateComponentTreeUI(centerPanel);
|
||||
if (currentStep==steps.size()-1) {
|
||||
next.setText("Finish");
|
||||
}
|
||||
prev.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,27 +20,23 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.ui.actions;
|
||||
package net.forwardfire.vasc.demo.server.ui.load;
|
||||
|
||||
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.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
/**
|
||||
* JDialogMetaCsv Add and runs MetaModel Schema Auto Entry code.
|
||||
|
|
@ -48,29 +44,21 @@ import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JDialogMetaCsv extends JDialog implements ActionListener {
|
||||
public class JLoadStepMetaCsv extends JPanel implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
|
||||
public JDialogMetaCsv(Frame aFrame) {
|
||||
setTitle("Add csv file");
|
||||
public JLoadStepMetaCsv(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);
|
||||
add(mainPanel);
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
|
|
@ -95,7 +83,7 @@ public class JDialogMetaCsv extends JDialog implements ActionListener {
|
|||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(file.getName());
|
||||
schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
}
|
||||
|
|
@ -20,28 +20,21 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.ui.actions;
|
||||
package net.forwardfire.vasc.demo.server.ui.load;
|
||||
|
||||
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.awt.FlowLayout;
|
||||
import java.sql.Connection;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import org.eobjects.metamodel.jdbc.JdbcDataContext;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
/**
|
||||
|
|
@ -50,7 +43,7 @@ import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
||||
public class JLoadStepMetaJdbc extends JPanel implements LoadStep {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JComboBox driverClassBox = null;
|
||||
|
|
@ -59,31 +52,19 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
|||
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 JLoadStepMetaJdbc() {
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
add(createPanelCenter());
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
setVisible(false);
|
||||
public String getStepTitle() {
|
||||
return "Connect to database.";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JPanel createPanelCenter() {
|
||||
JPanel result = new JPanel();
|
||||
result.setLayout(new SpringLayout());
|
||||
|
|
@ -105,32 +86,41 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
|||
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());
|
||||
String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(dbName);
|
||||
schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
result.add(new JLabel(""));
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 5, 2);
|
||||
SpringLayoutGrid.makeCompactGrid(result, 4, 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
public void setupStep(LoadStepData model) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
String url = connectUrlField.getText();
|
||||
MetaModelDataContextJdbc ds = new MetaModelDataContextJdbc();
|
||||
ds.setDriverClass((String)driverClassBox.getSelectedItem());
|
||||
ds.setConnectUrl(url);
|
||||
ds.setUsername(usernameField.getText());
|
||||
ds.setPassword(passwordField.getText());
|
||||
String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
|
||||
|
||||
try {
|
||||
Connection c = ds.getConnection();
|
||||
c.close();
|
||||
|
||||
if (model.dc instanceof JdbcDataContext) {
|
||||
JdbcDataContext dc = (JdbcDataContext)model.dc;
|
||||
dc.getConnection().close();
|
||||
}
|
||||
|
||||
model.dcProvider = ds;
|
||||
model.dc=ds.getDataContext();
|
||||
model.name=dbName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "Fatal connect error:\n"+e.getMessage(), "Jdbc Connect Error", JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,65 +20,49 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.ui.actions;
|
||||
package net.forwardfire.vasc.demo.server.ui.load;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.FlowLayout;
|
||||
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.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import org.eobjects.metamodel.mongodb.MongoDbDataContext;
|
||||
|
||||
import com.mongodb.DB;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
/**
|
||||
* JDialogMetaMongodb Add and runs MetaModel Schema Auto Entry code.
|
||||
* JLoadStepMetaMongodb Add and runs MetaModel Schema Auto Entry code.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JDialogMetaMongodb extends JDialog implements ActionListener {
|
||||
public class JLoadStepMetaMongodb extends JPanel implements LoadStep,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 JLoadStepMetaMongodb() {
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
add(createPanelCenter());
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
setVisible(false);
|
||||
public String getStepTitle() {
|
||||
return "Connect to mongodb.";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JPanel createPanelCenter() {
|
||||
|
|
@ -86,7 +70,7 @@ public class JDialogMetaMongodb extends JDialog implements ActionListener {
|
|||
result.setLayout(new SpringLayout());
|
||||
|
||||
result.add(new JLabel("Hostname"));
|
||||
hostNameField = new JTextField("localhost");
|
||||
hostNameField = new JTextField("localhost",25);
|
||||
result.add(hostNameField);
|
||||
|
||||
result.add(new JLabel("Port"));
|
||||
|
|
@ -96,31 +80,45 @@ public class JDialogMetaMongodb extends JDialog implements ActionListener {
|
|||
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());
|
||||
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(ds.getDatabase());
|
||||
schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
result.add(new JLabel(""));
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 4, 2);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 3, 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setupStep(LoadStepData model) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
|
||||
MetaModelDataContextMongodb ds = new MetaModelDataContextMongodb();
|
||||
ds.setHostname(hostNameField.getText());
|
||||
ds.setPort(new Integer(hostPortField.getText()));
|
||||
ds.setDatabase(databaseField.getText());
|
||||
|
||||
try {
|
||||
DB mongoDB = ds.getMongodbConnection();
|
||||
mongoDB.getMongo().close();
|
||||
|
||||
if (model.dc instanceof MongoDbDataContext) {
|
||||
MongoDbDataContext dc = (MongoDbDataContext)model.dc;
|
||||
dc.getMongoDb().getMongo().close();
|
||||
}
|
||||
|
||||
model.dcProvider = ds;
|
||||
model.dc=ds.getDataContext();
|
||||
model.name=ds.getDatabase();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "Fatal connect error:\n"+e.getMessage(), "Jdbc Connect Error", JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* 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.server.ui.load;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
/**
|
||||
* JLoadStepMiscInfo
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 21, 2012
|
||||
*/
|
||||
public class JLoadStepMiscInfo extends JPanel implements LoadStep {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JTextField filenameField = null;
|
||||
private JTextField groupIdField = null;
|
||||
private JTextField rolesGroupField = null;
|
||||
private JTextField rolesEntryField = null;
|
||||
|
||||
public JLoadStepMiscInfo() {
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
add(createPanelCenter());
|
||||
}
|
||||
|
||||
public String getStepTitle() {
|
||||
return "Select Info";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JPanel createPanelCenter() {
|
||||
JPanel result = new JPanel();
|
||||
result.setLayout(new SpringLayout());
|
||||
|
||||
filenameField = new JTextField();
|
||||
groupIdField = new JTextField();
|
||||
rolesGroupField = new JTextField();
|
||||
rolesEntryField = new JTextField();
|
||||
|
||||
result.add(new JLabel("Filename:"));
|
||||
result.add(filenameField);
|
||||
result.add(new JLabel("groupId:"));
|
||||
result.add(groupIdField);
|
||||
result.add(new JLabel("rolesGroup:"));
|
||||
result.add(rolesGroupField);
|
||||
result.add(new JLabel("rolesEntry:"));
|
||||
result.add(rolesEntryField);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 4, 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setupStep(LoadStepData model) {
|
||||
filenameField.setText(model.name+".xml");
|
||||
groupIdField.setText(model.name);
|
||||
rolesGroupField.setText("login,admin");
|
||||
rolesEntryField.setText("login,admin");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
model.filename = filenameField.getText();
|
||||
model.groupId = groupIdField.getText();
|
||||
model.rolesGroup = rolesGroupField.getText();
|
||||
model.rolesEntry = rolesEntryField.getText();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
* 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.server.ui.load;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import org.eobjects.metamodel.DataContext;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
|
||||
/**
|
||||
* JLoadStepSelectTables select tables to load.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JLoadStepSelectTables extends JPanel implements LoadStep {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JTable table = null;
|
||||
private MetaModelTableModel tableModel = null;
|
||||
private DataContext dcOld = null;
|
||||
|
||||
public JLoadStepSelectTables() {
|
||||
setLayout(new SpringLayout());
|
||||
add(createPanelCenter());
|
||||
SpringLayoutGrid.makeCompactGrid(this, 1, 1, 6, 6, 6, 6);
|
||||
}
|
||||
|
||||
public String getStepTitle() {
|
||||
return "Select Tables";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JComponent createPanelCenter() {
|
||||
tableModel = new MetaModelTableModel();
|
||||
table = new JTable(tableModel);
|
||||
table.setFillsViewportHeight(true);
|
||||
table.setShowHorizontalLines(true);
|
||||
table.setAutoscrolls(true);
|
||||
//((JComponent) table.getDefaultRenderer(Boolean.class)).setOpaque(true);// let backgroup color work correctly
|
||||
JScrollPane scrollPane = new JScrollPane(table);
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
return scrollPane;
|
||||
}
|
||||
|
||||
public void setupStep(LoadStepData model) {
|
||||
if (model.tables.isEmpty() | (dcOld!=null && dcOld!=model.dc)) {
|
||||
tableModel.setData(Arrays.asList(model.dc.getDefaultSchema().getTableNames()));
|
||||
dcOld = model.dc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
model.tables.clear();
|
||||
for (TableRow row:tableModel.getData()) {
|
||||
if (row.load) {
|
||||
model.tables.add(row.table);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
class TableRow {
|
||||
String table;
|
||||
boolean load = true;
|
||||
}
|
||||
|
||||
class MetaModelTableModel extends AbstractTableModel {
|
||||
|
||||
private static final long serialVersionUID = 5487313677918103654L;
|
||||
private List<TableRow> data = new ArrayList<TableRow>();
|
||||
|
||||
public void setData(List<String> tables) {
|
||||
data.clear();
|
||||
for (String table:tables) {
|
||||
TableRow row = new TableRow();
|
||||
row.table=table;
|
||||
data.add(row);
|
||||
}
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
public List<TableRow> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex) {
|
||||
if (columnIndex==0) {
|
||||
return String.class;
|
||||
} else {
|
||||
return Boolean.class;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int columnIndex) {
|
||||
if (columnIndex==0) {
|
||||
return "TableName";
|
||||
} else {
|
||||
return "Import";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
TableRow row = data.get(rowIndex);
|
||||
if (columnIndex==0) {
|
||||
return row.table;
|
||||
} else {
|
||||
return new Boolean(row.load);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return columnIndex>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueAt(Object value, int rowIndex, int columnIndex) {
|
||||
if (columnIndex==1) {
|
||||
TableRow row = data.get(rowIndex);
|
||||
if (value instanceof Boolean) {
|
||||
row.load = (Boolean)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* 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.server.ui.load;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import org.x4o.xml.sax.XMLWriter;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
/**
|
||||
* JLoadStepWriteFile writes the file.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 21, 2012
|
||||
*/
|
||||
public class JLoadStepWriteFile extends JPanel implements LoadStep,ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JTextArea text = null;
|
||||
|
||||
public JLoadStepWriteFile() {
|
||||
setLayout(new SpringLayout());
|
||||
add(createPanelCenter());
|
||||
SpringLayoutGrid.makeCompactGrid(this, 1, 1, 6, 6, 6, 6);
|
||||
}
|
||||
|
||||
public String getStepTitle() {
|
||||
return "Select Tables";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JComponent createPanelCenter() {
|
||||
text = new JTextArea(13,45);
|
||||
text.setAutoscrolls(true);
|
||||
JScrollPane scrollPane = new JScrollPane(text);
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
return scrollPane;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setupStep(LoadStepData model) {
|
||||
try {
|
||||
VascController vc = VascTechDemoStartup.getInstance().getVascControllerService().getVascController();
|
||||
StringWriter out = new StringWriter();
|
||||
XMLWriter outXml = new XMLWriter(out);
|
||||
LoadVascXmlWriter writer = new LoadVascXmlWriter(outXml,vc);
|
||||
writer.writeXml(model);
|
||||
|
||||
text.setText(out.getBuffer().toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
|
||||
try {
|
||||
VascController vc = VascTechDemoStartup.getInstance().getVascControllerService().getVascController();
|
||||
File tmpFile = new File("conf/vasc.d/"+model.filename);// File.createTempFile("vasc","xml");
|
||||
System.out.println("write to : "+tmpFile);
|
||||
Writer out = new OutputStreamWriter(new FileOutputStream(tmpFile));
|
||||
XMLWriter outXml = new XMLWriter(out);
|
||||
LoadVascXmlWriter writer = new LoadVascXmlWriter(outXml,vc);
|
||||
writer.writeXml(model);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* LoadStep are the load wizzard steps.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 21, 2012
|
||||
*/
|
||||
package net.forwardfire.vasc.demo.server.ui.load;
|
||||
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public interface LoadStep {
|
||||
|
||||
JPanel getPanel();
|
||||
|
||||
String getStepTitle();
|
||||
|
||||
void setupStep(LoadStepData model);
|
||||
|
||||
boolean performStep(LoadStepData model);
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.server.ui.load;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eobjects.metamodel.DataContext;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextProvider;
|
||||
|
||||
/**
|
||||
* LoadStepData Simple model to load wizzard steps.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 21, 2012
|
||||
*/
|
||||
public class LoadStepData {
|
||||
|
||||
public String name = null;
|
||||
public MetaModelDataContextProvider dcProvider = null;
|
||||
public DataContext dc = null;
|
||||
|
||||
public String filename = null;
|
||||
public String groupId = null;
|
||||
public String rolesGroup = null;
|
||||
public String rolesEntry = null;
|
||||
public List<String> tables = new ArrayList<String>();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
/*
|
||||
* 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.server.ui.load;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldType;
|
||||
import net.forwardfire.vasc.core.VascEntryLink;
|
||||
import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.DefaultHandler2;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
* LoadVascXmlWriter writes the xml tags.
|
||||
* note: need to move this to x4o
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 22, 2012
|
||||
*/
|
||||
public class LoadVascXmlWriter {
|
||||
|
||||
private VascController vc = null;
|
||||
private DefaultHandler2 xmlWriter = null;
|
||||
|
||||
static private final String URI_VASC_ROOT = "http://vasc.forwardfire.net/xml/ns/vasc-root";
|
||||
static private final String URI_VASC_LANG = "http://vasc.forwardfire.net/xml/ns/vasc-lang";
|
||||
static private final String URI_META_MODEL = "http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel";
|
||||
static private final String URI_VASC_DEMO = "http://vasc.forwardfire.net/xml/ns/vasc-tech-demo";
|
||||
|
||||
public LoadVascXmlWriter(DefaultHandler2 xmlWriter,VascController vc) {
|
||||
this.xmlWriter=xmlWriter;
|
||||
this.vc=vc;
|
||||
}
|
||||
|
||||
public void writeXml(LoadStepData model) throws SAXException {
|
||||
|
||||
MetaModelSchemaAutoEntry autoEntry = new MetaModelSchemaAutoEntry();
|
||||
autoEntry.setVascGroupId(model.groupId);
|
||||
autoEntry.setEntryPrefix(model.name);
|
||||
autoEntry.setDataContextProvider(model.dcProvider);
|
||||
autoEntry.getTables().addAll(model.tables);
|
||||
|
||||
autoEntry.autoFillResult(vc);
|
||||
|
||||
xmlWriter.startDocument();
|
||||
|
||||
char[] msg;
|
||||
msg = "\n".toCharArray();
|
||||
xmlWriter.ignorableWhitespace(msg,0,msg.length);
|
||||
|
||||
xmlWriter.startPrefixMapping("vasc", URI_VASC_ROOT);
|
||||
xmlWriter.startPrefixMapping("v", URI_VASC_LANG);
|
||||
xmlWriter.startPrefixMapping("mm", URI_META_MODEL);
|
||||
xmlWriter.startPrefixMapping("td", URI_VASC_DEMO);
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
xmlWriter.startElement (URI_VASC_ROOT, "root", "", atts);
|
||||
|
||||
msg = "Auto generated vasc xml example.".toCharArray();
|
||||
xmlWriter.comment(msg,0,msg.length);
|
||||
|
||||
writeGroup(model.groupId,model.rolesGroup);
|
||||
writeMetaProvider(model);
|
||||
|
||||
for (MetaModelVascBackend vb:autoEntry.getResultBackends()) {
|
||||
writeEntryBackend(vb,model);
|
||||
}
|
||||
for (VascEntry ve:autoEntry.getResultEntries()) {
|
||||
writeEntry(ve,model);
|
||||
}
|
||||
|
||||
|
||||
xmlWriter.endElement(URI_VASC_ROOT, "root", "");
|
||||
xmlWriter.endDocument();
|
||||
}
|
||||
|
||||
private void writeMetaProvider(LoadStepData model) throws SAXException {
|
||||
AttributesImpl atts = null;
|
||||
if (model.dcProvider instanceof MetaModelDataContextMongodb) {
|
||||
MetaModelDataContextMongodb mongo = (MetaModelDataContextMongodb)model.dcProvider;
|
||||
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "el.id", "", "", model.name+"DC");
|
||||
if (mongo.getHostname()!=null) {
|
||||
atts.addAttribute ("", "hostname", "", "", mongo.getHostname());
|
||||
}
|
||||
if (mongo.getDatabase()!=null) {
|
||||
atts.addAttribute ("", "database", "", "", mongo.getDatabase());
|
||||
}
|
||||
if (mongo.getUsername()!=null) {
|
||||
atts.addAttribute ("", "username", "", "", mongo.getUsername());
|
||||
}
|
||||
if (mongo.getPassword()!=null) {
|
||||
atts.addAttribute ("", "password", "", "", mongo.getPassword());
|
||||
}
|
||||
atts.addAttribute ("", "port", "", "", ""+mongo.getPort());
|
||||
|
||||
xmlWriter.startElement (URI_META_MODEL, "mongodbDataContext", "", atts);
|
||||
xmlWriter.endElement(URI_META_MODEL, "mongodbDataContext", "");
|
||||
|
||||
} else if (model.dcProvider instanceof MetaModelDataContextJdbc) {
|
||||
MetaModelDataContextJdbc jdbc = (MetaModelDataContextJdbc)model.dcProvider;
|
||||
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "name", "", "", "jdbc/load/"+model.name+"DS");
|
||||
atts.addAttribute ("", "auth", "", "", "Container");
|
||||
atts.addAttribute ("", "type", "", "", "javax.sql.DataSource");
|
||||
atts.addAttribute ("", "factory", "", "", "org.apache.tomcat.jdbc.pool.DataSourceFactory");
|
||||
atts.addAttribute ("", "initialSize", "", "", "1");
|
||||
atts.addAttribute ("", "minIdle", "", "", "1");
|
||||
atts.addAttribute ("", "username", "", "", jdbc.getUsername());
|
||||
atts.addAttribute ("", "password", "", "", jdbc.getPassword());
|
||||
atts.addAttribute ("", "driverClassName", "", "", jdbc.getDriverClass());
|
||||
atts.addAttribute ("", "url", "", "", jdbc.getConnectUrl());
|
||||
xmlWriter.startElement (URI_VASC_DEMO, "tomcatResource", "", atts);
|
||||
xmlWriter.endElement(URI_VASC_DEMO, "tomcatResource", "");
|
||||
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "el.id", "", "", model.name+"DC");
|
||||
atts.addAttribute ("", "jndiName", "", "", "java:jdbc/load/"+model.name+"DS");
|
||||
xmlWriter.startElement (URI_META_MODEL, "jndiDataSourceDataContext", "", atts);
|
||||
xmlWriter.endElement(URI_META_MODEL, "jndiDataSourceDataContext", "");
|
||||
}
|
||||
}
|
||||
|
||||
private void writeGroup(String groupId,String roles) throws SAXException {
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", groupId);
|
||||
atts.addAttribute ("", "rolesView", "", "", roles);
|
||||
xmlWriter.startElement (URI_VASC_LANG, "entryGroup", "", atts);
|
||||
xmlWriter.endElement(URI_VASC_LANG, "entryGroup", "");
|
||||
}
|
||||
|
||||
private void writeEntryBackend(MetaModelVascBackend vb,LoadStepData model) throws SAXException {
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", vb.getId());
|
||||
atts.addAttribute ("", "dataContextProvider", "", "", "${"+model.name+ "DC}");
|
||||
atts.addAttribute ("", "table", "", "", vb.getTable());
|
||||
atts.addAttribute ("", "tableId", "", "", vb.getTableId());
|
||||
|
||||
xmlWriter.startElement (URI_META_MODEL, "metaModelBackend", "", atts);
|
||||
xmlWriter.endElement(URI_META_MODEL, "metaModelBackend", "");
|
||||
}
|
||||
|
||||
private void writeEntry(VascEntry ve,LoadStepData model) throws SAXException {
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", ve.getId());
|
||||
atts.addAttribute ("", "backendId", "", "", ve.getBackendId());
|
||||
atts.addAttribute ("", "primaryKeyFieldId", "", "", ve.getPrimaryKeyFieldId());
|
||||
if (ve.getDisplayNameFieldId()!=null) {
|
||||
atts.addAttribute ("", "displayNameFieldId", "", "", ve.getDisplayNameFieldId());
|
||||
}
|
||||
if (ve.getVascGroupId()!=null) {
|
||||
atts.addAttribute ("", "vascGroupId", "", "", ve.getVascGroupId());
|
||||
}
|
||||
if (ve.getAccessType()!=null) {
|
||||
atts.addAttribute ("", "accessType", "", "", ve.getAccessType().name());
|
||||
}
|
||||
xmlWriter.startElement (URI_VASC_LANG, "entry", "", atts);
|
||||
createFields(ve);
|
||||
|
||||
for (VascEntryLink vel:ve.getVascEntryLinks()) {
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", vel.getId());
|
||||
if (vel.getVascEntryLinkType()!=null && vel.getVascEntryLinkType()!=VascEntryLinkType.DEFAULT_TYPE) {
|
||||
atts.addAttribute ("", "vascEntryLinkType", "", "", ""+vel.getVascEntryLinkType());
|
||||
}
|
||||
atts.addAttribute ("", "vascEntryId", "", "", vel.getVascEntryId());
|
||||
xmlWriter.startElement (URI_VASC_LANG, "link", "", atts);
|
||||
|
||||
for (String key:vel.getEntryParameterFieldIdKeys()) {
|
||||
String value = vel.getEntryParameterFieldId(key);
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "name", "", "", key);
|
||||
atts.addAttribute ("", "valueFieldId", "", "", value);
|
||||
xmlWriter.startElement (URI_VASC_LANG, "linkParameter", "", atts);
|
||||
xmlWriter.endElement(URI_VASC_LANG, "linkParameter", "");
|
||||
}
|
||||
xmlWriter.endElement(URI_VASC_LANG, "link", "");
|
||||
}
|
||||
xmlWriter.endElement(URI_VASC_LANG, "entry", "");
|
||||
}
|
||||
|
||||
private void createFields(VascEntry ve) throws SAXException {
|
||||
for (VascEntryField f:ve.getVascEntryFields()) {
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", f.getId());
|
||||
VascEntryFieldType type = f.getVascEntryFieldType();
|
||||
if (type!=null) {
|
||||
atts.addAttribute ("", "vascEntryFieldType", "", "", type.getId());
|
||||
}
|
||||
if (f.getEditReadOnly()!=null) {
|
||||
atts.addAttribute ("", "editReadOnly", "", "", ""+f.getEditReadOnly());
|
||||
}
|
||||
//atts.addAttribute ("", "vascGroupId", "", "", model.groupId);
|
||||
xmlWriter.startElement (URI_VASC_LANG, "field", "", atts);
|
||||
|
||||
if (type!=null && "ListField".equals(type.getId())) {
|
||||
VascSelectItemModelEntry link = (VascSelectItemModelEntry)type.getDataObject();
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "entryId", "", "", ""+link.getEntryId());
|
||||
atts.addAttribute ("", "displayFieldId", "", "", ""+link.getDisplayFieldId());
|
||||
xmlWriter.startElement (URI_VASC_LANG, "vascSelectItemModel", "", atts);
|
||||
xmlWriter.endElement(URI_VASC_LANG, "vascSelectItemModel", "");
|
||||
}
|
||||
|
||||
|
||||
xmlWriter.endElement(URI_VASC_LANG, "field", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -63,27 +63,6 @@ CREATE INDEX vasc_page_part_page_id_idx ON vasc_page_part(page_id);
|
|||
CREATE INDEX vasc_page_part_active_idx ON vasc_page_part(active);
|
||||
CREATE INDEX vasc_page_part_sitemap_idx ON vasc_page_part(sitemap);
|
||||
|
||||
|
||||
CREATE TABLE vasc_menu_group (
|
||||
id varchar not null primary key,
|
||||
title varchar not null,
|
||||
active BOOLEAN NOT NULL,
|
||||
roles varchar not null,
|
||||
menu_order integer not null,
|
||||
);
|
||||
CREATE INDEX vasc_menu_group_active_idx ON vasc_menu_group(active);
|
||||
|
||||
CREATE TABLE vasc_menu (
|
||||
id IDENTITY not null primary key,
|
||||
vasc_entry_id varchar not null,
|
||||
title varchar not null,
|
||||
active BOOLEAN NOT NULL,
|
||||
roles varchar not null,
|
||||
menu_order integer not null,
|
||||
menu_group varchar not null
|
||||
);
|
||||
CREATE INDEX vasc_menu_active_idx ON vasc_menu(active);
|
||||
|
||||
CREATE TABLE vasc_menu_web (
|
||||
id IDENTITY not null primary key,
|
||||
href varchar not null,
|
||||
|
|
@ -135,22 +114,6 @@ INSERT INTO vasc_page_part VALUES(10,6, 'metamodel','', TRUE,TRUE,TRUE,3,'WIKI',
|
|||
|
||||
-- INSERT INTO vasc_page VALUES(1, 'home','home','Welcome to the vasc demo, please login as admin to view all stuff.');
|
||||
|
||||
INSERT INTO vasc_menu_group VALUES('demo', 'Demo',true,'',1);
|
||||
INSERT INTO vasc_menu_group VALUES('meta', 'Meta',true,'',2);
|
||||
|
||||
INSERT INTO vasc_menu VALUES(1,'metaPeople', 'People', true,'',1,'meta');
|
||||
INSERT INTO vasc_menu VALUES(2,'metaProjects', 'Projects',true,'',2,'meta');
|
||||
|
||||
INSERT INTO vasc_menu VALUES(3,'AdminVascUser', 'Users', true,'',1,'demo');
|
||||
INSERT INTO vasc_menu VALUES(4,'AdminVascUserRole', 'UserRole',true,'',2,'demo');
|
||||
INSERT INTO vasc_menu VALUES(5,'AdminVascUserChangeField','ChangeField', true,'',3,'demo');
|
||||
INSERT INTO vasc_menu VALUES(6,'AdminVascUserChangeLog', 'ChangeLog',true,'',4,'demo');
|
||||
INSERT INTO vasc_menu VALUES(7,'AdminVascPage', 'Pages', true,'',5,'demo');
|
||||
INSERT INTO vasc_menu VALUES(8,'AdminVascPagePart', 'PagesPart',true,'',6,'demo');
|
||||
INSERT INTO vasc_menu VALUES( 9,'AdminVascMenuWeb', 'MenuWeb', true,'',7,'demo');
|
||||
INSERT INTO vasc_menu VALUES(10,'AdminVascMenuGroup', 'MenuGroup',true,'',8,'demo');
|
||||
INSERT INTO vasc_menu VALUES(11,'AdminVascMenu', 'Menu', true,'',9,'demo');
|
||||
|
||||
INSERT INTO vasc_menu_web VALUES(1, '/html/index.jsf','Home', '',true,'',1,'BAR_RIGHT');
|
||||
INSERT INTO vasc_menu_web VALUES(2, '/html/admin/debug.jsf','Debug','',true,'admin',2,'BAR_RIGHT');
|
||||
INSERT INTO vasc_menu_web VALUES(3, '/html/admin/index.jsf','Admin','',true,'admin',3,'BAR_RIGHT');
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ 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
|
||||
Application.icon = icon.png
|
||||
|
||||
Application.web.meta.robots = index, follow
|
||||
Application.web.meta.description = Vasc Tech Demo Web Frontends
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 264 B |
|
|
@ -0,0 +1,12 @@
|
|||
#
|
||||
# Default dark red color thema for pulsefire
|
||||
#
|
||||
text=#DF0A0A
|
||||
info=#370A00
|
||||
control=#0A1428
|
||||
nimbusBase=#00050A
|
||||
nimbusFocus=#0A6428
|
||||
nimbusOrange=#00960A
|
||||
nimbusBorder=#34415E
|
||||
nimbusDisabledText=#850F0F
|
||||
nimbusLightBackground=#050A28
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 400 B |
Loading…
Add table
Add a link
Reference in a new issue