Add Access Token Label and clean up clode

master
mike 2014-09-03 23:14:02 +02:00
parent 3ac35f4375
commit f586433757
4 changed files with 27 additions and 63 deletions

View File

@ -8,18 +8,17 @@
<property name="source" value="1.7"/>
<property name="lib" value="release/lib" />
<property name="groovy-version" value="2.3.4" />
<property name="out.dir" value="build/"/>
<path id="classpath">
<pathelement path="build/" />
<fileset dir="${lib}">
<include name="*.jar" />
<include name="**/*.jar" />
</fileset>
</path>
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="lib/appbundler-1.0.jar" />
<!-- deps - Download dependencies -->
<target name="deps" unless="skip.download">
<echo message="downloading groovy to ${lib}"/>
@ -71,18 +70,14 @@
</fileset>
</copy>
</target>
<manifestclasspath property="lib.list" jarfile="release/Magarena.jar">
<classpath refid="classpath"/>
</manifestclasspath>
<!-- jar (default target) - Create .jar file -->
<target depends="build" name="jar">
<jar destfile="release/Magarena.jar" basedir="build" includes="**/*.*">
<manifest>
<attribute name="Main-Class" value="magic.MagicMain" />
<attribute name="SplashScreen-Image" value="magic/data/textures/logo.jpg" />
<attribute name="Class-Path" value="lib/groovy-all-${groovy-version}.jar " />
<attribute name="Class-Path" value="lib/groovy-all-${groovy-version}.jar lib/json.jar lib/jedis-2.1.0.jar lib/mysql-connector-java-5.1.25-bin.jar lib/activejdbc-1.4.6.jar lib/slf4j-api-1.6.4.jar lib/slf4j-simple-1.6.4.jar lib/javalite-common-1.4.6.jar lib/miglayout-core-4.2.jar lib/miglayout-swing-4.2.jar lib/commons-io-2.4.jar lib/trident-1.3.jar" />
<attribute name="Class-Path" value="${lib.list}"/>
<attribute name="Class-Path" value="lib/groovy-all-${groovy-version}.jar lib/json.jar lib/miglayout-core-4.2.jar lib/miglayout-swing-4.2.jar lib/commons-io-2.4.jar lib/trident-1.3.jar" />
</manifest>
</jar>
</target>
@ -91,12 +86,5 @@
<target name="javadoc">
<javadoc sourcepath="src" destdir="javadoc" />
</target>
<target name="instrument" depends="build">
<java classname="org.javalite.instrumentation.Main">
<sysproperty key="outputDirectory" value="${out.dir}"/>
<classpath refid="classpath"/>
</java>
</target>
</project>

View File

