本文整理汇总了Java中com.vaadin.ui.Grid.Column.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Column.setWidth方法的具体用法?Java Column.setWidth怎么用?Java Column.setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Grid.Column
的用法示例。
在下文中一共展示了Column.setWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hackDateColumnWidth
import com.vaadin.ui.Grid.Column; //导入方法依赖的package包/类
private void hackDateColumnWidth(Grid grid) {
List<Column> columns = grid.getColumns();
if (columns.isEmpty()) {
return;
}
Column lastCol = columns.get(columns.size() - 1);
if (!"orderTime".equals(lastCol.getPropertyId())) {
return;
}
lastCol.setWidth(174);
}
示例2: addActionColumn
import com.vaadin.ui.Grid.Column; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void addActionColumn()
{
((GeneratedPropertyListContainer<E>) grid.getContainerDataSource())
.addGeneratedProperty(ACTION_MENU_PROPERTY_ID, getActionMenuColumnGenerator());
final Column actionMenuColumn = grid.addColumn(ACTION_MENU_PROPERTY_ID);
grid.setFrozenColumnCount(1);
actionMenuColumn.setHeaderCaption("");
actionMenuColumn.setRenderer(new ComponentRenderer());
actionMenuColumn.setWidth(40);
actionMenuColumn.setResizable(false);
grid.setCellStyleGenerator(new CellStyleGenerator()
{
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public String getStyle(CellReference event)
{
String style = "";
if (event.getPropertyId().equals(ACTION_MENU_PROPERTY_ID))
{
style = "grid-actionmenu";
}
return style;
}
});
}
示例3: setupGridPropertyColumn
import com.vaadin.ui.Grid.Column; //导入方法依赖的package包/类
/**
* Setup column configuration for given <code>property</code> using its {@link PropertyColumn} definition.
* @param property Property to which the column is bound
* @param column Column to setup
*/
protected void setupGridPropertyColumn(P property, Column column) {
PropertyColumn<T, P> propertyColumn = getPropertyColumn(property);
if (propertyColumn != null) {
// header
if (propertyColumn.getCaption() != null) {
String header = LocalizationContext.translate(propertyColumn.getCaption(), true);
if (header != null) {
column.setHeaderCaption(header);
}
}
// sortable
column.setSortable(requireDataSource().getConfiguration().isPropertySortable(property));
// width
if (propertyColumn.getWidth() > -1) {
column.setWidth(propertyColumn.getWidth());
}
if (propertyColumn.getMinWidth() > -1) {
column.setMinimumWidth(propertyColumn.getMinWidth());
}
if (propertyColumn.getMaxWidth() > -1) {
column.setMaximumWidth(propertyColumn.getMinWidth());
}
// expand
if (propertyColumn.getGridExpandRatio() > -1) {
column.setExpandRatio(propertyColumn.getGridExpandRatio());
}
// editing
if (requireDataSource().getConfiguration().isPropertyReadOnly(property)) {
column.setEditable(false);
} else {
column.setEditable(propertyColumn.isEditable());
if (propertyColumn.isEditable()) {
propertyColumn.getEditor().ifPresent(e -> column.setEditorField(e));
}
}
// hiding
if (columnHidingAllowed && propertyColumn.isHidable()) {
column.setHidable(true);
if (propertyColumn.isHidden()) {
column.setHidden(true);
}
if (propertyColumn.getHidingToggleCaption() != null) {
column.setHidingToggleCaption(
LocalizationContext.translate(propertyColumn.getHidingToggleCaption()));
}
} else {
column.setHidable(false);
}
}
}
示例4: setColumnWidth
import com.vaadin.ui.Grid.Column; //导入方法依赖的package包/类
private void setColumnWidth(final Column column, final double width)
{
// Avoid IllegalArgumentException if proposed width ends up being < 0
column.setWidth(width > 0 ? width : 0);
}