Mercurial > dive4elements > river
changeset 606:69c0a6ecad57
#165 (part 1) Added tooltips and table headers in the project list.
flys-client/trunk@2213 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 23 Jun 2011 09:29:46 +0000 |
parents | 9e30c776cbef |
children | 3acc631efdf0 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java |
diffstat | 2 files changed, 69 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Thu Jun 23 09:22:54 2011 +0000 +++ b/flys-client/ChangeLog Thu Jun 23 09:29:46 2011 +0000 @@ -1,3 +1,10 @@ +2011-06-23 Ingo Weinzierl <ingo@intevation.de> + + flys/issue165 (Projektliste: Einige Auffälligkeiten nach Neuimplementierung) + + * src/main/java/de/intevation/flys/client/client/ui/ProjectList.java: + Added tooltips and table headers. + 2011-06-23 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java Thu Jun 23 09:22:54 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java Thu Jun 23 09:29:46 2011 +0000 @@ -12,11 +12,15 @@ import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.ListGridEditEvent; import com.smartgwt.client.types.ListGridFieldType; +import com.smartgwt.client.types.SelectionStyle; +import com.smartgwt.client.types.SortArrow; import com.smartgwt.client.types.SortDirection; +import com.smartgwt.client.util.BooleanCallback; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.grid.CellFormatter; +import com.smartgwt.client.widgets.grid.HoverCustomizer; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; @@ -69,6 +73,15 @@ /** Min Interval to refresh the user's projects.*/ public static final int MIN_UPDATE_INTERVAL = 5000; + /** The initial width of this panel.*/ + public static final int MIN_WIDTH = 300; + + public static final String COLUMN_DATE_WIDTH = "100px"; + + public static final String COLUMN_TITLE_WIDTH = "*"; + + public static final String COLUMN_FAVORITE_WIDTH = "75px"; + /** The interface that provides i18n messages. */ private FLYSConstants messages = GWT.create(FLYSConstants.class); @@ -119,19 +132,18 @@ protected void initGrid() { + grid.setWidth100(); + grid.setHeight100(); + grid.setAutoFitMaxWidth(500); grid.setEmptyMessage(messages.no_projects()); grid.setLoadingDataMessage(messages.load_projects()); - grid.setShowRecordComponents(true); - grid.setShowRecordComponentsByCell(true); - grid.setCanRemoveRecords(false); - grid.setShowHeader(false); - grid.setWidth100(); - grid.setHeight100(); + grid.setCanEdit(false); + grid.setEditEvent(ListGridEditEvent.NONE); + grid.setShowHeaderContextMenu(false); + grid.setShowSortArrow(SortArrow.NONE); grid.setSortDirection(SortDirection.DESCENDING); grid.setSortField(0); - grid.setCanEdit(false); - grid.setEditByCell(true); - grid.setEditEvent(ListGridEditEvent.NONE); + grid.setSelectionType(SelectionStyle.SINGLE); ListGridField date = buildDateField(); ListGridField name = buildNameField(); @@ -229,7 +241,13 @@ MenuItem del = new MenuItem(messages.delete_project()); del.addClickHandler(new ClickHandler() { public void onClick(MenuItemClickEvent evt) { - deleteCollection(record.getCollection()); + SC.ask(messages.really_delete(), new BooleanCallback() { + public void execute(Boolean value) { + if (value) { + deleteCollection(record.getCollection()); + } + } + }); } }); @@ -253,7 +271,8 @@ * The init() method handles the layout stuff for this widget. */ protected void init() { - setWidth(300); + setWidth(MIN_WIDTH); + setMinWidth(MIN_WIDTH); setHeight100(); setShowResizeBar(true); setShowEdges(false); @@ -303,7 +322,6 @@ String name = (String) newValues.get("name"); c.setName(name); - updateCollectionName(c); } @@ -470,7 +488,9 @@ * @return the grid field. */ protected ListGridField buildDateField() { - ListGridField date = new ListGridField("creationTime", "creationTime"); + ListGridField date = new ListGridField( + "creationTime", messages.projectlist_creationTime()); + date.setType(ListGridFieldType.DATE); date.setCanEdit(false); @@ -487,8 +507,8 @@ } }); - date.setWidth(100); - date.setAlign(Alignment.LEFT); + date.setWidth(COLUMN_DATE_WIDTH); + date.setAlign(Alignment.CENTER); return date; } @@ -500,8 +520,28 @@ * @return the grid field. */ protected ListGridField buildNameField() { - ListGridField name = new ListGridField("name", "name"); + ListGridField name = new ListGridField( + "name", messages.projectlist_title()); + name.setType(ListGridFieldType.TEXT); + name.setShowHover(true); + name.setHoverCustomizer(new HoverCustomizer() { + public String hoverHTML( + Object value, + ListGridRecord record, + int row, + int col) + { + CollectionRecord r = (CollectionRecord) record; + Collection c = r.getCollection(); + + String name = c.getName(); + + return name != null && name.length() > 0 + ? name + : c.identifier(); + } + }); name.setCellFormatter(new CellFormatter() { public String format(Object value, ListGridRecord record, int row, int col) { @@ -517,7 +557,7 @@ } }); - name.setWidth(165); + name.setWidth(COLUMN_TITLE_WIDTH); name.setAlign(Alignment.LEFT); return name; @@ -525,13 +565,15 @@ protected ListGridField buildFavoriteField() { - ListGridField fav = new ListGridField("ttl", "ttl"); + ListGridField fav = new ListGridField( + "ttl", messages.projectlist_favorite()); + fav.setType(ListGridFieldType.IMAGE); String base = GWT.getHostPageBaseURL(); fav.setImageURLPrefix(base + "images/"); fav.setImageURLSuffix(".png"); - fav.setWidth(30); - fav.setAlign(Alignment.RIGHT); + fav.setWidth(COLUMN_FAVORITE_WIDTH); + fav.setAlign(Alignment.CENTER); fav.setCanEdit(false); return fav;