Skip to content

Commit

Permalink
make it executable
Browse files Browse the repository at this point in the history
  • Loading branch information
umjammer committed Nov 5, 2017
1 parent 4ca05fc commit e35cba9
Show file tree
Hide file tree
Showing 14 changed files with 405 additions and 548 deletions.
104 changes: 79 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,97 @@
<organization>
<name></name>
</organization>
<version>1.0.0</version>
<url>http://www.vavisoft.com/</url>
<description></description>
<version>0.0.1</version>
<url>https://github.com/umjammer/vavi-apps-treeview</url>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<executable>${JAVA_HOME}/bin/java</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>native2ascii</goal>
</goals>
<configuration>
<includes>**/*_ja.properties</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<versionRange>[1.0-alpha-1,)</versionRange>
<goals>
<goal>native2ascii</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>vavi</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.0.3</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>vavi</groupId>
<artifactId>vavi-awt</artifactId>
<version>1.0.0</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.0.6</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-awt</artifactId>
<version>1.0.1</version>
<optional>false</optional>
</dependency>
</dependencies>
<scm>
<url>https://github.com/umjammer/vavi-apps-treeview</url>
</scm>
<issueManagement>
<url>https://github.com/umjammer/vavi-apps-treeview/issues</url>
</issueManagement>
<description>TODO

</description>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@
package vavi.apps.treeView;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;


/**
* XMLSaver.
* Dao.
*
* @author <a href="mailto:vavivavi@yahoo.co.jp">Naohide Sano</a> (nsano)
* @version 0.00 041105 nsano initial version <br>
*/
public interface XMLSaver {
public interface Dao {

/** ルートのツリーノードを取得します. */
TreeViewTreeNode read(InputStream is) throws IOException;

/** ルート以下のツリーノードを書き込みます. */
void writeRootTreeNode(TreeViewTreeNode root) throws IOException;
void write(TreeViewTreeNode root, OutputStream os) throws IOException;
}

/* */
153 changes: 0 additions & 153 deletions src/main/java/vavi/apps/treeView/DomXMLSaver.java

This file was deleted.

22 changes: 16 additions & 6 deletions src/main/java/vavi/apps/treeView/TreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.logging.Level;

import javax.swing.AbstractAction;
import javax.swing.Action;
Expand Down Expand Up @@ -221,13 +220,16 @@ private JPopupMenu createPopupMenu() {

// -------------------------------------------------------------------------

/** */
private Dao dao = new XmlDao();

/**
* 初期状態にします.
*/
private void init() {
try {
InputStream is = getClass().getResourceAsStream(props.getProperty("tv.resource.tree"));
root = new DomXMLLoader(is).readRootTreeNode();
root = dao.read(is);
} catch (Exception e) {
Debug.println(props.getProperty("tv.resource.tree") + " cannot read: tv.resource.tree");
Debug.printStackTrace(e);
Expand All @@ -238,16 +240,17 @@ private void init() {
/**
* ツリーノードをロードします.
*/
@SuppressWarnings("unused")
private void load(InputStream is) throws IOException {
root = new DomXMLLoader(is).readRootTreeNode();
root = dao.read(is);
((DefaultTreeModel) tree.getModel()).setRoot(root);
}

/**
* ツリーノードをセーブします.
*/
private void save(OutputStream os) throws IOException {
new DomXMLSaver(os).writeRootTreeNode(root);
dao.write(root, os);
}

/**
Expand Down Expand Up @@ -554,8 +557,9 @@ protected void fireEditorUpdated(EditorEvent ev) {
final Class<?> clazz = TreeView.class;

try {
Properties ps = new Properties();
InputStream is = clazz.getResourceAsStream(path);
props.load(is);
ps.load(is);
is.close();

Toolkit t = Toolkit.getDefaultToolkit();
Expand All @@ -577,8 +581,13 @@ protected void fireEditorUpdated(EditorEvent ev) {

i++;
}

props = new Properties();
is = clazz.getResourceAsStream("/local.properties");
props.load(is);
is.close();
} catch (Exception e) {
Debug.println(Level.SEVERE, rb.getString("property.file"));
e.printStackTrace();;
System.exit(1);
}
}
Expand All @@ -593,6 +602,7 @@ public static void main(String[] args) throws Exception {
TreeView tree = new TreeView();

JFrame frame = new TreeViewFrame(tree);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vavi/apps/treeView/TreeViewTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void valueChanged(TreeSelectionEvent ev) {
return;
}

Vector<Object> selection = new Vector<Object>();
Vector<Object> selection = new Vector<>();
for (int i = 0; i < selected.length; i++) {
selection.addElement(selected[i].getLastPathComponent());
}
Expand Down
Loading

0 comments on commit e35cba9

Please sign in to comment.