diff --git a/.classpath b/.classpath index 23427e3..fe8612c 100644 --- a/.classpath +++ b/.classpath @@ -13,7 +13,7 @@ - + diff --git a/.gitignore b/.gitignore index 2ac8426..7ffee92 100755 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ hs_err_pid* /JetUML-0.9/* /JetUML-0.9/.idea/workspace.xml *.iml -logging +*.log +.fuse* META-INF diff --git a/conf/ladder.conf b/conf/ladder.conf new file mode 100644 index 0000000..8fa552d --- /dev/null +++ b/conf/ladder.conf @@ -0,0 +1,18 @@ +# Where should the Ladder system look for the configuration file to configure +# the logging system? +loggingConfigFile = logging/ladderLoggingConfig.lcf + +# What folder are any domain descriptions stored in? +domainDescriptions = ../LadderDomains/domainDescriptions/domains/ + +# What folder are the shape descriptions stored in? +shapeDescriptions = ../LadderDomains/domainDescriptions/shapes/ + +# What folder is testData stored in? +testData = ../LadderData/testData517 + +# This configuration property is the default domain to load +defaultLoadDomain = COA.xml + +# What folder are the various models stored in? +modelDir = model diff --git a/lib/kryo-4.0.0.jar b/lib/kryo-4.0.0.jar deleted file mode 100644 index e0805d4..0000000 Binary files a/lib/kryo-4.0.0.jar and /dev/null differ diff --git a/lib/kryo-4.0.2.jar b/lib/kryo-4.0.2.jar new file mode 100644 index 0000000..85bb050 Binary files /dev/null and b/lib/kryo-4.0.2.jar differ diff --git a/logging/ladderLoggingConfig.lcf b/logging/ladderLoggingConfig.lcf new file mode 100644 index 0000000..d54c4d2 --- /dev/null +++ b/logging/ladderLoggingConfig.lcf @@ -0,0 +1,230 @@ +# The root category uses the appender called ROOT_APP. You can comment/uncomment +# a given line to change the default level of debugging for the entire +# application. For development, you probably want DEBUG. For Deployment, you +# probably don't want anything but ERROR by default. This can always be changed +# by editing this file if you need more/less, and you don't have to modify +# the logging code within the application itself. + + +###################### Root Logger +## For development +#log4j.rootCategory=DEBUG, ROOT_APP +## For deployment +log4j.rootCategory=ERROR, ROOT_APP + + +###################### ROOT_APP appender +# APP is set to be a RollingFileAppender which outputs to the file +# "ladder.log". If the file gets above a specified size limit, create a new +# log file, up to a certain number of log files. +log4j.appender.ROOT_APP=org.apache.log4j.RollingFileAppender +log4j.appender.ROOT_APP.File=logging/ladder.log +# 5MB log size limit +log4j.appender.ROOT_APP.MaxFileSize=5000KB +# just one other file, then start to recycle +log4j.appender.ROOT_APP.MaxBackupIndex=1 +log4j.appender.ROOT_APP.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the ROOT_APP log. +# See org.apache.log4j.PatternLayout for field details +# Date, priority, thread, logger location (SLOW), message, endline +log4j.appender.ROOT_APP.layout.ConversionPattern=%-35d{dd MMM yyyy, HH:mm:ss:SSS} %-5p [%t] %l -- %m%n + + +###################### Class Loggers +#Examples adding loggers for specific classes/packages +# +# Adding a logger to a class +# log4j.logger.=DEBUG, +# +# Multiple loggers +# log4j.logger.=DEBUG, , , ... +# +# Currently the available logs are: +# HIGH_LEVEL - For high level recognition +# LOW_LEVEL - For low level recognition +# SEGS - For segmentations +# CON - Console logging + +# These go to both Console (short version) and to the Test file appender +log4j.logger.test.functional.ladder.recognition.constraint.domains.ShapeDefinitionAccuracyFactory=DEBUG, CONSHORT, TEST +log4j.logger.test.functional.ladder.recognition.constraint.domains.DomainDescriptionAccuracyTest=DEBUG, CONSHORT, TEST + + +log4j.logger.org.ladder.recognition.constraint.CALVIN=ERROR, HIGH_LEVEL, CON +log4j.logger.org.ladder.recognition.constraint.builders.ShapeBuilderTracy=ERROR, HIGH_LEVEL, CON +log4j.logger.org.ladder.recognition.constraint.grouping.PostMidLevelGrouper=ERROR, HIGH_LEVEL, CON +log4j.logger.org.ladder.recognition.paleo=ERROR, LOW_LEVEL, PALEO +log4j.logger.org.ladder.recognition.profiling.RunTimeLogger=DEBUG, RUNTIME +log4j.logger.org.ladder.segmentation=ERROR, LOW_LEVEL, SEGS + +log4j.logger.org.ladder.recognition.constraint.domains.compiler.DomainDefinitionCompiler=WARN,CON +#log4j.logger.org.ladder.recognition.handwriting.HandwritingRecognizer=ERROR, CON +#log4j.logger.test.functional.ladder.recognition.constraint.domains=INFO, CON +#log4j.logger.test.functional.ladder.recognition.shapes.SingleShapeAccuracy=INFO, CON +log4j.logger.org.ladder.recognition.RecognitionManager=ERROR, CON +#log4j.logger.edu.tamu.deepGreen.recognition.area.AreaRecognizer=DEBUG, CON + +## I want to see all the recognition package stuff on the console. +#log4j.logger.org.ladder.recognition=DEBUG, CON +## turn constraints off +#log4j.logger.org.ladder.recognition.constraint.confidence=OFF +#log4j.logger.org.ladder.recognition.constraint.ConstraintFactory=OFF +## turn paleo off, except for actual PaleoRecognizer +#log4j.logger.org.ladder.recognition.paleo=OFF +#log4j.logger.org.ladder.recognition.paleo.PaleoSketchRecognizer=DEBUG, CON +## COA TestPanel DEBUG and to the console +#log4j.logger.edu.tamu.deepGreen.test.COATestPanel=DEBUG, CON +#log4j.logger.edu.tamu.deepGreen.SIDCLookup=DEBUG, CON +#log4j.logger.test.ladder.recognition.constraint.domains.SingleExampleShapeAccuracyTest=INFO, CON + +###################### LADDER appenders +# To create an appender, copy one of the ones below and replace the name and file name +# For example, copy HIGH_LEVEL, replace all instances of HIGH_LEVEL with the new name +# and change highLevel.log to the name for your log file + + +###################### CON appender +# CON is set to be a ConsoleAppender which outputs to the file +# "ladder.log". If the file gets above a specified size limit, create a new +# log file, up to a certain number of log files. +log4j.appender.CON=org.apache.log4j.ConsoleAppender +log4j.appender.CON.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the CON log. +# See org.apache.log4j.PatternLayout for field details +# priority, thread, logger location (SLOW) -- message, endline +log4j.appender.CON.layout.ConversionPattern=%-5p [%t] %F.%M:%L -- %m%n + + + +###################### CONSHORT appender +# CON is set to be a ConsoleAppender which outputs to the file +# "ladder.log". If the file gets above a specified size limit, create a new +# log file, up to a certain number of log files. +log4j.appender.CONSHORT=org.apache.log4j.ConsoleAppender +log4j.appender.CONSHORT.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the CON log. +# See org.apache.log4j.PatternLayout for field details +# priority, thread, logger location (SLOW) -- message, endline +log4j.appender.CONSHORT.layout.ConversionPattern=%m%n + + +###################### HIGH_LEVEL appender +# HIGH_LEVEL is set to be a RollingFileAppender which outputs to the file +# "highLevel.log". If the file gets above a specified size limit, create a new +# log file, up to a certain number of log files. +log4j.appender.HIGH_LEVEL=org.apache.log4j.RollingFileAppender +log4j.appender.HIGH_LEVEL.File=logging/highLevel.log +# 5MB log size limit +log4j.appender.HIGH_LEVEL.MaxFileSize=5000KB +# just one other file, then start to recycle +log4j.appender.HIGH_LEVEL.MaxBackupIndex=1 +log4j.appender.HIGH_LEVEL.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the HIGH_LEVEL log. +# See org.apache.log4j.PatternLayout for field details +# Date, priority, thread, logger location (SLOW), message, endline +log4j.appender.HIGH_LEVEL.layout.ConversionPattern=%-35d{dd MMM yyyy, HH:mm:ss:SSS} %-5p [%t] %l -- %m%n%n + +###################### LOW_LEVEL appender +# LOW_LEVEL is set to be a RollingFileAppender which outputs to the file +# "lowLevel.log". If the file gets above a specified size limit, create a new +# log file, up to a certain number of log files. +log4j.appender.LOW_LEVEL=org.apache.log4j.RollingFileAppender +log4j.appender.LOW_LEVEL.File=logging/lowLevel.log +# 5MB log size limit +log4j.appender.LOW_LEVEL.MaxFileSize=5000KB +# just one other file, then start to recycle +log4j.appender.LOW_LEVEL.MaxBackupIndex=1 +log4j.appender.LOW_LEVEL.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the LOW_LEVEL log. +# See org.apache.log4j.PatternLayout for field details +# Date, priority, thread, logger location (SLOW), message, endline +log4j.appender.LOW_LEVEL.layout.ConversionPattern=%-35d{dd MMM yyyy, HH:mm:ss:SSS} %-5p [%t] %l -- %m%n%n + + +###################### PALEO appender +# PALEO is set to be a RollingFileAppender which outputs to the file +# "paleo.log". If the file gets above a specified size limit, create a new +# log file, up to a certain number of log files. +log4j.appender.PALEO=org.apache.log4j.RollingFileAppender +log4j.appender.PALEO.File=logging/paleo.log +# 5MB log size limit +log4j.appender.PALEO.MaxFileSize=5000KB +# just one other file, then start to recycle +log4j.appender.PALEO.MaxBackupIndex=1 +log4j.appender.PALEO.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the PALEO log. +# See org.apache.log4j.PatternLayout for field details +# Date, priority, thread, logger location (SLOW), message, endline +log4j.appender.PALEO.layout.ConversionPattern=%-35d{dd MMM yyyy, HH:mm:ss:SSS} %-5p [%t] %l -- %m%n%n + + +###################### SEGS appender +# SEGS is set to be a RollingFileAppender which outputs to the file +# "segs.log". If the file gets above a specified size limit, create a new +# log file, up to a certain number of log files. +log4j.appender.SEGS=org.apache.log4j.RollingFileAppender +log4j.appender.SEGS.File=logging/segmentation.log +# 5MB log size limit +log4j.appender.SEGS.MaxFileSize=5000KB +# just one other file, then start to recycle +log4j.appender.SEGS.MaxBackupIndex=1 +log4j.appender.SEGS.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the SEGS log. +# See org.apache.log4j.PatternLayout for field details +# Date, priority, thread, logger location (SLOW), message, endline +log4j.appender.SEGS.layout.ConversionPattern=%-35d{dd MMM yyyy, HH:mm:ss:SSS} %-5p [%t] %l -- %m%n%n + + +###################### CONSTR appender +# CONSTR is set to be a RollingFileAppender which outputs to the file +# "constraint.log". If the file gets above a specified size limit, create a new +# log file, up to a certain number of log files. +log4j.appender.CONSTR=org.apache.log4j.RollingFileAppender +log4j.appender.CONSTR.File=logging/constraint.log +# 5MB log size limit +log4j.appender.CONSTR.MaxFileSize=5000KB +# just one other file, then start to recycle +log4j.appender.CONSTR.MaxBackupIndex=1 +log4j.appender.CONSTR.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the SEGS log. +# See org.apache.log4j.PatternLayout for field details +# Date, priority, thread, logger location (SLOW), message, endline +log4j.appender.CONSTR.layout.ConversionPattern=%-35d{dd MMM yyyy, HH:mm:ss:SSS} %-5p [%t] %l -- %m%n%n + +###################### RUNTIME appender +# RUNTIME is set to be a RollingFileAppender which outputs to the file +# "runtime.log". If the file gets above a specified size limit, create a new +# log file, up to a certain number of log files. +log4j.appender.RUNTIME=org.apache.log4j.RollingFileAppender +log4j.appender.RUNTIME.File=logging/runtime.log +# 5MB log size limit +log4j.appender.RUNTIME.MaxFileSize=5000KB +# just one other file, then start to recycle +log4j.appender.RUNTIME.MaxBackupIndex=1 +log4j.appender.RUNTIME.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the SEGS log. +# See org.apache.log4j.PatternLayout for field details +# Date, priority, thread, logger location (SLOW), message, endline +log4j.appender.RUNTIME.layout.ConversionPattern=%-5p [%t]: %m%n + +###################### TEST appender +# TEST is set to be a FileAppender which outputs to the file +# "test.log". The logger does NOT append, but overwrites with a new file each +# time +log4j.appender.TEST=org.apache.log4j.FileAppender +# Do not append, start a new file each time +log4j.appender.TEST.append=false +log4j.appender.TEST.File=logging/test.log +log4j.appender.TEST.layout=org.apache.log4j.PatternLayout +# Format to use when logging entries in the TEST log. +# See org.apache.log4j.PatternLayout for field details +# Date, priority, thread, logger location (SLOW), message, endline +log4j.appender.TEST.layout.ConversionPattern=%m%n + + + +# We can create different appenders and files for different parts of LADDER. +# These loggers will log their information in their local appenders, PLUS all +# that information will also be present in the root logger. But, these +# sub-loggers can have different priorities, etc. +# For example, here's a logger for objects in org.ladder.core diff --git a/src/controller/AbstractDiagramController.java b/src/controller/AbstractDiagramController.java index 31c6af3..ac58b51 100644 --- a/src/controller/AbstractDiagramController.java +++ b/src/controller/AbstractDiagramController.java @@ -1,6 +1,7 @@ package controller; import javafx.application.Platform; + import javafx.embed.swing.SwingFXUtils; import javafx.fxml.FXML; import javafx.geometry.Bounds; @@ -20,6 +21,7 @@ import model.edges.*; import model.nodes.*; import util.Constants; +import util.GlobalVariables; import util.NetworkUtils; import util.commands.*; import util.insertIMG.*; @@ -40,16 +42,20 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import org.slf4j.LoggerFactory; + import java.io.IOException; import java.io.File; -import java.util.logging.Level; -import java.util.logging.Logger; + +import org.controlsfx.control.Notifications; +import org.slf4j.Logger; /** * Controls all user inputs and delegates work to other controllers. */ public abstract class AbstractDiagramController { + private static Logger logger = LoggerFactory.getLogger(AbstractDiagramController.class); protected Graph graph; protected Stage aStage; @@ -110,13 +116,16 @@ protected enum ToolEnum { @FXML CheckMenuItem mouseMenuItem; @FXML - protected Button createBtn, packageBtn, edgeBtn, selectBtn, drawBtn, undoBtn, redoBtn, moveBtn, deleteBtn, recognizeBtn, voiceBtn; + protected Button createBtn, packageBtn, edgeBtn, selectBtn, drawBtn, undoBtn, redoBtn, moveBtn, deleteBtn, recognizeBtn, voiceBtn, commitBtn; ContextMenu aContextMenu; private AbstractDiagramController instance = this; + private String userName; + private String collaborationType = Constants.collaborationTypeSynchronous; public void initialize() { + logger.debug("initialize()"); initDrawPaneActions(); initContextMenu(); initZoomSlider(); @@ -140,6 +149,7 @@ public void initialize() { } private void initDrawPaneActions() { + logger.debug("initDrawPaneActions()"); //Makes sure the pane doesn't scroll when using a touch screen. drawPane.setOnScroll(event -> event.consume()); @@ -152,12 +162,29 @@ private void initDrawPaneActions() { abstract void initNodeActions(AbstractNodeView nodeView); + public String getUserName() { + return userName; + } + + public void setUserName(String newValue) { + userName = newValue; + } + + public String getCollaborationType() { + return collaborationType; + } + + public void setCollaborationType(String newValue) { + collaborationType = newValue; + } + //----------------- DELETING ---------------------------------------- /** * Deletes all selected nodes, edges and sketches. */ void deleteSelected() { + logger.debug("deleteSelected()"); CompoundCommand command = new CompoundCommand(); for (AbstractNodeView nodeView : selectedNodes) { deleteNode(nodeView, command, false, false); @@ -189,6 +216,7 @@ void deleteSelected() { * @param remote, If true this command was received from a remote server. */ public void deleteNode(AbstractNodeView nodeView, CompoundCommand pCommand, boolean undo, boolean remote) { + logger.debug("deleteNode()"); CompoundCommand command = null; if (pCommand == null && !undo) { command = new CompoundCommand(); @@ -220,6 +248,7 @@ public void deleteNode(AbstractNodeView nodeView, CompoundCommand pCommand, bool * @param undo If true this is an undo and no command should be created */ public void deleteEdgeView(AbstractEdgeView edgeView, CompoundCommand pCommand, boolean undo, boolean remote) { + logger.debug("deleteEdgeView()"); CompoundCommand command = null; if (pCommand == null && !undo) { //If this is not part of a compoundcommand command = new CompoundCommand(); @@ -243,6 +272,7 @@ public void deleteEdgeView(AbstractEdgeView edgeView, CompoundCommand pCommand, } public void addSketch(Sketch sketch, boolean isImport, boolean remote){ + logger.debug("addSketch()"); initSketchActions(sketch); drawPane.getChildren().add(sketch.getPath()); if(!isImport){ @@ -252,6 +282,7 @@ public void addSketch(Sketch sketch, boolean isImport, boolean remote){ } public void deleteSketch(Sketch sketch, CompoundCommand pCommand, boolean remote) { + logger.debug("deleteSketch()"); CompoundCommand command; if (pCommand == null) { command = new CompoundCommand(); @@ -272,6 +303,7 @@ public void deleteSketch(Sketch sketch, CompoundCommand pCommand, boolean remote * @param remote, true if change comes from a remote server */ public void deleteNodeEdges(AbstractNode node, CompoundCommand command, boolean undo, boolean remote) { + logger.debug("deleteNodeEdges()"); AbstractEdge edge; ArrayList edgeViewsToBeDeleted = new ArrayList<>(); for (AbstractEdgeView edgeView : allEdgeViews) { @@ -295,6 +327,7 @@ public void deleteNodeEdges(AbstractNode node, CompoundCommand command, boolean * @param sketch */ private void initSketchActions(Sketch sketch) { + logger.debug("initSketchActions()"); sketch.getPath().setOnMousePressed(event -> { if (mouseCreationActivated) { handleOnSketchPressedEvents(sketch); @@ -353,6 +386,7 @@ private void initSketchActions(Sketch sketch) { } private void handleOnSketchPressedEvents(Sketch sketch) { + logger.debug("handleOnSketchPressedEvents()"); if (sketch.isSelected()) { selectedSketches.remove(sketch); sketch.setSelected(false); @@ -373,6 +407,7 @@ public ArrayList getSelectedEdges() { //---------------------- MENU HANDLERS --------------------------------- public void handleMenuActionUML() { + logger.debug("handleMenuActionUML()"); List