Browse Source

Fixed an issue with the default logging. Also made some sort of basic change to the fxml for the main app.

master
Drew Short 11 years ago
parent
commit
9d5fc4107f
  1. 20
      src/main/java/com/sothr/imagetools/AppCLI.java
  2. 2
      src/main/java/com/sothr/imagetools/AppConfig.java
  3. 2
      src/main/resources/fxml/mainapp/MainApp.fxml

20
src/main/java/com/sothr/imagetools/AppCLI.java

@ -1,11 +1,7 @@
package com.sothr.imagetools; package com.sothr.imagetools;
import com.sothr.imagetools.image.SimilarImages; import com.sothr.imagetools.image.SimilarImages;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import scala.collection.immutable.List; import scala.collection.immutable.List;
@ -17,16 +13,24 @@ class AppCLI {
private static Logger logger; private static Logger logger;
private static final String HEADER = "Process images and search for duplicates and similar images heuristically";
private static final String FOOTER = "Please report issues to...";
public static void main(String[] args) { public static void main(String[] args) {
AppConfig.configureApp();
logger = LoggerFactory.getLogger(AppCLI.class);
logger.info("Started Image Tools CLI");
try { try {
Options options = getOptions(); Options options = getOptions();
CommandLineParser parser = new BasicParser(); CommandLineParser parser = new BasicParser();
CommandLine cmd = parser.parse(options, args); CommandLine cmd = parser.parse(options, args);
if (cmd.hasOption('h') || cmd.getOptions().length < 1 || cmd.getArgs().length > 0) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("Image-Tools CLI", HEADER, options, FOOTER, true);
} else {
AppConfig.configureApp();
logger = LoggerFactory.getLogger(AppCLI.class);
logger.info("Started Image Tools CLI");
process(cmd); process(cmd);
AppConfig.shutdown(); AppConfig.shutdown();
}
System.exit(0); System.exit(0);
} catch (Exception ex) { } catch (Exception ex) {
logger.error("Unhandled exception in AppCLI",ex); logger.error("Unhandled exception in AppCLI",ex);

2
src/main/java/com/sothr/imagetools/AppConfig.java

@ -69,7 +69,7 @@ public class AppConfig {
// Call context.reset() to clear any previous configuration, e.g. default // Call context.reset() to clear any previous configuration, e.g. default
// configuration. For multi-step configuration, omit calling context.reset(). // configuration. For multi-step configuration, omit calling context.reset().
context.reset(); context.reset();
configurator.doConfigure(ResourceLoader.get().getResource("logback-minimum-config.xml"));
configurator.doConfigure(ResourceLoader.get().getResourceStream("logback-minimum-config.xml"));
} catch (JoranException je) { } catch (JoranException je) {
// StatusPrinter will handle this // StatusPrinter will handle this
} }

2
src/main/resources/fxml/mainapp/MainApp.fxml

@ -4,7 +4,7 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<AnchorPane minHeight="-Infinity" minWidth="0.0" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sothr.imagetools.ui.controller.AppController">
<AnchorPane minHeight="400.0" minWidth="600.0" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sothr.imagetools.ui.controller.AppController">
<children><MenuBar fx:id="rootMenuBar" minWidth="-Infinity" prefHeight="29.0" prefWidth="600.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns:fx="http://javafx.com/fxml"> <children><MenuBar fx:id="rootMenuBar" minWidth="-Infinity" prefHeight="29.0" prefWidth="600.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns:fx="http://javafx.com/fxml">
<menus> <menus>
<Menu mnemonicParsing="false" text="File"> <Menu mnemonicParsing="false" text="File">

Loading…
Cancel
Save