Ignore:
Timestamp:
06/24/13 13:38:40 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • upgrade to Java 7
    • use try-multi-catch clauses
    • use try-with-resources were appropriate
  • configure FindBugs? (use mvn site and then navigate in browser to the report)
    • remove most bugs found
  • parametrize Dispatching environment (Dispatcher, RunAt?) to enforce more control on the place of closures actual call

CHANGELOG:
Rework FavouritesXMLFactory.

FindBugs?. Thread start.

FindBugs?. Minor change.

FindBugs?. Iterate over entrySet.

FindBugs?. Various.

FindBug?.

FindBug?. Encoding.

FindBug?. Final fields.

FindBug?.

Remove synchronization bug in ClientConnection?.

Experiments with findbugs.

Finish parametrization.

Make RunAt? an abstract class.

More changes in parametrization.

More changes in parametrizing dispatching.

Several changes to parametrize tasks.

Rename Runnable to RunAt?.

Add specific framsticks Runnable.

Add JSR305 (annotations).

Add findbugs reporting.

More improvements to ParamBuilder? wording.

Make FramsClass? accept also ParamBuilder?.

Change wording of ParamBuilder?.

Change wording of Request creation.

Use Java 7 exception catch syntax.

Add ScopeEnd? class.

Upgrade to Java 7.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/gui/Frame.java

    r84 r85  
    66import com.framsticks.gui.view.TreeCellRenderer;
    77import com.framsticks.util.dispatching.Dispatcher;
     8import com.framsticks.util.lang.ScopeEnd;
    89import com.framsticks.util.swing.KeyboardModifier;
    910import org.apache.log4j.Logger;
     
    2122import java.util.HashMap;
    2223import java.util.Map;
     24import com.framsticks.util.dispatching.RunAt;
    2325
    2426/**
     
    2628 */
    2729@SuppressWarnings("serial")
    28 public class Frame extends JFrame implements Dispatcher {
     30public class Frame extends JFrame implements Dispatcher<Frame> {
    2931
    3032        private static final Logger log = Logger.getLogger(Frame.class.getName());
     
    267269
    268270        @Override
    269         public void invokeLater(Runnable runnable) {
    270                 SwingDispatcher.instance.invokeLater(runnable);
     271        public void invokeLater(RunAt<? extends Frame> runnable) {
     272                SwingDispatcher.getInstance().invokeLater(runnable);
    271273        }
    272274
     
    325327        }
    326328
    327         public Runnable startChange(final DefaultMutableTreeNode node) {
     329        public ScopeEnd startChange(final DefaultMutableTreeNode node) {
    328330                assert isActive();
    329331                final TreePath selection = tree.getSelectionPath();
    330                 return new Runnable() {
    331                         @Override
    332                         public void run() {
     332                return new ScopeEnd() {
     333                        @Override
     334                        public void close() {
    333335                                assert isActive();
    334336                                treeModel.nodeChanged(node);
     
    373375                final TreePath treePath = endpointsByInstance.get(path.getInstance()).getTreePath(path, false);
    374376                log.info("go to path: " + path + "(" + treePath + ")");
    375                 invokeLater(new Runnable() {
     377
     378                new RunAt<Frame>(this) {
    376379                        @Override
    377380                        public void run() {
     381                                log.info("executed");
    378382                                tree.setSelectionPath(treePath);
    379383                                tree.makeVisible(treePath);
    380384                                assert tree.isVisible(treePath);
    381385                        }
    382 
    383                 });
     386                };
     387
    384388        }
    385389
     
    387391        public void addNode(TreeNode child, DefaultMutableTreeNode parent) {
    388392                assert isActive();
    389                 Runnable r = startChange(parent);
    390                 treeModel.insertNodeInto(child, parent, parent.getChildCount());
    391                 r.run();
     393
     394                try (ScopeEnd e = startChange(parent)) {
     395                        treeModel.insertNodeInto(child, parent, parent.getChildCount());
     396                }
    392397        }
    393398
Note: See TracChangeset for help on using the changeset viewer.