Package org.jitterbit.integration.client.ui.interchange.entity.transformation.tree.utils

Examples of org.jitterbit.integration.client.ui.interchange.entity.transformation.tree.utils.Node


                if (name.equals(childName)) {
                    return child;
                }
            }
        }
        Node root = tree.m_root.getChildAt(0);
        String rootName = getName(root);
        if (name.equals(rootName)) {
            return root;
        }
        return null;
View Full Code Here


        return null;
    }

    private static List<Node> analyzeCandidates(List<Node> candidates, String[] parts) {
        if (candidates.size() == 1) {
            Node onlyMatch = candidates.get(0);
            if (onlyMatch.isFolder()) {
                String folderName = getName(onlyMatch);
                if (folderName.equals(parts[parts.length - 1])) {
                    // Exact match to a single folder. List all its children.
                    return Lists.newArrayList(onlyMatch.getChildren());
                }
            }
        }
        return candidates;
    }
View Full Code Here

    @Override
    public void execute(String[] params) throws CommandException {
        String pathFragment = params[0];
        NodeFinder finder = new NodeFinder(page.getTreeMapper().m_targetTreeComponent);
        Node node = finder.findNode(pathFragment);
        if (node != null) {
            if (node.isFolder()) {
                Alert.error("You cannot map a target folder node.", "Not Allowed");
            } else {
                page.showMapping(new NodePath(node.m_deName));
            }
        }
View Full Code Here

            return findNode(path);
        }
        boolean isLeaf=path.charAt(0)!='[';
        int k1=isLeaf?0:1, k2=path.length();
        if(m_flat){
            Node node=m_deHashtable.get(path);
            if(node==null){
                int k3=path.indexOf('#'), k4=isLeaf?path.length():(path.length()-1);
                boolean bMultipleMapping=k3>=0;
                boolean bIsPrecondition=path.startsWith(Node.c_sPrecondition);
                Node parent=m_root.getChildAt(0);
                if(bMultipleMapping){
                    int i_mapping=Integer.parseInt(path.substring(k3+1,k4));
                    Node parent_saved=parent;
                    parent=parent.findMultipleMappingExist(i_mapping);
                    if(parent==null){
                        parent=parent_saved.insertMultipleMapping(i_mapping);
                    }
                }
                for(Node child:parent.getChildren()){
                    if (bIsPrecondition) {
                        if (child.isPrecondition())
                            return child;
                    } else if (path.equals(child.getName())) {
                        return child;
                    }
                }
                if (bIsPrecondition) {
                    return insertPreconditionNode(parent);
                } else {
                    throw new TreeMapperException("Failed to find the node:" + path + " for flat target structure.");
                }
            }
            return node;
        }
        char c;
        for(;k2>k1;k2--)if((c=path.charAt(k2-1))=='.'||c=='$')break;
        if(k2<k1)return null;
        StringTokenizer tk=new StringTokenizer(path.substring(k1,k2),"$.",false);
        Node parent=m_root,node=null;

        if(parent.getName().length()>0){
            if(tk.hasMoreTokens()){
                if(!tk.nextToken().equals(parent.getName()))
                    throw new TreeMapperException(
                            "Find target data element failed, the root name is inconsistent with the path. root name="+parent.getName()+", path="+path);
            } else {
                return null;
            }
        }
        while(tk.hasMoreTokens()&&parent!=null){
            String token=tk.nextToken();
            parent.expandNode();

            node=parent.findChildFolder(token);

            if(node!=null && node.isValueLeaf()){
                if(path.endsWith(CROM.PRECONDITION_TAG)){
                    node=node.turnOffShortDisplay();
                    node=insertPreconditionNode(node);
                }
              return node;
            }

            if(node==null&&(parent.isDerivedTypeHolder()||parent.isSubstitutionGroupHeader())){
                // this could be a derived type or a substitution group
                String typeName=StringUtils.substringBefore(token, "#");
                node=parent.expandHoldersTypeNode(typeName,token);
            }
            if(node==null){
                int k=token.indexOf('#');
                if(k>=0){
                    if((k+1)<token.length()){
                        int i_mapping=Integer.parseInt(token.substring(k+1));
                        String name=token.substring(0,k);

                        node=parent.findChildFolder(name);

                        if(node!=null){
                            node.expandNode();
                            node.insertMultipleMapping(i_mapping);
                        }
                    } else {
                        throw new TreeMapperException("Find target data element failed, path="+path);
                    }

                }
                else {
                  parent.expandNode();
                }
                node=parent.findChildFolder(token);
            }
            parent=node;
        }
        if(parent!=null){
            parent.expandNode();
            if(path.endsWith(CROM.PRECONDITION_TAG)){
                insertPreconditionNode(parent);
            }
        }
