Package com.art.anette.datamodel.dataobjects.simple

Examples of com.art.anette.datamodel.dataobjects.simple.DataObject


        }
    }

    private static Object clone(Object object) {
        if (object instanceof DataObject) {
            DataObject dataObject = (DataObject) object;
            return dataObject.clone();
        } else {
            return object;
        }
    }
View Full Code Here


     *
     * @param o das veränderte DataObject
     */
    public synchronized void informDirty(Object o) {
        if (o instanceof DataObject) {
            final DataObject dObj = (DataObject) o;
            List<Long> ev = new LinkedList<Long>();

            if (dObj instanceof Employee) {
                final long oldDep = Extractor.extractDataFrom((Employee) dObj).getActual().department;
                final long newDep = Extractor.extractDataFrom((Employee) dObj).getModified().department;

                if (oldDep != newDep) {
                    ev.add(dObj.getId());
                }
            } else if (dObj instanceof Company) {
                final long oldMgr = Extractor.extractDataFrom((Company) dObj).getActual().manager;
                final long newMgr = Extractor.extractDataFrom((Company) dObj).getModified().manager;

View Full Code Here

        this.expand = expand;
        this.employee = employee;
        this.mob = mob;
        this.showOnlyOwnTasks = showOnlyOwnTasks;
        this.tree = tree;
        DataObject oldValue = nodeMap.put((DefaultMutableTreeNode) root, mob);
        // Abmelden bei dem alten Objekt, falls eines zurückgeliefert wurde
        if (oldValue != null) {
            oldValue.removeObserver(this);
        }

        Logic.lockReading();

        try {
View Full Code Here

            // Da ein Projekt alle WPs liefert, werden nur die HauptWPs
            // eingefügt. Die UnterWPs werden erst dann eingefügt, wenn es
            // sich um den HauptWP handelt
            if (mdo instanceof Project) {
                for (int i = 0; i < result.size(); i++) {
                    DataObject dObj = result.get(i);
                    if (dObj instanceof WorkPackage) {
                        WorkPackage workPackage = (WorkPackage) dObj;
                        if (!workPackage.isRoot()) {
                            result.remove(i);
                            i--;
                        }
                    }
                }
            }

            for (int i = 0; i < result.size(); i++) {
                DataObject dataObject = result.get(i);
                if (dataObject.getId() == DBControl.DUMMY_DEPARTMENT_ID) {
                    result.remove(i);
                    break;
                }
            }
View Full Code Here

        if (found.size() > 1) {
            throw new IllegalStateException("The data-object " + d + " is multiple times in the tree");
        }

        DefaultMutableTreeNode node = found.get(0);
        DataObject dObj = nodeMap.get(node);

        final List<DefaultMutableTreeNode> currentChildren = Collections.list(node.children());
        final List<DataObject> shouldChildren = createListOfShouldChildren(dObj);
        final List<DataObject> currentChildrenValues = new ArrayList<DataObject>();
        for (DefaultMutableTreeNode child : currentChildren) {
            currentChildrenValues.add((DataObject) child.getUserObject());
        }

        for (DefaultMutableTreeNode child : currentChildren) {
            DataObject childMob = (DataObject) child.getUserObject();

            // Das Objekt, welches in dem Knoten enthalten ist, ist
            // nicht mehr in der Liste der Elemente des ManagedDataObjects,
            // (mob) daher kann es gelöscht werden.
            if (!shouldChildren.contains(childMob)) {
                childMob.removeObserver(this);
                removeQueue.add(child);
                removeNodeFromParent(child);
                //Logic.unlockReading();
                //return;
            }
        }

        // Wenn die Liste leer ist, bedeutet es, dass keine
        // neuen Einträge hinzugefügt worden sind, also lediglich
        // die Grunddaten des Knotens geändert wurden
        // Da die Liste noch Einträge beinhält, werden diese mit
        // in den Baum an dem aktuellen Knoten eingehängt.
        for (int i = 0; i < shouldChildren.size(); i++) {
            DataObject child = shouldChildren.get(i);
            if (!currentChildrenValues.contains(child)) {
                DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(child);
                newNode.setUserObject(child);
                addList.add(newNode);

                // For the calculation of the index we assume that only one new
                // new is inserted. Otherwise the index may be wrong.
                insertNodeInto(newNode, node, i);
            }
        }
        if (!addList.isEmpty() || !removeQueue.isEmpty()) {
            nodeStructureChanged(node);
        }

        // Lists are up to date. Do the rest of the book-keeping

        // Neue Einträge in die nodeMap einfügen
        for (DefaultMutableTreeNode treeNode : addList) {
            DataObject obj = (DataObject) treeNode.getUserObject();
            obj.addObserver(this);
            DataObject oldVal = nodeMap.put(treeNode, obj);

            if (oldVal != null) {
                oldVal.removeObserver(this);
            }
        }

        // Obsolete Einträge aus der Map löschen
        while (!removeQueue.isEmpty()) {
View Full Code Here

     * bei jedem Objekt abmeldet.
     */
    @Override
    public void stopObservation() {
        for (Entry<DefaultMutableTreeNode, DataObject> entry : nodeMap.entrySet()) {
            DataObject val = entry.getValue();
            val.removeObserver(this);
        }
    }
View Full Code Here

        }
        Object[] objs = path.getPath();
        List<ID> result = new ArrayList<ID>();
        for (final Object newVar : objs) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) newVar;
            DataObject obj = (DataObject) node.getUserObject();
            result.add(new ID(obj.getPrimaryKey()));
        }
        return result;
    }
View Full Code Here

        for (int i = 0; i < list.size(); i++) {
            ID id = list.get(i);
            Object tmp = null;

            for (DefaultMutableTreeNode node : nodeMap.keySet()) {
                DataObject obj = nodeMap.get(node);
                if (obj.getPrimaryKey().equals(id.key)) {
                    tmp = node;
                }
            }
            if (tmp == null) {
                throw new IllegalStateException("unknown id " + id.key);
View Full Code Here

            checkNodeMap();

            nodeMap.clear();

            newRoot = new DefaultMutableTreeNode(mob);
            DataObject oldValue = nodeMap.put(newRoot, mob);
            // Abmelden bei dem alten Objekt, falls eines zurückgeliefert wurde
            if (oldValue != null) {
                oldValue.removeObserver(this);
            }

            mob.addObserver(this);

            buildTree(newRoot);
View Full Code Here

        if (value instanceof DefaultMutableTreeNode) {
            node = (DefaultMutableTreeNode) value;
        }

        DataObject dObj = null;
        if (node != null && node.getUserObject() != null && node.getUserObject() instanceof DataObject) {
            dObj = (DataObject) node.getUserObject();
        }

        final Employee emp = BasicController.getInstance().getLoggedInEmployee();
View Full Code Here

TOP

Related Classes of com.art.anette.datamodel.dataobjects.simple.DataObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.