本文整理匯總了Java中com.vaadin.data.Container類的典型用法代碼示例。如果您正苦於以下問題:Java Container類的具體用法?Java Container怎麽用?Java Container使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Container類屬於com.vaadin.data包,在下文中一共展示了Container類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: notifyItemSetChanged
import com.vaadin.data.Container; //導入依賴的package包/類
/**
* Notifies that item set has been changed.
* @param event Item set change event
*/
@SuppressWarnings("serial")
protected void notifyItemSetChanged(ItemSetChangeEvent event) {
if (itemSetChangeListeners != null) {
ItemSetChangeEvent evt = (event != null) ? event : new ItemSetChangeEvent() {
@Override
public Container getContainer() {
return DefaultItemDataSourceContainer.this;
}
};
for (ItemSetChangeListener listener : itemSetChangeListeners) {
listener.containerItemSetChange(evt);
}
}
}
示例2: notifyPropertySetChanged
import com.vaadin.data.Container; //導入依賴的package包/類
/**
* Notifies that property set has been changed.
*/
@SuppressWarnings("serial")
protected void notifyPropertySetChanged() {
if (propertySetChangeListeners != null) {
PropertySetChangeEvent event = new PropertySetChangeEvent() {
@Override
public Container getContainer() {
return DefaultItemDataSourceContainer.this;
}
};
for (PropertySetChangeListener listener : propertySetChangeListeners) {
listener.containerPropertySetChange(event);
}
}
}
示例3: addItemSetChangeListener
import com.vaadin.data.Container; //導入依賴的package包/類
/**
* Adds an {@link ItemSetChangeListener} to internal component container.
* @param listener Listener to add
*/
public void addItemSetChangeListener(Container.ItemSetChangeListener listener) {
Container container = null;
switch (getRenderingMode()) {
case GRID:
container = getGrid().getContainerDataSource();
break;
case TABLE:
container = getTable().getContainerDataSource();
break;
default:
break;
}
if (container != null && container instanceof ItemSetChangeNotifier) {
((ItemSetChangeNotifier) container).addItemSetChangeListener(listener);
}
}
示例4: createDataSource
import com.vaadin.data.Container; //導入依賴的package包/類
private Container createDataSource() {
Container languageItems = new IndexedContainer();
languageItems.addContainerProperty("icon", ThemeResource.class, null);
languageItems.addContainerProperty("caption", String.class, "");
fillItem(languageItems.addItem(Locale.ENGLISH), "English", "en");
fillItem(languageItems.addItem(new Locale("pl")), "Polski", "pl");
return languageItems;
}
示例5: fireItemSetChange
import com.vaadin.data.Container; //導入依賴的package包/類
/**
* Sends an Item set change event to all registered interested listeners.
*
* @param event
* the item set change event to send, optionally with additional
* information
*/
protected void fireItemSetChange(ItemSetChangeEvent event) {
if (getItemSetChangeListeners() != null) {
final Object[] l = getItemSetChangeListeners().toArray();
for (int i = 0; i < l.length; i++) {
((Container.ItemSetChangeListener) l[i])
.containerItemSetChange(event);
}
}
}
示例6: GaugeChart
import com.vaadin.data.Container; //導入依賴的package包/類
public GaugeChart(Container container) {
super(container);
getConfiguration().getPane().setStartAngle(-120);
getConfiguration().getPane().setEndAngle(120);
PlotOptionsGauge options = new PlotOptionsGauge();
options.setDataLabels(new Labels(false));
getConfiguration().setPlotOptions(options);
YAxis yAxis = getConfiguration().getyAxis();
yAxis.setMinorTickInterval("auto");
yAxis.setMinorTickWidth(1);
yAxis.setMinorTickLength(10);
yAxis.setTickPosition(TickPosition.INSIDE);
yAxis.setShowFirstLabel(false);
pointsManager = new GaugeSeriesManager(getConfiguration());
}
示例7: DonutChart
import com.vaadin.data.Container; //導入依賴的package包/類
public DonutChart(Container container) {
super(container);
innerItemsManager = new SimpleDataSeriesManager();
outerItemsManager = new GroupedDataSeriesManager();
// Setup outer ring
PlotOptionsPie outerOptions = new PlotOptionsPie();
outerOptions.setInnerSize(200);
outerOptions.setSize("80%");
outerItemsManager.getSeries().setPlotOptions(outerOptions);
outerOptions.setBorderWidth(0.5);
// Setup inner aggregation ring
PlotOptionsPie innerOptions = new PlotOptionsPie();
innerOptions.setSize(200);
innerItemsManager.getSeries().setPlotOptions(innerOptions);
innerOptions.setDataLabels(new Labels());
innerOptions.getDataLabels().setFormatter("this.y > 5 ? this.point.name : null");
innerOptions.getDataLabels().setColor(new SolidColor(255, 255, 255));
innerOptions.getDataLabels().setDistance(-35);
innerOptions.setBorderWidth(0.5);
getConfiguration().setSeries(innerItemsManager.getSeries(), outerItemsManager.getSeries());
}
示例8: createContainer
import com.vaadin.data.Container; //導入依賴的package包/類
/**
* @return
*/
private Container createContainer() {
final Map<String, Object> queryConfiguration = Maps.newHashMapWithExpectedSize(2);
queryConfiguration.put(SPUIDefinitions.FILTER_BY_NO_TAG,
managementUIState.getDistributionTableFilters().isNoTagSelected());
queryConfiguration.put(SPUIDefinitions.FILTER_BY_TAG,
managementUIState.getDistributionTableFilters().getDistSetTags());
final BeanQueryFactory<DistributionBeanQuery> distributionQF = new BeanQueryFactory<>(
DistributionBeanQuery.class);
distributionQF.setQueryConfiguration(queryConfiguration);
return new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), distributionQF);
}
示例9: addContainerProperties
import com.vaadin.data.Container; //導入依賴的package包/類
@Override
protected void addContainerProperties(final Container container) {
final LazyQueryContainer lazyContainer = (LazyQueryContainer) container;
lazyContainer.addContainerProperty("nameAndVersion", String.class, null, false, false);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_ID, Long.class, null, false, false);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_VERSION, String.class, null, false, false);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, null, false, true);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_VENDOR, String.class, null, false, true);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_BY, String.class, null, false, true);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class, null, false, true);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false, true);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false,
true);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_COLOR, String.class, null, false, true);
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_SOFT_TYPE_ID, Long.class, null, false, true);
}
示例10: populateTableByDistributionSet
import com.vaadin.data.Container; //導入依賴的package包/類
/**
* Populate software module metadata.
*
* @param distributionSet
* the selected distribution set
*/
public void populateTableByDistributionSet(final DistributionSet distributionSet) {
removeAllItems();
if (distributionSet == null) {
return;
}
final Container dataSource = getContainerDataSource();
final List<TargetFilterQuery> filters = distributionSet.getAutoAssignFilters();
filters.forEach(query -> {
final Object itemId = dataSource.addItem();
final Item item = dataSource.getItem(itemId);
item.getItemProperty(TFQ_NAME).setValue(query.getName());
item.getItemProperty(TFQ_QUERY).setValue(query.getQuery());
});
}
示例11: sourceData
import com.vaadin.data.Container; //導入依賴的package包/類
protected void sourceData(String key, Object val) {
if (val instanceof String) {
if (viewData.getItemProperty(key) == null) {
viewData.addItemProperty(key, new ObjectProperty<String>((String) val));
} else {
viewData.getItemProperty(key).setValue(val);
}
} else {
// Creates the options container and add given options to it
final Container c = new IndexedContainer();
if (val != null) {
c.addContainerProperty("name", String.class, "");
for (final Iterator<?> i = ((List) val).iterator(); i.hasNext();) {
Item item = c.addItem(i.next());
}
}
if (viewData.getItemProperty(key) == null) {
viewData.addItemProperty(key, new ObjectProperty<Container>(c));
} else {
viewData.getItemProperty(key).setValue(c);
}
}
}
示例12: filterToString
import com.vaadin.data.Container; //導入依賴的package包/類
public String filterToString(Container.Filter filter) {
if (filter instanceof Compare.LessOrEqual) {
return String.format("%s <= %s", ((Compare.LessOrEqual) filter).getPropertyId(), ((Compare.LessOrEqual) filter).getValue());
} else
if (filter instanceof Compare.GreaterOrEqual) {
return String.format("%s >= %s", ((Compare.GreaterOrEqual) filter).getPropertyId(), ((Compare.GreaterOrEqual) filter).getValue());
} else
if (filter instanceof And) {
StringBuffer sb = new StringBuffer();
Collection<Container.Filter> coll = ((And) filter).getFilters();
for (Container.Filter f: coll) {
sb.append(filterToString(f));
sb.append(", ");
}
return sb.toString();
}
throw new UnsupportedOperationException("unsupported filter");
}
示例13: buildSelectorProviders
import com.vaadin.data.Container; //導入依賴的package包/類
protected void buildSelectorProviders(Map<String, AbstractComponent> mapComponents, VaadinFormInstance formInstance) {
for (AbstractComponent component : mapComponents.values()) {
if (component.getData() instanceof VaadinDataObject) {
VaadinDataObject dataObject = (VaadinDataObject) component.getData();
Field field = dataObject.getField();
if (field.getType().equals(SelectorConstants.TYPE_SELECTOR)) {
if (component instanceof Container.Viewer) {
Container.Viewer viewer = (Container.Viewer) component;
SelectorProviderFactory factory = (SelectorProviderFactory) field
.getExtra(SelectorConstants.EXTRA_SELECTOR_PROVIDER_FACTORY);
viewer.setContainerDataSource(new VaadinSelectorContainer(factory.createSelectorProvider(formInstance)));
}
}
}
}
}
示例14: testAddMoreFilters
import com.vaadin.data.Container; //導入依賴的package包/類
@Test
public void testAddMoreFilters() {
final MongoContainer<Customer> mc =
builder().build();
Container.Filter f1 = new SimpleStringFilter("firstName", "i", false, false);
Container.Filter f2 = new SimpleStringFilter("lastName", "x", false, false);
mc.addContainerFilter(f1);
mc.addContainerFilter(f2);
Collection<Container.Filter> filters = mc.getContainerFilters();
assertEquals(2, filters.size());
assertTrue(filters.contains(f1));
assertTrue(filters.contains(f2));
}
示例15: createField
import com.vaadin.data.Container; //導入依賴的package包/類
public Field<?> createField(final Container dataContainer, final Object itemId, final Object propertyId, Component uiContext) {
final AgentParameter parameter = (AgentParameter) itemId;
final TextField textField = new ImmediateUpdateTextField(null) {
protected void save(String text) {
parameter.setValue(text);
context.getConfigurationService().save(parameter);
}
};
textField.setWidth(100, Unit.PERCENTAGE);
textField.addFocusListener(new FocusListener() {
public void focus(FocusEvent event) {
table.select(itemId);
}
});
return textField;
}