Examples of SNode


Examples of org.joshy.sketch.model.SNode

            }
            return false;
        }

        private Method getMethod() throws NoSuchMethodException {
            SNode first = items.iterator().next();
            try {
                Method method = first.getClass().getMethod("get"+ name.substring(0,1).toUpperCase()+ name.substring(1));
                return method;
            } catch (NoSuchMethodException ex) {
                Method method = first.getClass().getMethod("is"+ name.substring(0,1).toUpperCase()+ name.substring(1));
                return method;
            }
        }
View Full Code Here

Examples of org.joshy.sketch.model.SNode

                Method method = first.getClass().getMethod("is"+ name.substring(0,1).toUpperCase()+ name.substring(1));
                return method;
            }
        }
        private Method getBooleanMethod() throws NoSuchMethodException {
            SNode first = items.iterator().next();
            Method method = first.getClass().getMethod("is"+ name.substring(0,1).toUpperCase()+ name.substring(1));
            return method;
        }
View Full Code Here

Examples of org.joshy.sketch.model.SNode

            Method method = first.getClass().getMethod("is"+ name.substring(0,1).toUpperCase()+ name.substring(1));
            return method;
        }

        public void setValue(Object value) {
            SNode node = items.iterator().next();
            try {
                String methodName = "set"+name.substring(0,1).toUpperCase()+name.substring(1);
                Method method = null;
                for(Method m : node.getClass().getMethods()) {
                    if(m.getName().equals(methodName)) {
                        method = m;
                    }
                }

                if(method == null) {
                    throw new Exception("Method: " + methodName + " not found on object " + node.getClass().getName());
                }
                for(SNode s : items) {
                    method.invoke(s,value);
                }
                //method.invoke(node,value);
View Full Code Here

Examples of org.joshy.sketch.model.SNode

            }
        }

        public boolean hasSingleValue() {
            try {
                SNode first = items.iterator().next();
                Method meth = getMethod();
                Object value = meth.invoke(first);
                for(SNode item : items) {
                    Object ival = meth.invoke(item);
                    //u.p("comparing: " + ival + " " + value);
View Full Code Here

Examples of org.joshy.sketch.model.SNode

            return true;
        }


        public Object getValue() {
            SNode first = items.iterator().next();
            try {
                Method method = getMethod();
                Object value = method.invoke(first);
                return value;
            } catch (NoSuchMethodException e) {
View Full Code Here

Examples of org.joshy.sketch.model.SNode

    protected void call(KeyEvent event) {
    }

    @Override
    protected void call(ScrollEvent event) {
        SNode node = context.getSelection().firstItem();
        double scale = 2.0;
        node.setRotate(node.getRotate()+event.getAmount()*scale);
        context.redraw();
    }
View Full Code Here

Examples of org.joshy.sketch.model.SNode

                max = Math.max(max,doc.getCurrentPage().getModel().indexOf(node));
            }
            //if there is room to move up
            List<SNode> model = doc.getCurrentPage().getModel();
            if(max+1 < model.size()) {
                SNode nextNode = model.get(max+1);
                model.removeAll(nodes);
                int n = model.indexOf(nextNode);
                model.addAll(n+1,nodes);
            } else {
                //just remove and move all to the top
View Full Code Here

Examples of org.joshy.sketch.model.SNode

            for(SNode node : nodes) {
                min = Math.min(model.indexOf(node),min);
            }
            //if there is room to move down
            if(min > 0) {
                SNode prevNode = model.get(min-1);
                model.removeAll(nodes);
                model.addAll(model.indexOf(prevNode),nodes);
            } else {
                //just remove and move all to the bottom
                model.removeAll(nodes);
View Full Code Here

Examples of org.joshy.sketch.model.SNode

        }

        @Override
        public void execute() {
            Map<SNode,Point2D.Double> diffs = new HashMap<SNode,Point2D.Double>();
            SNode first = context.getSelection().firstItem();
            double center = first.getTransformedBounds().getCenterY();
            for(SNode node: context.getSelection().items()) {
                double c2 = node.getTransformedBounds().getCenterY();
                double cdiff = c2-center;
                node.setTranslateY(node.getTranslateY()-cdiff);
                diffs.put(node,new Point2D.Double(0,-cdiff));
View Full Code Here

Examples of org.joshy.sketch.model.SNode

        }

        @Override
        public void execute() {
            Map<SNode,Point2D.Double> diffs = new HashMap<SNode,Point2D.Double>();
            SNode first = context.getSelection().firstItem();
            double center = first.getTransformedBounds().getCenterX();
            for(SNode node: context.getSelection().items()) {
                double c2 = node.getTransformedBounds().getCenterX();
                double cdiff = c2-center;
                node.setTranslateX(node.getTranslateX()-cdiff);
                diffs.put(node,new Point2D.Double(-cdiff,0));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.