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);
}
}
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();
}
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;
}
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();
}
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());
}
}
Aggregations