@ -71,7 +71,6 @@ public class FiremindQueueWorker {
}
public static void main(final String[] args) {
// setup the handler for any uncaught exception
try {
if (java.net.InetAddress.getLocalHost().getHostName()
.equals("mike-AndroidDev")) {
@ -110,7 +109,7 @@ public class FiremindQueueWorker {
if (gameCount > 25) {
System.out
.println("Exceeded max number of games. Shutting down.");
System.exit(0);
return;
}
} else {

View File

@ -86,13 +86,11 @@ public class FiremindWorkerDialog extends JDialog implements ActionListener, Pro
setSize(360, 460);
setUndecorated(true);
((JComponent)getContentPane()).setBorder(BorderFactory.createMatteBorder(0, 8, 8, 8, THEME.getColor(Theme.COLOR_TITLE_BACKGROUND)));
//
backgroundButton.setEnabled(false);
}
private void updateComponentState() {
System.out.println("Update component state"+ (firemindWorkerPanel.isRunning() ? "true" : "false"));
boolean isBackgroundButtonEnabled = false;
final boolean isRunning = firemindWorkerPanel.isRunning();
isBackgroundButtonEnabled = isBackgroundButtonEnabled || isRunning;
@ -136,13 +134,6 @@ public class FiremindWorkerDialog extends JDialog implements ActionListener, Pro
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("isRunning")) {
updateComponentState();
// final int progressValue = (int)evt.getNewValue();
// progressBar.setIndeterminate(progressValue == 0 && importWorker.getProgressNote() != "");
// progressBar.setValue(progressValue);
// } else if (evt.getPropertyName().equalsIgnoreCase("state")) {
// progressBar.setIndeterminate(!evt.getNewValue().toString().equalsIgnoreCase("done"));
// } else if (evt.getPropertyName().equalsIgnoreCase("progressNote")) {
// taskOutput.append(evt.getNewValue().toString());
}
}

View File

@ -30,6 +30,7 @@ public class FiremindWorkerPanel extends JPanel {
protected final GeneralConfig CONFIG = GeneralConfig.getInstance();
protected final JLabel accessKeyLabel = getAccessKeyLabel();
private final JTextField accessKeyTextField = new JTextField();
private final MigLayout migLayout = new MigLayout();
protected final JLabel captionLabel = getCaptionLabel(getProgressCaption());
@ -37,8 +38,6 @@ public class FiremindWorkerPanel extends JPanel {
private final JButton cancelButton = new JButton("Cancel");
@SuppressWarnings("unused")
private boolean isCancelled = false;
private SwingWorker<String, Void> firemindWorker;
private boolean isRunning = false;
protected SwingWorker<String, Void> getFiremindWorker(final Proxy proxy) {
@ -67,7 +66,6 @@ public class FiremindWorkerPanel extends JPanel {
setLookAndFeel();
refreshLayout();
setActions();
// buildDownloadImagesList();
}
public boolean isRunning() {
@ -108,8 +106,8 @@ public class FiremindWorkerPanel extends JPanel {
}
public void doCancel() {
isCancelled = true;
doCancelFiremindWorker();
isRunning = false;
}
private void doCancelFiremindWorker() {
@ -117,19 +115,7 @@ public class FiremindWorkerPanel extends JPanel {
firemindWorker.cancel(true);
setButtonState(false);
}
}
// protected final void buildDownloadImagesList() {
// if (!isCancelled) {
// captionLabel.setIcon(IconImages.BUSY16);
// captionLabel.setText(getProgressCaption());
// imagesScanner = new ImagesScanner();
// imagesScanner.execute();
// downloadButton.setEnabled(false);
// notifyStatusChanged(DownloaderState.SCANNING);
// }
// }
}
protected void setButtonState(final boolean isRunning) {
runButton.setVisible(!isRunning);
@ -146,6 +132,7 @@ public class FiremindWorkerPanel extends JPanel {
removeAll();
migLayout.setLayoutConstraints("flowy, insets 2, gapy 0");
accessKeyTextField.setText(CONFIG.getFiremindAccessToken());
add(accessKeyLabel, "w 100%");
add(accessKeyTextField, "w 100%");
add(runButton.isVisible() ? runButton : cancelButton, "w 100%");
}
@ -157,7 +144,17 @@ public class FiremindWorkerPanel extends JPanel {
runButton.setEnabled(true);
runButton.setText(getStartButtonCaption());
}
private JLabel getAccessKeyLabel() {
final JLabel lbl = new JLabel();
lbl.setText("Access Key");
// lbl.setHorizontalAlignment(SwingConstants.LEFT);
// lbl.setHorizontalTextPosition(SwingConstants.LEADING);
lbl.setOpaque(false);
lbl.setFont(lbl.getFont().deriveFont(Font.BOLD));
return lbl;
}
private JLabel getCaptionLabel(final String text) {
final ImageIcon ii = IconImages.BUSY16;
final JLabel lbl = new JLabel(ii);
@ -179,25 +176,14 @@ public class FiremindWorkerPanel extends JPanel {
private class FiremindWorkerRunner extends SwingWorker<String, Void> {
@Override
protected String doInBackground() throws Exception {
String[] arguments = new String[]{""};
FiremindQueueWorker.main(arguments);
return "finished";
// restarts after 25 games
while(true){
String[] arguments = new String[]{""};
FiremindQueueWorker.main(arguments);
}
}
@Override
protected void done() {
// try {
// files = get();
// } catch (InterruptedException | ExecutionException ex) {
// throw new RuntimeException(ex);
// } catch (CancellationException ex) {
//// System.out.println("ImagesScanner cancelled by user!");
// }
// if (!isCancelled) {
// downloadButton.setEnabled(files.size() > 0);
// captionLabel.setIcon(null);
// captionLabel.setText(getProgressCaption() + files.size());
// }
// notifyStatusChanged(DownloaderState.STOPPED);
}
}