use of org.eclipse.scout.rt.client.ui.form.fields.composer.node.RootNode in project scout.rt by eclipse.
the class AbstractComposerField method initConfig.
@Override
protected void initConfig() {
m_uiFacade = BEANS.get(ModelContextProxy.class).newProxy(new P_UIFacade(), ModelContext.copyCurrent());
super.initConfig();
m_dataModel = interceptCreateDataModel();
// tree
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) {
RootNode rootNode = interceptCreateRootNode();
rootNode.getCellForUpdate().setText(getLabel());
m_tree.setRootNode(rootNode);
m_tree.setNodeExpanded(rootNode, true);
m_tree.setEnabled(isEnabled());
m_tree.addTreeListener(new TreeAdapter() {
@Override
public void treeChanged(TreeEvent e) {
switch(e.getType()) {
case TreeEvent.TYPE_NODES_DELETED:
case TreeEvent.TYPE_ALL_CHILD_NODES_DELETED:
case TreeEvent.TYPE_NODES_INSERTED:
case TreeEvent.TYPE_NODES_UPDATED:
case TreeEvent.TYPE_NODES_CHECKED:
{
checkSaveNeeded();
checkEmpty();
break;
}
}
}
});
// local enabled listener
addPropertyChangeListener(PROP_ENABLED_COMPUTED, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
if (m_tree == null) {
return;
}
boolean newEnabled = ((Boolean) e.getNewValue()).booleanValue();
m_tree.setEnabled(newEnabled);
}
});
} else {
LOG.warn("there is no inner class of type ITree in {}", getClass().getName());
}
}
Aggregations