Examples of ItemNode


Examples of org.apache.myfaces.trinidad.menu.ItemNode

    * @return Node of type ItemNode.
    */
  private ItemNode _createItemNode()
  {
    // Create the itemNode
    ItemNode itemNode = new ItemNode();

    String action         = _getAndRemoveAttrValue(_ACTION_ATTR);
    String actionListener = _getAndRemoveAttrValue(_ACTIONLISTENER_ATTR);
    String launchListener = _getAndRemoveAttrValue(_LAUNCHLISTENER_ATTR);
    String returnListener = _getAndRemoveAttrValue(_RETURNLISTENER_ATTR);
    String immediate      = _getAndRemoveAttrValue(_IMMEDIATE_ATTR);
    String useWindow      = _getAndRemoveAttrValue(_USEWINDOW_ATTR);
    String windowHeight   = _getAndRemoveAttrValue(_WINDOWHEIGHT_ATTR);
    String windowWidth    = _getAndRemoveAttrValue(_WINDOWWIDTH_ATTR);
    String defaultFocusPathStr = _getAndRemoveAttrValue(_DEFAULT_FOCUS_PATH_ATTR);
    String focusViewId    = _getAndRemoveAttrValue(_FOCUS_VIEWID_ATTR);

    // Former Destination node attrs
    String destination = _getAndRemoveAttrValue(_DESTINATION_ATTR);
    String targetFrame = _getAndRemoveAttrValue(_TARGETFRAME_ATTR);

    // An item node with one of two(2) possible values:
    // 1) outcome
    // 2) EL method binding  (which can return either a URI or
    //    an outcome

    // Set its properties - null is ok.
    itemNode.setAction(action);
    itemNode.setActionListener(actionListener);
    itemNode.setLaunchListener(launchListener);
    itemNode.setReturnListener(returnListener);
    itemNode.setImmediate(immediate);
    itemNode.setUseWindow(useWindow);
    itemNode.setWindowHeight(windowHeight);
    itemNode.setWindowWidth(windowWidth);
    itemNode.setFocusViewId(focusViewId);
    itemNode.setDefaultFocusPath(defaultFocusPathStr);

    // Former destination node attrs
    itemNode.setDestination(destination);
    itemNode.setTargetFrame(targetFrame);

    // Set the Any Attributes Attrlist
    if (_attrMap.size() > 0)
    {
      itemNode.setCustomPropList(_attrMap);
    }

    return itemNode;
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.menu.ItemNode

    * @return Node of type ItemNode.
    */
  private ItemNode _createItemNode()
  {
    // Create the itemNode
    ItemNode itemNode = new ItemNode();

    String action         = _getAndRemoveAttrValue(_ACTION_ATTR);
    String actionListener = _getAndRemoveAttrValue(_ACTIONLISTENER_ATTR);
    String launchListener = _getAndRemoveAttrValue(_LAUNCHLISTENER_ATTR);
    String returnListener = _getAndRemoveAttrValue(_RETURNLISTENER_ATTR);
    String immediate      = _getAndRemoveAttrValue(_IMMEDIATE_ATTR);
    String useWindow      = _getAndRemoveAttrValue(_USEWINDOW_ATTR);
    String windowHeight   = _getAndRemoveAttrValue(_WINDOWHEIGHT_ATTR);
    String windowWidth    = _getAndRemoveAttrValue(_WINDOWWIDTH_ATTR);
    String defaultFocusPathStr = _getAndRemoveAttrValue(_DEFAULT_FOCUS_PATH_ATTR);
    String focusViewId    = _getAndRemoveAttrValue(_FOCUS_VIEWID_ATTR);

    // Former Destination node attrs
    String destination = _getAndRemoveAttrValue(_DESTINATION_ATTR);
    String targetFrame = _getAndRemoveAttrValue(_TARGETFRAME_ATTR);

    // An item node with one of two(2) possible values:
    // 1) outcome
    // 2) EL method binding  (which can return either a URI or
    //    an outcome

    // Set its properties - null is ok.
    itemNode.setAction(action);
    itemNode.setActionListener(actionListener);
    itemNode.setLaunchListener(launchListener);
    itemNode.setReturnListener(returnListener);
    itemNode.setImmediate(immediate);
    itemNode.setUseWindow(useWindow);
    itemNode.setWindowHeight(windowHeight);
    itemNode.setWindowWidth(windowWidth);
    itemNode.setFocusViewId(focusViewId);
    itemNode.setDefaultFocusPath(defaultFocusPathStr);

    // Former destination node attrs
    itemNode.setDestination(destination);
    itemNode.setTargetFrame(targetFrame);

    // Set the Any Attributes Attrlist
    if (_attrMap.size() > 0)
    {
      itemNode.setCustomPropList(_attrMap);
    }

    return itemNode;
  }
View Full Code Here

Examples of org.olat.ims.qti.editor.tree.ItemNode

      if (te.getCommand().equals(TreeEvent.COMMAND_TREENODE_CLICKED)) {
        // user chose a position to insert the node to be copied
        String nodeId = te.getNodeId();
        TreePosition tp = insertTreeModel.getTreePosition(nodeId);
        int targetPos = tp.getChildpos();
        ItemNode selectedNode = (ItemNode) menuTree.getSelectedNode();
        // only items are moveable
        // use XStream instead of ObjectCloner
        // Item qtiItem =
        // (Item)xstream.fromXML(xstream.toXML(selectedNode.getUnderlyingQTIObject()));
        Item toClone = (Item) selectedNode.getUnderlyingQTIObject();
        Item qtiItem = (Item) XStreamHelper.xstreamClone(toClone);
        // copy flow label class too, olat-2791
        Question orgQuestion = toClone.getQuestion();
        if (orgQuestion instanceof ChoiceQuestion) {
          String flowLabelClass = ((ChoiceQuestion)orgQuestion).getFlowLabelClass();
          Question copyQuestion =  qtiItem.getQuestion();
          if (copyQuestion instanceof ChoiceQuestion) {
            ((ChoiceQuestion)copyQuestion).setFlowLabelClass(flowLabelClass);
          } else {
            throw new AssertException("Could not copy flow-label-class, wrong type of copy question , must be 'ChoiceQuestion' but is " +copyQuestion);
          }
        }
        String editorIdentPrefix = "";
        if (qtiItem.getIdent().startsWith(ItemParser.ITEM_PREFIX_SCQ)) editorIdentPrefix = ItemParser.ITEM_PREFIX_SCQ;
        else if (qtiItem.getIdent().startsWith(ItemParser.ITEM_PREFIX_MCQ)) editorIdentPrefix = ItemParser.ITEM_PREFIX_MCQ;
        else if (qtiItem.getIdent().startsWith(ItemParser.ITEM_PREFIX_KPRIM)) editorIdentPrefix = ItemParser.ITEM_PREFIX_KPRIM;
        else if (qtiItem.getIdent().startsWith(ItemParser.ITEM_PREFIX_FIB)) editorIdentPrefix = ItemParser.ITEM_PREFIX_FIB;
        else if (qtiItem.getIdent().startsWith(ItemParser.ITEM_PREFIX_ESSAY)) editorIdentPrefix = ItemParser.ITEM_PREFIX_ESSAY;
        // set new ident... this is all it needs for our engine to recognise it
        // as a new item.
        qtiItem.setIdent(editorIdentPrefix + CodeHelper.getForeverUniqueID());
        // insert into menutree (insert on GenericNode do a remove from parent)
        GenericQtiNode parentTargetNode = (GenericQtiNode) tp.getParentTreeNode();
        GenericQtiNode newNode = new ItemNode(qtiItem, qtiPackage);
        parentTargetNode.insert(newNode, targetPos);
        // insert into model
        parentTargetNode.insertQTIObjectAt(qtiItem, targetPos);
        // activate copied node
        menuTree.setSelectedNodeId(newNode.getIdent());
        event(ureq, menuTree, new Event(MenuTree.COMMAND_TREENODE_CLICKED));
        qtiPackage.serializeQTIDocument();
      }
    } else if (source == insertTree) { // catch insert operations
      cmc.deactivate();
View Full Code Here

Examples of org.olat.ims.qti.editor.tree.ItemNode

        if (cmd.equals(CMD_TOOLS_ADD_SECTION)) {
          Section newSection = QTIEditHelper.createSection(getTranslator());
          Item newItem = QTIEditHelper.createSCItem(getTranslator());
          newSection.getItems().add(newItem);
          SectionNode scNode = new SectionNode(newSection, qtiPackage);
          ItemNode itemNode = new ItemNode(newItem, qtiPackage);
          scNode.addChild(itemNode);
          insertObject = scNode;
        } else if (cmd.equals(CMD_TOOLS_ADD_SINGLECHOICE)) insertObject = new ItemNode(QTIEditHelper.createSCItem(getTranslator()), qtiPackage);
        else if (cmd.equals(CMD_TOOLS_ADD_MULTIPLECHOICE)) insertObject = new ItemNode(QTIEditHelper.createMCItem(getTranslator()), qtiPackage);
        else if (cmd.equals(CMD_TOOLS_ADD_KPRIM)) insertObject = new ItemNode(QTIEditHelper.createKPRIMItem(getTranslator()), qtiPackage);
        else if (cmd.equals(CMD_TOOLS_ADD_FIB)) insertObject = new ItemNode(QTIEditHelper.createFIBItem(getTranslator()), qtiPackage);
        else if (cmd.equals(CMD_TOOLS_ADD_FREETEXT)) insertObject = new ItemNode(QTIEditHelper.createEssayItem(getTranslator()), qtiPackage);

        // prepare insert tree
        insertTree = new SelectionTree("insertTree", getTranslator());
        insertTree.setFormButtonKey("submit");
        if (cmd.equals(CMD_TOOLS_ADD_SECTION)) insertTreeModel = new InsertItemTreeModel(menuTreeModel,
View Full Code Here

Examples of org.olat.ims.qti.editor.tree.ItemNode

              Memento mem = (Memento) history.get(key);
              result.append("\n---++ Section " + formatVariable(sn.getAltText()) + " changes:");
              result.append(sn.createChangeMessage(mem));
            }
          } else if (node instanceof ItemNode) {
            ItemNode in = (ItemNode) node;
            SectionNode sn = (SectionNode) in.getParent();
            String parentSectkey = ((Section) ((SectionNode) in.getParent()).getUnderlyingQTIObject()).getIdent();
            Item item = (Item) in.getUnderlyingQTIObject();
            Question question = item.getQuestion();
            String itemKey = item.getIdent();
            String prefixKey = "null/" + itemKey;
            String questionIdent = question != null ? question.getQuestion().getId() : "null";
            String key = prefixKey + "/" + questionIdent + "/null";
            StringBuilder changeMessage = new StringBuilder();
            boolean hasChanges = false;

            if (!itemMap.containsKey(itemKey)) {
              Memento questMem = null;
              Memento respMem = null;
              if (history.containsKey(key)) {
                // question changed!
                questMem = (Memento) history.get(key);
                hasChanges = true;
              }
              // if(!hasChanges){
              // check if a response changed
              // new prefix for responses
              prefixKey += "/null/";
              // list contains org.olat.ims.qti.editor.beecom.objects.Response
              List responses = question != null ? question.getResponses() : null;
              if (responses != null && responses.size() > 0) {
                // check for changes in each response
                for (Iterator iter = responses.iterator(); iter.hasNext();) {
                  Response resp = (Response) iter.next();
                  if (history.containsKey(prefixKey + resp.getIdent())) {
                    // this response changed!
                    Memento tmpMem = (Memento) history.get(prefixKey + resp.getIdent());
                    if (respMem != null) {
                      respMem = respMem.getTimestamp() > tmpMem.getTimestamp() ? tmpMem : respMem;
                    } else {
                      hasChanges = true;
                      respMem = tmpMem;
                    }
                  }
                }
              }
              // }
              // output message
              if (hasChanges) {
                Memento mem = null;
                if (questMem != null && respMem != null) {
                  // use the earlier memento
                  mem = questMem.getTimestamp() > respMem.getTimestamp() ? respMem : questMem;
                } else if (questMem != null) {
                  mem = questMem;
                } else if (respMem != null) {
                  mem = respMem;
                }
                changeMessage.append(in.createChangeMessage(mem));
                itemMap.put(itemKey, itemKey);
                if (!parentSectkey.equals(sectionKey)) {
                  // either this item belongs to a new section or no section
                  // is active
                  result.append("\n---++ Section " + formatVariable(sn.getAltText()) + " changes:");
View Full Code Here

Examples of rocks.xmpp.extensions.disco.model.items.ItemNode

                "          name='Music from the time of Shakespeare'/>\n" +
                "  </query>\n" +
                "</iq>\n";

        IQ iq = unmarshal(xml, IQ.class);
        ItemNode itemNode = iq.getExtension(ItemDiscovery.class);
        Assert.assertNotNull(itemNode);
        Assert.assertEquals(itemNode.getItems().size(), 3);
        Assert.assertEquals(itemNode.getItems().get(0).getJid(), Jid.valueOf("catalog.shakespeare.lit"));
        Assert.assertEquals(itemNode.getItems().get(0).getNode(), "books");
        Assert.assertEquals(itemNode.getItems().get(0).getName(), "Books by and about Shakespeare");
        Assert.assertEquals(itemNode.getItems().get(1).getJid(), Jid.valueOf("catalog.shakespeare.lit"));
        Assert.assertEquals(itemNode.getItems().get(1).getNode(), "clothing");
        Assert.assertEquals(itemNode.getItems().get(1).getName(), "Wear your literary taste with pride");
        Assert.assertEquals(itemNode.getItems().get(2).getJid(), Jid.valueOf("catalog.shakespeare.lit"));
        Assert.assertEquals(itemNode.getItems().get(2).getNode(), "music");
        Assert.assertEquals(itemNode.getItems().get(2).getName(), "Music from the time of Shakespeare");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.disco.model.items.ItemNode

                                IQ result = iq.createResult();
                                result.setExtension(new ItemDiscovery(items));
                                xmppSession.send(result);
                                e.consume();
                            } else {
                                ItemNode itemNode = itemNodeMap.get(itemDiscovery.getNode());
                                if (itemNode != null) {
                                    IQ result = iq.createResult();
                                    result.setExtension(new ItemDiscovery(itemNode.getNode(), items));
                                    xmppSession.send(result);
                                    e.consume();
                                } else {
                                    xmppSession.send(iq.createError(new StanzaError(new ItemNotFound())));
                                    e.consume();
View Full Code Here

Examples of rocks.xmpp.extensions.disco.model.items.ItemNode

     * @throws rocks.xmpp.core.session.NoResponseException  If the chat service did not respond.
     * @see <a href="http://xmpp.org/extensions/xep-0045.html#disco-roomitems">6.5 Querying for Room Items</a>
     * @see #getOccupants()
     */
    public List<String> discoverOccupants() throws XmppException {
        ItemNode itemNode = serviceDiscoveryManager.discoverItems(roomJid);
        List<String> occupants = new ArrayList<>();
        List<Item> items = itemNode.getItems();
        for (Item item : items) {
            if (item.getJid() != null) {
                String nickname = item.getJid().getResource();
                if (nickname != null) {
                    occupants.add(nickname);
View Full Code Here

Examples of rocks.xmpp.extensions.disco.model.items.ItemNode

                                @Override
                                public void handle(ActionEvent actionEvent) {
                                    PubSubManager pubSubManager = xmppSession.getExtensionManager(PubSubManager.class);
                                    ServiceDiscoveryManager serviceDiscoveryManager = xmppSession.getExtensionManager(ServiceDiscoveryManager.class);
                                    try {
                                        ItemNode infoNode = serviceDiscoveryManager.discoverItems(null);
                                        int i = 0;
                                    } catch (XmppException e) {
                                        e.printStackTrace();
                                    }
                                }
View Full Code Here

Examples of rocks.xmpp.extensions.disco.model.items.ItemNode

     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     * @see <a href="http://xmpp.org/extensions/xep-0060.html#entity-nodes">5.2 Discover Nodes</a>
     */
    public List<PubSubNode> getNodes() throws XmppException {
        ItemNode itemNode = serviceDiscoveryManager.discoverItems(service);
        List<PubSubNode> nodes = new ArrayList<>();
        for (Item item : itemNode.getItems()) {
            PubSubNode n = new PubSubNode(item.getNode(), item.getName(), service, xmppSession);
            nodes.add(n);
        }
        return nodes;
    }
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.