List of usage examples for com.google.gwt.user.cellview.client CellWidget CellWidget
public CellWidget(Cell<C> cell)
null. From source file:n3phele.client.view.ProcessView.java
License:Open Source License
public ProcessView() { super(new MenuItem(N3phele.n3pheleResource.activityIcon(), "Activity", null)); table = new FlexTable(); table.setCellPadding(2);//from w w w . j a v a 2 s. com this.add(table); table.setWidth("100%"); Label lblNewLabel_4 = new Label("name"); table.setWidget(0, 0, lblNewLabel_4); name = new Label(""); table.setWidget(0, 1, name); iconStatus = new CellWidget<IconText>(new IconTextCell<IconText>(32, 32, 15)); table.setWidget(0, 2, iconStatus); table.getColumnFormatter().setWidth(0, "60px"); table.getColumnFormatter().setWidth(2, "170px"); Label lblNewLabel = new Label("running"); table.setWidget(1, 0, lblNewLabel); command = new Hyperlink("", ""); table.setWidget(1, 1, command); table.getFlexCellFormatter().setColSpan(1, 1, 2); // description = new Label("-description-"); // table.setWidget(1, 2, description); Label lblNewLabel_3 = new Label("started"); table.setWidget(2, 0, lblNewLabel_3); startdate = new CellWidget<Date>( new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT))); table.setWidget(2, 1, startdate); //table.getFlexCellFormatter().setColSpan(2, 1, 2); Label lblNewLabel_6 = new Label("completed"); table.setWidget(3, 0, lblNewLabel_6); completedate = new CellWidget<Date>( new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT))); table.setWidget(3, 1, completedate); //table.getFlexCellFormatter().setColSpan(3, 1, 2); duration = new Label(".duration"); table.setWidget(3, 2, duration); if (resource == null) resource = GWT.create(NarrativeListCellTableResource.class); narrativeTable = new CellTable<Narrative>(15, resource); this.add(narrativeTable); narrativeTable.setWidth("100%", true); final Map<String, ImageResource> mapper = new HashMap<String, ImageResource>(); mapper.put("info", N3phele.n3pheleResource.narrativeInfo()); mapper.put("warning", N3phele.n3pheleResource.narrativeWarning()); mapper.put("error", N3phele.n3pheleResource.narrativeError()); state = new Column<Narrative, ImageResource>(new ImageResourceCell()) { @Override public ImageResource getValue(Narrative object) { return mapper.get(object.getState()); } }; state.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); state.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); narrativeTable.addColumn(state); narrativeTable.setColumnWidth(state, "8%"); Column<Narrative, Date> date = new Column<Narrative, Date>( new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT))) { @Override public Date getValue(Narrative object) { return object.getStamp(); } }; narrativeTable.addColumn(date); narrativeTable.setColumnWidth(date, "15%"); Column<Narrative, Hyperlink> id = new Column<Narrative, Hyperlink>(new HyperlinkCell()) { @Override public Hyperlink getValue(Narrative object) { if (object == null) return null; String name = object.getTag(); String historyToken = presenter.getToken(object.getProcessUri()); return new Hyperlink(name, historyToken); } }; id.setFieldUpdater(new FieldUpdater<Narrative, Hyperlink>() { @Override public void update(int index, Narrative object, Hyperlink value) { ProcessView.this.narrativeTable.setFocus(false); } }); id.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); id.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); narrativeTable.addColumn(id); narrativeTable.setColumnWidth(id, "20%"); TextColumn<Narrative> msg = new TextColumn<Narrative>() { @Override public String getValue(Narrative object) { return object.getText(); } }; msg.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); msg.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); narrativeTable.addColumn(msg); narrativeTable.setColumnWidth(msg, "60%"); }
From source file:n3phele.client.view.ProgressView.java
License:Open Source License
public ProgressView() { super(new MenuItem(N3phele.n3pheleResource.activityIcon(), "Activity", null)); table = new FlexTable(); table.setCellPadding(2);/*from w w w .j a v a 2 s. com*/ this.add(table); //table.setSize("478px", "260px"); Label lblNewLabel_4 = new Label("name"); table.setWidget(0, 0, lblNewLabel_4); name = new Label(""); table.setWidget(0, 1, name); iconStatus = new CellWidget<IconText>(new IconTextCell<IconText>(32, 32, 15)); // { // @Override // public IconText getValue(Progress progress) { // String status = progress.getStatus(); // ImageResource icon = statusVizualization.get(status); // if(icon != null) return new IconText(icon, progress.getName()); // return new IconText(getTemplate().statusBar(getPercentComplete(progress), barUrl ), progress.getName()); // make progress bar // } // }; table.setWidget(0, 2, iconStatus); Label lblNewLabel = new Label("running"); table.setWidget(1, 0, lblNewLabel); command = new Hyperlink("", ""); table.setWidget(1, 1, command); description = new Label("-description-"); table.setWidget(1, 2, description); Label lblNewLabel_3 = new Label("started"); table.setWidget(2, 0, lblNewLabel_3); startdate = new CellWidget<Date>( new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT))); table.setWidget(2, 1, startdate); table.getFlexCellFormatter().setColSpan(2, 1, 2); Label lblNewLabel_6 = new Label("completed"); table.setWidget(3, 0, lblNewLabel_6); completedate = new CellWidget<Date>( new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT))); table.setWidget(3, 1, completedate); table.getFlexCellFormatter().setColSpan(3, 1, 2); Label lblNewLabel_7 = new Label("estimated duration", true); table.setWidget(4, 0, lblNewLabel_7); duration = new Label(".duration"); table.setWidget(4, 1, duration); table.getFlexCellFormatter().setColSpan(4, 1, 2); if (resource == null) resource = GWT.create(NarrativeListCellTableResource.class); narrativeTable = new CellTable<Narrative>(15, resource); this.add(narrativeTable); narrativeTable.setWidth("100%", true); final Map<String, ImageResource> mapper = new HashMap<String, ImageResource>(); mapper.put("info", N3phele.n3pheleResource.narrativeInfo()); mapper.put("warning", N3phele.n3pheleResource.narrativeWarning()); mapper.put("error", N3phele.n3pheleResource.narrativeError()); state = new Column<Narrative, ImageResource>(new ImageResourceCell()) { @Override public ImageResource getValue(Narrative object) { return mapper.get(object.getState()); } }; state.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); state.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); narrativeTable.addColumn(state); narrativeTable.setColumnWidth(state, "8%"); Column<Narrative, Date> date = new Column<Narrative, Date>( new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT))) { @Override public Date getValue(Narrative object) { return object.getStamp(); } }; narrativeTable.addColumn(date); narrativeTable.setColumnWidth(date, "15%"); TextColumn<Narrative> id = new TextColumn<Narrative>() { @Override public String getValue(Narrative object) { return object.getId(); } }; id.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); id.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); narrativeTable.addColumn(id); narrativeTable.setColumnWidth(id, "20%"); TextColumn<Narrative> msg = new TextColumn<Narrative>() { @Override public String getValue(Narrative object) { return object.getText(); } }; msg.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); msg.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); narrativeTable.addColumn(msg); narrativeTable.setColumnWidth(msg, "60%"); }