Java 类com.vaadin.ui.renderers.DateRenderer 实例源码

项目:bean-grid    文件:BeanGridDateValueProvider.java   
@Override
public DateRenderer getRenderer(ColumnDefinition definition) {
    if (definition.getFormat().isPresent()) {
        return new DateRenderer(new SimpleDateFormat(definition.getFormat().get()));
    }

    if (configurationProvider.getDateFormatPattern().isPresent()) {
        return new DateRenderer(new SimpleDateFormat(configurationProvider.getDateFormatPattern().get()));
    }

    return new DateRenderer(configurationProvider.getLocale());
}
项目:bean-grid    文件:BeanGridLocalDateValueProvider.java   
@Override
public DateRenderer getRenderer(ColumnDefinition definition) {
    if (definition.getFormat().isPresent()) {
        return new DateRenderer(new SimpleDateFormat(definition.getFormat().get()));
    }

    if (configurationProvider.getDateFormatPattern().isPresent()) {
        return new DateRenderer(new SimpleDateFormat(configurationProvider.getDateFormatPattern().get()));
    }

    return new DateRenderer(configurationProvider.getLocale());
}
项目:cuba    文件:WebDateRenderer.java   
@Override
protected DateRenderer createImplementation() {
    if (dateFormat == null) {
        checkNotNullArgument(formatString, "Format string may not be null");
        checkNotNullArgument(locale, "Locale may not be null");
        dateFormat = new SimpleDateFormat(formatString, locale);
    }
    return new DateRenderer(dateFormat, getNullRepresentation());
}
项目:KrishnasSpace    文件:BasicGridView.java   
/**
 * Initializes basic properties of the grid
 */
private void initGridProperties() {
    grid.setHeightMode(HeightMode.ROW);
    grid.setWidth(100, Unit.PERCENTAGE);
    grid.setColumnOrder(new Object[] { "customerName", "city", "pincode",
            "gender" });
    // Hiding is not supported by Grid, in order to remove/hide a column use
    // this API
    grid.removeColumn("customerID");
    Column dob = grid.getColumn("dob");
    dob.setRenderer(new DateRenderer(DateFormat
            .getDateInstance(DateFormat.MEDIUM)));
}
项目:vaadin-grid-util    文件:DemoUI.java   
private void setColumnRenderes(final Grid grid) {
      grid.getColumn("id")
              .setRenderer(
                      new EditDeleteButtonValueRenderer<Inhabitants>(edit -> {
                          Notification.show(edit.getItem()
                                  .toString() + " want's to get edited", Type.HUMANIZED_MESSAGE);
                      }, delete -> {
                          Notification.show(delete.getItem()
                                  .toString() + " want's to get deleted", Type.WARNING_MESSAGE);

                      }))
              .setWidth(160);

      grid.getColumn("bodySize")
              .setRenderer(new IndicatorRenderer(1.8, 1.1))
              .setWidth(150);
      grid.getColumn("birthday")
              .setRenderer(new DateRenderer(DateFormat.getDateInstance()))
              .setWidth(210);
      grid.getColumn("onFacebook")
              .setRenderer(new BooleanRenderer())
              .setWidth(130);

/*
       * the icon of the editButton will get overwritten below by css styling @see DemoUI.initColumnAlignments
 */
      grid.addColumn((ValueProvider<Inhabitants, String>) value -> String.format("%s <i>(%d)</i>",
              value.getCountry()
                      .getName(),
              value.getCountry()
                      .getPopulation()), new EditButtonValueRenderer<Inhabitants>(e -> {
          Notification.show("Goto Link for " + e.getItem()
                  .getCountry()
                  .getName(), Type.HUMANIZED_MESSAGE);
      }));
  }
项目:java-course-ee    文件:MyWindow.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
    mainWindow = new Window("Test Vaadin application");

    mainWindow.setWidth(800, Unit.PIXELS);
    mainWindow.setHeight(600, Unit.PIXELS);
    mainWindow.center();

    grid.setWidth("100%");
    grid.setHeight(300, Unit.PIXELS);
    grid.setSelectionMode(Grid.SelectionMode.SINGLE);

    grid.setContainerDataSource(new BeanItemContainer<Person>(Person.class, DaoImpl.getAllPersons()));
    grid.setColumns("name", "birth");
    Grid.Column bornColumn = grid.getColumn("birth");
    bornColumn.setRenderer(new DateRenderer("%1$td-%1$tm-%1$tY"));
    grid.addSelectionListener(event -> {
        Set<Object> selected = event.getSelected();
        Person o = (Person) selected.toArray()[0];
        BeanFieldGroup.bindFieldsUnbuffered(o, formLayout);
        formLayout.id.setEnabled(true);
        formLayout.name.setEnabled(true);
        formLayout.birth.setEnabled(true);
    });

    formLayout.id.setEnabled(false);
    formLayout.name.setEnabled(false);
    formLayout.birth.setEnabled(false);

    verticalLayout.setMargin(true);

    verticalLayout.addComponent(grid);
    verticalLayout.addComponent(formLayout);

    mainWindow.setContent(verticalLayout);

    addWindow(mainWindow);
}
项目:cuba    文件:WebDateRenderer.java   
@Override
public DateRenderer getImplementation() {
    return (DateRenderer) super.getImplementation();
}