View Full Code Here

    @Override
    protected void onDragStopped(MenuBuilder myPopupMenu, int x, int y) {
        Point p1=m_TreeMapper.m_sourceTreeComponent.getLocationOnScreen();
        m_TreeMapper.m_sourceTreeComponent.getLocationStatus(x-p1.x,y-p1.y, false);
        Node sourceNode=m_TreeMapper.m_sourceTreeComponent.m_getLocationNode,
          targetNode=m_highLightedNode;
        setDropNode(sourceNode);
        if(sourceNode!=null){
            if(!sourceNode.isFolder()&&!m_highLightedNode.isFolder()){
                m_TreeMapper.m_sourceTreeComponent.m_highLightedNode=sourceNode;
                m_TreeMapper.doMap(m_highLightedNode,false);
            }
            if(sourceNode.isSfdcNode()){
              sourceNode=sourceNode.m_parent;
            }
            if(targetNode.isSfdcNode()){
              targetNode=targetNode.m_parent;
            }
            if(sourceNode.isRootLoopNode() && targetNode.isRootLoopNode()){
              TreeMapper tm=getTreeMapper();
              if(!m_flat || !(tm!=null && tm.m_sourceTreeComponent.m_flat))
                myPopupMenu.addMenuItem(cmd_define_generator);
            }
            if(sourceNode.isFolder()&&m_highLightedNode.isFolder()){
                myPopupMenu.addMenuItem(cmd_do_straight_mapping);
            }
            if(m_popup.getComponentCount()==1){
                String cmd=m_popup.getComponent(0).getName();
                if(cmd_define_generator.equals(cmd)){
View Full Code Here

        }
    }

    @Override
    protected void populateFolderNodeContextMenu(Node node, MenuBuilder myPopupMenu) {
        Node parent=node.m_parent;
        if((node.isTypeDefinition()&&node.m_parent.isDerivedTypeHolder())||
                node.isSubstitutionGroup()||
                node.isOptional()||
                node.isLoopNode()||
                (parent!=null&&parent.isOneOf())||
                (parent != null&&node.isFolder()&&!m_TreeMapper.isTargetXml())) {
            if(m_rightClickNode.hasPrecondition()) {
               myPopupMenu.addMenuItem(cmd_remove_condition);
            }
            else {
View Full Code Here

             refresh();
         }
    }

    public Node getTlnDtdRoot(String targetDE){
        Node targetNode=m_deHashtable.get(targetDE);
        if(targetNode==null||targetNode.isFolder())return null;
        return targetNode.getRootLoopNode();
    }
View Full Code Here

    @Override
    public void actionPerformed(ActionEvent e) {
      TreeComponent sourceTree=mappingTree.m_sourceTreeComponent;
      TreeComponent targetTree=mappingTree.m_targetTreeComponent;
      Node sourceNode=getSelectedNode(sourceTree);
      Node targetNode=getSelectedNode(targetTree);
      if(sourceNode==null || targetNode==null){
        sourceNode = getRootTable(sourceTree);
        targetNode = getRootTable(targetTree);
      }
        if (sourceNode != null && targetNode != null) {
View Full Code Here

            mappingTree.doStraightMappings(sourceNode, targetNode);
        }
    }

    private Node getSelectedNode(TreeComponent tree) {
        Node selectedNode=tree.m_highLightedNode;
        if(selectedNode!=null && selectedNode.isFolder()==false)
          return null;
        return selectedNode;
    }
View Full Code Here

          return null;
        return selectedNode;
    }

    private Node getRootTable(TreeComponent tree) {
        Node root = tree.m_root;
        if (root.getChildCount() == 1) {
            return root.getChildAt(0);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.client.ui.interchange.entity.transformation.tree.utils.Node

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.