Package org.openoffice.extensions.diagrams.diagram.organizationcharts

Examples of org.openoffice.extensions.diagrams.diagram.organizationcharts.TreeItem


        }
        if(methodName.equals("root")){
            if(getController().getDiagram() != null) {
                if(getController().getGroupType() == Controller.ORGANIGROUP){
                    OrganizationChart orgChart = (OrganizationChart)getController().getDiagram();
                    TreeItem treeItem = orgChart.getDiagramTree().getRootItem();
                    if(treeItem != null)
                        getController().setSelectedShape(treeItem.getRectangleShape());
                }
            }
            return true;
        }

        if(methodName.equals("previous")){
            if(getController().isOnlySimpleItemIsSelected()){
                if(getController().getDiagram() != null) {
                    if(getController().getGroupType() == Controller.ORGANIGROUP){
                        OrganizationChart orgChart = (OrganizationChart)getController().getDiagram();
                        TreeItem treeItem = orgChart.getDiagramTree().getTreeItem(getController().getSelectedShape());
                        if(treeItem.isDad()){
                             TreeItem previousItem = treeItem.getDad().getPreviousSibling(treeItem);
                            if(previousItem != null)
                                getController().setSelectedShape(previousItem.getRectangleShape());
                        }
                    }
                }
            }
            return true;
        }

        if(methodName.equals("next")){
            if(getController().isOnlySimpleItemIsSelected()){
                if(getController().getDiagram() != null) {
                    if(getController().getGroupType() == Controller.ORGANIGROUP){
                        OrganizationChart orgChart = (OrganizationChart)getController().getDiagram();
                        TreeItem treeItem = orgChart.getDiagramTree().getTreeItem(getController().getSelectedShape());
                        if(treeItem.isFirstSibling())
                            getController().setSelectedShape(treeItem.getFirstSibling().getRectangleShape());
                    }
                }
            }
            return true;
        }

        if(methodName.equals("up")){
            if(getController().isOnlySimpleItemIsSelected()){
                if(getController().getDiagram() != null) {
                    if(getController().getGroupType() == Controller.ORGANIGROUP){
                        OrganizationChart orgChart = (OrganizationChart)getController().getDiagram();
                        TreeItem treeItem = orgChart.getDiagramTree().getTreeItem(getController().getSelectedShape());
                        if(treeItem.isDad())
                            getController().setSelectedShape(treeItem.getDad().getRectangleShape());
                    }
                }
            }
            return true;
        }

        if(methodName.equals("down")){
            if(getController().isOnlySimpleItemIsSelected()){
                if(getController().getDiagram() != null) {
                    if(getController().getGroupType() == Controller.ORGANIGROUP){
                        OrganizationChart orgChart = (OrganizationChart)getController().getDiagram();
                        TreeItem treeItem = orgChart.getDiagramTree().getTreeItem(getController().getSelectedShape());
                        if(treeItem.isFirstChild())
                            getController().setSelectedShape(treeItem.getFirstChild().getRectangleShape());
                    }
                }
            }
            return true;
        }
