| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.runtime.web.vaadin.databinding; |
| |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ButtonClickProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ColorPickerGradientColorProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ColorPickerGridColorProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ColorPickerHistoryColorProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ColorPickerSelectColorProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ComponentDescriptionProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ComponentFocusedProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SimpleAccessorProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SizeableHeightProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SizeableWidthProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelMaxSplitPositionProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelMaxSplitPositionUnitProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelMinSplitPositionProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelMinSplitPositionUnitProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelSplitPositionProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelSplitPositionUnitProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.TabSheetSelectedTabProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ContainerItemSetContentProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.GridSelectionSetProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.GridSelectionValueProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ItemPropertySetInfoValueProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ItemPropertySetValueProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.MultiSelectionListProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.MultiSelectionSetProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.PropertyReadonlyProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.PropertyValueProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.SingleSelectionProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ViewerContainerDatasourceProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ViewerItemDatasourceProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ViewerPropertyDatasourceProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.IVaadinListProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.IVaadinSetProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.IVaadinValueProperty; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.VaadinListPropertyDecorator; |
| import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.VaadinSetPropertyDecorator; |
| |
| import com.vaadin.data.Container; |
| import com.vaadin.data.Item; |
| import com.vaadin.data.Property; |
| import com.vaadin.ui.AbstractSplitPanel; |
| import com.vaadin.ui.Component; |
| import com.vaadin.ui.Field; |
| import com.vaadin.ui.TabSheet; |
| import com.vaadin.ui.components.colorpicker.ColorPickerGradient; |
| import com.vaadin.ui.components.colorpicker.ColorPickerGrid; |
| import com.vaadin.ui.components.colorpicker.ColorPickerHistory; |
| import com.vaadin.ui.components.colorpicker.ColorPickerSelect; |
| |
| // TODO: Auto-generated Javadoc |
| /** |
| * A factory for creating properties of SWT {@link Component components}. |
| * |
| * @since 1.3 |
| */ |
| public class VaadinProperties { |
| |
| /** |
| * Returns a property that handles the attribute defined by the given |
| * property. |
| * |
| * @param componentClass |
| * the component class |
| * @param property |
| * the property |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty accessor(Class<?> componentClass, |
| String property) { |
| return new SimpleAccessorProperty(componentClass, property); |
| } |
| |
| /** |
| * Returns a property that handles the focus for {@link Field fields}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty focus() { |
| return new ComponentFocusedProperty(); |
| } |
| |
| /** |
| * Returns a property that observes a button click. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty buttonClick() { |
| return new ButtonClickProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the description attribute of components. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty description() { |
| return new ComponentDescriptionProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the max split position for the |
| * {@link AbstractSplitPanel}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty maxSplitPosition() { |
| return new SplitPanelMaxSplitPositionProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the unit of the maximum split position |
| * for the {@link AbstractSplitPanel}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty maxSplitPositionUnit() { |
| return new SplitPanelMaxSplitPositionUnitProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the minimal split position for the |
| * {@link AbstractSplitPanel}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty minSplitPosition() { |
| return new SplitPanelMinSplitPositionProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the unit of the minimal split position |
| * for the {@link AbstractSplitPanel}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty minSplitPositionUnit() { |
| return new SplitPanelMinSplitPositionUnitProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the split position for the |
| * {@link AbstractSplitPanel}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty splitPosition() { |
| return new SplitPanelSplitPositionProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the unit of the split position for the |
| * {@link AbstractSplitPanel}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty splitPositionUnit() { |
| return new SplitPanelSplitPositionUnitProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the selected tab of {@link TabSheet}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty selectedTab() { |
| return new TabSheetSelectedTabProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the color attribute of the |
| * {@link ColorPickerGradient}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty colorColorPickerGradient() { |
| return new ColorPickerGradientColorProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the color attribute of the |
| * {@link ColorPickerGrid}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty colorColorPickerGrid() { |
| return new ColorPickerGridColorProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the color attribute of the |
| * {@link ColorPickerHistory}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty colorColorPickerHistory() { |
| return new ColorPickerHistoryColorProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the color attribute of a |
| * {@link ColorPickerSelect}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty colorColorPickerSelect() { |
| return new ColorPickerSelectColorProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the height attribute. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty height() { |
| return new SizeableHeightProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the width attribute. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty width() { |
| return new SizeableWidthProperty(); |
| } |
| |
| /** |
| * TODO change to observableList. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty itemPropertysetValue() { |
| return new ItemPropertySetValueProperty(); |
| } |
| |
| /** |
| * TODO. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty itemPropertysetInfoValue() { |
| return new ItemPropertySetInfoValueProperty(); |
| } |
| |
| /** |
| * Creates a list property that observes changes of multi selections. The |
| * sort order of the list random since vaadin selects handle the selections |
| * in a set. So the list is just a wrapper for the set. |
| * |
| * @param collectionType |
| * the types contained in the collection |
| * @return listProperty |
| */ |
| public static IVaadinListProperty propertyMultiSelectionAsList( |
| Class<?> collectionType) { |
| MultiSelectionListProperty property = new MultiSelectionListProperty( |
| collectionType); |
| return new VaadinListPropertyDecorator(property); |
| } |
| |
| /** |
| * Creates a set property that observes changes of multi selections. |
| * |
| * @param collectionType |
| * the types contained in the collection |
| * @return setProperty |
| */ |
| public static IVaadinSetProperty propertyMultiSelectionAsSet( |
| Class<?> collectionType) { |
| MultiSelectionSetProperty property = new MultiSelectionSetProperty( |
| collectionType); |
| return new VaadinSetPropertyDecorator(property); |
| } |
| |
| /** |
| * Creates a set property that observes changes of multi selections of Grid |
| * component. Grid.SelectionModel#SINGLE and #MULTI are supported. |
| * |
| * @param collectionType |
| * the types contained in the collection |
| * @return setProperty |
| */ |
| public static IVaadinSetProperty propertyGridSelectionSetPropertyAsSet( |
| Class<?> collectionType) { |
| GridSelectionSetProperty property = new GridSelectionSetProperty( |
| collectionType); |
| return property; |
| } |
| |
| /** |
| * Creates a value property that observes changes of single selections of |
| * Grid component. Grid.SelectionModel#SINGLE and #MULTI are supported. |
| * |
| * @param valueType |
| * the type of the value |
| * @return valueProperty |
| */ |
| public static IVaadinValueProperty propertyGridSelectionValueProperty( |
| Class<?> valueType) { |
| GridSelectionValueProperty property = new GridSelectionValueProperty( |
| valueType); |
| return property; |
| } |
| |
| /** |
| * Creates a list property that observes changes of item sets in container. |
| * |
| * @param collectionType |
| * the types contained in the collection |
| * @return listProperty |
| */ |
| public static IVaadinListProperty containerItemsetAsList( |
| Class<?> collectionType) { |
| ContainerItemSetContentProperty property = new ContainerItemSetContentProperty( |
| collectionType); |
| return new VaadinListPropertyDecorator(property); |
| } |
| |
| /** |
| * Returns a property that handles the containerDatasource attribute of |
| * {@link Container.Viewer}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty containerDatasource() { |
| return new ViewerContainerDatasourceProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the itemDatasource attribute of |
| * {@link Item.Viewer}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty itemDatasource() { |
| return new ViewerItemDatasourceProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the propertyDatasource attribute of |
| * {@link Property.Viewer}. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty datasource() { |
| return new ViewerPropertyDatasourceProperty(); |
| } |
| |
| /** |
| * Returns a property that handles the value attribute. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty value() { |
| return new PropertyValueProperty(); |
| } |
| |
| /** |
| * Returns a property that handles single selections. |
| * |
| * @param type |
| * the type |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty singleSelection(Class<?> type) { |
| return new SingleSelectionProperty(type); |
| } |
| |
| /** |
| * Returns a property that handles the readonly attribute. |
| * |
| * @return the i vaadin value property |
| */ |
| public static IVaadinValueProperty readonly() { |
| return new PropertyReadonlyProperty(); |
| } |
| |
| } |