use of org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree in project scout.rt by eclipse.
the class IncrementalTreeBuilderTest method createTestTree.
private ITree createTestTree() {
AbstractTree tree = new AbstractTree() {
};
tree.initTree();
return tree;
}
use of org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree in project scout.rt by eclipse.
the class AbstractTreeBox method initConfig.
@SuppressWarnings("unchecked")
@Override
protected void initConfig() {
m_fields = CollectionUtility.emptyArrayList();
m_movedFormFieldsByClass = new HashMap<Class<? extends IFormField>, IFormField>();
super.initConfig();
setFilterActiveNodes(getConfiguredFilterActiveNodes());
setFilterActiveNodesValue(TriState.TRUE);
setFilterCheckedNodes(getConfiguredFilterCheckedNodes());
setFilterCheckedNodesValue(getConfiguredFilterCheckedNodes());
setAutoExpandAll(getConfiguredAutoExpandAll());
setLoadIncremental(getConfiguredLoadIncremental());
List<ITree> contributedTrees = m_contributionHolder.getContributionsByClass(ITree.class);
m_tree = CollectionUtility.firstElement(contributedTrees);
if (m_tree == null) {
Class<? extends ITree> configuredTree = getConfiguredTree();
if (configuredTree != null) {
m_tree = ConfigurationUtility.newInnerInstance(this, configuredTree);
}
}
if (m_tree != null) {
if (m_tree instanceof AbstractTree) {
((AbstractTree) m_tree).setContainerInternal(this);
}
m_tree.setRootNode(getTreeNodeBuilder().createTreeNode(new LookupRow(null, "Root"), ITreeNode.STATUS_NON_CHANGED, false));
m_tree.setAutoDiscardOnDelete(false);
updateActiveNodesFilter();
updateCheckedNodesFilter();
m_tree.addTreeListener(new TreeAdapter() {
@Override
public void treeChanged(TreeEvent e) {
switch(e.getType()) {
case TreeEvent.TYPE_NODES_SELECTED:
{
if (!getTree().isCheckable()) {
syncTreeToValue();
}
break;
}
case TreeEvent.TYPE_NODES_CHECKED:
{
if (getTree().isCheckable()) {
syncTreeToValue();
}
break;
}
}
}
});
m_tree.setEnabled(isEnabled());
// default icon
if (this.getConfiguredIconId() != null) {
m_tree.setDefaultIconId(this.getConfiguredIconId());
}
} else {
LOG.warn("there is no inner class of type ITree in {}", getClass().getName());
}
getTree().setAutoCheckChildNodes(getConfiguredAutoCheckChildNodes());
Class<? extends ILookupCall<T>> lookupCallClass = getConfiguredLookupCall();
if (lookupCallClass != null) {
ILookupCall<T> call = BEANS.get(lookupCallClass);
setLookupCall(call);
}
// code type
if (getConfiguredCodeType() != null) {
setCodeTypeClass(getConfiguredCodeType());
}
// local property listener
addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
if (m_tree == null) {
return;
}
String name = e.getPropertyName();
if (PROP_ENABLED_COMPUTED.equals(name)) {
boolean newEnabled = ((Boolean) e.getNewValue()).booleanValue();
m_tree.setEnabled(newEnabled);
} else if (PROP_FILTER_CHECKED_NODES_VALUE.equals(name)) {
updateCheckedNodesFilter();
} else if (PROP_FILTER_ACTIVE_NODES_VALUE.equals(name)) {
updateActiveNodesFilter();
}
}
});
// add fields
List<Class<? extends IFormField>> configuredFields = getConfiguredFields();
List<IFormField> contributedFields = m_contributionHolder.getContributionsByClass(IFormField.class);
List<IFormField> fieldList = new ArrayList<IFormField>(configuredFields.size() + contributedFields.size());
for (Class<? extends IFormField> fieldClazz : configuredFields) {
fieldList.add(ConfigurationUtility.newInnerInstance(this, fieldClazz));
}
fieldList.addAll(contributedFields);
Collections.sort(fieldList, new OrderedComparator());
for (IFormField f : fieldList) {
f.setParentFieldInternal(this);
}
m_fields = fieldList;
}
Aggregations