use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractActionNode method initConfig.
@Override
@SuppressWarnings("unchecked")
protected void initConfig() {
super.initConfig();
// menus
List<Class<? extends IActionNode>> configuredChildActions = getConfiguredChildActions();
OrderedCollection<T> actionNodes = new OrderedCollection<T>();
for (Class<? extends IActionNode> a : configuredChildActions) {
IActionNode node = ConfigurationUtility.newInnerInstance(this, a);
node.setParent(this);
actionNodes.addOrdered((T) node);
}
m_contributionHolder = new ContributionComposite(this);
List<IActionNode> contributedActions = m_contributionHolder.getContributionsByClass(IActionNode.class);
for (IActionNode n : contributedActions) {
actionNodes.addOrdered((T) n);
}
try {
injectActionNodesInternal(actionNodes);
} catch (RuntimeException e) {
BEANS.get(ExceptionHandler.class).handle(e);
}
// add
setChildActions(actionNodes.getOrderedList());
}
use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractTreeNode method initConfig.
protected void initConfig() {
setLeafInternal(getConfiguredLeaf());
setEnabled(getConfiguredEnabled(), IDimensions.ENABLED);
setExpandedInternal(getConfiguredExpanded());
setLazyExpandingEnabled(getConfiguredLazyExpandingEnabled());
setExpandedLazyInternal(isLazyExpandingEnabled());
setInitialExpanded(getConfiguredExpanded());
m_contributionHolder = new ContributionComposite(this);
// menus are lazy
}
use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractTable method initConfig.
protected void initConfig() {
m_eventHistory = createEventHistory();
m_eventBuffer = createEventBuffer();
m_uiFacade = BEANS.get(ModelContextProxy.class).newProxy(createUIFacade(), ModelContext.copyCurrent());
m_contributionHolder = new ContributionComposite(this);
setEnabled(true);
setLoading(false);
setGroupingStyle(getConfiguredGroupingStyle());
setTitle(getConfiguredTitle());
setAutoDiscardOnDelete(getConfiguredAutoDiscardOnDelete());
setSortEnabled(getConfiguredSortEnabled());
setDefaultIconId(getConfiguredDefaultIconId());
setCssClass((getConfiguredCssClass()));
setRowIconVisible(getConfiguredRowIconVisible());
setHeaderVisible(getConfiguredHeaderVisible());
setHeaderEnabled(getConfiguredHeaderEnabled());
setAutoResizeColumns(getConfiguredAutoResizeColumns());
setCheckable(getConfiguredCheckable());
setMultiCheck(getConfiguredMultiCheck());
setMultiSelect(getConfiguredMultiSelect());
setInitialMultilineText(getConfiguredMultilineText());
setMultilineText(getConfiguredMultilineText());
setKeyboardNavigation(getConfiguredKeyboardNavigation());
setDragType(getConfiguredDragType());
setDropType(getConfiguredDropType());
setDropMaximumSize(getConfiguredDropMaximumSize());
setScrollToSelection(getConfiguredScrollToSelection());
setTableStatusVisible(getConfiguredTableStatusVisible());
if (getTableCustomizer() == null) {
setTableCustomizer(createTableCustomizer());
}
// columns
createColumnsInternal();
// table controls
createTableControlsInternal();
// menus
initMenus();
// key strokes
List<Class<? extends IKeyStroke>> ksClasses = getConfiguredKeyStrokes();
List<IKeyStroke> ksList = new ArrayList<IKeyStroke>(ksClasses.size());
for (Class<? extends IKeyStroke> clazz : ksClasses) {
IKeyStroke ks = ConfigurationUtility.newInnerInstance(this, clazz);
ks.initAction();
if (ks.getKeyStroke() != null) {
ksList.add(ks);
}
}
// add ENTER key stroke when default menu is used or execRowAction has an override
Class<? extends IMenu> defaultMenuType = getDefaultMenuInternal();
if (defaultMenuType != null || ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "execRowAction", new Class[] { ITableRow.class }, this.getClass())) {
ksList.add(new KeyStroke("ENTER") {
@Override
protected void execAction() {
fireRowAction(getSelectedRow());
}
});
}
// add keystroke contributions
List<IKeyStroke> contributedKeyStrokes = m_contributionHolder.getContributionsByClass(IKeyStroke.class);
ksList.addAll(contributedKeyStrokes);
setKeyStrokes(ksList);
m_tableOrganizer = BEANS.get(ITableOrganizerProvider.class).createTableOrganizer(this);
// add Convenience observer for drag & drop callbacks, event history and ui sort possible check
addTableListener(new TableAdapter() {
@Override
public void tableChanged(TableEvent e) {
// event history
IEventHistory<TableEvent> h = getEventHistory();
if (h != null) {
h.notifyEvent(e);
}
// dnd
switch(e.getType()) {
case TableEvent.TYPE_ROWS_DRAG_REQUEST:
{
if (e.getDragObject() == null) {
try {
e.setDragObject(interceptDrag(e.getRows()));
} catch (RuntimeException ex) {
BEANS.get(ExceptionHandler.class).handle(ex);
}
}
break;
}
case TableEvent.TYPE_ROW_DROP_ACTION:
{
if (e.getDropObject() != null && isEnabled()) {
try {
interceptDrop(e.getFirstRow(), e.getDropObject());
} catch (RuntimeException ex) {
BEANS.get(ExceptionHandler.class).handle(ex);
}
}
break;
}
case TableEvent.TYPE_ROWS_COPY_REQUEST:
{
if (e.getCopyObject() == null) {
try {
e.setCopyObject(interceptCopy(e.getRows()));
} catch (RuntimeException ex) {
BEANS.get(ExceptionHandler.class).handle(ex);
}
}
break;
}
case TableEvent.TYPE_ALL_ROWS_DELETED:
case TableEvent.TYPE_ROWS_DELETED:
case TableEvent.TYPE_ROWS_INSERTED:
case TableEvent.TYPE_ROWS_UPDATED:
{
if (isValueChangeTriggerEnabled()) {
try {
interceptContentChanged();
} catch (RuntimeException ex) {
BEANS.get(ExceptionHandler.class).handle(ex);
}
}
break;
}
case TableEvent.TYPE_ROWS_CHECKED:
try {
interceptRowsChecked(e.getRows());
} catch (RuntimeException ex) {
BEANS.get(ExceptionHandler.class).handle(ex);
}
break;
case TableEvent.TYPE_COLUMN_HEADERS_UPDATED:
case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED:
checkIfColumnPreventsUiSortForTable();
break;
}
}
});
}
use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractMixedSmartColumn method initConfig.
@Override
protected void initConfig() {
super.initConfig();
m_contributionHolder = new ContributionComposite(this);
setSortCodesByDisplayText(getConfiguredSortCodesByDisplayText());
}
use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractSmartColumn2 method initConfig.
@Override
protected void initConfig() {
super.initConfig();
m_contributionHolder = new ContributionComposite(this);
setSortCodesByDisplayText(getConfiguredSortCodesByDisplayText());
// code type
if (getConfiguredCodeType() != null) {
setCodeTypeClass(getConfiguredCodeType());
}
// lazy lookup decorator
Class<? extends ILookupCall<VALUE>> lookupCallClass = getConfiguredLookupCall();
if (lookupCallClass != null) {
ILookupCall<VALUE> call;
try {
call = BEANS.get(lookupCallClass);
setLookupCall(call);
} catch (Exception e) {
BEANS.get(ExceptionHandler.class).handle(new ProcessingException("error creating instance of class '" + lookupCallClass.getName() + "'.", e));
}
}
}
Aggregations