Search in sources :

Example 21 with OrderedCollection

use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.

the class AbstractTabBox method initMenus.

private void initMenus() {
    List<Class<? extends IMenu>> declaredMenus = getDeclaredMenus();
    List<IMenu> contributedMenus = m_contributionHolder.getContributionsByClass(IMenu.class);
    OrderedCollection<IMenu> menus = new OrderedCollection<IMenu>();
    for (Class<? extends IMenu> menuClazz : declaredMenus) {
        try {
            menus.addOrdered(ConfigurationUtility.newInnerInstance(this, menuClazz));
        } catch (Exception e) {
            BEANS.get(ExceptionHandler.class).handle(new ProcessingException("error creating instance of class '" + menuClazz.getName() + "'.", e));
        }
    }
    menus.addAllOrdered(contributedMenus);
    try {
        injectMenusInternal(menus);
    } catch (Exception e) {
        LOG.error("error occured while dynamically contributing menus.", e);
    }
    new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
    // set container on menus
    IFormFieldContextMenu contextMenu = new FormFieldContextMenu<ITabBox>(this, menus.getOrderedList());
    contextMenu.setContainerInternal(this);
    setContextMenu(contextMenu);
}
Also used : IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) FormFieldContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.internal.FormFieldContextMenu) IFormFieldContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.IFormFieldContextMenu) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) IFormFieldContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.IFormFieldContextMenu) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Example 22 with OrderedCollection

use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.

the class AbstractProposalColumnTest method testLookupRowWithTooLongText2.

@Test
public void testLookupRowWithTooLongText2() throws Exception {
    final AbstractProposalColumn<Long> column = new AbstractProposalColumn<Long>() {

        @Override
        protected boolean getConfiguredEditable() {
            return true;
        }

        @Override
        protected int getConfiguredMaxLength() {
            return 8;
        }
    };
    column.setCodeTypeClass(TestCodeType.class);
    final ITable table = new AbstractTable() {

        @Override
        protected void injectColumnsInternal(OrderedCollection<IColumn<?>> columns) {
            columns.addFirst(column);
        }
    };
    ITableRow row = table.addRow();
    @SuppressWarnings("unchecked") IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
    field.getUIFacade().acceptProposalFromUI("1234567890", false, false);
    column.completeEdit(row, field);
    assertEquals("12345678", column.getValue(row));
}
Also used : AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) IProposalField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Example 23 with OrderedCollection

use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.

the class AbstractProposalColumnTest method testLookupRowWithTooLongText1.

@Test
public void testLookupRowWithTooLongText1() throws Exception {
    final AbstractProposalColumn<Long> column = new AbstractProposalColumn<Long>() {

        @Override
        protected boolean getConfiguredEditable() {
            return true;
        }

        @Override
        protected int getConfiguredMaxLength() {
            return 32;
        }
    };
    column.setCodeTypeClass(TestCodeType.class);
    final ITable table = new AbstractTable() {

        @Override
        protected void injectColumnsInternal(OrderedCollection<IColumn<?>> columns) {
            columns.addFirst(column);
        }
    };
    ITableRow row = table.addRow();
    @SuppressWarnings("unchecked") IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
    field.getUIFacade().acceptProposalFromUI("1234567890", false, false);
    column.completeEdit(row, field);
    assertEquals("1234567890", column.getValue(row));
}
Also used : AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) IProposalField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Aggregations

OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)23 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)12 ContributionComposite (org.eclipse.scout.rt.shared.extension.ContributionComposite)8 ArrayList (java.util.ArrayList)7 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)5 PropertyChangeEvent (java.beans.PropertyChangeEvent)4 PropertyChangeListener (java.beans.PropertyChangeListener)4 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)4 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)4 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)4 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)4 EventListenerList (org.eclipse.scout.rt.platform.util.EventListenerList)4 Test (org.junit.Test)4 List (java.util.List)3 FormFieldContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.internal.FormFieldContextMenu)3 IEventHistory (org.eclipse.scout.rt.client.ui.IEventHistory)2 IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)2 IFormFieldContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.IFormFieldContextMenu)2 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)2 IOException (java.io.IOException)1