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);
}
}
}
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);
}
}
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);
}
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());
}
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());
}
Aggregations