Exemple #1
0
 /*
  * Update of user tree for ordered menu nodes (favorites, create new list)
  * favorites @param menuIDs List<Integer> ordered list of menuIDs to put in
  * the tree @param menuTree MTree the tree to be reordered @return true if
  * updated
  */
 private boolean updateUserTree(List<Integer> menuIDs, MTree menuTree) {
   CTreeNode root = menuTree.getRoot();
   if (root != null) {
     Enumeration<?> nodes = root.preorderEnumeration();
     while (nodes.hasMoreElements()) {
       CTreeNode nd = (CTreeNode) nodes.nextElement();
       if (!menuIDs.contains(nd.getNode_ID())) {
         MTreeNodeMM node = null;
         if ((node = MTreeNodeMM.get(menuTree, nd.getNode_ID())) != null) {
           if (!node.delete(true)) return false;
         }
       }
     }
   }
   int seq = 0;
   for (int id : menuIDs) {
     MTreeNodeMM node = null;
     if ((node = MTreeNodeMM.get(menuTree, id)) == null) {
       node = new MTreeNodeMM(menuTree, id);
     }
     node.setSeqNo(++seq);
     if (!node.save()) return false;
   }
   return true;
 }
Exemple #2
0
 /**
  * Draw the icon at the specified location. Icon implementations may use the Component argument to
  * get properties useful for painting, e.g. the foreground or background color.
  *
  * @param c Component
  * @param g Graphics
  * @param x X
  * @param y Y
  * @see javax.swing.Icon#paintIcon(Component, Graphics, int, int)
  */
 public void paintIcon(Component c, Graphics g, int x, int y) {
   Graphics2D g2D = (Graphics2D) g;
   Icon icon = CTreeNode.getIcon(m_type);
   if (icon != null) {
     int xI = x + ((WIDTH - icon.getIconWidth()) / 2);
     int yI = y + ((HEIGHT - icon.getIconHeight()) / 2);
     icon.paintIcon(c, g, xI, yI);
   } else //	draw dot
   {
     int size = 10;
     int xI = x + ((WIDTH - size) / 2);
     int yI = y + ((HEIGHT - size) / 2);
     g2D.setColor(Color.magenta);
     g2D.fillOval(xI, yI, size, size);
   }
 } //	PaintIcon
Exemple #3
0
 /**
  * Constructor
  *
  * @param action image indicator
  */
 public WFIcon(String action) {
   if (action != null) m_type = CTreeNode.getImageIndex(action);
 } //	WFIcon
Exemple #4
0
 /**
  * Get a menu tree representation based on a AD_Tree_ID
  *
  * @param AD_Tree_ID A tree based on AD_Menu
  * @return menu as array list
  */
 private ArrayList<CTreeNode> getMenuTree(int AD_Tree_ID, boolean edit) {
   MTree tree = new MTree(m_context, AD_Tree_ID, edit, true, true, null); // Language
   // set
   // in
   // WLogin
   // Trim tree
   CTreeNode root = tree.getRoot();
   Enumeration<?> en = root.preorderEnumeration();
   while (en.hasMoreElements()) {
     CTreeNode nd = (CTreeNode) en.nextElement();
     if (nd.isTask() || nd.isWorkbench() // || nd.isWorkFlow()
     // server
     ) {
       CTreeNode parent = (CTreeNode) nd.getParent();
       parent.remove(nd);
     }
   }
   tree.trimTree();
   en = root.preorderEnumeration();
   ArrayList<CTreeNode> retValue = new ArrayList<CTreeNode>();
   while (en.hasMoreElements()) {
     CTreeNode nd = (CTreeNode) en.nextElement();
     // Issue #420: removed menu entries for un-implemented forms
     if (nd.getAD_Form_ID() == 119 || nd.getAD_Form_ID() == 102
     //					|| nd.getAD_Workflow_ID() == 106
     //					|| nd.getAD_Workflow_ID() == 104
     //					// Review
     //					|| nd.getAD_Workflow_ID() == 112
     //					// Setup
     //					|| nd.getAD_Workflow_ID() == 113
     //					|| nd.getAD_Workflow_ID() == 110
     //					|| nd.getAD_Workflow_ID() == 111
     // || nd.getAD_Process_ID() == 205
     ) {
     } else retValue.add(nd);
   }
   return retValue;
 }