View Full Code Here


                XNamed xNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class, xSelectedShape );
                String selectedShapeName = xNamed.getName();
                int iTopShapeID = -1;

                if(selectedShapeName.contains("RectangleShape") && !selectedShapeName.contains("RectangleShape0")){
                    TreeItem selectedItem = m_DiagramTree.getTreeItem(xSelectedShape);
                    // can't be associate of root item
                    if(selectedItem.getDad() == null && m_sNewItemHType == 1 ) {
                        String title = getGui().getDialogPropertyValue("Strings", "ItemAddError.Title");
                        String message = getGui().getDialogPropertyValue("Strings", "ItemAddError.Message");
                        getGui().showMessageBox(title, message);
                    }else{
                        iTopShapeID = getTopShapeID();
                        if( iTopShapeID <= 0 ){
                            clearEmptyDiagramAndReCreate();
                        }else{
                            iTopShapeID++;
                            XShape xRectangleShape = createShape("RectangleShape", iTopShapeID);
                            m_xShapes.add(xRectangleShape);
                            setMoveProtectOfShape(xRectangleShape);
                            setTextFitToSize(xRectangleShape);
                            setShapeProperties(xRectangleShape, "RectangleShape");
                            int color = -1;
                            if(getGui() != null && getGui().getControlDialogWindow() != null)
                                color = getGui().getImageColorOfControlDialog();
                            if(color < 0)
                                color = COLOR;
                            setColorOfShape(xRectangleShape, color);
                            m_DiagramTree.addToRectangles(xRectangleShape);

                            TreeItem newTreeItem = null;
                            TreeItem dadItem = null;

                            if(m_sNewItemHType == UNDERLING){
                                dadItem = selectedItem;
                                newTreeItem = new OTreeItem(m_DiagramTree, xRectangleShape, dadItem, (short)0 , 0.0);
                                if(!dadItem.isFirstChild()){
                                    dadItem.setFirstChild(newTreeItem);
                                }else{
                                    XShape xPreviousChild = m_DiagramTree.getLastChildShape(xSelectedShape);
                                    if(xPreviousChild != null){
                                        TreeItem previousItem = m_DiagramTree.getTreeItem(xPreviousChild);
                                        if(previousItem != null)
                                            previousItem.setFirstSibling(newTreeItem);
                                    }
                                }
                            }else if(m_sNewItemHType == ASSOCIATE){
                                dadItem = selectedItem.getDad();
                                newTreeItem = new OTreeItem(m_DiagramTree, xRectangleShape, dadItem, (short)0, 0.0);
View Full Code Here

                    String title = getGui().getDialogPropertyValue("Strings", "RoutShapeRemoveError.Title");
                    String message = getGui().getDialogPropertyValue("Strings", "RoutShapeRemoveError.Message");
                    getGui().showMessageBox(title, message);
                }else{
                    // clear everythin under the item in the tree
                    TreeItem selectedItem = m_DiagramTree.getTreeItem(xSelectedShape);
                       
                    TreeItem dadItem = selectedItem.getDad();
                    if(selectedItem.equals(dadItem.getFirstChild())){
                        if(selectedItem.getFirstSibling() != null){
                            dadItem.setFirstChild(selectedItem.getFirstSibling());                              
                        }else{
                            dadItem.setFirstChild(null);
                        }
                    }else{
                        TreeItem previousSibling = m_DiagramTree.getPreviousSibling(selectedItem);
                        if(previousSibling != null){
                            if(selectedItem.getFirstSibling() != null)
                                previousSibling.setFirstSibling(selectedItem.getFirstSibling());
                            else
                                previousSibling.setFirstSibling(null);
                        }
                    }

                    XShape xDadShape = selectedItem.getDad().getRectangleShape();
View Full Code Here

            double firstSiblingPos = m_Pos + 1.0;

            if(firstSiblingLevel > ODiagramTree.LASTHORLEVEL){
                firstSiblingPos = m_Pos;
                if(isFirstChild()){
                    TreeItem lastSibling = getFirstChild().getLastSibling();
                    firstSiblingLevel = (short)(lastSibling.getLevel() + 1);
                    TreeItem lastSiblingsLastChild = lastSibling.getLastChild();
                    if(lastSiblingsLastChild != null)
                        firstSiblingLevel = (short)(lastSiblingsLastChild.getLevel());
                }else{
                    firstSiblingLevel = (short)(getLevel() + 1);
                }
            }
            m_FirstSibling = new OTreeItem(getDiagramTree(), xFirstSiblingShape, m_Dad, firstSiblingLevel, firstSiblingPos);
View Full Code Here

            if(firstSiblingLevel > ODiagramTree.LASTHORLEVEL){
                firstSiblingPos = m_Pos;
                //firstSiblingLevel = (short)(m_Level + getNumberOfItemsInBranch(this));
                if(isFirstChild()){
                    TreeItem lastSibling = getFirstChild().getLastSibling();
                    firstSiblingLevel = (short)(lastSibling.getLevel() + 1);
                    TreeItem lastSiblingsLastChild = lastSibling.getLastChild();
                    if(lastSiblingsLastChild != null)
                        firstSiblingLevel = (short)(lastSiblingsLastChild.getLevel());
                }else{
                    firstSiblingLevel = (short)(getLevel() + 1);
                }
            }
            m_FirstSibling.setLevel(firstSiblingLevel);
View Full Code Here

            if(xSelectedShape != null){
                XNamed xNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class, xSelectedShape );
                String selectedShapeName = xNamed.getName();
                int iTopShapeID = -1;
                if(selectedShapeName.contains("RectangleShape") && !selectedShapeName.contains("RectangleShape0")){
                    TreeItem selectedItem = m_DiagramTree.getTreeItem(xSelectedShape);
                    // can't be associate of root item
                    if(selectedItem.getDad() == null && m_sNewItemHType == 1 ) {
                        String title = getGui().getDialogPropertyValue("Strings", "ItemAddError.Title");
                        String message = getGui().getDialogPropertyValue("Strings", "ItemAddError.Message");
                        getGui().showMessageBox(title, message);
                    }else{
                        iTopShapeID = getTopShapeID();
                        if( iTopShapeID <= 0 ){
                            clearEmptyDiagramAndReCreate();
                        }else{
                            iTopShapeID++;
                            XShape xRectangleShape = createShape("RectangleShape", iTopShapeID);
                            m_xShapes.add(xRectangleShape);
                            setMoveProtectOfShape(xRectangleShape);
                            setTextFitToSize(xRectangleShape);
                            setShapeProperties(xRectangleShape, "RectangleShape");
                            int color = -1;
                            if(getGui() != null && getGui().getControlDialogWindow() != null)
                                color = getGui().getImageColorOfControlDialog();
                            if(color < 0)
                                color = COLOR;
                            setColorOfShape(xRectangleShape, color);
                            m_DiagramTree.addToRectangles(xRectangleShape);
                            TreeItem newTreeItem = null;
                            TreeItem dadItem = null;

                            if(m_sNewItemHType == UNDERLING){
                                dadItem = selectedItem;
                                newTreeItem = new HTreeItem(m_DiagramTree, xRectangleShape, dadItem, (short)0 , 0.0);
                                if(!dadItem.isFirstChild()){
                                    dadItem.setFirstChild(newTreeItem);
                                }else{
                                    XShape xPreviousChild = m_DiagramTree.getLastChildShape(xSelectedShape);
                                    if(xPreviousChild != null){
                                        TreeItem previousItem = m_DiagramTree.getTreeItem(xPreviousChild);
                                        if(previousItem != null)
                                            previousItem.setFirstSibling(newTreeItem);
                                    }
                                }
                            }else if(m_sNewItemHType == ASSOCIATE){
                                dadItem = selectedItem.getDad();
                                newTreeItem = new HTreeItem(m_DiagramTree, xRectangleShape, dadItem, (short)0, 0.0);
View Full Code Here

                    String title = getGui().getDialogPropertyValue("Strings", "RoutShapeRemoveError.Title");
                    String message = getGui().getDialogPropertyValue("Strings", "RoutShapeRemoveError.Message");
                    getGui().showMessageBox(title, message);
                }else{
                    // clear everythin under the item in the tree
                    TreeItem selectedItem = m_DiagramTree.getTreeItem(xSelectedShape);

                    TreeItem dadItem = selectedItem.getDad();
                    if(selectedItem.equals(dadItem.getFirstChild())){
                        if(selectedItem.getFirstSibling() != null){
                            dadItem.setFirstChild(selectedItem.getFirstSibling());
                        }else{
                            dadItem.setFirstChild(null);
                        }
                    }else{
                        TreeItem previousSibling = m_DiagramTree.getPreviousSibling(selectedItem);
                        if(previousSibling != null){
                            if(selectedItem.getFirstSibling() != null)
                                previousSibling.setFirstSibling(selectedItem.getFirstSibling());
                            else
                                previousSibling.setFirstSibling(null);
                        }
                    }

                    XShape xDadShape = selectedItem.getDad().getRectangleShape();
View Full Code Here

            if(xSelectedShape != null){
                XNamed xNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class, xSelectedShape );
                String selectedShapeName = xNamed.getName();
                int iTopShapeID = -1;
                if(selectedShapeName.contains("RectangleShape") && !selectedShapeName.contains("RectangleShape0")){
                    TreeItem selectedItem = m_DiagramTree.getTreeItem(xSelectedShape);
                    // can't be associate of root item
                    if(selectedItem.getDad() == null && m_sNewItemHType == 1 ) {
                        String title = getGui().getDialogPropertyValue("Strings", "ItemAddError.Title");
                        String message = getGui().getDialogPropertyValue("Strings", "ItemAddError.Message");
                        getGui().showMessageBox(title, message);
                    }else{
                        iTopShapeID = getTopShapeID();
                        if( iTopShapeID <= 0 ){
                            clearEmptyDiagramAndReCreate();
                        }else{
                            iTopShapeID++;
                            XShape xRectangleShape = createShape("RectangleShape", iTopShapeID);
                            m_xShapes.add(xRectangleShape);
                            setMoveProtectOfShape(xRectangleShape);
                            setTextFitToSize(xRectangleShape);
                            setShapeProperties(xRectangleShape, "RectangleShape");
                            int color = -1;
                            if(getGui() != null && getGui().getControlDialogWindow() != null)
                                color = getGui().getImageColorOfControlDialog();
                            if(color < 0)
                                color = COLOR;
                            setColorOfShape(xRectangleShape, color);
                            m_DiagramTree.addToRectangles(xRectangleShape);

                            TreeItem newTreeItem = null;
                            TreeItem dadItem = null;

                            if(m_sNewItemHType == UNDERLING){
                                dadItem = selectedItem;
                                newTreeItem = new SOTreeItem(m_DiagramTree, xRectangleShape, dadItem, (short)0 , 0.0);
                                if(!dadItem.isFirstChild()){
                                    dadItem.setFirstChild(newTreeItem);
                                }else{
                                    XShape xPreviousChild = m_DiagramTree.getLastChildShape(xSelectedShape);
                                    if(xPreviousChild != null){
                                        TreeItem previousItem = m_DiagramTree.getTreeItem(xPreviousChild);
                                        if(previousItem != null)
                                            previousItem.setFirstSibling(newTreeItem);
                                    }
                                }
                             }else if(m_sNewItemHType == ASSOCIATE){
                                 dadItem = selectedItem.getDad();
                                 newTreeItem = new SOTreeItem(m_DiagramTree, xRectangleShape, dadItem, (short)0, 0.0);
View Full Code Here

                    String title = getGui().getDialogPropertyValue("Strings", "RoutShapeRemoveError.Title");
                    String message = getGui().getDialogPropertyValue("Strings", "RoutShapeRemoveError.Message");
                    getGui().showMessageBox(title, message);
                }else{
                    // clear everythin under the item in the tree
                    TreeItem selectedItem = m_DiagramTree.getTreeItem(xSelectedShape);

                    TreeItem dadItem = selectedItem.getDad();
                    if(selectedItem.equals(dadItem.getFirstChild())){
                        if(selectedItem.getFirstSibling() != null){
                            dadItem.setFirstChild(selectedItem.getFirstSibling());
                        }else{
                            dadItem.setFirstChild(null);
                        }
                    }else{
                        TreeItem previousSibling = m_DiagramTree.getPreviousSibling(selectedItem);
                        if(previousSibling != null){
                            if(selectedItem.getFirstSibling() != null)
                                previousSibling.setFirstSibling(selectedItem.getFirstSibling());
                            else
                                previousSibling.setFirstSibling(null);
                        }
                    }

                    XShape xDadShape = selectedItem.getDad().getRectangleShape();
View Full Code Here

                XNamed xNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class, xSelectedShape );
                String selectedShapeName = xNamed.getName();
                int iTopShapeID = -1;

                if(selectedShapeName.contains("RectangleShape") && !selectedShapeName.contains("RectangleShape0")){
                    TreeItem selectedItem = m_DiagramTree.getTreeItem(xSelectedShape);
                    // can't be associate of root item
                    if(selectedItem.getDad() == null && m_sNewItemHType == 1 ) {
                        String title = getGui().getDialogPropertyValue("Strings", "ItemAddError.Title");
                        String message = getGui().getDialogPropertyValue("Strings", "ItemAddError.Message");
                        getGui().showMessageBox(title, message);
                    }else{
                        iTopShapeID = getTopShapeID();
                        if( iTopShapeID <= 0 ){
                            clearEmptyDiagramAndReCreate();
                        }else{
                            iTopShapeID++;
                            XShape xRectangleShape = createShape("RectangleShape", iTopShapeID);
                            m_xShapes.add(xRectangleShape);
                            setMoveProtectOfShape(xRectangleShape);
                            setTextFitToSize(xRectangleShape);
                            setShapeProperties(xRectangleShape, "RectangleShape");
                            int color = -1;
                            if(getGui() != null && getGui().getControlDialogWindow() != null)
                                color = getGui().getImageColorOfControlDialog();
                            if(color < 0)
                                color = COLOR;
                            setColorOfShape(xRectangleShape, color);
                            m_DiagramTree.addToRectangles(xRectangleShape);

                            TreeItem newTreeItem = null;
                            TreeItem dadItem = null;

                            if(m_sNewItemHType == UNDERLING){
                                dadItem = selectedItem;
                                newTreeItem = new THTreeItem(m_DiagramTree, xRectangleShape, dadItem, (short)0 , 0.0);
                                if(!dadItem.isFirstChild()){
                                    dadItem.setFirstChild(newTreeItem);
                                }else{
                                    XShape xPreviousChild = m_DiagramTree.getLastChildShape(xSelectedShape);
                                    if(xPreviousChild != null){
                                        TreeItem previousItem = m_DiagramTree.getTreeItem(xPreviousChild);
                                        if(previousItem != null)
                                            previousItem.setFirstSibling(newTreeItem);
                                    }
                                }
                            }else if(m_sNewItemHType == ASSOCIATE){
                                dadItem = selectedItem.getDad();
                                newTreeItem = new THTreeItem(m_DiagramTree, xRectangleShape, dadItem, (short)0, 0.0);
View Full Code Here

TOP

Related Classes of org.openoffice.extensions.diagrams.diagram.organizationcharts.TreeItem

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.