From b0641e2f1e4809de7d4c605fd7ebf29845e83178 Mon Sep 17 00:00:00 2001 From: alatnet Date: Tue, 11 Dec 2018 21:55:53 -0500 Subject: [PATCH] Initial Commit. --- build.xml | 73 + manifest.mf | 3 + nbproject/build-impl.xml | 1413 +++++++++++++++ nbproject/genfiles.properties | 8 + nbproject/project.properties | 85 + nbproject/project.xml | 15 + src/com/alatnet/gmod/GmodPaths.form | 258 +++ src/com/alatnet/gmod/GmodPaths.java | 365 ++++ .../alatnet/gmod/GmodPublishingUtility.java | 413 +++++ src/com/alatnet/gmod/JTextAreaHandler.java | 39 + src/com/alatnet/gmod/MainFrame.form | 1004 +++++++++++ src/com/alatnet/gmod/MainFrame.java | 1548 +++++++++++++++++ src/com/alatnet/gmod/Settings.form | 427 +++++ src/com/alatnet/gmod/Settings.java | 516 ++++++ src/com/alatnet/gmod/addon_json.java | 112 ++ src/com/alatnet/gmod/gmpuJob.java | 478 +++++ .../gmod/logHandlers/JTextAreaHandler.java | 46 + .../gmod/logHandlers/SystemOutHandler.java | 42 + src/com/alatnet/gmod/queue/gmpuQueue.java | 87 + src/com/alatnet/gmod/queue/gmpuQueueRoot.java | 22 + .../alatnet/gmod/queue/gmpuSmartQueue.java | 386 ++++ .../gmod/tableModels/tableModelAddons.java | 73 + .../gmod/tableModels/tableModelQueue.java | 147 ++ 23 files changed, 7560 insertions(+) create mode 100644 build.xml create mode 100644 manifest.mf create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/com/alatnet/gmod/GmodPaths.form create mode 100644 src/com/alatnet/gmod/GmodPaths.java create mode 100644 src/com/alatnet/gmod/GmodPublishingUtility.java create mode 100644 src/com/alatnet/gmod/JTextAreaHandler.java create mode 100644 src/com/alatnet/gmod/MainFrame.form create mode 100644 src/com/alatnet/gmod/MainFrame.java create mode 100644 src/com/alatnet/gmod/Settings.form create mode 100644 src/com/alatnet/gmod/Settings.java create mode 100644 src/com/alatnet/gmod/addon_json.java create mode 100644 src/com/alatnet/gmod/gmpuJob.java create mode 100644 src/com/alatnet/gmod/logHandlers/JTextAreaHandler.java create mode 100644 src/com/alatnet/gmod/logHandlers/SystemOutHandler.java create mode 100644 src/com/alatnet/gmod/queue/gmpuQueue.java create mode 100644 src/com/alatnet/gmod/queue/gmpuQueueRoot.java create mode 100644 src/com/alatnet/gmod/queue/gmpuSmartQueue.java create mode 100644 src/com/alatnet/gmod/tableModels/tableModelAddons.java create mode 100644 src/com/alatnet/gmod/tableModels/tableModelQueue.java diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..6f5e53a --- /dev/null +++ b/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project Gmod Publishing Utility. + + + diff --git a/manifest.mf b/manifest.mf new file mode 100644 index 0000000..1574df4 --- /dev/null +++ b/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..784ee58 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..ca7666d --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=78ade521 +build.xml.script.CRC32=31156c1d +build.xml.stylesheet.CRC32=8064a381@1.75.2.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=78ade521 +nbproject/build-impl.xml.script.CRC32=298738d4 +nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..9768f2b --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,85 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=Gmod Publishing Utility +application.vendor=alatnet +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/Gmod_Publishing_Utility.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=false +jar.index=${jnlp.enabled} +javac.classpath=\ + ${libs.beans-binding.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=default +jnlp.offline-allowed=false +jnlp.signed=false +jnlp.signing= +jnlp.signing.alias= +jnlp.signing.keystore= +main.class=com.alatnet.gmod.GmodPublishingUtility +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..9fd236e --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + Gmod Publishing Utility + + + + + + + + + diff --git a/src/com/alatnet/gmod/GmodPaths.form b/src/com/alatnet/gmod/GmodPaths.form new file mode 100644 index 0000000..07ca2fa --- /dev/null +++ b/src/com/alatnet/gmod/GmodPaths.form @@ -0,0 +1,258 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/com/alatnet/gmod/GmodPaths.java b/src/com/alatnet/gmod/GmodPaths.java new file mode 100644 index 0000000..e706289 --- /dev/null +++ b/src/com/alatnet/gmod/GmodPaths.java @@ -0,0 +1,365 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod; + +import javax.swing.JFileChooser; + +/** + * + * @author alatnet + */ +public class GmodPaths extends javax.swing.JDialog { + private String gmpublishPath, gmpublishProgram, gmadPath, gmadProgram; + private boolean pressOK=false; + + private JFileChooser fileChooser; + + /** + * Creates new form GmodPaths + */ + public GmodPaths(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + initComponents2(); + } + + public void setData(String gmpublishPath, String gmpublishProgram, String gmadPath, String gmadProgram){ + this.gmadPath = gmadPath; + this.gmadProgram = gmadProgram; + this.gmpublishPath = gmpublishPath; + this.gmpublishProgram = gmpublishProgram; + this.txtGmadPath.setText(gmadPath); + this.txtGmadProgram.setText(gmadProgram); + this.txtGmpublishPath.setText(gmpublishPath); + this.txtGmpublishProgram.setText(gmpublishProgram); + } + public String getGmpublishPath(){ + //return this.txtGmpublishPath.getText(); + return this.gmpublishPath; + } + public String getGmpublishProgram(){ + //return this.txtGmpublishProgram.getText(); + return this.gmpublishProgram; + } + public String getGmadPath(){ + //return this.txtGmadPath.getText(); + return this.gmadPath; + } + public String getGmadProgram(){ + //return this.txtGmadProgram.getText(); + return this.gmadProgram; + } + + public boolean pressedOK(){ + return this.pressOK; + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + btnGmpublishPath = new javax.swing.JButton(); + btnGmpublishProgram = new javax.swing.JButton(); + txtGmpublishPath = new javax.swing.JTextField(); + txtGmpublishProgram = new javax.swing.JTextField(); + jPanel2 = new javax.swing.JPanel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + txtGmadPath = new javax.swing.JTextField(); + txtGmadProgram = new javax.swing.JTextField(); + btnGmadPath = new javax.swing.JButton(); + btnGmadProgram = new javax.swing.JButton(); + btnOK = new javax.swing.JButton(); + btnCancel = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("GMod Paths"); + setModal(true); + setResizable(false); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("gmpublish")); + + jLabel1.setText("Path: "); + + jLabel2.setText("Program: "); + + btnGmpublishPath.setText("Folder"); + btnGmpublishPath.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnGmpublishPathActionPerformed(evt); + } + }); + + btnGmpublishProgram.setText("File"); + btnGmpublishProgram.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnGmpublishProgramActionPerformed(evt); + } + }); + + txtGmpublishProgram.setText("gmpublish.exe"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtGmpublishPath) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnGmpublishPath)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtGmpublishProgram, javax.swing.GroupLayout.DEFAULT_SIZE, 561, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnGmpublishProgram))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(btnGmpublishPath) + .addComponent(txtGmpublishPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(btnGmpublishProgram) + .addComponent(txtGmpublishProgram, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + ); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("gmad")); + + jLabel3.setText("Path: "); + + jLabel4.setText("Program: "); + + txtGmadProgram.setText("gmad.exe"); + + btnGmadPath.setText("Folder"); + btnGmadPath.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnGmadPathActionPerformed(evt); + } + }); + + btnGmadProgram.setText("File"); + btnGmadProgram.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnGmadProgramActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtGmadPath) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnGmadPath)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtGmadProgram) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnGmadProgram))) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(txtGmadPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnGmadPath)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(txtGmadProgram, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnGmadProgram))) + ); + + btnOK.setText("OK"); + btnOK.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnOKActionPerformed(evt); + } + }); + + btnCancel.setText("Cancel"); + btnCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnCancelActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(btnOK) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnCancel))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnOK) + .addComponent(btnCancel)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void initComponents2() { + fileChooser = new JFileChooser(); + } + + private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed + this.gmadPath = this.txtGmadPath.getText(); + this.gmadProgram = this.txtGmadProgram.getText(); + this.gmpublishPath = this.txtGmpublishPath.getText(); + this.gmpublishProgram = this.txtGmpublishProgram.getText(); + this.pressOK=true; + this.dispose(); + }//GEN-LAST:event_btnOKActionPerformed + + private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed + this.dispose(); + }//GEN-LAST:event_btnCancelActionPerformed + + private void btnGmpublishPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGmpublishPathActionPerformed + this.fileChooser.setDialogTitle("Choose gmpublish path."); + this.fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + if (this.fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ + this.gmpublishPath = this.fileChooser.getSelectedFile().getPath(); + this.txtGmpublishPath.setText(this.gmpublishPath); + } + }//GEN-LAST:event_btnGmpublishPathActionPerformed + + private void btnGmadPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGmadPathActionPerformed + this.fileChooser.setDialogTitle("Choose gmad path."); + this.fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + if (this.fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ + this.gmadPath = this.fileChooser.getSelectedFile().getPath(); + this.txtGmadPath.setText(this.gmadPath); + } + }//GEN-LAST:event_btnGmadPathActionPerformed + + private void btnGmpublishProgramActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGmpublishProgramActionPerformed + this.fileChooser.setDialogTitle("Choose gmpublish program."); + this.fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + if (this.fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ + this.gmpublishProgram = this.fileChooser.getSelectedFile().getName(); + this.txtGmpublishProgram.setText(this.gmpublishProgram); + } + }//GEN-LAST:event_btnGmpublishProgramActionPerformed + + private void btnGmadProgramActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGmadProgramActionPerformed + this.fileChooser.setDialogTitle("Choose gmad program."); + this.fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + if (this.fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ + this.gmadProgram = this.fileChooser.getSelectedFile().getName(); + this.txtGmadProgram.setText(this.gmadProgram); + } + }//GEN-LAST:event_btnGmadProgramActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(GmodPaths.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(GmodPaths.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(GmodPaths.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(GmodPaths.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + GmodPaths dialog = new GmodPaths(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnCancel; + private javax.swing.JButton btnGmadPath; + private javax.swing.JButton btnGmadProgram; + private javax.swing.JButton btnGmpublishPath; + private javax.swing.JButton btnGmpublishProgram; + private javax.swing.JButton btnOK; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JTextField txtGmadPath; + private javax.swing.JTextField txtGmadProgram; + private javax.swing.JTextField txtGmpublishPath; + private javax.swing.JTextField txtGmpublishProgram; + // End of variables declaration//GEN-END:variables +} diff --git a/src/com/alatnet/gmod/GmodPublishingUtility.java b/src/com/alatnet/gmod/GmodPublishingUtility.java new file mode 100644 index 0000000..6ebe83f --- /dev/null +++ b/src/com/alatnet/gmod/GmodPublishingUtility.java @@ -0,0 +1,413 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod; + +import com.alatnet.gmod.logHandlers.SystemOutHandler; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Scanner; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author alatnet + */ + +/* +gmpublsh create -addon -icon +gmpublush update -addon -id -changes +gmpublish list + +gmad.exe create -folder -out +gmad.exe extract -file [-out ] +*/ + +public class GmodPublishingUtility { + // + //paths + public static String gmadPath=""; + public static String gmad="gmad.exe"; + public static String gmpublishPath=""; + public static String gmpublish="gmpublish.exe"; + + //gma creation + public static boolean convertFilenames=false; + + //queue + public static boolean Q_autoRemoveCompleted=false; + + //smart queue + public static int SQ_uploadDelay=300; //5 minutes + public static int SQ_uploadRetryTimes=5; + public static int SQ_numThreads=5; + public static boolean SQ_autoRemoveCompleted=false; + public static boolean useSmartQueue=false; + public static boolean SQ_uploadRetryDelayE=false; + public static int SQ_uploadRetryDelayI=30; + + //misc + public static boolean openBrowserOnCreate=false; + public static boolean useJavaLAF=false; + public static String javaLAF="Nimbus"; + + //testing system + public static boolean simulateSystem=false; + public static boolean simulateSystemError=false; + public static int simulateSystemWait=3000; + // + + //logger system + public static final Logger gmpuLogger=Logger.getLogger("gmpuLog"); + private static final Level gmpuLoggerLevelOrig = Level.ALL;//gmpuLogger.getLevel(); + + public static boolean unixSys=false; + + //hack? to see if on a unix system. + static { + if (File.separatorChar == '/'){ + gmad="gmad"; + gmpublish="gmpublish"; + unixSys=true; + } + } + + private static MainFrame mainFrame; + + //public static boolean enableLogging=true; + + private static void checkSettings(){ + Scanner scanner; + try { + scanner = new Scanner(new BufferedReader(new FileReader("gmpuSettings.settings"))); + + //gmpu v1.0+ settings + gmadPath = scanner.nextLine(); + gmpublishPath = scanner.nextLine(); + gmad = scanner.nextLine(); + gmpublish = scanner.nextLine(); + + //gmpu v2.0 settings + if (scanner.hasNext()){ + convertFilenames=scanner.nextBoolean(); + SQ_uploadDelay=scanner.nextInt(); + SQ_uploadRetryTimes=scanner.nextInt(); + SQ_numThreads=scanner.nextInt(); + SQ_autoRemoveCompleted=scanner.nextBoolean(); + Q_autoRemoveCompleted=scanner.nextBoolean(); + useSmartQueue=scanner.nextBoolean(); + openBrowserOnCreate=scanner.nextBoolean(); + useJavaLAF=scanner.nextBoolean(); + scanner.nextLine(); + javaLAF=scanner.nextLine(); + } + + //gmpu v2.2 + if (scanner.hasNext()){ + SQ_uploadRetryDelayE=scanner.nextBoolean(); + SQ_uploadRetryDelayI=scanner.nextInt(); + } + + scanner.close(); + } catch (FileNotFoundException ex) { + Logger.getLogger(GmodPublishingUtility.class.getName()).log(Level.SEVERE, null, ex); + gmpuLogger.log(Level.SEVERE, "Settings file not found. Requesting Paths."); + + GmodPaths paths = new GmodPaths(null,true); + paths.setVisible(true); + + if (paths.pressedOK()){ + gmadPath = paths.getGmadPath(); + gmpublishPath = paths.getGmpublishPath(); + gmad = paths.getGmadProgram(); + gmpublish = paths.getGmpublishProgram(); + } + + gmpuLogger.log(Level.INFO, "Paths set!"); + } + } + + public static void saveSettings(){ + PrintWriter PW; + try { + PW = new PrintWriter(new BufferedWriter(new FileWriter("gmpuSettings.settings"))); + + PW.println(gmadPath); + PW.println(gmpublishPath); + PW.println(gmad); + PW.println(gmpublish); + + //gmpu v2.0 + PW.println(convertFilenames); + PW.println(SQ_uploadDelay); + PW.println(SQ_uploadRetryTimes); + PW.println(SQ_numThreads); + PW.println(SQ_autoRemoveCompleted); + PW.println(Q_autoRemoveCompleted); + PW.println(useSmartQueue); + PW.println(openBrowserOnCreate); + PW.println(useJavaLAF); + PW.println(javaLAF); + + //gmpu v2.2 + PW.println(SQ_uploadRetryDelayE); + PW.println(SQ_uploadRetryDelayI); + + PW.flush(); + PW.close(); + /*BW.flush(); + BW.close();*/ + } catch (IOException ex) { + Logger.getLogger(GmodPublishingUtility.class.getName()).log(Level.SEVERE, null, ex); + } + } + + private static void checkDebug(){ + Scanner scanner; + try { + scanner = new Scanner(new BufferedReader(new FileReader("gmpuDebug.settings"))); + gmpuLogger.log(Level.CONFIG, "Debug settings found!"); + simulateSystem=scanner.nextBoolean(); + simulateSystemError=scanner.nextBoolean(); + simulateSystemWait=scanner.nextInt(); + scanner.close(); + } catch (FileNotFoundException ex) { + } + } + + private static void setupLogging(){ + gmpuLogger.setUseParentHandlers(false); + gmpuLogger.setLevel(Level.ALL); + gmpuLogger.addHandler(new SystemOutHandler()); + gmpuLogger.log(Level.CONFIG, "Console Logging Initialized."); + } + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + setupLogging(); + checkDebug(); + checkSettings(); + + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + + if (useJavaLAF){ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if (javaLAF.equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + } + // + + if (args.length == 0){ + mainFrame = new MainFrame(); + mainFrame.setVisible(true); + }else if (args[0].equals("/h") || args[0].equals("-h") || args[0].equals("--h") || args[0].equals("-help") || args[0].equals("--help")){ + // + System.out.println("Gmod Publishing Utility."); + System.out.println("Usage:"); + System.out.println(" java -jar gmpu.jar [ [ [...]]]"); + System.out.println(" Commands:"); + System.out.println(" -s {gmpublish|gmad|gmpublishPath|gmadPath|paths} "); + System.out.println(" set {gmpublish|gmad|gmpublishPath|gmadPath|paths} "); + System.out.println(" -Set the program and paths to gmpublish and gmad."); + System.out.println(" -l"); + System.out.println(" list"); + System.out.println(" -List all addons published to the workshop."); + System.out.println(" -e [-o ]"); + System.out.println(" extract [-o ]"); + System.out.println(" -Extract a gma file."); + System.out.println(" -u [-c ]"); + System.out.println(" update [-c ]"); + System.out.println(" -Update an addon in the workshop."); + System.out.println(" -c -icon "); + System.out.println(" create -icon "); + System.out.println(" -Create and publish an addon."); + System.out.println(" -c gma "); + System.out.println(" create gma "); + System.out.println(" -Create a gma file."); + /* + * commands: + * set {gmpublish|gmad|gmpublishPath|gmadPath|paths} * Should work + * extract [-o ] * Works + * list * Works + * update [-c ] * Unknown + * create -icon * Unknown + * create gma * Works + */ + // + }else{ + // + Deque jobs=new ArrayDeque<>(); + + Deque argList=new ArrayDeque<>(); + for (int i=0; i + jobs.addLast(new gmpuJob(gmpuJob.LIST)); + break; + // + case "-s": + case "set": + // + switch (argList.pop()){ + case "gmpublishPath": + gmpublishPath=argList.pop(); + break; + case "gmadPath": + gmadPath=argList.pop(); + break; + case "gmpublish": + gmpublish=argList.pop(); + break; + case "gmad": + gmad=argList.pop(); + break; + case "paths": + gmpublishPath=gmadPath=argList.pop(); + break; + /*case "dialog": + break;*/ + } + break; + // + case "-e": + case "extract": + // + job = new gmpuJob(gmpuJob.EXTRACT); + job.extractName = argList.pop(); + try{ + if (argList.peek().equals("-o")){ + argList.pop(); + job.extractOut = argList.pop(); + } + }catch(Exception e){ + } + jobs.addLast(job); + job = null; + break; + // + case "-u": + case "update": + // + /* + * update: + * createGmaFolder - only when updating from a folder. + * createGmaOut - required + * updateID - required + * updateChanges - optional + */ + job = new gmpuJob(gmpuJob.UPDATE); + addon = argList.pop(); + if (addon.endsWith(".gma")){ + job.createGmaOut = addon; + }else{ + job.createGmaFolder = addon; + //job.createGmaOut = "temp.gma"; + } + job.updateID=argList.pop(); + if (argList.peek().equals("-c")){ + argList.pop(); + job.updateChanges = argList.pop(); + } + jobs.addLast(job); + job = null; + break; + // + case "-c": + case "create": + // + /* + * create: + * createGmaFolder - only when creating directly from folder + * createGmaOut - required + * createIcon - required + */ + try{ + if (argList.peek().equals("gma")){ + argList.pop(); + job = new gmpuJob(gmpuJob.CREATE_GMA); + job.createGmaFolder = argList.pop(); + job.createGmaOut = argList.pop(); + }else{ //create -icon + job = new gmpuJob(gmpuJob.CREATE); + addon = argList.pop(); + if (addon.endsWith(".gma")){ + job.createGmaOut = addon; + }else{ + job.createGmaFolder = addon; + //job.createGmaOut = "temp.gma"; + } + job.createIcon = argList.pop(); + } + }catch(Exception ex){ + } + + jobs.addLast(job); + job = null; + break; + // + } + } + + // + while (jobs.size()!=0){ + gmpuJob gJob = jobs.pop(); + if (gJob.getJobType() == gmpuJob.LIST) gmpuLogger.setLevel(Level.WARNING);//gmpuLogger.setLevel(Level.OFF); + try { + gJob.call(); + } catch (Exception ex) { + Logger.getLogger(GmodPublishingUtility.class.getName()).log(Level.SEVERE, null, ex); + } + if (gJob.getJobType() == gmpuJob.LIST){ + gmpuLogger.setLevel(gmpuLoggerLevelOrig); + System.out.println("List of Addons in Workshop:"); + for (int i=0;i + /* + * commands: + * set {gmpublish|gmad|gmpublishPath|gmadPath|paths} * Should work + * extract [-o ] * Works + * list * Works + * update [-c ] * works + * create -icon * works + * create gma * Works + */ + // + } + saveSettings(); + } +} diff --git a/src/com/alatnet/gmod/JTextAreaHandler.java b/src/com/alatnet/gmod/JTextAreaHandler.java new file mode 100644 index 0000000..94c12ef --- /dev/null +++ b/src/com/alatnet/gmod/JTextAreaHandler.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod; + +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import javax.swing.JTextArea; + +/** + * + * @author alatnet + */ +public class JTextAreaHandler extends Handler { + JTextArea jTxtArea; + + public JTextAreaHandler(JTextArea jTxtArea){ this.jTxtArea=jTxtArea; } + + @Override + public void publish(LogRecord lr) { + lr.getLevel(); + if (lr.getLevel() != Level.INFO){ + jTxtArea.append("[" + lr.getLevel().getLocalizedName() + "] " + lr.getMessage() + "\n"); + }else{ + jTxtArea.append(lr.getMessage() + "\n"); + } + jTxtArea.setCaretPosition(jTxtArea.getText().length()); + } + + @Override + public void flush() { + } + + @Override + public void close() throws SecurityException { + } +} diff --git a/src/com/alatnet/gmod/MainFrame.form b/src/com/alatnet/gmod/MainFrame.form new file mode 100644 index 0000000..90b23d8 --- /dev/null +++ b/src/com/alatnet/gmod/MainFrame.form @@ -0,0 +1,1004 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/com/alatnet/gmod/MainFrame.java b/src/com/alatnet/gmod/MainFrame.java new file mode 100644 index 0000000..40cf7b4 --- /dev/null +++ b/src/com/alatnet/gmod/MainFrame.java @@ -0,0 +1,1548 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod; + +import com.alatnet.gmod.logHandlers.JTextAreaHandler; +import com.alatnet.gmod.queue.*; +import com.alatnet.gmod.tableModels.*; +import java.awt.AlphaComposite; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.ArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.imageio.ImageIO; +import javax.swing.ImageIcon; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.filechooser.FileNameExtensionFilter; + +/** + * + * @author alatnet + */ +public class MainFrame extends javax.swing.JFrame { + private static JTextAreaHandler MainFrameLogArea; + private JFileChooser fileChooser; + private static FileNameExtensionFilter imageFileFilter = new FileNameExtensionFilter("JPG or JPEG Images [.jpg,.jpeg]", "jpg", "jpeg"); + private static FileNameExtensionFilter gmaFileFilter = new FileNameExtensionFilter("Gmod Archive [.gma]", "gma"); + private ArrayList tagsChkBoxes; + + private gmpuQueueRoot queueRoot=null; + + /** + * Creates new form MainFrame + */ + public MainFrame() { + initComponents(); + initComponents2(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + modeButtonGroup = new javax.swing.ButtonGroup(); + typeButtonGroup = new javax.swing.ButtonGroup(); + tagsButtonGroup = new javax.swing.ButtonGroup(); + tagsButtonGroup.add(chkFun); + tagsButtonGroup.add(chkRoleplay); + tagsButtonGroup.add(chkScenic); + tagsButtonGroup.add(chkMovie); + tagsButtonGroup.add(chkRealism); + tagsButtonGroup.add(chkCartoon); + tagsButtonGroup.add(chkWater); + tagsButtonGroup.add(chkComic); + tagsButtonGroup.add(chkBuild); + jScrollPane1 = new javax.swing.JScrollPane(); + jPanel1 = new javax.swing.JPanel(); + jPanel2 = new javax.swing.JPanel(); + jScrollPane2 = new javax.swing.JScrollPane(); + LogTxtArea = new javax.swing.JTextArea(); + jPanel3 = new javax.swing.JPanel(); + btnCreate = new javax.swing.JRadioButton(); + btnUpdate = new javax.swing.JRadioButton(); + btnExtract = new javax.swing.JRadioButton(); + btnCreateGMA = new javax.swing.JRadioButton(); + jPanel5 = new javax.swing.JPanel(); + txtCreateFileFolder = new javax.swing.JTextField(); + btnCreateFile = new javax.swing.JButton(); + btnCreateFolder = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + txtCreateIcon = new javax.swing.JTextField(); + btnCreateIcon = new javax.swing.JButton(); + pnlIconPreview = new javax.swing.JPanel(); + lblIconPreview = new javax.swing.JLabel(); + jPanel8 = new javax.swing.JPanel(); + jLabel3 = new javax.swing.JLabel(); + txtAddonTitle = new javax.swing.JTextField(); + jPanel9 = new javax.swing.JPanel(); + btnGamemode = new javax.swing.JRadioButton(); + btnMap = new javax.swing.JRadioButton(); + btnWeapon = new javax.swing.JRadioButton(); + btnVehicle = new javax.swing.JRadioButton(); + btnNPC = new javax.swing.JRadioButton(); + btnTool = new javax.swing.JRadioButton(); + btnEffects = new javax.swing.JRadioButton(); + btnModel = new javax.swing.JRadioButton(); + btnServerContent = new javax.swing.JRadioButton(); + jPanel10 = new javax.swing.JPanel(); + chkFun = new javax.swing.JCheckBox(); + chkRoleplay = new javax.swing.JCheckBox(); + chkScenic = new javax.swing.JCheckBox(); + chkCartoon = new javax.swing.JCheckBox(); + chkRealism = new javax.swing.JCheckBox(); + chkMovie = new javax.swing.JCheckBox(); + chkBuild = new javax.swing.JCheckBox(); + chkComic = new javax.swing.JCheckBox(); + chkWater = new javax.swing.JCheckBox(); + jLabel4 = new javax.swing.JLabel(); + txtAddonIgnore = new javax.swing.JTextField(); + jPanel4 = new javax.swing.JPanel(); + jScrollPane3 = new javax.swing.JScrollPane(); + tblAddonList = new javax.swing.JTable(); + txtGMAOut = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); + btnGMAOut = new javax.swing.JButton(); + jLabel7 = new javax.swing.JLabel(); + txtUpdateChanges = new javax.swing.JTextField(); + jPanel6 = new javax.swing.JPanel(); + jScrollPane4 = new javax.swing.JScrollPane(); + tblQueue = new javax.swing.JTable(); + btnQueueExecute = new javax.swing.JButton(); + btnQueueClear = new javax.swing.JButton(); + jPanel7 = new javax.swing.JPanel(); + jLabel5 = new javax.swing.JLabel(); + txtExtractFile = new javax.swing.JTextField(); + btnExtractFile = new javax.swing.JButton(); + chkExtractOut = new javax.swing.JCheckBox(); + txtExtractOut = new javax.swing.JTextField(); + btnExtractOutFolder = new javax.swing.JButton(); + btnAddQueue = new javax.swing.JButton(); + btnSettings = new javax.swing.JButton(); + + modeButtonGroup.add(btnCreate); + modeButtonGroup.add(btnCreateGMA); + modeButtonGroup.add(btnUpdate); + modeButtonGroup.add(btnExtract); + + typeButtonGroup.add(btnGamemode); + typeButtonGroup.add(btnMap); + typeButtonGroup.add(btnWeapon); + typeButtonGroup.add(btnVehicle); + typeButtonGroup.add(btnNPC); + typeButtonGroup.add(btnTool); + typeButtonGroup.add(btnEffects); + typeButtonGroup.add(btnModel); + typeButtonGroup.add(btnServerContent); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("GMod Publishing Utility"); + setName("MainFrame"); // NOI18N + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + formWindowClosing(evt); + } + }); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Log")); + + LogTxtArea.setEditable(false); + LogTxtArea.setColumns(20); + LogTxtArea.setRows(5); + jScrollPane2.setViewportView(LogTxtArea); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE) + .addContainerGap()) + ); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Mode")); + + btnCreate.setSelected(true); + btnCreate.setText("Create"); + btnCreate.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + modeSelectActionPerformed(evt); + } + }); + + btnUpdate.setText("Update"); + btnUpdate.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + modeSelectActionPerformed(evt); + } + }); + + btnExtract.setText("Extract"); + btnExtract.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + modeSelectActionPerformed(evt); + } + }); + + btnCreateGMA.setText("Create GMA"); + btnCreateGMA.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + modeSelectActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnCreate) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnCreateGMA) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnUpdate) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnExtract)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnCreate) + .addComponent(btnUpdate) + .addComponent(btnExtract) + .addComponent(btnCreateGMA)) + ); + + jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Create\\Create GMA\\Update")); + + btnCreateFile.setText("File"); + btnCreateFile.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnCreateFileActionPerformed(evt); + } + }); + + btnCreateFolder.setText("Folder"); + btnCreateFolder.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnCreateFolderActionPerformed(evt); + } + }); + + jLabel1.setText("File or Folder: "); + + jLabel2.setText("Icon:"); + + txtCreateIcon.setEditable(false); + txtCreateIcon.setColumns(30); + txtCreateIcon.setRequestFocusEnabled(false); + + btnCreateIcon.setText("Load"); + btnCreateIcon.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnCreateIconActionPerformed(evt); + } + }); + + pnlIconPreview.setBorder(javax.swing.BorderFactory.createTitledBorder("Icon Preview")); + + lblIconPreview.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblIconPreview.setText("No Preview"); + lblIconPreview.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + + javax.swing.GroupLayout pnlIconPreviewLayout = new javax.swing.GroupLayout(pnlIconPreview); + pnlIconPreview.setLayout(pnlIconPreviewLayout); + pnlIconPreviewLayout.setHorizontalGroup( + pnlIconPreviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlIconPreviewLayout.createSequentialGroup() + .addComponent(lblIconPreview, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + ); + pnlIconPreviewLayout.setVerticalGroup( + pnlIconPreviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(lblIconPreview, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) + ); + + jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Addon.json")); + + jLabel3.setText("Title: "); + + jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Type")); + + btnGamemode.setText("Gamemode"); + + btnMap.setText("Map"); + + btnWeapon.setText("Weapon"); + + btnVehicle.setText("Vehicle"); + + btnNPC.setText("NPC"); + + btnTool.setText("Tool"); + + btnEffects.setText("Effects"); + + btnModel.setText("Model"); + + btnServerContent.setText("Server Content"); + + javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); + jPanel9.setLayout(jPanel9Layout); + jPanel9Layout.setHorizontalGroup( + jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel9Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel9Layout.createSequentialGroup() + .addComponent(btnGamemode) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnMap) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnWeapon) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnVehicle) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel9Layout.createSequentialGroup() + .addComponent(btnNPC) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnTool) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnEffects) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnModel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnServerContent) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + ); + jPanel9Layout.setVerticalGroup( + jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel9Layout.createSequentialGroup() + .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnGamemode) + .addComponent(btnMap) + .addComponent(btnWeapon) + .addComponent(btnVehicle)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnNPC) + .addComponent(btnTool) + .addComponent(btnEffects) + .addComponent(btnModel) + .addComponent(btnServerContent))) + ); + + jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Tags")); + + chkFun.setText("Fun"); + chkFun.setName("fun"); // NOI18N + chkFun.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tagsActionPerformed(evt); + } + }); + + chkRoleplay.setText("Roleplay"); + chkRoleplay.setName("roleplay"); // NOI18N + chkRoleplay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tagsActionPerformed(evt); + } + }); + + chkScenic.setText("Scenic"); + chkScenic.setName("scenic"); // NOI18N + chkScenic.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tagsActionPerformed(evt); + } + }); + + chkCartoon.setText("Cartoon"); + chkCartoon.setName("cartoon"); // NOI18N + chkCartoon.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tagsActionPerformed(evt); + } + }); + + chkRealism.setText("Realism"); + chkRealism.setName("realism"); // NOI18N + chkRealism.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tagsActionPerformed(evt); + } + }); + + chkMovie.setText("Movie"); + chkMovie.setName("movie"); // NOI18N + chkMovie.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tagsActionPerformed(evt); + } + }); + + chkBuild.setText("Build"); + chkBuild.setName("build"); // NOI18N + chkBuild.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tagsActionPerformed(evt); + } + }); + + chkComic.setText("Comic"); + chkComic.setName("comic"); // NOI18N + chkComic.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tagsActionPerformed(evt); + } + }); + + chkWater.setText("Water"); + chkWater.setName("water"); // NOI18N + chkWater.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tagsActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); + jPanel10.setLayout(jPanel10Layout); + jPanel10Layout.setHorizontalGroup( + jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel10Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel10Layout.createSequentialGroup() + .addComponent(chkFun) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(chkRoleplay) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(chkScenic) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(chkMovie) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(chkRealism)) + .addGroup(jPanel10Layout.createSequentialGroup() + .addComponent(chkCartoon) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(chkWater) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(chkComic) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(chkBuild)))) + ); + jPanel10Layout.setVerticalGroup( + jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup() + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(chkFun) + .addComponent(chkRoleplay) + .addComponent(chkScenic) + .addComponent(chkMovie) + .addComponent(chkRealism)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(chkCartoon) + .addComponent(chkWater) + .addComponent(chkComic) + .addComponent(chkBuild))) + ); + + jLabel4.setText("Ignore: "); + + txtAddonIgnore.setText("\"*.psd\", \"*.vcproj\", \"*.svn*\""); + + javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); + jPanel8.setLayout(jPanel8Layout); + jPanel8Layout.setHorizontalGroup( + jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel8Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel8Layout.createSequentialGroup() + .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel8Layout.createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtAddonTitle)) + .addGroup(jPanel8Layout.createSequentialGroup() + .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addGap(10, 10, 10)) + .addGroup(jPanel8Layout.createSequentialGroup() + .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel8Layout.createSequentialGroup() + .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel8Layout.createSequentialGroup() + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtAddonIgnore))) + .addContainerGap()))) + ); + jPanel8Layout.setVerticalGroup( + jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel8Layout.createSequentialGroup() + .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(txtAddonTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(txtAddonIgnore, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + ); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Addon List")); + + tblAddonList.setModel(new tableModelAddons()); + tblAddonList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); + tblAddonList.setSurrendersFocusOnKeystroke(true); + jScrollPane3.setViewportView(tblAddonList); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane3) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE) + ); + + jLabel6.setText("GMA Output: "); + + btnGMAOut.setText("Select"); + btnGMAOut.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnGMAOutActionPerformed(evt); + } + }); + + jLabel7.setText("Changes: "); + + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtCreateFileFolder) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnCreateFile) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnCreateFolder)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlIconPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtCreateIcon) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnCreateIcon)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel7) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtUpdateChanges)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel6) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtGMAOut) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnGMAOut)))) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(txtCreateFileFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnCreateFolder) + .addComponent(btnCreateFile)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(txtCreateIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnCreateIcon)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pnlIconPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(txtUpdateChanges, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(txtGMAOut, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnGMAOut))) + ); + + jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Queue")); + + tblQueue.setModel(new tableModelQueue()); + jScrollPane4.setViewportView(tblQueue); + + btnQueueExecute.setText("Execute"); + btnQueueExecute.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnQueueExecuteActionPerformed(evt); + } + }); + + btnQueueClear.setText("Clear"); + btnQueueClear.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnQueueClearActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); + jPanel6.setLayout(jPanel6Layout); + jPanel6Layout.setHorizontalGroup( + jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel6Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jScrollPane4) + .addGroup(jPanel6Layout.createSequentialGroup() + .addComponent(btnQueueExecute) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnQueueClear))) + .addContainerGap()) + ); + jPanel6Layout.setVerticalGroup( + jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel6Layout.createSequentialGroup() + .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnQueueExecute) + .addComponent(btnQueueClear)) + .addContainerGap()) + ); + + jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Extract")); + + jLabel5.setText("File: "); + + btnExtractFile.setText("File"); + btnExtractFile.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnExtractFileActionPerformed(evt); + } + }); + + chkExtractOut.setText("Out: "); + chkExtractOut.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + chkExtractOutActionPerformed(evt); + } + }); + + btnExtractOutFolder.setText("Folder"); + btnExtractOutFolder.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnExtractOutFolderActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); + jPanel7.setLayout(jPanel7Layout); + jPanel7Layout.setHorizontalGroup( + jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel7Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel7Layout.createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtExtractFile) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnExtractFile)) + .addGroup(jPanel7Layout.createSequentialGroup() + .addComponent(chkExtractOut) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtExtractOut) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnExtractOutFolder))) + .addContainerGap()) + ); + jPanel7Layout.setVerticalGroup( + jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel7Layout.createSequentialGroup() + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(txtExtractFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnExtractFile)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(chkExtractOut) + .addComponent(txtExtractOut, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnExtractOutFolder))) + ); + + btnAddQueue.setText("Add to Queue"); + btnAddQueue.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnAddQueueActionPerformed(evt); + } + }); + + btnSettings.setText("Settings"); + btnSettings.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnSettingsActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(btnSettings) + .addGap(355, 355, 355) + .addComponent(btnAddQueue)) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnSettings) + .addComponent(btnAddQueue))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) + ); + + jScrollPane1.setViewportView(jPanel1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1) + ); + + pack(); + }// //GEN-END:initComponents + + private void initComponents2() { + this.fileChooser = new JFileChooser(); + //btnCreate; + //btnUpdate; + this.btnCreateFile.setEnabled(true); + this.btnCreateFolder.setEnabled(true); + this.btnCreateIcon.setEnabled(true); + this.btnEffects.setEnabled(true); + this.btnGamemode.setEnabled(true); + this.btnMap.setEnabled(true); + this.btnModel.setEnabled(true); + this.btnNPC.setEnabled(true); + this.btnTool.setEnabled(true); + this.btnVehicle.setEnabled(true); + this.btnWeapon.setEnabled(true); + this.btnServerContent.setEnabled(true); + this.chkBuild.setEnabled(true); + this.chkCartoon.setEnabled(true); + this.chkComic.setEnabled(true); + this.chkFun.setEnabled(true); + this.chkMovie.setEnabled(true); + this.chkRealism.setEnabled(true); + this.chkRoleplay.setEnabled(true); + this.chkScenic.setEnabled(true); + this.chkWater.setEnabled(true); + this.tblAddonList.setEnabled(false); + this.txtAddonIgnore.setEnabled(true); + this.txtAddonTitle.setEnabled(true); + this.txtCreateFileFolder.setEnabled(true); + this.txtCreateIcon.setEnabled(true); + this.txtGMAOut.setEnabled(false); + this.btnGMAOut.setEnabled(false); + this.txtUpdateChanges.setEditable(false); + //btnExtract; + this.txtExtractFile.setEnabled(false); + this.txtExtractOut.setEnabled(false); + this.btnExtractFile.setEnabled(false); + this.btnExtractOutFolder.setEnabled(false); + this.chkExtractOut.setEnabled(false); + + MainFrameLogArea = new JTextAreaHandler(this.LogTxtArea); + GmodPublishingUtility.gmpuLogger.addHandler(MainFrameLogArea); + GmodPublishingUtility.gmpuLogger.log(Level.CONFIG, "Logging Initiallized."); + + new Thread(){ + @Override + public void run(){ + gmpuJob listItems = new gmpuJob(gmpuJob.LIST); + try { + listItems.call(); + } catch (Exception ex) { + Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); + } + + tableModelAddons tblModel = (tableModelAddons) tblAddonList.getModel(); + + for (int i=0;i(); + this.tagsChkBoxes.add(this.chkBuild); + this.tagsChkBoxes.add(this.chkCartoon); + this.tagsChkBoxes.add(this.chkComic); + this.tagsChkBoxes.add(this.chkFun); + this.tagsChkBoxes.add(this.chkMovie); + this.tagsChkBoxes.add(this.chkRealism); + this.tagsChkBoxes.add(this.chkRoleplay); + this.tagsChkBoxes.add(this.chkScenic); + this.tagsChkBoxes.add(this.chkWater); + + this.tblQueue.getSelectionModel().addListSelectionListener(new tblQueueListSelectionListener()); + } + + private class tblQueueListSelectionListener implements ListSelectionListener{ + @Override + public void valueChanged(ListSelectionEvent lse) { + if (tblQueue.getSelectedRows().length==0) btnQueueClear.setText("Clear"); + else btnQueueClear.setText("Remove"); + } + } + + private void setTagsEnabled(boolean enabled){ + this.chkBuild.setEnabled(enabled); + this.chkCartoon.setEnabled(enabled); + this.chkComic.setEnabled(enabled); + this.chkFun.setEnabled(enabled); + this.chkMovie.setEnabled(enabled); + this.chkRealism.setEnabled(enabled); + this.chkRoleplay.setEnabled(enabled); + this.chkScenic.setEnabled(enabled); + this.chkWater.setEnabled(enabled); + } + + private void setTagsSelected(boolean selected){ + this.chkBuild.setSelected(selected); + this.chkCartoon.setSelected(selected); + this.chkComic.setSelected(selected); + this.chkFun.setSelected(selected); + this.chkMovie.setSelected(selected); + this.chkRealism.setSelected(selected); + this.chkRoleplay.setSelected(selected); + this.chkScenic.setSelected(selected); + this.chkWater.setSelected(selected); + } + + private void setTypeEnabled(boolean enabled){ + this.btnEffects.setEnabled(enabled); + this.btnGamemode.setEnabled(enabled); + this.btnMap.setEnabled(enabled); + this.btnModel.setEnabled(enabled); + this.btnNPC.setEnabled(enabled); + this.btnTool.setEnabled(enabled); + this.btnVehicle.setEnabled(enabled); + this.btnWeapon.setEnabled(enabled); + this.btnServerContent.setEnabled(enabled); + } + + private void setTypeSelected(boolean selected){ + this.btnEffects.setSelected(selected); + this.btnGamemode.setSelected(selected); + this.btnMap.setSelected(selected); + this.btnModel.setSelected(selected); + this.btnNPC.setSelected(selected); + this.btnTool.setSelected(selected); + this.btnVehicle.setSelected(selected); + this.btnWeapon.setSelected(selected); + this.btnServerContent.setSelected(selected); + } + + private void setAddonJsonEnabled(boolean enabled){ + setTagsEnabled(enabled); + setTypeEnabled(enabled); + this.txtAddonTitle.setEnabled(enabled); + this.txtAddonIgnore.setEnabled(enabled); + } + + private void modeSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modeSelectActionPerformed + if (this.btnCreate.isSelected()){ + //btnCreate; + //btnUpdate; + this.btnCreateFile.setEnabled(true); + this.btnCreateFolder.setEnabled(true); + this.btnCreateIcon.setEnabled(true); + this.txtUpdateChanges.setEnabled(false); + setAddonJsonEnabled(true); + this.tblAddonList.setEnabled(false); + this.txtCreateFileFolder.setEnabled(true); + this.txtCreateIcon.setEnabled(true); + this.txtGMAOut.setEnabled(false); + this.btnGMAOut.setEnabled(false); + this.txtUpdateChanges.setEditable(false); + //btnExtract; + this.txtExtractFile.setEnabled(false); + this.txtExtractOut.setEnabled(false); + this.txtExtractFile.setText(""); + this.txtExtractOut.setText(""); + this.btnExtractFile.setEnabled(false); + this.btnExtractOutFolder.setEnabled(false); + this.chkExtractOut.setEnabled(false); + this.chkExtractOut.setSelected(false); + + this.lblIconPreview.setText("No Preview."); + this.lblIconPreview.setIcon(null); + this.txtCreateIcon.setText(""); + + this.tblAddonList.clearSelection(); + setTypeSelected(false); + setTagsSelected(false); + this.txtCreateFileFolder.setText(""); + this.txtAddonTitle.setText(""); + this.txtUpdateChanges.setText(""); + this.txtGMAOut.setText(""); + }else if (this.btnUpdate.isSelected()){ + //btnCreate; + //btnUpdate; + this.btnCreateFile.setEnabled(true); + this.btnCreateFolder.setEnabled(true); + this.btnCreateIcon.setEnabled(false); + this.txtUpdateChanges.setEnabled(true); + setAddonJsonEnabled(true); + this.tblAddonList.setEnabled(true); + this.txtCreateFileFolder.setEnabled(true); + this.txtCreateIcon.setEnabled(false); + this.txtGMAOut.setEnabled(false); + this.btnGMAOut.setEnabled(false); + this.txtUpdateChanges.setEditable(true); + //btnExtract; + this.txtExtractFile.setEnabled(false); + this.txtExtractOut.setEnabled(false); + this.txtExtractFile.setText(""); + this.txtExtractOut.setText(""); + this.btnExtractFile.setEnabled(false); + this.btnExtractOutFolder.setEnabled(false); + this.chkExtractOut.setEnabled(false); + this.chkExtractOut.setSelected(false); + + this.tblAddonList.clearSelection(); + setTypeSelected(false); + setTagsSelected(false); + this.txtCreateFileFolder.setText(""); + this.txtAddonTitle.setText(""); + this.txtUpdateChanges.setText(""); + this.txtGMAOut.setText(""); + }else if (this.btnExtract.isSelected()){ + //btnCreate; + //btnUpdate; + this.btnCreateFile.setEnabled(false); + this.btnCreateFolder.setEnabled(false); + this.btnCreateIcon.setEnabled(false); + this.txtUpdateChanges.setEnabled(false); + setAddonJsonEnabled(false); + this.tblAddonList.setEnabled(false); + this.txtCreateFileFolder.setEnabled(false); + this.txtCreateIcon.setEnabled(false); + this.txtGMAOut.setEnabled(false); + this.btnGMAOut.setEnabled(false); + this.txtUpdateChanges.setEditable(false); + //btnExtract; + this.txtExtractFile.setEnabled(true); + this.txtExtractOut.setEnabled(false); + this.txtExtractFile.setText(""); + this.txtExtractOut.setText(""); + this.btnExtractFile.setEnabled(true); + this.btnExtractOutFolder.setEnabled(false); + this.chkExtractOut.setEnabled(true); + this.chkExtractOut.setSelected(false); + + this.lblIconPreview.setText("No Preview."); + this.lblIconPreview.setIcon(null); + this.txtCreateIcon.setText(""); + + this.tblAddonList.clearSelection(); + setTypeSelected(false); + setTagsSelected(false); + this.txtCreateFileFolder.setText(""); + this.txtAddonTitle.setText(""); + this.txtUpdateChanges.setText(""); + this.txtGMAOut.setText(""); + }else if (this.btnCreateGMA.isSelected()){ + //btnCreate; + //btnUpdate; + this.btnCreateFile.setEnabled(false); + this.btnCreateFolder.setEnabled(true); + this.btnCreateIcon.setEnabled(false); + this.txtUpdateChanges.setEnabled(false); + setAddonJsonEnabled(true); + this.tblAddonList.setEnabled(false); + this.txtCreateFileFolder.setEnabled(true); + this.txtCreateIcon.setEnabled(false); + this.txtGMAOut.setEnabled(true); + this.btnGMAOut.setEnabled(true); + this.txtUpdateChanges.setEditable(false); + //btnExtract; + this.txtExtractFile.setEnabled(false); + this.txtExtractOut.setEnabled(false); + this.txtExtractFile.setText(""); + this.txtExtractOut.setText(""); + this.btnExtractFile.setEnabled(false); + this.btnExtractOutFolder.setEnabled(false); + this.chkExtractOut.setEnabled(false); + this.chkExtractOut.setSelected(false); + + this.lblIconPreview.setText("No Preview."); + this.lblIconPreview.setIcon(null); + this.txtCreateIcon.setText(""); + + this.tblAddonList.clearSelection(); + setTypeSelected(false); + setTagsSelected(false); + this.txtCreateFileFolder.setText(""); + this.txtAddonTitle.setText(""); + this.txtUpdateChanges.setText(""); + this.txtGMAOut.setText(""); + } + }//GEN-LAST:event_modeSelectActionPerformed + + private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing + GmodPublishingUtility.saveSettings(); + MainFrameLogArea.close(); + }//GEN-LAST:event_formWindowClosing + + private void btnSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSettingsActionPerformed + Settings settings = new Settings(this,true); + settings.setPathsData(GmodPublishingUtility.gmpublishPath, GmodPublishingUtility.gmpublish, GmodPublishingUtility.gmadPath, GmodPublishingUtility.gmad); + settings.setBooleanData(GmodPublishingUtility.convertFilenames, GmodPublishingUtility.openBrowserOnCreate, GmodPublishingUtility.Q_autoRemoveCompleted, GmodPublishingUtility.SQ_autoRemoveCompleted, GmodPublishingUtility.useSmartQueue,GmodPublishingUtility.SQ_uploadRetryDelayE); + settings.setSpinData(GmodPublishingUtility.SQ_uploadDelay, GmodPublishingUtility.SQ_numThreads, GmodPublishingUtility.SQ_uploadRetryTimes,GmodPublishingUtility.SQ_uploadRetryDelayI); + settings.setLookAndFeelData(GmodPublishingUtility.useJavaLAF, GmodPublishingUtility.javaLAF); + settings.setVisible(true); + GmodPublishingUtility.gmad = settings.getGmadProgram(); + GmodPublishingUtility.gmadPath = settings.getGmadPath(); + GmodPublishingUtility.gmpublish = settings.getGmpublishProgram(); + GmodPublishingUtility.gmpublishPath = settings.getGmpublishPath(); + GmodPublishingUtility.convertFilenames=settings.getConvertFileNames(); + GmodPublishingUtility.openBrowserOnCreate=settings.getOpenBrowserOnCreate(); + GmodPublishingUtility.Q_autoRemoveCompleted=settings.getQueueAutoRemove(); + GmodPublishingUtility.SQ_autoRemoveCompleted=settings.getSQueueAutoRemove(); + GmodPublishingUtility.useSmartQueue=settings.getSQueueEnable(); + GmodPublishingUtility.SQ_uploadDelay=settings.getSQueueDelay(); + GmodPublishingUtility.SQ_numThreads=settings.getSQueueNumThreads(); + GmodPublishingUtility.SQ_uploadRetryTimes=settings.getSQueueRetry(); + GmodPublishingUtility.useJavaLAF = settings.getJLAF_Enabled(); + GmodPublishingUtility.javaLAF = settings.getJLAF_Text(); + GmodPublishingUtility.SQ_uploadRetryDelayE=settings.getSQueueUploadRetryDelayE(); + GmodPublishingUtility.SQ_uploadRetryDelayI=settings.getSQueueUploadRetryDelayI(); + + if (settings.pathsPressedOK()){ + new Thread(){ + @Override + public void run(){ + gmpuJob listItems = new gmpuJob(gmpuJob.LIST); + try { + listItems.call(); + } catch (Exception ex) { + Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); + } + + tableModelAddons tblModel = (tableModelAddons) tblAddonList.getModel(); + tblModel.clearData(); + + for (int i=0;i=2) break; + if (this.tagsChkBoxes.get(i).isSelected()){ + ret.tags[tagIndex] = this.tagsChkBoxes.get(i).getName(); + tagIndex++; + } + } + + ret.title=this.txtAddonTitle.getText(); + ret.type=getAddonType(); + return ret; + } + + private void btnAddQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddQueueActionPerformed + boolean addonSelectedUpdate = false; + gmpuJob job=null; + if (this.btnCreate.isSelected()){ + job = new gmpuJob(gmpuJob.CREATE); + String addon = this.txtCreateFileFolder.getText(); + if (addon.endsWith(".gma")) job.createGmaOut = addon; + else{ + job.addonJson = createJson(); + job.createGmaFolder = addon; + } + job.createIcon = this.txtCreateIcon.getText(); + }else if (this.btnCreateGMA.isSelected()){ + job = new gmpuJob(gmpuJob.CREATE_GMA); + job.addonJson = createJson(); + job.createGmaFolder = this.txtCreateFileFolder.getText(); + job.createGmaOut = this.txtGMAOut.getText(); + }else if (this.btnUpdate.isSelected()){ + job = new gmpuJob(gmpuJob.UPDATE); + String addon = this.txtCreateFileFolder.getText(); + if (addon.endsWith(".gma")) job.createGmaOut = addon; + else{ + job.addonJson = createJson(); + job.createGmaFolder = addon; + } + int selectedRow = this.tblAddonList.getSelectedRow(); + if (selectedRow !=-1){ + job.updateID=(String) this.tblAddonList.getValueAt(selectedRow, 0); + addonSelectedUpdate=true; + } + job.updateChanges=this.txtUpdateChanges.getText(); + }else if (this.btnExtract.isSelected()){ + job = new gmpuJob(gmpuJob.EXTRACT); + job.extractName = this.txtExtractFile.getText(); + if (this.chkExtractOut.isSelected()) job.extractOut = this.txtExtractOut.getText(); + } + + if (job != null){ + int jobType = job.getJobType(); + switch(jobType){ + case gmpuJob.UPDATE: + if (!addonSelectedUpdate){ + JOptionPane.showMessageDialog(this,"Error!\nNo addon selected for update!","No Addon Selected",JOptionPane.ERROR_MESSAGE); + break; + } + case gmpuJob.CREATE: + if (jobType == gmpuJob.CREATE && this.txtCreateIcon.getText().isEmpty()){ + JOptionPane.showMessageDialog(this,"Error!\nNo icon selected!","No Icon Selected",JOptionPane.ERROR_MESSAGE); + break; + } + case gmpuJob.CREATE_GMA: + if (jobType == gmpuJob.CREATE_GMA && this.txtGMAOut.getText().isEmpty()){ + JOptionPane.showMessageDialog(this,"Error!\nNo output file selected!","No Output File",JOptionPane.ERROR_MESSAGE); + break; + } + if (this.txtCreateFileFolder.getText().isEmpty()){ + JOptionPane.showMessageDialog(this,"Error!\nNo file or folder selected!","No File or Folder",JOptionPane.ERROR_MESSAGE); + break; + } + if (job.addonJson != null){ + switch(job.addonJson.checkData()){ + case addon_json.CHK_OK: + ((tableModelQueue)this.tblQueue.getModel()).addJob(job); + break; + case addon_json.CHK_TITLE: //title is empty + JOptionPane.showMessageDialog(this,"Error!\nTitle in addon.json section is empty!","Empty Title",JOptionPane.ERROR_MESSAGE); + break; + case addon_json.CHK_TYPE_A: //type is empty + JOptionPane.showMessageDialog(this,"Error!\nNo type selected in addon.json section!","No Type",JOptionPane.ERROR_MESSAGE); + break; + case addon_json.CHK_TYPE_B: //type is wrong + JOptionPane.showMessageDialog(this,"Error!\nIncorrect type selected in addon.json section!","Incorrect Type",JOptionPane.ERROR_MESSAGE); + break; + case addon_json.CHK_TAGS_A: //tags are empty + JOptionPane.showMessageDialog(this,"Error!\nNo tags selected in addon.json section!","No Tags",JOptionPane.ERROR_MESSAGE); + break; + case addon_json.CHK_TAGS_B_1: //first tag is wrong + JOptionPane.showMessageDialog(this,"Error!\nIncorrect first tag selected in addon.json section!","First Tag Incorrect",JOptionPane.ERROR_MESSAGE); + break; + case addon_json.CHK_TAGS_B_2: //second tag is wrong + JOptionPane.showMessageDialog(this,"Error!\nIncorrect second tag selected in addon.json section!","Second Tag Incorrect",JOptionPane.ERROR_MESSAGE); + break; + case addon_json.CHK_TAGS_B_3: //both tags are wrong + JOptionPane.showMessageDialog(this,"Error!\nIncorrect tags selected in addon.json section!","Incorrect Tags",JOptionPane.ERROR_MESSAGE); + break; + } + }else ((tableModelQueue)this.tblQueue.getModel()).addJob(job); + break; + case gmpuJob.EXTRACT: + if (this.txtExtractFile.getText().isEmpty()){ + JOptionPane.showMessageDialog(this,"Error!\nNo file or folder selected for extraction!","No File or Folder for Extract",JOptionPane.ERROR_MESSAGE); + break; + } + default: + ((tableModelQueue)this.tblQueue.getModel()).addJob(job); + break; + } + } + }//GEN-LAST:event_btnAddQueueActionPerformed + + private void btnQueueClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQueueClearActionPerformed + int rows[] = tblQueue.getSelectedRows(); + tableModelQueue model = (tableModelQueue)this.tblQueue.getModel(); + + if (model.getRowCount()!=0){ + if (rows.length==0) model.clearData();//while (model.getRowCount()>0) model.removeRow(0); //clear the list + else{ + for (int i=rows.length-1;i>=0;i--) model.removeRow(rows[i]); //remove selected + this.tblQueue.clearSelection(); + } + } + }//GEN-LAST:event_btnQueueClearActionPerformed + + //private boolean queueRunning = false; + private void btnQueueExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQueueExecuteActionPerformed + //if (!this.queueRunning){ + /*if (this.queueRoot==null){ + if (GmodPublishingUtility.useSmartQueue){ + queueRoot = new gmpuSmartQueue((DefaultTableModel)this.tblQueue.getModel(),(DefaultTableModel)this.tblAddonList.getModel()); + }else{ + queueRoot = new gmpuQueue((DefaultTableModel)this.tblQueue.getModel(),(DefaultTableModel)this.tblAddonList.getModel()); + } + queueRoot.start(); + this.btnQueueExecute.setText("Stop"); + }else{ + //stop queue; + this.queueRoot.stopQueue(); + this.btnQueueExecute.setText("Execute"); + }*/ + + if (this.queueRoot==null || !this.queueRoot.isAlive()){ + if (GmodPublishingUtility.useSmartQueue){ + this.queueRoot = new gmpuSmartQueue((tableModelQueue)this.tblQueue.getModel(), (tableModelAddons)this.tblAddonList.getModel()); + this.queueRoot.setQueueBtn(this.btnQueueExecute); + }else{ + this.queueRoot = new gmpuQueue((tableModelQueue)this.tblQueue.getModel(), (tableModelAddons)this.tblAddonList.getModel()); + this.queueRoot.setQueueBtn(this.btnQueueExecute); + } + this.queueRoot.start(); + this.btnQueueExecute.setText("Stop"); + }else{ + this.queueRoot.stopQueue(); + this.btnQueueExecute.setText("Execute"); + } + }//GEN-LAST:event_btnQueueExecuteActionPerformed + + private void checkTags(){ + int numTagsSelected=0; + + for (int i=0 ;i=2) break; + } + + if (numTagsSelected >= 2){ + for (int i=0 ;i + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + new MainFrame().setVisible(true); + } + }); + + } + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTextArea LogTxtArea; + private javax.swing.JButton btnAddQueue; + private javax.swing.JRadioButton btnCreate; + private javax.swing.JButton btnCreateFile; + private javax.swing.JButton btnCreateFolder; + private javax.swing.JRadioButton btnCreateGMA; + private javax.swing.JButton btnCreateIcon; + private javax.swing.JRadioButton btnEffects; + private javax.swing.JRadioButton btnExtract; + private javax.swing.JButton btnExtractFile; + private javax.swing.JButton btnExtractOutFolder; + private javax.swing.JButton btnGMAOut; + private javax.swing.JRadioButton btnGamemode; + private javax.swing.JRadioButton btnMap; + private javax.swing.JRadioButton btnModel; + private javax.swing.JRadioButton btnNPC; + private javax.swing.JButton btnQueueClear; + private javax.swing.JButton btnQueueExecute; + private javax.swing.JRadioButton btnServerContent; + private javax.swing.JButton btnSettings; + private javax.swing.JRadioButton btnTool; + private javax.swing.JRadioButton btnUpdate; + private javax.swing.JRadioButton btnVehicle; + private javax.swing.JRadioButton btnWeapon; + private javax.swing.JCheckBox chkBuild; + private javax.swing.JCheckBox chkCartoon; + private javax.swing.JCheckBox chkComic; + private javax.swing.JCheckBox chkExtractOut; + private javax.swing.JCheckBox chkFun; + private javax.swing.JCheckBox chkMovie; + private javax.swing.JCheckBox chkRealism; + private javax.swing.JCheckBox chkRoleplay; + private javax.swing.JCheckBox chkScenic; + private javax.swing.JCheckBox chkWater; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel10; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JPanel jPanel6; + private javax.swing.JPanel jPanel7; + private javax.swing.JPanel jPanel8; + private javax.swing.JPanel jPanel9; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JScrollPane jScrollPane4; + private javax.swing.JLabel lblIconPreview; + private javax.swing.ButtonGroup modeButtonGroup; + private javax.swing.JPanel pnlIconPreview; + private javax.swing.ButtonGroup tagsButtonGroup; + private javax.swing.JTable tblAddonList; + private javax.swing.JTable tblQueue; + private javax.swing.JTextField txtAddonIgnore; + private javax.swing.JTextField txtAddonTitle; + private javax.swing.JTextField txtCreateFileFolder; + private javax.swing.JTextField txtCreateIcon; + private javax.swing.JTextField txtExtractFile; + private javax.swing.JTextField txtExtractOut; + private javax.swing.JTextField txtGMAOut; + private javax.swing.JTextField txtUpdateChanges; + private javax.swing.ButtonGroup typeButtonGroup; + // End of variables declaration//GEN-END:variables +} diff --git a/src/com/alatnet/gmod/Settings.form b/src/com/alatnet/gmod/Settings.form new file mode 100644 index 0000000..1b873e0 --- /dev/null +++ b/src/com/alatnet/gmod/Settings.form @@ -0,0 +1,427 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/com/alatnet/gmod/Settings.java b/src/com/alatnet/gmod/Settings.java new file mode 100644 index 0000000..53ab98a --- /dev/null +++ b/src/com/alatnet/gmod/Settings.java @@ -0,0 +1,516 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod; + +import java.util.ArrayList; + +/** + * + * @author alatnet + */ +public class Settings extends javax.swing.JDialog { + private String gmpublishPath, gmpublishProgram, gmadPath, gmadProgram; + private boolean convertFilenames, openBrowserOnCreate, queueAutoRemove, sQueueAutoRemove, sQueueEnable, sQueueUploadDelayE; + private int sQueueDelay, sQueueNumThreads, sQueueRetry, sQueueUploadDelayI; + + boolean pressOK=false,pathsPressOK=false; + + /** + * Creates new form Settings + */ + public Settings(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); + + btnOK = new javax.swing.JButton(); + btnCancel = new javax.swing.JButton(); + jPanel1 = new javax.swing.JPanel(); + chkSmartQueueEnable = new javax.swing.JCheckBox(); + spinSmartQueueDelay = new javax.swing.JSpinner(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + spinSmartQueueRetry = new javax.swing.JSpinner(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + spinSmartQueueNumThreads = new javax.swing.JSpinner(); + chkSQ_AutoRemove = new javax.swing.JCheckBox(); + chkUploadRetryDelay = new javax.swing.JCheckBox(); + spinUploadRetryDelay = new javax.swing.JSpinner(); + jLabel6 = new javax.swing.JLabel(); + jPanel2 = new javax.swing.JPanel(); + chkConvertFilenames = new javax.swing.JCheckBox(); + chkOpenBrowserOnCreate = new javax.swing.JCheckBox(); + jPanel4 = new javax.swing.JPanel(); + chkJLAF = new javax.swing.JCheckBox(); + cmbxJLAF = new javax.swing.JComboBox(); + btnSetPaths = new javax.swing.JButton(); + jPanel3 = new javax.swing.JPanel(); + chkQ_AutoRemove = new javax.swing.JCheckBox(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("GMPU Settings"); + + btnOK.setText("OK"); + btnOK.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnOKActionPerformed(evt); + } + }); + + btnCancel.setText("Cancel"); + btnCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnCancelActionPerformed(evt); + } + }); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Smart Queue")); + + chkSmartQueueEnable.setText("Enable"); + chkSmartQueueEnable.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + chkSmartQueueEnableActionPerformed(evt); + } + }); + + spinSmartQueueDelay.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(300), Integer.valueOf(120), null, Integer.valueOf(1))); + + org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, chkSmartQueueEnable, org.jdesktop.beansbinding.ELProperty.create("${selected}"), spinSmartQueueDelay, org.jdesktop.beansbinding.BeanProperty.create("enabled")); + bindingGroup.addBinding(binding); + + jLabel1.setText("Upload Delay: "); + + jLabel2.setText("Seconds"); + + jLabel3.setText("Upload Retry: "); + + spinSmartQueueRetry.setModel(new javax.swing.SpinnerNumberModel(5, 0, 10, 1)); + + binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, chkSmartQueueEnable, org.jdesktop.beansbinding.ELProperty.create("${selected}"), spinSmartQueueRetry, org.jdesktop.beansbinding.BeanProperty.create("enabled")); + bindingGroup.addBinding(binding); + + jLabel4.setText("Times"); + + jLabel5.setText("Number of Threads: "); + + spinSmartQueueNumThreads.setModel(new javax.swing.SpinnerNumberModel(5, 1, 10, 1)); + + binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, chkSmartQueueEnable, org.jdesktop.beansbinding.ELProperty.create("${selected}"), spinSmartQueueNumThreads, org.jdesktop.beansbinding.BeanProperty.create("enabled")); + bindingGroup.addBinding(binding); + + chkSQ_AutoRemove.setText("Auto Remove Completed Actions"); + + binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, chkSmartQueueEnable, org.jdesktop.beansbinding.ELProperty.create("${selected}"), chkSQ_AutoRemove, org.jdesktop.beansbinding.BeanProperty.create("enabled")); + bindingGroup.addBinding(binding); + + chkUploadRetryDelay.setText("Upload Retry Delay:"); + + binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, chkSmartQueueEnable, org.jdesktop.beansbinding.ELProperty.create("${selected}"), chkUploadRetryDelay, org.jdesktop.beansbinding.BeanProperty.create("enabled")); + bindingGroup.addBinding(binding); + + chkUploadRetryDelay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + chkUploadRetryDelayActionPerformed(evt); + } + }); + + spinUploadRetryDelay.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(30), Integer.valueOf(30), null, Integer.valueOf(1))); + + jLabel6.setText("Seconds"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addComponent(chkUploadRetryDelay) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spinUploadRetryDelay)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spinSmartQueueDelay))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(chkSQ_AutoRemove) + .addComponent(chkSmartQueueEnable)) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spinSmartQueueNumThreads)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spinSmartQueueRetry, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel4) + .addGap(14, 14, 14))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(chkSmartQueueEnable) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(spinSmartQueueDelay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(spinSmartQueueRetry, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(chkUploadRetryDelay) + .addComponent(spinUploadRetryDelay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(spinSmartQueueNumThreads, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(chkSQ_AutoRemove)) + ); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Misc")); + + chkConvertFilenames.setText("Convert Filenames to Lowercase"); + + chkOpenBrowserOnCreate.setText("Open Web Browser on Addon Creation Success"); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Java Look and Feel (Requires Restart)")); + + chkJLAF.setText("Use Look and Feel"); + + ArrayList lafList=new ArrayList<>(); + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { lafList.add(info.getName()); } + cmbxJLAF.setModel(new javax.swing.DefaultComboBoxModel(lafList.toArray())); + + binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, chkJLAF, org.jdesktop.beansbinding.ELProperty.create("${selected}"), cmbxJLAF, org.jdesktop.beansbinding.BeanProperty.create("enabled")); + bindingGroup.addBinding(binding); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(chkJLAF) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(cmbxJLAF, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(chkJLAF) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cmbxJLAF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(chkConvertFilenames) + .addComponent(chkOpenBrowserOnCreate)) + .addGap(0, 0, Short.MAX_VALUE)))) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(chkConvertFilenames) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(chkOpenBrowserOnCreate) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + btnSetPaths.setText("Set Paths"); + btnSetPaths.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnSetPathsActionPerformed(evt); + } + }); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Queue")); + + chkQ_AutoRemove.setText("Auto Removed Completed Actions"); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(chkQ_AutoRemove) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(chkQ_AutoRemove) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(btnOK) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnCancel)) + .addComponent(btnSetPaths, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnSetPaths) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnOK) + .addComponent(btnCancel)) + .addContainerGap()) + ); + + bindingGroup.bind(); + + pack(); + }// //GEN-END:initComponents + + private void btnSetPathsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetPathsActionPerformed + GmodPaths paths = new GmodPaths(null,true); + paths.setData(this.gmpublishPath, this.gmpublishProgram, this.gmadPath, this.gmadProgram); + paths.setVisible(true); + this.gmadProgram = paths.getGmadProgram(); + this.gmadPath = paths.getGmadPath(); + this.gmpublishProgram = paths.getGmpublishProgram(); + this.gmpublishPath = paths.getGmpublishPath(); + this.pathsPressOK=paths.pressedOK(); + }//GEN-LAST:event_btnSetPathsActionPerformed + + private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed + this.convertFilenames=this.chkConvertFilenames.isSelected(); + this.openBrowserOnCreate=this.chkOpenBrowserOnCreate.isSelected(); + this.queueAutoRemove=this.chkQ_AutoRemove.isSelected(); + this.sQueueAutoRemove=this.chkSQ_AutoRemove.isSelected(); + this.sQueueEnable=this.chkSmartQueueEnable.isSelected(); + this.sQueueDelay=(int)this.spinSmartQueueDelay.getValue(); + this.sQueueNumThreads=(int)this.spinSmartQueueNumThreads.getValue(); + this.sQueueRetry=(int)this.spinSmartQueueRetry.getValue(); + this.sQueueUploadDelayI=(int)this.spinUploadRetryDelay.getValue(); + this.sQueueUploadDelayE=this.chkUploadRetryDelay.isSelected(); + this.pressOK=true; + this.dispose(); + }//GEN-LAST:event_btnOKActionPerformed + + private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed + this.dispose(); + }//GEN-LAST:event_btnCancelActionPerformed + + private void chkUploadRetryDelayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkUploadRetryDelayActionPerformed + this.spinUploadRetryDelay.setEnabled(this.chkSmartQueueEnable.isSelected() && this.chkUploadRetryDelay.isSelected()); + }//GEN-LAST:event_chkUploadRetryDelayActionPerformed + + private void chkSmartQueueEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkSmartQueueEnableActionPerformed + this.spinUploadRetryDelay.setEnabled(this.chkSmartQueueEnable.isSelected() && this.chkUploadRetryDelay.isSelected()); + }//GEN-LAST:event_chkSmartQueueEnableActionPerformed + + public boolean pressedOK(){ return this.pressOK; } + public boolean pathsPressedOK(){ return this.pathsPressOK; } + + public void setBooleanData(boolean convertFilenames, boolean openBrowserOnCreate, boolean queueAutoRemove, boolean sQueueAutoRemove, boolean sQueueEnable, boolean sQueueUploadDelayE){ + this.chkConvertFilenames.setSelected(convertFilenames); + this.chkOpenBrowserOnCreate.setSelected(openBrowserOnCreate); + this.chkQ_AutoRemove.setSelected(queueAutoRemove); + this.chkSQ_AutoRemove.setSelected(sQueueAutoRemove); + this.chkSmartQueueEnable.setSelected(sQueueEnable); + this.chkUploadRetryDelay.setSelected(sQueueUploadDelayE); + this.convertFilenames=convertFilenames; + this.openBrowserOnCreate=openBrowserOnCreate; + this.queueAutoRemove=queueAutoRemove; + this.sQueueAutoRemove=sQueueAutoRemove; + this.sQueueEnable=sQueueEnable; + this.sQueueUploadDelayE=sQueueUploadDelayE; + this.spinUploadRetryDelay.setEnabled(this.chkSmartQueueEnable.isSelected() && this.chkUploadRetryDelay.isSelected()); + } + public boolean getConvertFileNames(){ return this.convertFilenames; } + public boolean getOpenBrowserOnCreate(){ return this.openBrowserOnCreate; } + public boolean getQueueAutoRemove(){ return this.queueAutoRemove; } + public boolean getSQueueAutoRemove(){ return this.sQueueAutoRemove; } + public boolean getSQueueEnable(){ return this.sQueueEnable; } + public boolean getSQueueUploadRetryDelayE(){ return this.sQueueUploadDelayE; } + + public void setSpinData(int sQueueDelay, int sQueueNumThreads, int sQueueRetry, int sQueueUploadDelayI){ + this.spinSmartQueueDelay.setValue(sQueueDelay); + this.spinSmartQueueNumThreads.setValue(sQueueNumThreads); + this.spinSmartQueueRetry.setValue(sQueueRetry); + this.spinUploadRetryDelay.setValue(sQueueUploadDelayI); + this.sQueueDelay=sQueueDelay; + this.sQueueNumThreads=sQueueNumThreads; + this.sQueueRetry=sQueueRetry; + this.sQueueUploadDelayI=sQueueUploadDelayI; + } + public int getSQueueDelay(){ return this.sQueueDelay; } + public int getSQueueNumThreads(){ return this.sQueueNumThreads; } + public int getSQueueRetry(){ return this.sQueueRetry; } + public int getSQueueUploadRetryDelayI() { return this.sQueueUploadDelayI; } + + public void setPathsData(String gmpublishPath, String gmpublishProgram, String gmadPath, String gmadProgram){ + this.gmadPath = gmadPath; + this.gmadProgram = gmadProgram; + this.gmpublishPath = gmpublishPath; + this.gmpublishProgram = gmpublishProgram; + /*this.txtGmadPath.setText(gmadPath); + this.txtGmadProgram.setText(gmadProgram); + this.txtGmpublishPath.setText(gmpublishPath); + this.txtGmpublishProgram.setText(gmpublishProgram);*/ + } + public String getGmpublishPath(){ + return this.gmpublishPath; + } + public String getGmpublishProgram(){ + return this.gmpublishProgram; + } + public String getGmadPath(){ + return this.gmadPath; + } + public String getGmadProgram(){ + return this.gmadProgram; + } + + public void setLookAndFeelData(boolean jLAF_Enabled, String jLAF_Text){ + this.chkJLAF.setSelected(jLAF_Enabled); + + javax.swing.DefaultComboBoxModel model = (javax.swing.DefaultComboBoxModel)this.cmbxJLAF.getModel(); + for (int i=0;i + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Settings.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Settings.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Settings.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Settings.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + Settings dialog = new Settings(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnCancel; + private javax.swing.JButton btnOK; + private javax.swing.JButton btnSetPaths; + private javax.swing.JCheckBox chkConvertFilenames; + private javax.swing.JCheckBox chkJLAF; + private javax.swing.JCheckBox chkOpenBrowserOnCreate; + private javax.swing.JCheckBox chkQ_AutoRemove; + private javax.swing.JCheckBox chkSQ_AutoRemove; + private javax.swing.JCheckBox chkSmartQueueEnable; + private javax.swing.JCheckBox chkUploadRetryDelay; + private javax.swing.JComboBox cmbxJLAF; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JSpinner spinSmartQueueDelay; + private javax.swing.JSpinner spinSmartQueueNumThreads; + private javax.swing.JSpinner spinSmartQueueRetry; + private javax.swing.JSpinner spinUploadRetryDelay; + private org.jdesktop.beansbinding.BindingGroup bindingGroup; + // End of variables declaration//GEN-END:variables +} diff --git a/src/com/alatnet/gmod/addon_json.java b/src/com/alatnet/gmod/addon_json.java new file mode 100644 index 0000000..5a62bdd --- /dev/null +++ b/src/com/alatnet/gmod/addon_json.java @@ -0,0 +1,112 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; + +/** + * + * @author alatnet + */ + +//: +//"gamemode" +//"map" +//"weapon" +//"vehicle" +//"npc" +//"tool" +//"effects" +//"model" +//"servercontent" +// +// (only two): +//"fun" +//"roleplay" +//"scenic" +//"movie" +//"realism" +//"cartoon" +//"water" +//"comic" +//"build" + +public class addon_json { + public static final int + CHK_OK=0, + CHK_TITLE=1, //title is empty + CHK_TYPE_A=2, //type is empty + CHK_TYPE_B=3, //type is wrong + CHK_TAGS_A=4, //tags are empty + CHK_TAGS_B_1=5, //first tag is wrong + CHK_TAGS_B_2=6, //second tag is wrong + CHK_TAGS_B_3=7; //both tags are wrong + private static final String[] TYPE = {"gamemode", "map","weapon","vehicle","npc","tool","effects","model","servercontent"}; + private static final String[] TAGS = {"fun","roleplay","scenic","movie","realism","cartoon","water","comic","build"}; + public String title=""; + public String type=""; + public String[] tags={"",""}; + public String ignore; + + public void write(String path) throws IOException{ + try (BufferedWriter BW = new BufferedWriter(new FileWriter(path))) { + BW.write(this.toString()); + } + } + + public int checkData(){ + if (this.title.isEmpty()) return CHK_TITLE; + + if (!this.type.isEmpty()){ + boolean typeOK=false; + for (int i=0;i{ + public static final int LIST=0,EXTRACT=1,UPDATE=2,CREATE=3,CREATE_GMA=4; + + public String extractName=""; + public String extractOut=""; + + public String createGmaFolder=""; + public String createGmaOut=""; + + public String createIcon=""; + + public String updateID=""; + public String updateChanges=""; + + public addon_json addonJson=null; + + public String errorNumber=""; + + private int jobType=0; + + public class listEntry{ + public String ID; + public String Name; + + public listEntry(String ID, String Name){ + this.ID = ID; + this.Name = Name; + } + } + + public ArrayList listReturn=null; + + public gmpuJob(int jobType){ + this.jobType=jobType; + } + + public int getJobType(){ return this.jobType; } + + @Override + public String toString(){ + switch (this.jobType){ + case LIST: + return "Get addon listing."; + case EXTRACT: + return "Extraction of \""+this.extractName+"\"."; + case UPDATE: + return "Update of addon id \""+this.updateID+"\"."; + case CREATE: + String s=""; + if (!this.createGmaFolder.isEmpty()) s=this.createGmaFolder; + else s=this.createGmaOut; + return "Creating addon from \""+s+"\""; + case CREATE_GMA: + return "Creating GMA file from \""+this.createGmaFolder+"\""; + } + return "Unknown."; + } + + private void filenames2lowercase(File f){ + if (f.isDirectory()){ + File[] files = f.listFiles(); + for (int i=0;i + try { + this.listReturn=new ArrayList<>(); + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Retreving list of Addons."); + pb = new ProcessBuilder("\""+GmodPublishingUtility.gmpublishPath+File.separatorChar+GmodPublishingUtility.gmpublish+"\"","list"); + pb.directory(new File(GmodPublishingUtility.gmpublishPath)); + p = pb.start(); + stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); + + stdoutStr = stdout.readLine(); + + Pattern idPatt = Pattern.compile("\\d+"); + Pattern namePatt = Pattern.compile("\".+\""); + while (stdoutStr != null){ + Matcher idMatch = idPatt.matcher(stdoutStr); + Matcher nameMatch = namePatt.matcher(stdoutStr); + + if (idMatch.find() && nameMatch.find()){ + this.listReturn.add(new listEntry(idMatch.group(0),nameMatch.group(0))); + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "ID: "+idMatch.group(0)+"\tName: "+nameMatch.group(0)); + } + //GmodPublishingUtility.gmpuLogger.log(Level.INFO, stdoutStr); + stdoutStr = stdout.readLine(); + } + p.waitFor(); + stdout.close(); + + exitStatus = p.exitValue(); + if (exitStatus==0) GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Retrieval Finished!"); + else GmodPublishingUtility.gmpuLogger.log(Level.WARNING, "Retrieval Failed!"); + } catch (IOException | InterruptedException ex) { + Logger.getLogger(gmpuJob.class.getName()).log(Level.SEVERE, null, ex); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, "Retrieval Errored!"); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, null, ex); + } + break; + // + case EXTRACT: + // + if (!GmodPublishingUtility.simulateSystem){ + try { + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Extracting " + this.extractName + "."); + //s = "\""+GmodPublishingUtility.gmadPath+File.separatorChar+GmodPublishingUtility.gmad;//+"\" extract -file"+this.extractName; + s = "\""+GmodPublishingUtility.gmadPath+File.separatorChar+GmodPublishingUtility.gmad+"\""; + if (this.extractOut.length()!=0){ + //s+=" -out "+this.extractOut; + pb = new ProcessBuilder(s,"extract","-file",this.extractName,"-out",this.extractOut); + }else{ + pb = new ProcessBuilder(s,"extract","-file",this.extractName); + } + pb.directory(new File(GmodPublishingUtility.gmadPath)); + //p = r.exec(s, null, new File(GmodPublishingUtility.gmadPath)); + + p = pb.start(); + + stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); + stdoutStr = stdout.readLine(); + while (stdoutStr != null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, stdoutStr); + stdoutStr = stdout.readLine(); + } + + p.waitFor(); + stdout.close(); + + exitStatus = p.exitValue(); + if (exitStatus==0) GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Extract OK!"); + else GmodPublishingUtility.gmpuLogger.log(Level.WARNING, "Extracting Failed!"); + } catch (IOException | InterruptedException ex) { + Logger.getLogger(gmpuJob.class.getName()).log(Level.SEVERE, null, ex); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, "Extracting Errored!"); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, null, ex); + } + }else{ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Extract..."); + Thread.sleep(GmodPublishingUtility.simulateSystemWait); + if (GmodPublishingUtility.simulateSystemError){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Extract Error!"); + exitStatus = -1; + }else GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Extract Done!"); + } + break; + // + case UPDATE: + // + /* + * update: + * createGmaFolder - only when updating from a folder. + * createGmaOut - required + * updateID - required + * updateChanges - optional + */ + if (!GmodPublishingUtility.simulateSystem){ + try { + //create gma + //gmpublush update -addon -id -changes + + if (!this.createGmaFolder.isEmpty()){ + createGMA = true; + if (this.addonJson != null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Creating temporary addon.json."); + this.addonJson.write(this.createGmaFolder+File.separatorChar+"addon.json"); + } + + if (GmodPublishingUtility.convertFilenames){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Converting filenames to lowercase..."); + filenames2lowercase(new File(this.createGmaFolder)); + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Done!"); + } + + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Creating temporary gma."); + this.createGmaOut="temp.gma"; + s = "\""+GmodPublishingUtility.gmadPath+File.separatorChar+GmodPublishingUtility.gmad + "\""; + pb = new ProcessBuilder(s,"create","-folder",this.createGmaFolder,"-out",this.createGmaOut); + pb.directory(new File(GmodPublishingUtility.gmadPath)); + //p = r.exec("\""+GmodPublishingUtility.gmadPath+File.pathSeparator+GmodPublishingUtility.gmad + "\" create -folder "+this.createGmaFolder+ " -out "+this.createGmaOut, null, new File(GmodPublishingUtility.gmadPath)); + p = pb.start(); + + stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); + stdoutStr = stdout.readLine(); + while (stdoutStr != null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, stdoutStr); + stdoutStr = stdout.readLine(); + } + + p.waitFor(); + stdout.close(); + createGMAExitStatus = p.exitValue(); + } + + if (createGMAExitStatus==0){ + //s="\""+GmodPublishingUtility.gmpublishPath+File.pathSeparator+GmodPublishingUtility.gmpublish+"\" update -addon "+this.createGmaOut+" -id "+this.updateID; + s="\""+GmodPublishingUtility.gmpublishPath+File.separatorChar+GmodPublishingUtility.gmpublish+"\""; + if (this.updateChanges.length()==0){ + pb = new ProcessBuilder(s,"update","-addon",this.createGmaOut,"-id",this.updateID); + }else{ + pb = new ProcessBuilder(s,"update","-addon",this.createGmaOut,"-id",this.updateID,"-changes",this.updateChanges); + } + pb.directory(new File(GmodPublishingUtility.gmpublishPath)); + //p = r.exec(s, null, new File(GmodPublishingUtility.gmpublishPath)); + p = pb.start(); + + stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); + stdoutStr = stdout.readLine(); + while (stdoutStr != null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, stdoutStr); + stdoutStr = stdout.readLine(); + } + + p.waitFor(); + stdout.close(); + exitStatus = p.exitValue(); + } + + if (createGMA && createGMAExitStatus==0){ + //delete temporary gma file and addon.json + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Deleting temporary gma..."); + File temp_gma = new File(GmodPublishingUtility.gmadPath+File.separatorChar+"temp.gma"); + if (temp_gma.delete()) GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Temporary gma deleted."); + else GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Error deleting temporary gma."); + } + if (this.addonJson!=null && !this.createGmaFolder.isEmpty()){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Deleting temporary addon.json..."); + File json = new File(this.createGmaFolder+File.separatorChar+"addon.json"); + if (json.delete()) GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Temporary addon.json deleted."); + else GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Error deleting temporary addon.json."); + } + + if (exitStatus==0 && createGMAExitStatus==0) GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Update OK!"); + else GmodPublishingUtility.gmpuLogger.log(Level.WARNING, "Update Failed!"); + } catch (IOException | InterruptedException ex) { + Logger.getLogger(gmpuJob.class.getName()).log(Level.SEVERE, null, ex); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, "Update Errored!"); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, null, ex); + } + }else{ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Update..."); + Thread.sleep(GmodPublishingUtility.simulateSystemWait); + if (GmodPublishingUtility.simulateSystemError){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Update Error!"); + exitStatus = -1; + }else GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Update Done!"); + } + break; + // + case CREATE: + // + /* + * create: + * createGmaFolder - only when creating directly from folder + * createGmaOut - required + * createIcon - required + */ + if (!GmodPublishingUtility.simulateSystem){ + try { + //create gma + //gmpublsh create -addon -icon + String logOutStr = "Creating addon from "; + if (this.createGmaFolder.length()!=0){ + logOutStr+=this.createGmaFolder; + }else{ + logOutStr+=this.createGmaOut; + } + logOutStr+="..."; + GmodPublishingUtility.gmpuLogger.log(Level.INFO, logOutStr); + + BufferedImage image = ImageIO.read(new File(this.createIcon)); + if (image.getHeight()==512 || image.getWidth()==512){ + if (!this.createGmaFolder.isEmpty()){ + createGMA = true; + if (this.addonJson != null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Creating temporary addon.json."); + this.addonJson.write(this.createGmaFolder+File.separatorChar+"addon.json"); + } + + if (GmodPublishingUtility.convertFilenames){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Converting filenames to lowercase..."); + filenames2lowercase(new File(this.createGmaFolder)); + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Done!"); + } + + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Creating temporary gma."); + this.createGmaOut="temp.gma"; + s = "\""+GmodPublishingUtility.gmadPath+File.separatorChar+GmodPublishingUtility.gmad + "\""; + pb = new ProcessBuilder(s,"create","-folder",this.createGmaFolder,"-out",this.createGmaOut); + pb.directory(new File(GmodPublishingUtility.gmadPath)); + //p = r.exec("\""+GmodPublishingUtility.gmadPath+File.pathSeparator+GmodPublishingUtility.gmad + "\" create -folder "+this.createGmaFolder+ " -out "+this.createGmaOut, null, new File(GmodPublishingUtility.gmadPath)); + p = pb.start(); + + stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); + stdoutStr = stdout.readLine(); + while (stdoutStr != null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, stdoutStr); + stdoutStr = stdout.readLine(); + } + + p.waitFor(); + stdout.close(); + createGMAExitStatus = p.exitValue(); + } + + + String addonID=""; + if (createGMAExitStatus==0){ + s="\""+GmodPublishingUtility.gmpublishPath+File.separatorChar+GmodPublishingUtility.gmpublish+"\""; + pb = new ProcessBuilder(s,"create","-addon",this.createGmaOut,"-icon",this.createIcon); + pb.directory(new File(GmodPublishingUtility.gmpublishPath)); + //p = r.exec("\""+GmodPublishingUtility.gmpublishPath+File.pathSeparator+GmodPublishingUtility.gmpublish+"\" create -addon "+this.createGmaOut+" -icon "+this.createIcon, null, new File(GmodPublishingUtility.gmpublishPath)); + p = pb.start(); + + stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); + stdoutStr = stdout.readLine(); + Pattern numberPatt = Pattern.compile("\\d+"); + + while (stdoutStr != null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, stdoutStr); + + //get addon id. + if (stdoutStr.contains("UID:")){ + Matcher numberMatch = numberPatt.matcher(stdoutStr); + if (numberMatch.find()) addonID = numberMatch.group(0); + }else if (stdoutStr.contains("PublishWorkshopFile failed!")){ + Matcher numberMatch = numberPatt.matcher(stdoutStr); + if (numberMatch.find()) errorNumber = numberMatch.group(0); + } + + stdoutStr = stdout.readLine(); + } + + p.waitFor(); + stdout.close(); + exitStatus = p.exitValue(); + } + + if (createGMA && createGMAExitStatus==0){ + //delete temporary gma file and addon.json + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Deleting temporary gma..."); + File temp_gma = new File(GmodPublishingUtility.gmadPath+File.separatorChar+"temp.gma"); + if (temp_gma.delete()) GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Temporary gma deleted."); + else GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Error deleting temporary gma."); + } + if (this.addonJson!=null && !this.createGmaFolder.isEmpty()){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Deleting temporary addon.json..."); + File json = new File(this.createGmaFolder+File.separatorChar+"addon.json"); + if (json.delete()) GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Temporary addon.json deleted."); + else GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Error deleting temporary addon.json."); + } + if (exitStatus==0){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Creation OK!"); + if (GmodPublishingUtility.openBrowserOnCreate) + if (!addonID.equals("")) + Desktop.getDesktop().browse(java.net.URI.create("http://steamcommunity.com/sharedfiles/filedetails/?id="+addonID)); + } else GmodPublishingUtility.gmpuLogger.log(Level.WARNING, "Creation Failed!"); + }else GmodPublishingUtility.gmpuLogger.log(Level.WARNING, "Icon Image is not 512x512! Creation of addon aborted!"); + } catch (IOException | InterruptedException ex) { + Logger.getLogger(gmpuJob.class.getName()).log(Level.SEVERE, null, ex); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, "Creation Errored!"); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, null, ex); + } + }else{ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Create..."); + Thread.sleep(GmodPublishingUtility.simulateSystemWait); + if (GmodPublishingUtility.simulateSystemError){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Create Error!"); + exitStatus = -1; + }else{ + Desktop.getDesktop().browse(java.net.URI.create("http://steamcommunity.com/")); + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Create Done!"); + } + } + break; + // + case CREATE_GMA: + // + if (!GmodPublishingUtility.simulateSystem){ + try { + if (this.addonJson != null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Creating temporary addon.json."); + this.addonJson.write(this.createGmaFolder+File.separatorChar+"addon.json"); + } + + if (GmodPublishingUtility.convertFilenames){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Converting filenames to lowercase..."); + filenames2lowercase(new File(this.createGmaFolder)); + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Done!"); + } + + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Creating GMA from "+this.createGmaFolder); + s = "\""+GmodPublishingUtility.gmadPath+File.separatorChar+GmodPublishingUtility.gmad + "\""; + pb = new ProcessBuilder(s,"create","-folder",this.createGmaFolder,"-out",this.createGmaOut); + pb.directory(new File(GmodPublishingUtility.gmadPath)); + //p = r.exec("\""+GmodPublishingUtility.gmadPath+File.pathSeparator+GmodPublishingUtility.gmad + "\" create -folder "+this.createGmaFolder+ " -out "+this.createGmaOut, null, new File(GmodPublishingUtility.gmadPath)); + p = pb.start(); + + stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); + stdoutStr = stdout.readLine(); + while (stdoutStr != null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, stdoutStr); + stdoutStr = stdout.readLine(); + } + + p.waitFor(); + stdout.close(); + + if (this.addonJson!=null){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Deleting temporary addon.json..."); + File json = new File(this.createGmaFolder+File.separatorChar+"addon.json"); + if (json.delete()) GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Temporary addon.json deleted."); + else GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Error deleting temporary addon.json."); + } + + exitStatus = p.exitValue(); + if (exitStatus==0) GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Creation of GMA OK!"); + else GmodPublishingUtility.gmpuLogger.log(Level.WARNING, "Creation of GMA Failed!"); + } catch (IOException | InterruptedException ex) { + Logger.getLogger(gmpuJob.class.getName()).log(Level.SEVERE, null, ex); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, "Creation of GMA Errored!"); + GmodPublishingUtility.gmpuLogger.log(Level.SEVERE, null, ex); + } + }else{ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Create GMA..."); + Thread.sleep(GmodPublishingUtility.simulateSystemWait); + if (GmodPublishingUtility.simulateSystemError){ + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Create GMA Error!"); + exitStatus = -1; + }else GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Simulating Create GMA Done!"); + } + break; + // + } + + return exitStatus; + } +} diff --git a/src/com/alatnet/gmod/logHandlers/JTextAreaHandler.java b/src/com/alatnet/gmod/logHandlers/JTextAreaHandler.java new file mode 100644 index 0000000..a99e6d1 --- /dev/null +++ b/src/com/alatnet/gmod/logHandlers/JTextAreaHandler.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod.logHandlers; + +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import javax.swing.JTextArea; + +/** + * + * @author alatnet + */ +public class JTextAreaHandler extends Handler { + JTextArea jTxtArea; + + public JTextAreaHandler(JTextArea jTxtArea){ this.jTxtArea=jTxtArea; } + + @Override + public void publish(LogRecord lr) { + if (lr.getLevel() != Level.INFO){ + jTxtArea.append("[" + lr.getLevel().getLocalizedName() + "] " + lr.getMessage() + "\n"); + Throwable thrown = lr.getThrown(); + if (thrown != null){ + String tMsg = thrown.getMessage(); + if (tMsg!=null && !tMsg.isEmpty()) jTxtArea.append(tMsg + "\n"); + } + }else{ + jTxtArea.append(lr.getMessage() + "\n"); + Throwable thrown = lr.getThrown(); + if (thrown != null){ + String tMsg = thrown.getMessage(); + if (tMsg!=null && !tMsg.isEmpty()) jTxtArea.append(tMsg + "\n"); + } + } + jTxtArea.setCaretPosition(jTxtArea.getText().length()); + } + + @Override + public void flush() {} + + @Override + public void close() throws SecurityException {} +} diff --git a/src/com/alatnet/gmod/logHandlers/SystemOutHandler.java b/src/com/alatnet/gmod/logHandlers/SystemOutHandler.java new file mode 100644 index 0000000..ea50052 --- /dev/null +++ b/src/com/alatnet/gmod/logHandlers/SystemOutHandler.java @@ -0,0 +1,42 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod.logHandlers; + +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; + +/** + * + * @author alatnet + */ +public class SystemOutHandler extends Handler { + + @Override + public void publish(LogRecord lr) { + if (lr.getLevel() != Level.INFO){ + System.out.println("[" + lr.getLevel().getLocalizedName() + "] " + lr.getMessage()); + Throwable thrown = lr.getThrown(); + if (thrown != null){ + String tMsg = thrown.getMessage(); + if (tMsg!=null && !tMsg.isEmpty()) System.out.println(tMsg); + } + }else{ + System.out.println(lr.getMessage()); + Throwable thrown = lr.getThrown(); + if (thrown != null){ + String tMsg = thrown.getMessage(); + if (tMsg!=null && !tMsg.isEmpty()) System.out.println(tMsg); + } + } + } + + @Override + public void flush() { System.out.flush(); } + + @Override + public void close() throws SecurityException {} + +} diff --git a/src/com/alatnet/gmod/queue/gmpuQueue.java b/src/com/alatnet/gmod/queue/gmpuQueue.java new file mode 100644 index 0000000..af9fd88 --- /dev/null +++ b/src/com/alatnet/gmod/queue/gmpuQueue.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod.queue; + +import com.alatnet.gmod.GmodPublishingUtility; +import com.alatnet.gmod.gmpuJob; +import java.util.logging.Level; +import com.alatnet.gmod.tableModels.*; +import java.util.logging.Logger; +/** + * + * @author alatnet + */ +public class gmpuQueue extends gmpuQueueRoot { + private tableModelQueue modelQueue; + private tableModelAddons modelAddon; + + public gmpuQueue(tableModelQueue modelQueue, tableModelAddons modelAddon){ + this.modelQueue = modelQueue; + this.modelAddon = modelAddon; + } + + @Override + public void run(){ + boolean refreshAddons = false; + int exitStatus = 0; + + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Executing queue."); + + if (GmodPublishingUtility.Q_autoRemoveCompleted){ + while (this.modelQueue.getRowCount()>0 && !this.stopQueue){ + exitStatus = 0; + this.modelQueue.setStatus(0, "Running"); + gmpuJob job = (gmpuJob) this.modelQueue.getJob(0); + if (job.getJobType() == gmpuJob.CREATE) refreshAddons = true; + try { + exitStatus = job.call(); + } catch (Exception ex) { + Logger.getLogger(gmpuQueue.class.getName()).log(Level.SEVERE, null, ex); + } + if (exitStatus==0) this.modelQueue.setStatus(0, "Done!"); + else this.modelQueue.setStatus(0, "Error! Exit Status("+exitStatus+")"); + this.modelQueue.removeRow(0); + } + }else{ + for (int i=0;i0) this.modelAddon.removeRow(0); //clear the addon list + this.modelAddon.clearData(); + for (int i=0;i priorityJobs=new ArrayDeque<>(); + Deque standardJobs=new ArrayDeque<>(); + + + GmodPublishingUtility.gmpuLogger.log(Level.INFO, "Executing queue."); + + //populate lists + for (int i=0;i0){ + this._modelQueue.setStatus(job, "Retrying "+(i+1)+" of "+GmodPublishingUtility.SQ_uploadRetryTimes + ": "+this.retryCountdown); + this.sq.alert(); + synchronized(this.waitNotifyObj){ + try { + this.waitNotifyObj.wait(); + } catch (InterruptedException ex) { + Logger.getLogger(gmpuSmartQueue.class.getName()).log(Level.SEVERE, null, ex); + } + } + if (this._stopExecution) break; + } + waitThread.stop(); + this.retryCountdown=GmodPublishingUtility.SQ_uploadRetryDelayI; + this._modelQueue.setStatus(job, "Retrying "+(i+1)+" of "+GmodPublishingUtility.SQ_uploadRetryTimes); + this.sq.alert(); + }else{ + this._modelQueue.setStatus(job, "Retrying "+(i+1)+" of "+GmodPublishingUtility.SQ_uploadRetryTimes); + this.sq.alert(); + } + if (!this._stopExecution){ + try { + errorCode = this.job.call(); + } catch (Exception ex) { + Logger.getLogger(gmpuSmartQueue.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + + if (_stopExecution) break; + Thread.yield(); + } + } + } + }else{ + try { + errorCode = this.job.call(); + } catch (Exception ex) { + Logger.getLogger(gmpuSmartQueue.class.getName()).log(Level.SEVERE, null, ex); + } + } + + if (this._stopExecution){ + this._modelQueue.setStatus(job, "Stopped!"); + this.sq.alert(); + } + else if (errorCode==0){ + this._modelQueue.setStatus(job, "Done!"); + this.sq.alert(); + } else { + if (job.getJobType() == gmpuJob.CREATE){ + if (!job.errorNumber.isEmpty()){ + int gmpublishErrorCode = Integer.parseInt(job.errorNumber); + switch (gmpublishErrorCode){ + case 16: + this._modelQueue.setStatus(job, "Timed Out! Exit Status("+errorCode+") GMPublish Error Code: "+gmpublishErrorCode); + this.sq.alert(); + break; + default: + this._modelQueue.setStatus(job, "Error! Exit Status("+errorCode+") GMPublish Error Code: "+gmpublishErrorCode); + this.sq.alert(); + break; + } + } else { + this._modelQueue.setStatus(job, "Error! Exit Status("+errorCode+")"); + this.sq.alert(); + } + } else { + this._modelQueue.setStatus(job, "Error! Exit Status("+errorCode+")"); + this.sq.alert(); + } + } + if (GmodPublishingUtility.SQ_autoRemoveCompleted) modelQueue.removeJob(this.job); + this.sq.alert(); + } + + @Override + public void actionPerformed(ActionEvent e) { + if (GmodPublishingUtility.SQ_uploadRetryDelayE){ + this.retryCountdown--; + if (this.retryCountdown < 0) this.retryCountdown=0; + synchronized(this.waitNotifyObj){ + this.waitNotifyObj.notify(); + } + } + } + } + + private class timerActionListener implements ActionListener { + private int time=0,setTime=0; + private final Object timeAccess = new Object(); + private gmpuSmartQueue sq; + + public timerActionListener(int time, gmpuSmartQueue sq){ + this.time=this.setTime=time; + this.sq=sq; + } + + public int getTime(){ + synchronized(timeAccess){ + return time; + } + } + + public int reset(){ + synchronized(timeAccess){ + int prev=time; + time=setTime; + return prev; + } + } + + @Override + public void actionPerformed(ActionEvent e) { + synchronized(timeAccess){ + time--; + if (this.time<=0) this.time=0; + } + this.sq.alert(); + } + } +} diff --git a/src/com/alatnet/gmod/tableModels/tableModelAddons.java b/src/com/alatnet/gmod/tableModels/tableModelAddons.java new file mode 100644 index 0000000..8bb06e4 --- /dev/null +++ b/src/com/alatnet/gmod/tableModels/tableModelAddons.java @@ -0,0 +1,73 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod.tableModels; + +import java.util.ArrayList; +import javax.swing.table.AbstractTableModel; + +/** + * + * @author alatnet + */ +public class tableModelAddons extends AbstractTableModel { + public static int ID=0,NAME=1; + private static final String[] COLUMN_NAMES = {"ID", "Name"}; + + public static class addonsRowData { + public String ID,Name; + + public addonsRowData(String ID, String Name){ + this.ID = ID; + this.Name = Name; + } + } + + private ArrayList tableData; + + public tableModelAddons(){ this.tableData = new ArrayList<>(); } + + @Override + public int getRowCount() { return this.tableData.size(); } + + @Override + public int getColumnCount() { return 2; } + + @Override + public Object getValueAt(int row, int col) { + addonsRowData data = this.tableData.get(row); + if (data!=null){ + switch (col){ + case 0: + return data.ID; + case 1: + return data.Name; + } + } + + return null; + } + + @Override + public String getColumnName(int col){ return COLUMN_NAMES[col]; } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex){ return false; } + + public void addRow(addonsRowData data){ + this.tableData.add(data); + fireTableRowsInserted(this.tableData.size(),this.tableData.size()); + } + + public void addRow(String Id, String Name){ + this.tableData.add(new addonsRowData(Id,Name)); + fireTableRowsInserted(this.tableData.size(),this.tableData.size()); + } + + public void clearData(){ + int maxSize = this.tableData.size(); + this.tableData.clear(); + fireTableRowsDeleted(0,maxSize-1); + } +} diff --git a/src/com/alatnet/gmod/tableModels/tableModelQueue.java b/src/com/alatnet/gmod/tableModels/tableModelQueue.java new file mode 100644 index 0000000..f658a00 --- /dev/null +++ b/src/com/alatnet/gmod/tableModels/tableModelQueue.java @@ -0,0 +1,147 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.alatnet.gmod.tableModels; + +import com.alatnet.gmod.gmpuJob; +import java.util.ArrayList; +import javax.swing.table.AbstractTableModel; + +/** + * + * @author alatnet + */ +public class tableModelQueue extends AbstractTableModel { + public static int ACTION=0,JOB=1,STATUS=2; + private static final String[] COLUMN_NAMES = {"Action", "Job", "Status"}; + private final Object tableAccess = new Object(); + + public static class queueRowData { + String Action; + gmpuJob Job; + String Status; + + public queueRowData(String Action, gmpuJob Job, String Status){ + this.Action = Action; + this.Job = Job; + this.Status = Status; + } + } + + private ArrayList tableData; + + public tableModelQueue(){ this.tableData = new ArrayList<>(); } + + @Override + public int getRowCount() { return this.tableData.size(); } + + @Override + public int getColumnCount() { return 3; } + + @Override + public Object getValueAt(int row, int col) { + if (row >= this.tableData.size()) return null; + queueRowData data = this.tableData.get(row); + + switch (col){ + case 0: + return data.Action; + case 1: + return data.Job; + case 2: + return data.Status; + } + + return null; + } + + public gmpuJob getJob(int row){ return this.tableData.get(row).Job; } + + public void setStatus(int row, String status){ + synchronized(tableAccess){ + this.tableData.get(row).Status=status; + fireTableCellUpdated(row,2); + } + } + + public void setStatus(gmpuJob job, String status){ + synchronized(tableAccess){ + int row = this.findJob(job); + if (row != -1){ + this.tableData.get(row).Status=status; + fireTableCellUpdated(row,2); + } + } + } + + public void addJob(gmpuJob job){ + String jobType; + switch(job.getJobType()){ + case gmpuJob.CREATE: + jobType="Create"; + break; + case gmpuJob.CREATE_GMA: + jobType="Create GMA"; + break; + case gmpuJob.EXTRACT: + jobType="Extract"; + break; + case gmpuJob.LIST: + jobType="List"; + break; + case gmpuJob.UPDATE: + jobType="Update"; + break; + default: + jobType="Unknown"; + break; + } + synchronized(tableAccess){ + this.tableData.add(new queueRowData(jobType,job,"Waiting")); + fireTableRowsInserted(this.tableData.size(),this.tableData.size()); + } + } + + public void removeRow(int row) throws ArrayIndexOutOfBoundsException { + if (row < 0 || row >= this.tableData.size()) throw new ArrayIndexOutOfBoundsException(row); + + synchronized(tableAccess){ + this.tableData.remove(row); + fireTableRowsDeleted(row,row); + } + } + + public void removeJob(gmpuJob job){ + synchronized(tableAccess){ + int i=this.findJob(job); + if (i != -1){ + this.tableData.remove(i); + fireTableRowsDeleted(i,i); + } + } + } + + private int findJob(gmpuJob job){ + for (int i=0,i2=this.tableData.size()-1;i=0;i++,i2--){ //setup variables to check in two directions. + if (this.tableData.get(i).Job == job) return i; //look going towards max size. + else if (this.tableData.get(i2).Job == job) return i2; //look going towards 0. + else if (i>=i2) break; //if we cant find the data in either direction, break out. + } + return -1; + } + + @Override + public String getColumnName(int col){ return COLUMN_NAMES[col]; } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex){ return false; } + + public void clearData(){ + synchronized(tableAccess){ + int maxSize = this.tableData.size(); + this.tableData.clear(); + fireTableRowsDeleted(0,maxSize-1); + } + } +}