use of org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent in project scout.rt by eclipse.
the class CalendarContextMenu method handleOwnerValueChanged.
protected void handleOwnerValueChanged() {
ICalendar container = getContainer();
if (container != null) {
final CalendarComponent ownerValue = container.getSelectedComponent();
setCurrentMenuTypes(MenuUtility.getMenuTypesForCalendarSelection(ownerValue));
acceptVisitor(new MenuOwnerChangedVisitor(ownerValue, getCurrentMenuTypes()));
calculateLocalVisibility();
}
}
use of org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent in project scout.rt by eclipse.
the class JsonCalendar method handleUiSelectionChange.
protected void handleUiSelectionChange(JsonEvent event) {
JSONObject data = event.getData();
Date selectedDate = toJavaDate(data, "date");
String componentId = data.optString("componentId", null);
CalendarComponent selectedComponent = null;
JsonCalendarComponent<CalendarComponent> jsonComponent = resolveCalendarComponent(componentId);
if (jsonComponent != null) {
selectedComponent = jsonComponent.getModel();
addPropertyEventFilterCondition(ICalendar.PROP_SELECTED_COMPONENT, selectedComponent);
} else if (componentId != null) {
LOG.info("Unkown component with ID {} [event='{}']", componentId, EVENT_SELECTION_CHANGE);
}
addPropertyEventFilterCondition(ICalendar.PROP_SELECTED_DATE, selectedDate);
getModel().getUIFacade().setSelectionFromUI(selectedDate, selectedComponent);
LOG.debug("date={} componentId={}", selectedDate, componentId);
}
use of org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent in project scout.rt by eclipse.
the class JsonObjectFactory method createJsonAdapter.
@SuppressWarnings("unchecked")
@Override
public IJsonAdapter<?> createJsonAdapter(Object model, IUiSession session, String id, IJsonAdapter<?> parent) {
// --- form fields ----
if (model instanceof IGroupBox) {
// we must distinct between normal group-boxes and group-boxes in tab-boxes
// the use the same model, but we need different adapters
IGroupBox groupBox = (IGroupBox) model;
if (groupBox.getParentField() instanceof ITabBox) {
return new JsonTabItem<IGroupBox>(groupBox, session, id, parent);
} else {
return new JsonGroupBox<IGroupBox>(groupBox, session, id, parent);
}
}
if (model instanceof ISequenceBox) {
return new JsonSequenceBox<ISequenceBox>((ISequenceBox) model, session, id, parent);
}
if (model instanceof ITabBox) {
return new JsonTabBox<ITabBox>((ITabBox) model, session, id, parent);
}
if (model instanceof IBooleanField) {
return new JsonCheckBoxField<IBooleanField>((IBooleanField) model, session, id, parent);
}
if (model instanceof ILabelField) {
return new JsonLabelField<ILabelField>((ILabelField) model, session, id, parent);
}
if (model instanceof IImageField) {
return new JsonImageField<IImageField>((IImageField) model, session, id, parent);
}
if (model instanceof ITableField<?>) {
return new JsonTableField<ITableField<? extends ITable>>((ITableField<?>) model, session, id, parent);
}
if (model instanceof IListBox<?>) {
return new JsonListBox((IListBox<?>) model, session, id, parent);
}
if (model instanceof ITreeField) {
return new JsonTreeField<ITreeField>((ITreeField) model, session, id, parent);
}
if (model instanceof ITreeBox<?>) {
return new JsonTreeBox<ITreeBox>((ITreeBox<?>) model, session, id, parent);
}
if (model instanceof IRadioButton<?>) {
return new JsonRadioButton<IRadioButton>((IRadioButton<?>) model, session, id, parent);
}
if (model instanceof IRadioButtonGroup<?>) {
return new JsonRadioButtonGroup<IRadioButtonGroup>((IRadioButtonGroup<?>) model, session, id, parent);
}
if (model instanceof IButton) {
return new JsonButton<IButton>((IButton) model, session, id, parent);
}
if (model instanceof IStringField) {
return new JsonStringField<IStringField>((IStringField) model, session, id, parent);
}
if (model instanceof INumberField<?>) {
return new JsonNumberField<INumberField>((INumberField<?>) model, session, id, parent);
}
if (model instanceof IProposalField2<?>) {
return new JsonProposalField2((IProposalField2<?>) model, session, id, parent);
}
if (model instanceof ISmartField2<?>) {
return new JsonSmartField2((ISmartField2<?>) model, session, id, parent);
}
if (model instanceof IContentAssistField<?, ?>) {
return new JsonSmartField((IContentAssistField<?, ?>) model, session, id, parent);
}
if (model instanceof IProposalChooser) {
return new JsonProposalChooser<IProposalChooser>((IProposalChooser) model, session, id, parent);
}
if (model instanceof IDateField) {
return new JsonDateField<IDateField>((IDateField) model, session, id, parent);
}
if (model instanceof ICalendarField<?>) {
return new JsonCalendarField<ICalendarField<? extends ICalendar>>((ICalendarField<?>) model, session, id, parent);
}
if (model instanceof IPlannerField<?>) {
return new JsonPlannerField((IPlannerField<?>) model, session, id, parent);
}
if (model instanceof IWrappedFormField<?>) {
return new JsonWrappedFormField<IWrappedFormField<? extends IForm>>((IWrappedFormField<?>) model, session, id, parent);
}
if (model instanceof ISplitBox) {
return new JsonSplitBox<ISplitBox>((ISplitBox) model, session, id, parent);
}
if (model instanceof IPlaceholderField) {
return new JsonPlaceholderField<IPlaceholderField>((IPlaceholderField) model, session, id, parent);
}
if (model instanceof IWizardProgressField) {
return new JsonWizardProgressField<IWizardProgressField>((IWizardProgressField) model, session, id, parent);
}
if (model instanceof IHtmlField) {
return new JsonHtmlField<IHtmlField>((IHtmlField) model, session, id, parent);
}
if (model instanceof IComposerField) {
return new JsonComposerField<IComposerField>((IComposerField) model, session, id, parent);
}
if (model instanceof IBeanField) {
return new JsonBeanField<IBeanField<?>>((IBeanField) model, session, id, parent);
}
if (model instanceof IFileChooserField) {
return new JsonFileChooserField<IFileChooserField>((IFileChooserField) model, session, id, parent);
}
if (model instanceof IColorField) {
return new JsonColorField<IColorField>((IColorField) model, session, id, parent);
}
if (model instanceof IBrowserField) {
return new JsonBrowserField<IBrowserField>((IBrowserField) model, session, id, parent);
}
if (model instanceof IClipboardField) {
return new JsonClipboardField<IClipboardField>((IClipboardField) model, session, id, parent);
}
// --- other model objects ---
if (model instanceof IDesktop) {
return new JsonDesktop<IDesktop>((IDesktop) model, session, id, parent);
}
if (model instanceof IFormMenu<?>) {
return new JsonFormMenu((IFormMenu<?>) model, session, id, parent);
}
if (model instanceof IMenu) {
return new JsonMenu<IMenu>((IMenu) model, session, id, parent);
}
if (model instanceof IKeyStroke) {
return new JsonKeyStroke<IKeyStroke>((IKeyStroke) model, session, id, parent);
}
if (model instanceof ISearchForm) {
return new JsonSearchForm<ISearchForm>((ISearchForm) model, session, id, parent);
}
if (model instanceof IForm) {
return new JsonForm<IForm>((IForm) model, session, id, parent);
}
if (model instanceof IMessageBox) {
return new JsonMessageBox<IMessageBox>((IMessageBox) model, session, id, parent);
}
if (model instanceof IDesktopNotification) {
return new JsonDesktopNotification<IDesktopNotification>((IDesktopNotification) model, session, id, parent);
}
if (model instanceof IOutlineViewButton) {
return new JsonOutlineViewButton<IOutlineViewButton>((IOutlineViewButton) model, session, id, parent);
}
if (model instanceof IViewButton) {
return new JsonViewButton<IViewButton>((IViewButton) model, session, id, parent);
}
if (model instanceof ISearchOutline) {
return new JsonSearchOutline<ISearchOutline>((ISearchOutline) model, session, id, parent);
}
if (model instanceof IOutline) {
return new JsonOutline<IOutline>((IOutline) model, session, id, parent);
}
if (model instanceof ITree) {
return new JsonTree<ITree>((ITree) model, session, id, parent);
}
if (model instanceof ITable) {
ITable table = (ITable) model;
IPage page = (IPage) table.getProperty(JsonOutlineTable.PROP_PAGE);
if (page != null) {
return new JsonOutlineTable<ITable>(table, session, id, parent, page);
}
return new JsonTable<ITable>(table, session, id, parent);
}
if (model instanceof IClientSession) {
return new JsonClientSession<IClientSession>((IClientSession) model, session, id, parent);
}
if (model instanceof ICalendar) {
return new JsonCalendar<ICalendar>((ICalendar) model, session, id, parent);
}
if (model instanceof CalendarComponent) {
return new JsonCalendarComponent<CalendarComponent>((CalendarComponent) model, session, id, parent);
}
if (model instanceof IPlanner<?, ?>) {
return new JsonPlanner<IPlanner>((IPlanner<?, ?>) model, session, id, parent);
}
if (model instanceof IFileChooser) {
return new JsonFileChooser<IFileChooser>((IFileChooser) model, session, id, parent);
}
if (model instanceof IAggregateTableControl) {
// needs to be before ITableControl
return new JsonAggregateTableControl<IAggregateTableControl>((IAggregateTableControl) model, session, id, parent);
}
if (model instanceof IFormTableControl) {
// needs to be before ITableControl
return new JsonFormTableControl<IFormTableControl>((IFormTableControl) model, session, id, parent);
}
if (model instanceof ITableControl) {
return new JsonTableControl<ITableControl>((ITableControl) model, session, id, parent);
}
if (model instanceof IStatusMenuMapping) {
return new JsonStatusMenuMapping<IStatusMenuMapping>((IStatusMenuMapping) model, session, id, parent);
}
return null;
}
use of org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent in project scout.rt by eclipse.
the class JsonCalendar method initJsonProperties.
@Override
protected void initJsonProperties(CALENDAR model) {
putJsonProperty(new JsonAdapterProperty<CALENDAR>(ICalendar.PROP_COMPONENTS, model, getUiSession()) {
@Override
protected Set<? extends CalendarComponent> modelValue() {
return getModel().getComponents();
}
});
putJsonProperty(new JsonAdapterProperty<CALENDAR>(ICalendar.PROP_SELECTED_COMPONENT, model, getUiSession()) {
@Override
protected CalendarComponent modelValue() {
return getModel().getSelectedComponent();
}
@Override
protected JsonAdapterPropertyConfig createConfig() {
return new JsonAdapterPropertyConfigBuilder().disposeOnChange(false).build();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_DISPLAY_MODE, model) {
@Override
protected Integer modelValue() {
return getModel().getDisplayMode();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_DISPLAY_CONDENSED, model) {
@Override
protected Boolean modelValue() {
return getModel().isDisplayCondensed();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_TITLE, model) {
@Override
protected String modelValue() {
return getModel().getTitle();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_VIEW_RANGE, model) {
@Override
protected Range<Date> modelValue() {
return getModel().getViewRange();
}
@SuppressWarnings("unchecked")
@Override
public Object prepareValueForToJson(Object value) {
if (value == null) {
return null;
}
return new JsonDateRange((Range<Date>) value).toJson();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_SELECTED_DATE, model) {
@Override
protected Date modelValue() {
return getModel().getSelectedDate();
}
@Override
public Object prepareValueForToJson(Object value) {
return new JsonDate((Date) value).asJsonString();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_LOAD_IN_PROGRESS, model) {
@Override
protected Boolean modelValue() {
return getModel().isLoadInProgress();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_START_HOUR, model) {
@Override
protected Integer modelValue() {
return getModel().getStartHour();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_END_HOUR, model) {
@Override
protected Integer modelValue() {
return getModel().getEndHour();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_USE_OVERFLOW_CELLS, model) {
@Override
protected Boolean modelValue() {
return getModel().getUseOverflowCells();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_SHOW_DISPLAY_MODE_SELECTION, model) {
@Override
protected Boolean modelValue() {
return getModel().getShowDisplayModeSelection();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_MARK_NOON_HOUR, model) {
@Override
protected Boolean modelValue() {
return getModel().getMarkNoonHour();
}
});
putJsonProperty(new JsonProperty<CALENDAR>(ICalendar.PROP_MARK_OUT_OF_MONTH_DAYS, model) {
@Override
protected Boolean modelValue() {
return getModel().getMarkOutOfMonthDays();
}
});
}
use of org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent in project scout.rt by eclipse.
the class JsonCalendar method handleUiComponentMove.
protected void handleUiComponentMove(JsonEvent event) {
JSONObject data = event.getData();
Date newDate = toJavaDate(data, "newDate");
String componentId = data.optString("component", null);
JsonCalendarComponent<CalendarComponent> component = resolveCalendarComponent(componentId);
if (component != null) {
getModel().getUIFacade().fireComponentMoveFromUI(component.getModel(), newDate);
} else if (componentId != null) {
LOG.info("Unkown component with ID {} [event='{}']", componentId, EVENT_COMPONENT_MOVE);
}
}
Aggregations