Search in sources :

Example 61 with ITreeNode

use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.

the class ComposerDisplayTextBuilder method visitAndNodes.

private void visitAndNodes(List<? extends ITreeNode> nodes, StringBuilder buf, String prefix) {
    Iterator<? extends ITreeNode> nodeIt = nodes.iterator();
    ITreeNode node = null;
    boolean skipDoNext = false;
    while (nodeIt.hasNext() || skipDoNext) {
        // to ensure visit first node after an either or...
        if (!skipDoNext) {
            node = nodeIt.next();
        }
        // reset
        skipDoNext = false;
        if (node instanceof EntityNode) {
            visitEntityNode((EntityNode) node, buf, prefix);
        } else if (node instanceof AttributeNode) {
            visitAttributeNode((AttributeNode) node, buf, prefix);
        } else if (node instanceof EitherOrNode) {
            List<EitherOrNode> eitherOrNodes = new ArrayList<EitherOrNode>();
            eitherOrNodes.add((EitherOrNode) node);
            while (nodeIt.hasNext()) {
                node = nodeIt.next();
                if (node instanceof EitherOrNode) {
                    eitherOrNodes.add((EitherOrNode) node);
                } else {
                    skipDoNext = true;
                    break;
                }
            }
            visitOrNodes(eitherOrNodes, buf, prefix);
        }
    }
}
Also used : EitherOrNode(org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode) ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) AttributeNode(org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode) ArrayList(java.util.ArrayList) EntityNode(org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode)

Example 62 with ITreeNode

use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.

the class AbstractAddAttributeMenu method execAction.

@Override
protected void execAction() {
    ComposerAttributeForm form = new ComposerAttributeForm();
    EntityNode eNode = null;
    ITreeNode n = m_parentNode;
    while (n != null) {
        if (n instanceof EntityNode) {
            eNode = (EntityNode) n;
            break;
        }
        n = n.getParentNode();
    }
    if (eNode != null) {
        form.setAvailableAttributes(eNode.getEntity().getAttributes());
    } else {
        form.setAvailableAttributes(m_field.getAttributes());
    }
    form.startNew();
    form.waitFor();
    if (form.isFormStored()) {
        IDataModelAttribute a = form.getSelectedAttribute();
        IDataModelAttributeOp op = form.getSelectedOp();
        List<Object> values = form.getSelectedValues();
        List<String> displayValues = form.getSelectedDisplayValues();
        m_field.addAttributeNode(m_parentNode, a, null, op, values, displayValues);
    }
}
Also used : ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) IDataModelAttributeOp(org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp) IDataModelAttribute(org.eclipse.scout.rt.shared.data.model.IDataModelAttribute) ComposerAttributeForm(org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm)

Example 63 with ITreeNode

use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.

the class EitherOrNode method execDecorateCell.

@Override
protected void execDecorateCell(Cell cell) {
    String text = "";
    ITreeNode siblingBefore = getSiblingBefore();
    if (isBeginOfEitherOr() && siblingBefore != null) {
        text += TEXTS.get("ExtendedSearchAnd") + " ";
    }
    if (isBeginOfEitherOr()) {
        text += TEXTS.get("ExtendedSearchEither");
    } else {
        text += TEXTS.get("ExtendedSearchOr");
    }
    if (isNegative()) {
        text += " " + TEXTS.get("ExtendedSearchNot");
    }
    cell.setText(text);
}
Also used : ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)

Example 64 with ITreeNode

use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.

the class SmartFieldTest method testHierarchyNoResult.

@Test
public void testHierarchyNoResult() {
    StyleField f = m_styleField;
    f.setBrowseHierarchy(true);
    m_styleField.getUIFacade().openProposalChooserFromUI("unknown", false, false);
    waitForProposalResult(IProposalChooser.PROP_STATUS);
    // single result
    assertTrue(m_styleField.isProposalChooserRegistered());
    assertEquals("unknown", m_styleField.getDisplayText());
    // verifies tree is loaded containing a single node
    @SuppressWarnings("unchecked") TreeProposalChooser<Long> treeProposalChooser = (TreeProposalChooser<Long>) f.getProposalChooser();
    ITree tree = treeProposalChooser.getModel();
    ITreeNode rootNode = tree.getRootNode();
    assertEquals(0, rootNode.getChildNodes().size());
}
Also used : ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) ITree(org.eclipse.scout.rt.client.ui.basic.tree.ITree) StyleField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartFieldTest.TestForm.MainBox.StyleField) Test(org.junit.Test)

Example 65 with ITreeNode

use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.

the class SmartFieldTest method testThrowingLookupCall.

@Test
public void testThrowingLookupCall() {
    StyleField f = m_styleField;
    f.setBrowseHierarchy(true);
    ((StyleLookupCall) f.getLookupCall()).allowLookup(false);
    m_styleField.getUIFacade().openProposalChooserFromUI("Red", false, false);
    waitForProposalResult(IProposalChooser.PROP_STATUS);
    @SuppressWarnings("unchecked") TreeProposalChooser<Long> treeProposalChooser = ((TreeProposalChooser<Long>) f.getProposalChooser());
    ITree tree = treeProposalChooser.getModel();
    ITreeNode rootNode = tree.getRootNode();
    assertEquals(0, rootNode.getChildNodes().size());
    assertEquals(IStatus.ERROR, treeProposalChooser.getStatus().getSeverity());
}
Also used : ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) ITree(org.eclipse.scout.rt.client.ui.basic.tree.ITree) StyleField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartFieldTest.TestForm.MainBox.StyleField) Test(org.junit.Test)

Aggregations

ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)95 Test (org.junit.Test)34 ITree (org.eclipse.scout.rt.client.ui.basic.tree.ITree)29 ArrayList (java.util.ArrayList)23 ITreeVisitor (org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor)16 JSONObject (org.json.JSONObject)14 TreeNode (org.eclipse.scout.rt.ui.html.json.tree.fixtures.TreeNode)12 JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)11 JSONArray (org.json.JSONArray)10 HashSet (java.util.HashSet)9 IPage (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage)6 EitherOrNode (org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode)6 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)5 TreeEvent (org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent)5 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)5 LinkedList (java.util.LinkedList)4 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)4 IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)4 ITreeNodeFilter (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter)3 StyleField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartFieldTest.TestForm.MainBox.StyleField)3