drafts.setSpacing(true);
titleAndDrafts.addComponent(drafts);
CssLayout draftThumb = new CssLayout();
draftThumb.addStyleName("draft-thumb");
Image draft = new Image(null, new ThemeResource(
"img/draft-report-thumb.png"));
draftThumb.addComponent(draft);
Label draftTitle = new Label(
"Monthly revenue<br><span>Last modified 1 day ago</span>",
ContentMode.HTML);
draftTitle.setSizeUndefined();
draftThumb.addComponent(draftTitle);
drafts.addComponent(draftThumb);
// TODO layout bug, we need to set the alignment also for the first
// child
drafts.setComponentAlignment(draftThumb, Alignment.MIDDLE_CENTER);
final Button delete = new Button("×");
delete.setPrimaryStyleName("delete-button");
draftThumb.addComponent(delete);
delete.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Notification.show("Not implemented in this demo");
}
});
draftThumb.addLayoutClickListener(new LayoutClickListener() {
@Override
public void layoutClick(LayoutClickEvent event) {
if (event.getButton() == MouseButton.LEFT
&& event.getChildComponent() != delete) {
editors.addTab(createEditorInstance(1, null, null))
.setClosable(true);
editors.setSelectedTab(editors.getComponentCount() - 1);
}
}
});
draft.setDescription("Click to edit");
delete.setDescription("Delete draft");
VerticalLayout createBox = new VerticalLayout();
createBox.setWidth(null);
createBox.addStyleName("create");