Commit 94e85d49 by Jessica Hawkwell

got a window, adding config

1 parent 75fdc163
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.felinewith.lang_toolkit.apps</groupId>
<groupId>me.felinewith.lang-toolkit.apps</groupId>
<artifactId>bootstrap</artifactId>
<packaging>jar</packaging>
<name>Bootstrap</name>
......
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.felinewith.lang_toolkit.apps</groupId>
<groupId>me.felinewith.lang-toolkit.apps</groupId>
<artifactId>langbuilder</artifactId>
<packaging>jar</packaging>
<name>LangBuilder</name>
......@@ -18,7 +18,15 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependencies>
<dependency>
<groupId>me.felinewith.lang_toolkit.apps</groupId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
</dependency>
<dependency>
<groupId>org.freedesktop.tango</groupId>
<artifactId>tango-icon-theme</artifactId>
</dependency>
<dependency>
<groupId>me.felinewith.lang-toolkit.apps</groupId>
<artifactId>bootstrap</artifactId>
</dependency>
</dependencies>
......
package me.felinewith.lang_toolkit.apps.langbuilder;
import java.awt.Dimension;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.util.HashMap;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTree;
import me.felinewith.lang_toolkit.apps.bootstrap.IStrappedApp;
import me.felinewith.lang_toolkit.apps.bootstrap.IStrappedPlugin;
import org.apache.commons.configuration2.HierarchicalConfiguration;
import org.apache.commons.configuration2.builder.BasicConfigurationBuilder;
import org.apache.commons.configuration2.builder.fluent.Parameters;
/**
*
......@@ -13,20 +25,79 @@ public class LangBuilder implements IStrappedApp {
private String[] args;
private HashMap<String, IStrappedPlugin> plugins;
private JFrame window;
private JFrame jFrame;
private JSplitPane jSplitPane;
private JScrollPane jScrollPane;
private JTree jTree;
private JDesktopPane jDesktopPane;
@Override public void preStart(String[] argsStrings) {
args = argsStrings;
plugins = new HashMap<>();
window = new JFrame("LangBuilder");
// TODO: app settings, main window, toolbar menu
jFrame = new JFrame("LangBuilder");
// TODO: toolbar menu
jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
jTree = new JTree();
jScrollPane = new JScrollPane(jTree,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jDesktopPane = new JDesktopPane();
jSplitPane.setLeftComponent(jScrollPane);
jSplitPane.setRightComponent(jDesktopPane);
jFrame.add(jSplitPane);
// configure the window
// set some sensible defaults
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
DisplayMode dm;
int sx = 0, sy = 0;
int bx = 0, by = 0;
int tx, ty;
for ( GraphicsDevice gd : ge.getScreenDevices() ) {
dm = gd.getDisplayMode();
tx = dm.getWidth();
ty = dm.getHeight();
// we want the SMALLEST display in a multi-display environment
if ( (tx < sx) || (sx == 0) ) { sx = tx; }
if ( (ty < sy) || (sy == 0) ) { sy = ty; }
// and here we want the BIGGEST
if ( tx > bx ) { bx = tx; }
if ( ty > by ) { by = ty; }
}
jFrame.setMinimumSize(new Dimension(sx / 2, sy / 2));
jFrame.setMaximumSize(new Dimension(bx, by));
jFrame.setPreferredSize(new Dimension(sx / 2, sy / 2));
// configuration!
StringBuilder sb = new StringBuilder(System.getProperty("user.home"));
sb.append("/.local/share/lang-toolkit/config/");
File f = new File(sb.toString());
if ( !f.exists() ) { f.mkdirs(); }
Parameters param = new Parameters();
param.basic().setThrowExceptionOnMissing(false);
param.hierarchical().setBasePath(f.getAbsolutePath());
BasicConfigurationBuilder<HierarchicalConfiguration> bcb =
new BasicConfigurationBuilder<HierarchicalConfiguration>(HierarchicalConfiguration.class);
}
@Override public void registerPlugin(IStrappedPlugin plugin) {
}
@Override public void start() {
jFrame.pack();
jFrame.setVisible(true);
}
}
package me.felinewith.lang_toolkit.apps.langbuilder;
import java.awt.event.WindowAdapter;
/**
*
* @author jlhawkwell
*/
public class ListenWindow extends WindowAdapter {
LangBuilder lb;
public ListenWindow(LangBuilder langbuilder) {
lb = langbuilder;
}
}
......@@ -111,7 +111,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<!-- repository>
<id>external</id>
<name>SPM Externals</name>
<url>https://mvn.felinewith.me/repository/external</url>
......@@ -121,25 +121,35 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repository -->
</repositories>
<dependencyManagement>
<dependencies>
<!-- PROJECT DEPENDENCIES ********************************************************************* PROJECT DEPENDENCIES -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.freedesktop.tango</groupId>
<artifactId>tango-icon-theme</artifactId>
<version>0.8.90</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>me.felinewith.lang_toolkit.apps</groupId>
<groupId>me.felinewith.lang-toolkit.apps</groupId>
<artifactId>bootstrap</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!