本文整理匯總了Java中com.vaadin.ui.Grid.Column方法的典型用法代碼示例。如果您正苦於以下問題:Java Grid.Column方法的具體用法?Java Grid.Column怎麽用?Java Grid.Column使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Grid
的用法示例。
在下文中一共展示了Grid.Column方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generateHeaders
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
/**
* Generates component header fields using the passed {@link ComponentHeaderGenerator} and
* sets them to the columns.
*
* @param generator the header generator
* @return the decorator for method chaining
*/
public ComponentGridDecorator<T> generateHeaders(ComponentHeaderGenerator generator) {
for (Grid.Column column : grid.getColumns()) {
grid.getDefaultHeaderRow()
.getCell(column.getPropertyId())
.setComponent(generator.getHeader(column.getPropertyId()));
}
return this;
}
示例2: getVisibleColumns
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
@Override
public Object[] getVisibleColumns() {
List<Grid.Column> columns = grid.getColumns();
Object[] propertyIds = new Object[columns.size()];
for (int i = 0; i < columns.size(); i++) {
propertyIds[i] = columns.get(i).getPropertyId();
}
return propertyIds;
}
示例3: setColumnHeaders
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
@Override
public void setColumnHeaders(String... columnHeaders) {
List<Grid.Column> columns = grid.getColumns();
if (columnHeaders.length != columns.size()) {
throw new IllegalArgumentException(
"The given headers did not match the number of declared columns");
}
for (int i = 0; i < columnHeaders.length; i++) {
columns.get(i).setHeaderCaption(columnHeaders[i]);
}
}
示例4: withColumnHeaders
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
public MGrid<T> withColumnHeaders(String... properties) {
List<Column<T, ?>> columns = getColumns();
for (int i = 0; i < columns.size(); i++) {
Grid.Column<T, ? extends Object> c = columns.get(i);
c.setCaption(properties[i]);
}
return this;
}
示例5: init
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setMargin(true);
layout.setSizeFull();
Grid<DemoPerson> grid = new Grid("<b>Demo Grid</b>", new ListDataProvider(DemoPerson.getPersonList()));
grid.setCaptionAsHtml(true);
grid.setSizeFull();
grid.setSelectionMode(Grid.SelectionMode.NONE);
Grid.Column<DemoPerson, String> idColumn = grid.addColumn(DemoPerson::getId).setCaption("Id");
Grid.Column<DemoPerson, String> firstNameColumn = grid.addColumn(DemoPerson::getFirstName).setCaption("Firstname");
Grid.Column<DemoPerson, String> surNameColumn = grid.addColumn(DemoPerson::getSurName).setCaption("Surname");
Grid.Column<DemoPerson, String> companyColumn = grid.addColumn(DemoPerson::getCompany,
new ClickableTextRenderer(getCompanyClickListener())).setCaption("Company");
Grid.Column<DemoPerson, String> companyTypeColumn = grid.addColumn(DemoPerson::getCompanyType).setCaption("Company Type");
Grid.Column<DemoPerson, String> cityColumn = grid.addColumn(DemoPerson::getCity).setCaption("City");
// Use the advanced form of the Clickable Text Renderer on
// column "city". This will require a value provider where the PRESENTATION
// class is of type ClickableText. Because the city is of type String
// the value provider must convert from String to ClickableText.
cityColumn.setRenderer((String source) -> {
ClickableText ct = new ClickableText();
ct.description = "Will take you to " + source; // Sets the HTML title attribute, aka tooltip
// I want a space between the underlined text and the icon. To avoid the
// space being underlined (because of the link styling) I use a
// a different style for the space itself.
ct.value = source + "<span class=\"v-icon\"> </span>" + VaadinIcons.EXTERNAL_LINK.getHtml();
ct.isHTML = true;
return ct;
}, new ClickableTextRendererAdv<>(getCityClickListener()));
layout.addComponent(grid);
setContent(layout);
}
示例6: CheckBoxDemo
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
public CheckBoxDemo() {
Random random = new Random(4837291937l);
BeanItemContainer<SimplePojo> container = new BeanItemContainer<SimplePojo>(SimplePojo.class);
SimplePojo bean1 = new SimplePojo(0, "Me", true, new Date(), BigDecimal.valueOf(random.nextDouble()*100), Double.valueOf(random.nextInt(5)), Integer.valueOf(random.nextInt(5)));
SimplePojo bean2 = new SimplePojo(1, "You", false, new Date(), BigDecimal.valueOf(random.nextDouble()*100), Double.valueOf(random.nextInt(5)), Integer.valueOf(random.nextInt(5)));
SimplePojo bean3 = new SimplePojo(2, "He", true, new Date(), BigDecimal.valueOf(random.nextDouble()*100), Double.valueOf(random.nextInt(5)), Integer.valueOf(random.nextInt(5)));
container.addBean(bean1);
container.addBean(bean2);
container.addBean(bean3);
byte[] image = Base64.decodeBase64(castle);
bean1.setImage(image);
bean2.setImage(image);
bean3.setImage(image);
Grid grid = new Grid(container);
grid.setColumns("description","yes","truth","date","number","image");
grid.setSizeFull();
grid.setEditorEnabled(true);
grid.setEditorBuffered(false);
Grid.Column yes = grid.getColumn("yes");
yes.setRenderer(new CheckboxRenderer());
yes.setEditable(true);
grid.getColumn("image").setEditable(false);
grid.getColumn("image").setRenderer(new BlobImageRenderer(30,30,"image/png"));
Grid.Column truth = grid.getColumn("truth");
truth.setRenderer(new HtmlRenderer(), new StringToBooleanConverter() {
@Override
protected String getTrueString() {
return FontAwesome.CHECK_CIRCLE_O.getHtml();
}
@Override
protected String getFalseString() {
return FontAwesome.CIRCLE_O.getHtml();
}
});
truth.setEditable(false);
setStyleName("demoContentLayout");
setSizeFull();
addComponent(grid);
setComponentAlignment(grid
, Alignment.MIDDLE_CENTER);
setMargin(true);
}
示例7: addComponentColumn
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
/**
* Add a generated component column to the ComponentGrid.
*
* @param propertyId the generated column's property-id
* @param generator the component-generator
* @return the decorator for method chaining
*/
public Grid.Column addComponentColumn(Object propertyId, ComponentGenerator<T> generator) {
gpc.addGeneratedProperty(propertyId, new ComponentPropertyGenerator<>(typeOfRows, generator));
return grid.getColumn(propertyId)
.setRenderer(new ComponentRenderer())
.setEditorField(new ComponentCustomField());
}