Search in sources :

Example 1 with ClientUIPreferences

use of org.eclipse.scout.rt.client.ui.ClientUIPreferences in project scout.rt by eclipse.

the class OrganizeColumnsForm method storeCurrentStateAsConfig.

public void storeCurrentStateAsConfig(String configName) {
    ClientUIPreferences prefs = ClientUIPreferences.getInstance();
    prefs.addTableColumnsConfig(m_organizedTable, configName);
    prefs.setAllTableColumnPreferences(m_organizedTable, configName);
    if (m_organizedTable.isCustomizable()) {
        prefs.setTableCustomizerData(m_organizedTable.getTableCustomizer(), configName);
    }
}
Also used : ClientUIPreferences(org.eclipse.scout.rt.client.ui.ClientUIPreferences)

Example 2 with ClientUIPreferences

use of org.eclipse.scout.rt.client.ui.ClientUIPreferences in project scout.rt by eclipse.

the class ColumnSet method initialize.

public void initialize() {
    ClientUIPreferences prefs = ClientUIPreferences.getInstance();
    // clean up visible column index hints, make as permutation of model indices
    int n = getColumnCount();
    TreeMap<CompositeObject, IColumn> sortMap = new TreeMap<CompositeObject, IColumn>();
    int viewIndex = 0;
    for (int modelIndex = 0; modelIndex < n; modelIndex++) {
        IColumn col = getColumn(modelIndex);
        double viewHint = col.getVisibleColumnIndexHint();
        if (viewHint < 0) {
            viewHint = col.getOrder();
        }
        if (viewHint < 0) {
            viewHint = viewIndex;
        }
        sortMap.put(new CompositeObject(viewHint, viewIndex), col);
        // next
        viewIndex++;
    }
    viewIndex = 0;
    for (Map.Entry<CompositeObject, IColumn> e : sortMap.entrySet()) {
        e.getValue().setVisibleColumnIndexHint(viewIndex);
        viewIndex++;
    }
    reorganizeIndexes();
    applySortingAndGrouping(null);
    /*
     * ticket 93309
     * sanity check: when there is no visible column at all, reset visibilities to model init defaults
     */
    if (getVisibleColumnCount() == 0) {
        viewIndex = 0;
        for (IColumn c : getColumns()) {
            if (c.isDisplayable() && c.isInitialVisible()) {
                c.setVisible(true);
            } else {
                c.setVisible(false);
            }
            c.setWidth(c.getInitialWidth());
            c.setVisibleColumnIndexHint(viewIndex);
            prefs.removeAllTableColumnPreferences(c, null, true);
            // next
            viewIndex++;
        }
        reorganizeIndexes();
    }
    checkMultiline();
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) ClientUIPreferences(org.eclipse.scout.rt.client.ui.ClientUIPreferences) TreeMap(java.util.TreeMap) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 3 with ClientUIPreferences

use of org.eclipse.scout.rt.client.ui.ClientUIPreferences in project scout.rt by eclipse.

the class ColumnSet method createSortingAndGroupingConfig.

private P_SortingAndGroupingConfig createSortingAndGroupingConfig(IColumn<?> col, String configName) {
    if (col.isInitialAlwaysIncludeSortAtBegin() || col.isInitialAlwaysIncludeSortAtEnd()) {
        return createSortingAndGroupingConfig(col);
    }
    P_SortingAndGroupingConfig config = new P_SortingAndGroupingConfig();
    ClientUIPreferences prefs = ClientUIPreferences.getInstance();
    config.setSortIndex(prefs.getTableColumnSortIndex(col, col.getInitialSortIndex(), configName));
    config.setAscending(prefs.getTableColumnSortAscending(col, col.isInitialSortAscending(), configName));
    config.setGrouped(prefs.getTableColumnGrouped(col, col.isInitialGrouped(), configName));
    if (col instanceof INumberColumn) {
        config.setAggregationFunction(prefs.getTableColumnAggregationFunction(col, ((INumberColumn) col).getInitialAggregationFunction(), configName));
    }
    return config;
}
Also used : INumberColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.INumberColumn) ClientUIPreferences(org.eclipse.scout.rt.client.ui.ClientUIPreferences)

Example 4 with ClientUIPreferences

use of org.eclipse.scout.rt.client.ui.ClientUIPreferences in project scout.rt by eclipse.

the class AbstractNumberColumn method initColumn.

@Override
public void initColumn() {
    ClientUIPreferences prefs = ClientUIPreferences.getInstance();
    setBackgroundEffect(prefs.getTableColumnBackgroundEffect(this, getBackgroundEffect(), null));
    super.initColumn();
}
Also used : ClientUIPreferences(org.eclipse.scout.rt.client.ui.ClientUIPreferences)

Example 5 with ClientUIPreferences

use of org.eclipse.scout.rt.client.ui.ClientUIPreferences in project scout.rt by eclipse.

the class AbstractCalendarField method initConfig.

@Override
@SuppressWarnings("unchecked")
protected void initConfig() {
    super.initConfig();
    List<ICalendar> contributedCalendars = m_contributionHolder.getContributionsByClass(ICalendar.class);
    m_calendar = (T) CollectionUtility.firstElement(contributedCalendars);
    if (m_calendar == null) {
        Class<? extends ICalendar> configuredCalendar = getConfiguredCalendar();
        m_calendar = (T) ConfigurationUtility.newInnerInstance(this, configuredCalendar);
    }
    if (m_calendar != null) {
        if (m_calendar instanceof AbstractCalendar) {
            ((AbstractCalendar) m_calendar).setContainerInternal(this);
        }
        // restore calendar settings
        ClientUIPreferences env = ClientUIPreferences.getInstance();
        m_calendar.setDisplayMode(env.getCalendarDisplayMode(ICalendarDisplayMode.MONTH));
        m_calendar.setDisplayCondensed(env.getCalendarDisplayCondensed(true));
        /*
       * add observer for: - selected date sync - persistence of calendar
       * settings
       */
        m_calendar.addPropertyChangeListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent e) {
                if (e.getPropertyName().equals(ICalendar.PROP_SELECTED_DATE)) {
                    syncCalendarToCalendarField();
                }
            }
        });
        syncCalendarToCalendarField();
    } else {
        LOG.warn("there is no inner class of type ICalendar in {}", getClass().getName());
    }
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) ClientUIPreferences(org.eclipse.scout.rt.client.ui.ClientUIPreferences) ICalendar(org.eclipse.scout.rt.client.ui.basic.calendar.ICalendar) AbstractCalendar(org.eclipse.scout.rt.client.ui.basic.calendar.AbstractCalendar)

Aggregations

ClientUIPreferences (org.eclipse.scout.rt.client.ui.ClientUIPreferences)7 INumberColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.INumberColumn)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 AbstractCalendar (org.eclipse.scout.rt.client.ui.basic.calendar.AbstractCalendar)1 ICalendar (org.eclipse.scout.rt.client.ui.basic.calendar.ICalendar)1 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)1 CompositeObject (org.eclipse.scout.rt.platform.util.CompositeObject)1