Ignore:
Timestamp:
07/10/13 22:41:02 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGTS:

  • complete events implementation
  • add CLI in Java Framsticks server
  • add automatic registration for events in GUI
  • improve objects fetching (object are never overwritten with new instances)
  • properly react for ListChange? events
  • add ListPanel? with table view
    • columns to be shown may be statically specified in configuration
    • currently modyfying data through tables is not available
  • improve maven configuration
    • configuration file may be specified without touching pom.xml

CHANGELOG:
Extract constants from Flags into ParamFlags? and SetStateFlags?.

Extract flags I/O to FlagsUtils? class.

Configured maven to exec given resource configuration.

For example:
mvn exec:exec -Dframsticks.config=/configs/managed-console.xml

Cleanup pom.xml

Rename ObjectTree? to LocalTree? (also make LocalTree? and RemoteTree? final).

Minor change.

Add maximum number of columns in ListPanelProvider?.

Improve ColumnsConfig? interpretation.

Automatically fill FramsClass?.name if trying to construct empty.

Improve identitifer case mangling in XmlLoader?.

Introduce configurable ColumnsConfig?.

Draft working version of ListPanel?.

Table is being shown (although empty).

More improvements to table building.

Move some functionality from Frame to TreeModel?.

Move tree classes in gui to separate package.

Remove old table related classes.

Add draft implementation of TableModel?.

Redirect ParamBuilder?.forAccess to AccessInterface?.

Optimize ParamBuilder?.forAccess()

Do not clear list when loading.

Do not load fetched values directly.

Implement different AccessInterface? copying policy.

Optimize fetching values routine.

Remove Mode enum (work out get semantics).

Some improvements to ListChange? handling.

Improve UniqueListAccess?.

Add reaction for ListChanges? in the TreeNode?.

EventListeners? are being added in the TreeNode?.

Listeners for ListParams? are now very naive (they download
whole list).

Automatially register on events in GUI.

Events are working in RemoteTree? and Server.

Move listeners to the ClientSideManagedConnection?.

Remove old classes responsible for event subscriptions.

Improve event reading.

Improve events handling at server side.

Add register attribute in FramsClassAnnotation?
to automatically also register other classes.

Registering events works.

Setup for remote listeners registration.

More improvements.

Minor changes.

Add rootTree to the ClientAtServer?.

Moving CLI to the ClientAtServer?.

Fix bug: use Void.TYPE instead of Void.class

More development around CLI.

  • Improve Path resolving.

Add synthetic root to ObjectTree?.

It is needed to allow sybling for the original root
that would containg CLI.

Some work with registering events in RemoteTree?.

Draft implementation of listener registering in RemoteTree?.

Support events registration in the ObjectTree?.

Add events support to ReflectionAccess?.

EventParam? is recognized by ParamCandidate?.

Prepare interface for Events across project.

Add EventListener? and API for listeners in Tree.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/core/Path.java

    r98 r99  
    66import com.framsticks.util.FramsticksException;
    77import com.framsticks.util.dispatching.Dispatching;
     8import com.framsticks.util.dispatching.ExceptionResultHandler;
     9import com.framsticks.util.dispatching.IgnoreExceptionHandler;
     10import com.framsticks.util.lang.Pair;
    811
    912import java.util.Iterator;
    1013import java.util.LinkedList;
    1114import java.util.List;
     15import java.util.regex.Pattern;
    1216
    1317import javax.annotation.Nonnull;
     
    2731        final LinkedList<Node> nodes;
    2832
    29         protected static Object getKnownChild(Tree tree, AccessInterface access, CompositeParam param) {
     33        protected static Object getKnownChild(Tree tree, AccessInterface access, CompositeParam param, ExceptionResultHandler handler) {
    3034                Object child = access.get(param, Object.class);
    3135                if (child == null) {
     
    3640                        return child;
    3741                } catch (FramsticksException e) {
     42                        handler.handle(e);
    3843                }
    3944                return null;
     
    130135                }
    131136
    132 
    133137                public PathBuilder resolve(@Nonnull Tree tree, String textual) {
     138                        return resolve(tree, textual, IgnoreExceptionHandler.getInstance());
     139                }
     140
     141                public PathBuilder resolve(@Nonnull Tree tree, String textual, ExceptionResultHandler handler) {
    134142
    135143                        assert nodes.isEmpty();
     
    146154                                String e = i.next();
    147155                                Param p = access.getParam(e);
     156                                if (p == null) {
     157                                        break;
     158                                }
    148159                                if (!(p instanceof CompositeParam)) {
    149                                         //entries.add(new Entry());
    150                                         break;
    151                                 }
    152                                 CompositeParam c = (CompositeParam)p;
     160                                        throw new FramsticksException().msg("param is not a composite").arg("param", p).arg("tree", tree).arg("textual", textual).arg("access", access);
     161                                }
     162                                CompositeParam c = (CompositeParam) p;
    153163                                b.append("/").append(e);
    154164                                access.select(current.getObject());
    155                                 current = new Node(current.getTree(), c, getKnownChild(tree, access, c));
     165                                current = new Node(current.getTree(), c, getKnownChild(tree, access, c, handler));
    156166                                nodes.add(current);
    157167                        }
     
    245255                        return Path.build().resolve(tree, "/").finish();
    246256                }
    247                 Object child = getKnownChild(tree, TreeOperations.bindAccess(getUnder()), getTop().getParam());
     257                Object child = getKnownChild(tree, TreeOperations.bindAccess(getUnder()), getTop().getParam(), IgnoreExceptionHandler.getInstance());
    248258                if (child == null) {
    249259                        return this;
     
    274284        }
    275285
     286        public static Path tryTo(@Nonnull Tree tree, String textual) {
     287                return Path.build().resolve(tree, textual).finish();
     288        }
     289
    276290        public static Path to(@Nonnull Tree tree, String textual) {
    277                 return Path.build().resolve(tree, textual).finish();
     291                Path path = tryTo(tree, textual);
     292                if (path.getTextual().equals(textual)) {
     293                        return path;
     294                }
     295                throw new FramsticksException().msg("failed to create path").arg("textual", textual).arg("result", path).arg("tree", tree);
    278296        }
    279297
     
    299317        }
    300318
     319        public static final Pattern pathPattern = Pattern.compile("(\\/)|((\\/[^/]+)+)");
     320
     321        public static boolean isValidString(String path) {
     322                return pathPattern.matcher(path).matches();
     323        }
     324
     325        public static String appendString(String path, String element) {
     326                if (path.equals("/")) {
     327                        return path + element;
     328                }
     329                return path + "/" + element;
     330        }
     331
     332        public static Pair<String, String> removeLastElement(String path) {
     333                assert isValidString(path);
     334                if (path.equals("/")) {
     335                        throw new FramsticksException().msg("cannot remove last element from root path");
     336                }
     337                int index = path.lastIndexOf('/');
     338                assert index != -1;
     339                if (index == 0) {
     340                        return new Pair<String, String>("/", path.substring(1));
     341                }
     342                return new Pair<String, String>(path.substring(0, index), path.substring(index + 1));
     343        }
     344
     345        public static String validateString(String path) {
     346                if (!isValidString(path)) {
     347                        throw new FramsticksException().msg("path string validation failured").arg("path", path);
     348                }
     349                return path;
     350        }
     351
    301352
    302353        // public boolean isEmpty() {
Note: See TracChangeset for help on using the changeset viewer.