本文整理汇总了Java中com.haulmont.chile.core.model.MetaPropertyPath类的典型用法代码示例。如果您正苦于以下问题:Java MetaPropertyPath类的具体用法?Java MetaPropertyPath怎么用?Java MetaPropertyPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetaPropertyPath类属于com.haulmont.chile.core.model包,在下文中一共展示了MetaPropertyPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadEditable
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
protected void loadEditable(FieldGroup resultComponent, FieldGroup.FieldConfig field) {
Element element = field.getXmlDescriptor();
if (element != null) {
String editable = element.attributeValue("editable");
if (StringUtils.isNotEmpty(editable)) {
field.setEditable(Boolean.parseBoolean(editable));
}
}
if (!field.isCustom() && BooleanUtils.isNotFalse(field.isEditable())) {
MetaClass metaClass = getMetaClass(resultComponent, field);
MetaPropertyPath propertyPath = metadataTools.resolveMetaPropertyPath(metaClass, field.getProperty());
checkNotNullArgument(propertyPath, "Could not resolve property path '%s' in '%s'", field.getId(), metaClass);
if (!security.isEntityAttrUpdatePermitted(metaClass, propertyPath.toString())) {
field.setEditable(false);
}
}
}
示例2: getTableCellEditorComponent
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
@Override
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int row, int column) {
Entity item = getTableModel().getItem(row);
TableColumn tableColumn = impl.getColumnModel().getColumn(column);
Column columnConf = (Column) tableColumn.getIdentifier();
Component component = cellProvider.generateCell(item, (MetaPropertyPath) columnConf.getId());
if (component == null) {
return new JLabel("");
}
if (component instanceof JComponent) {
((JComponent) component).putClientProperty(DesktopTableCellEditor.CELL_EDITOR_TABLE, impl);
}
return component;
}
示例3: CollectionDsWrapper
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public CollectionDsWrapper(CollectionDatasource datasource, Collection<MetaPropertyPath> properties,
boolean autoRefresh, CollectionDsListenersWrapper collectionDsListenersWrapper) {
this.datasource = datasource;
this.autoRefresh = autoRefresh;
this.collectionDsListenersWrapper = collectionDsListenersWrapper;
final View view = datasource.getView();
final MetaClass metaClass = datasource.getMetaClass();
if (properties == null) {
createProperties(view, metaClass);
} else {
this.properties.addAll(properties);
}
cdsItemPropertyChangeListener = createItemPropertyChangeListener();
cdsStateChangeListener = createStateChangeListener();
cdsCollectionChangeListener = createCollectionChangeListener();
collectionDsListenersWrapper.addItemPropertyChangeListener(cdsItemPropertyChangeListener);
collectionDsListenersWrapper.addStateChangeListener(cdsStateChangeListener);
collectionDsListenersWrapper.addCollectionChangeListener(cdsCollectionChangeListener);
}
示例4: getColumnEditor
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
protected TableCellEditor getColumnEditor(int column) {
TableColumn tableColumn = impl.getColumnModel().getColumn(column);
if (tableColumn.getIdentifier() instanceof Table.Column) {
Table.Column columnConf = (Table.Column) tableColumn.getIdentifier();
if (columnConf.getId() instanceof MetaPropertyPath
&& !(isEditable() && columnConf.isEditable())
&& !getTableModel().isGeneratedColumn(columnConf)) {
MetaPropertyPath propertyPath = (MetaPropertyPath) columnConf.getId();
final CellProvider cellProvider = getCustomCellEditor(propertyPath);
if (cellProvider != null) {
return new CellProviderEditor(cellProvider);
}
}
}
return null;
}
示例5: ItemWrapper
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
public ItemWrapper(Object item, MetaClass metaClass, Collection<MetaPropertyPath> properties) {
this.item = item;
this.metaClass = metaClass;
for (MetaPropertyPath property : properties) {
this.properties.put(property, createPropertyWrapper(item, property));
}
if (item instanceof CollectionDatasource) {
cdsCollectionChangeListener = e -> fireItemPropertySetChanged();
CollectionDatasource datasource = (CollectionDatasource) item;
weakCollectionChangeListener = new WeakCollectionChangeListener(datasource, cdsCollectionChangeListener);
//noinspection unchecked
datasource.addCollectionChangeListener(weakCollectionChangeListener);
}
}
示例6: getColumnRenderer
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
protected TableCellRenderer getColumnRenderer(int column) {
TableColumn tableColumn = impl.getColumnModel().getColumn(column);
if (tableColumn.getIdentifier() instanceof Table.Column) {
Table.Column columnConf = (Table.Column) tableColumn.getIdentifier();
if (columnConf.getId() instanceof MetaPropertyPath
&& !(isEditable() && columnConf.isEditable())
&& !getTableModel().isGeneratedColumn(columnConf)) {
MetaPropertyPath propertyPath = (MetaPropertyPath) columnConf.getId();
final CellProvider cellViewProvider = getCustomCellView(propertyPath);
if (cellViewProvider != null) {
return new CellProviderRenderer(cellViewProvider);
} else if (multiLineCells && String.class == columnConf.getType()) {
return new MultiLineTableCellRenderer();
}
}
}
return null;
}
示例7: createDatasourceWrapper
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
@Override
protected ItemWrapper createDatasourceWrapper(Datasource datasource, Collection<MetaPropertyPath> propertyPaths) {
return new ItemWrapper(datasource, datasource.getMetaClass(), propertyPaths) {
@Override
protected PropertyWrapper createPropertyWrapper(Object item, MetaPropertyPath propertyPath) {
return new PropertyWrapper(item, propertyPath) {
@Override
public Object getValue() {
Object value = super.getValue();
if (value == null) {
Range range = propertyPath.getRange();
if (range.isDatatype()
&& range.asDatatype().equals(Datatypes.get(Boolean.class))) {
value = Boolean.FALSE;
}
}
return value;
}
};
}
};
}
示例8: getOptionsDatasource
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
@Override
@Nullable
protected CollectionDatasource getOptionsDatasource(Datasource fieldDatasource, String propertyId) {
if (datasource == null)
throw new IllegalStateException("Table datasource is null");
MetaPropertyPath metaPropertyPath = AppBeans.get(MetadataTools.NAME, MetadataTools.class)
.resolveMetaPropertyPath(datasource.getMetaClass(), propertyId);
Column columnConf = columns.get(metaPropertyPath);
final DsContext dsContext = datasource.getDsContext();
String optDsName = columnConf.getXmlDescriptor() != null ?
columnConf.getXmlDescriptor().attributeValue("optionsDatasource") : "";
if (StringUtils.isBlank(optDsName)) {
return null;
} else {
CollectionDatasource ds = (CollectionDatasource) dsContext.get(optDsName);
if (ds == null)
throw new IllegalStateException("Options datasource not found: " + optDsName);
return ds;
}
}
示例9: getPropertyLocCaption
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
public static String getPropertyLocCaption(MetaClass metaClass, String propertyPath) {
MessageTools messageTools = AppBeans.get(MessageTools.class);
MetaPropertyPath mpp = metaClass.getPropertyPath(propertyPath);
if (mpp == null) {
return propertyPath;
} else {
MetaProperty[] metaProperties = mpp.getMetaProperties();
StringBuilder sb = new StringBuilder();
List<String> metaPropertyNames = new ArrayList<>();
for (int i = 0; i < metaProperties.length; i++) {
metaPropertyNames.add(metaProperties[i].getName());
String currentMetaPropertyPath = StringUtils.join(metaPropertyNames, ".");
sb.append(messageTools.getPropertyCaption(metaClass, currentMetaPropertyPath));
if (i < metaProperties.length - 1) {
sb.append(".");
}
}
return sb.toString();
}
}
示例10: checkAggregation
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
protected void checkAggregation(AggregationInfo aggregationInfo) {
MetaPropertyPath propertyPath = aggregationInfo.getPropertyPath();
Class<?> javaType = propertyPath.getMetaProperty().getJavaType();
Aggregation<?> aggregation = Aggregations.get(javaType);
AggregationInfo.Type aggregationType = aggregationInfo.getType();
if (aggregationType == AggregationInfo.Type.CUSTOM)
return;
if (aggregation != null && aggregation.getSupportedAggregationTypes().contains(aggregationType))
return;
String msg = String.format("Unable to aggregate column \"%s\" with data type %s with default aggregation strategy: %s",
propertyPath, propertyPath.getRange(), aggregationInfo.getType());
throw new IllegalArgumentException(msg);
}
示例11: handleEditorCommit
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
protected void handleEditorCommit(Entity editorItem, Entity rowItem, String columnId) {
MetaPropertyPath mpp = rowItem.getMetaClass().getPropertyPath(columnId);
if (mpp == null) {
throw new IllegalStateException(String.format("Unable to find metaproperty %s for class %s",
columnId, rowItem.getMetaClass()));
}
if (mpp.getRange().isClass()) {
DatasourceImplementation ds = ((DatasourceImplementation) getDatasource());
boolean modifiedInTable = ds.getItemsToUpdate().contains(rowItem);
boolean ownerDsModified = ds.isModified();
rowItem.setValueEx(columnId, null);
rowItem.setValueEx(columnId, editorItem);
// restore modified for owner datasource
// remove from items to update if it was not modified before setValue
if (!modifiedInTable) {
ds.getItemsToUpdate().remove(rowItem);
}
ds.setModified(ownerDsModified);
} else {
//noinspection unchecked
getDatasource().updateItem(editorItem);
}
}
示例12: generateCell
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
protected com.vaadin.ui.Component generateCell(AbstractSelect source, Object itemId, Object columnId) {
CollectionDatasource ds = WebAbstractTable.this.getDatasource();
MetaPropertyPath propertyPath = ds.getMetaClass().getPropertyPath(columnId.toString());
PropertyWrapper propertyWrapper = (PropertyWrapper) source.getContainerProperty(itemId, propertyPath);
com.haulmont.cuba.gui.components.Formatter formatter = null;
Table.Column column = WebAbstractTable.this.getColumn(columnId.toString());
if (column != null) {
formatter = column.getFormatter();
}
final com.vaadin.ui.Label label = new com.vaadin.ui.Label();
WebComponentsHelper.setLabelText(label, propertyWrapper.getValue(), formatter);
label.setWidth("-1px");
//add property change listener that will update a label value
propertyWrapper.addListener(new CalculatablePropertyValueChangeListener(label, formatter));
return label;
}
示例13: addInitialColumns
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
protected void addInitialColumns(CollectionDatasource datasource) {
if (this.columns.isEmpty()) {
MessageTools messageTools = AppBeans.get(MessageTools.NAME);
MetaClass metaClass = datasource.getMetaClass();
Collection<MetaPropertyPath> paths = datasource.getView() != null ?
// if a view is specified - use view properties
metadataTools.getViewPropertyPaths(datasource.getView(), metaClass) :
// otherwise use all properties from meta-class
metadataTools.getPropertyPaths(metaClass);
for (MetaPropertyPath metaPropertyPath : paths) {
MetaProperty property = metaPropertyPath.getMetaProperty();
if (!property.getRange().getCardinality().isMany() && !metadataTools.isSystem(property)) {
String propertyName = property.getName();
ColumnImpl column = new ColumnImpl(propertyName, metaPropertyPath, this);
MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(metaPropertyPath);
column.setCaption(messageTools.getPropertyCaption(propertyMetaClass, propertyName));
addColumn(column);
}
}
}
}
示例14: toggleSortOrder
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
@Override
public void toggleSortOrder(int column) {
Table.Column modelColumn = model.getColumn(column);
if (model.isGeneratedColumn(modelColumn)) {
if (!(modelColumn.getId() instanceof MetaPropertyPath)) {
return;
}
}
SortKey key;
if (sortKey != null && sortKey.getColumn() == column) {
if (sortKey.getSortOrder() == SortOrder.ASCENDING) {
key = new SortKey(sortKey.getColumn(), SortOrder.DESCENDING);
} else {
key = null;
}
} else {
key = new SortKey(column, SortOrder.ASCENDING);
}
if (key == null)
setSortKeys(Collections.<SortKey>emptyList());
else
setSortKeys(Collections.singletonList(key));
}
示例15: groupItems
import com.haulmont.chile.core.model.MetaPropertyPath; //导入依赖的package包/类
protected GroupInfo<MetaPropertyPath> groupItems(int propertyIndex, GroupInfo parent, List<GroupInfo> children,
T item, final LinkedMap groupValues) {
final MetaPropertyPath property = (MetaPropertyPath) groupProperties[propertyIndex++];
Object itemValue = getValueByProperty(item, property);
groupValues.put(property, itemValue);
GroupInfo<MetaPropertyPath> groupInfo = new GroupInfo<>(groupValues);
itemGroups.put(item.getId(), groupInfo);
if (!parents.containsKey(groupInfo)) {
parents.put(groupInfo, parent);
}
if (!children.contains(groupInfo)) {
children.add(groupInfo);
}
List<GroupInfo> groupChildren =
this.children.computeIfAbsent(groupInfo, k -> new ArrayList<>());
if (propertyIndex < groupProperties.length) {
groupInfo = groupItems(propertyIndex, groupInfo, groupChildren, item, groupValues);
}
return groupInfo;
}