Package org.enhydra.shark.xpdl

Examples of org.enhydra.shark.xpdl.XMLCollection


    protected void changeModel(XPDLElementChangeInfo info) {
        try {
            if (info.getAction() == XPDLElementChangeInfo.INSERTED) {
                if (info.getChangedElement() instanceof XMLCollection) {
                    XMLCollection col = (XMLCollection) info.getChangedElement();
                    List lst = info.getChangedSubElements();
                    for (int i = 0; i < lst.size(); i++) {
                        col.add((XMLElement) lst.get(i));
                    }

                }
            } else if (info.getAction() == XPDLElementChangeInfo.REMOVED) {
                if (info.getChangedElement() instanceof XMLCollection) {
                    XMLCollection col = (XMLCollection) info.getChangedElement();
                    List lst = info.getChangedSubElements();
                    for (int i = 0; i < lst.size(); i++) {
                        col.remove((XMLElement) lst.get(i));
                    }

                }
            } else if (info.getAction() == XPDLElementChangeInfo.UPDATED) {
                XMLElement el = info.getChangedElement();
                if (el instanceof XMLComplexChoice) {
                    ((XMLComplexChoice) el).setChoosen((XMLElement) info.getNewValue());
                } else {
                    el.setValue(info.getNewValue().toString());
                }
            } else if (info.getAction() == XPDLElementChangeInfo.REPOSITIONED) {
                XMLCollection col = (XMLCollection) info.getChangedElement();
                List lst = info.getChangedSubElements();
                List newPositions = (List) info.getNewValue();
                for (int i = 0; i < lst.size(); i++) {
                    col.reposition((XMLElement) lst.get(i), ((Integer) newPositions.get(i)).intValue());
                }

            }
        } catch (Exception e) {
            //ignore
View Full Code Here


                }
            } else if (el instanceof XMLCollection) {
                if (!tmplEl.toValue().equals("") && !tmplEl.toValue().equals(el.toValue())) {
                    ret = false;
                } else {
                    XMLCollection col = (XMLCollection) el;
                    List cels = ((XMLCollection) tmplEl).toElements();
                    for (int i = 0; i < cels.size(); i++) {
                        XMLElement tcel = (XMLElement) cels.get(i);
                        if (tcel instanceof ActualParameter || tcel instanceof FormalParameter) {
                            if (!compareToTemplate(topEl, col.get(i), tcel)) {
                                ret = false;
                                break;
                            }
                        } else {
                            boolean btt = false;
                            for (int j = 0; j < col.size(); j++) {
                                XMLElement e = (XMLElement) col.get(j);
                                if (compareToTemplate(topEl, e, tcel)) {
                                    btt = true;
                                    break;
                                }
                            }
View Full Code Here

   }

   protected void moveItem() {
      changing = true;
      DefaultListModel listModel = (DefaultListModel) allParam.getModel();
      XMLCollection owncol = (XMLCollection) getOwner();
      int rowCnt = listModel.getSize();
      if (movingElement == null || movingElementPosition == -1 || newMovingElementPosition == -1
            || newMovingElementPosition == movingElementPosition || (rowCnt - 1) < movingElementPosition
            || (rowCnt - 1) < newMovingElementPosition || !owncol.contains(movingElement.getElement())) {
         changing = false;
         return;
      }

      XMLCollection col = (XMLCollection) getOwner();
      if (JaWEManager.getInstance().getJaWEController().canRepositionElement(col, movingElement.getElement())) {
         XMLElement currentElementAtPosition = ((XMLElementView) listModel.getElementAt(newMovingElementPosition))
               .getElement();
         int newpos = owncol.indexOf(currentElementAtPosition);
View Full Code Here

      allParam.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

      allParam.setAlignmentX(Component.LEFT_ALIGNMENT);
      allParam.setAlignmentY(Component.TOP_ALIGNMENT);

      final XMLCollection col = (XMLCollection) getOwner();
      final boolean canRepos = JaWEManager.getInstance().getJaWEController().canRepositionElement(col, null);

      // mouse listener for editing on double-click and dragging list items
      allParam.addMouseListener(new MouseAdapter() {
         public void mouseClicked(MouseEvent me) {
View Full Code Here

   }

   protected JPanel createArrowPanel() {
      JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      XMLCollection col = (XMLCollection) getOwner();
      boolean canRepos = JaWEManager.getInstance().getJaWEController().canRepositionElement(col, null);

      JButton buttonUp = new JButton();
      buttonUp.setIcon(ipc.getPanelSettings().getArrowUpImageIcon());
View Full Code Here

      moveItem();
   }

   protected void moveItem() {
      changing = true;
      XMLCollection owncol = (XMLCollection) getOwner();
      int rowCnt = allItems.getRowCount();
      if (movingElement == null || movingElementPosition == -1 || newMovingElementPosition == -1
            || newMovingElementPosition == movingElementPosition || (rowCnt - 1) < movingElementPosition
            || (rowCnt - 1) < newMovingElementPosition || !owncol.contains(movingElement)) {
         changing = false;
         return;
      }

      if (JaWEManager.getInstance().getJaWEController().canRepositionElement(owncol, movingElement)) {
         XMLElement currentElementAtPosition = (XMLElement) allItems.getValueAt(newMovingElementPosition, 0);
         int newpos = owncol.indexOf(currentElementAtPosition);

         DefaultTableModel dtm = (DefaultTableModel) allItems.getModel();
         Vector v = getRow(movingElement);
         dtm.removeRow(movingElementPosition);
         dtm.insertRow(newMovingElementPosition, v);

         JaWEController jc = JaWEManager.getInstance().getJaWEController();
         jc.startUndouableChange();
         owncol.reposition(movingElement, newpos);
         List toSelect = new ArrayList();
         toSelect.add(movingElement);
         jc.endUndouableChange(toSelect);

         setSelectedRow(newMovingElementPosition);
View Full Code Here

            Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
            if (!isCellSelected(rowIndex, vColIndex) && colors) {
               XMLElement el = (XMLElement) getValueAt(rowIndex, 0);
               if (el instanceof XMLCollectionElement) {
                  XMLCollectionElement cel = (XMLCollectionElement) el;
                  XMLCollection celOwner = (XMLCollection) cel.getParent();
                  if (celOwner == null) {
                     c.setBackground(SPEC_EL_COLOR_BKG);
                  } else if (celOwner!=getOwner()) {
                     c.setBackground(FOREIGN_EL_COLOR_BKG);
                  } else {
View Full Code Here

      allItems.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false), "delete");
      allItems.getActionMap().put("delete", deleteElementAction);


      final XMLCollection col = (XMLCollection) getOwner();
      final boolean canRepos = JaWEManager.getInstance().getJaWEController().canRepositionElement(col, null);

      if (!getOwner().isReadOnly())
         allItems.setToolTipText(ResourceManager.getLanguageDependentString("MessageDragItemToChangeItsPosition"));
View Full Code Here

TOP

Related Classes of org.enhydra.shark.xpdl.XMLCollection

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.