Search in sources :

Example 1 with OptimisticLock

use of org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock in project scout.rt by eclipse.

the class AbstractOutline method initConfig.

@Override
protected void initConfig() {
    // default visible
    m_visible = NamedBitMaskHelper.ALL_BITS_SET;
    m_contextPageOptimisticLock = new OptimisticLock();
    setPageChangeStrategy(createPageChangeStrategy());
    m_outlineMediator = createOutlineMediator();
    addTreeListener(new P_OutlineListener());
    addNodeFilter(new P_TableFilterBasedTreeNodeFilter());
    super.initConfig();
    IPage<?> rootPage = interceptCreateRootPage();
    setRootNode(rootPage);
    setEnabled(getConfiguredEnabled());
    setVisible(getConfiguredVisible());
    setOrder(calculateViewOrder());
    setNavigateButtonsVisible(getConfiguredNavigateButtonsVisible());
    setOutlineOverviewVisible(getConfiguredOutlineOverviewVisible());
    ensureDefaultDetailFormCreated();
    ensureDefaultDetailFormStarted();
}
Also used : OptimisticLock(org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock)

Example 2 with OptimisticLock

use of org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock in project scout.rt by eclipse.

the class OptimisticLockTest method testInitiallyNotAcqiured.

@Test
public void testInitiallyNotAcqiured() throws Exception {
    OptimisticLock l = new OptimisticLock();
    assertFalse(l.isAcquired());
    assertTrue(l.isReleased());
}
Also used : OptimisticLock(org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock) Test(org.junit.Test)

Example 3 with OptimisticLock

use of org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock in project scout.rt by eclipse.

the class OptimisticLockTest method testAcquire.

@Test
public void testAcquire() {
    OptimisticLock l = new OptimisticLock();
    boolean acquired = l.acquire();
    assertTrue(acquired);
    assertTrue(l.isAcquired());
    assertFalse(l.isReleased());
}
Also used : OptimisticLock(org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock) Test(org.junit.Test)

Example 4 with OptimisticLock

use of org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock in project scout.rt by eclipse.

the class OptimisticLockTest method testMultipleAcquiresReleases.

@Test
public void testMultipleAcquiresReleases() {
    OptimisticLock l = new OptimisticLock();
    l.acquire();
    l.acquire();
    l.release();
    l.release();
    assertFalse(l.isAcquired());
    assertTrue(l.isReleased());
}
Also used : OptimisticLock(org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock) Test(org.junit.Test)

Example 5 with OptimisticLock

use of org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock in project scout.rt by eclipse.

the class AbstractSequenceBox method initConfig.

@Override
protected void initConfig() {
    m_labelCompositionLock = new OptimisticLock();
    m_grid = new SequenceBoxGrid();
    super.initConfig();
    setAutoCheckFromTo(getConfiguredAutoCheckFromTo());
    setEqualColumnWidths(getConfiguredEqualColumnWidths());
    // when range box has visible label, suppress first field's label and append
    // to own label
    propertySupport.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent e) {
            if (e.getPropertyName().equals(IFormField.PROP_LABEL_VISIBLE) || e.getPropertyName().equals(IFormField.PROP_LABEL) || e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
                updateLabelComposition();
            }
        }
    });
    // If inner fields change their visibility dynamically, the label of the SequenceBox might change.
    for (IFormField field : getFields()) {
        field.addPropertyChangeListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent e) {
                if (e.getPropertyName().equals(IFormField.PROP_LABEL_VISIBLE) || e.getPropertyName().equals(IFormField.PROP_LABEL) || e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
                    updateLabelComposition();
                }
            }
        });
    }
    updateLabelComposition();
    hideFieldStatusOfChildren();
    // attach change triggers
    attachCheckFromToListeners();
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) PropertyChangeEvent(java.beans.PropertyChangeEvent) SequenceBoxGrid(org.eclipse.scout.rt.client.ui.form.fields.sequencebox.internal.SequenceBoxGrid) PropertyChangeListener(java.beans.PropertyChangeListener) OptimisticLock(org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock)

Aggregations

OptimisticLock (org.eclipse.scout.rt.platform.util.concurrent.OptimisticLock)7 Test (org.junit.Test)5 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)1 SequenceBoxGrid (org.eclipse.scout.rt.client.ui.form.fields.sequencebox.internal.SequenceBoxGrid)1