Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionGrid.java @ 40:1458bc0a20e2
Clear the panel that displays the current input widget before adding a new item to this panel.
flys-client/trunk@1474 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 15 Mar 2011 14:55:47 +0000 |
parents | 89976499e013 |
children | 0bec0112c8b3 |
rev | line source |
---|---|
4
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.Date; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import com.google.gwt.core.client.GWT; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import com.google.gwt.i18n.client.DateTimeFormat; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import com.smartgwt.client.widgets.Canvas; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import com.smartgwt.client.widgets.IButton; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import com.smartgwt.client.widgets.Label; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import com.smartgwt.client.widgets.grid.ListGrid; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import com.smartgwt.client.widgets.grid.ListGridRecord; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.client.shared.model.CollectionRecord; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.client.client.FLYSMessages; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 /** |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 */ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public class CollectionGrid extends ListGrid { |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 /** The message class that provides i18n strings.*/ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 FLYSMessages messages = GWT.create(FLYSMessages.class); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 /** |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 * The default constructor that creates a new ListGrid item. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 * |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 * @param collection The artifact collection. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 */ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 public CollectionGrid() { |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 @Override |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 protected Canvas createRecordComponent( |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 final ListGridRecord record, Integer col) |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 { |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 String field = getFieldName(col); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 if (field == null) return null; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 if (field.equals("date")) return createDateField(record); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 else if (field.equals("name")) return createNameField(record); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 else if (field.equals("publish")) return createPublishField(record); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 else if (field.equals("delete")) return createDeleteField(record); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 return null; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 /** |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 * This method creates the date field for the collection grid. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 * |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 * @param record The record to be displayed. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 */ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 protected Canvas createDateField(ListGridRecord record) { |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 CollectionRecord rec = (CollectionRecord) record; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 Date date = rec.getDate(); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 DateTimeFormat dtf = DateTimeFormat.getFormat(messages.date_format()); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 String formatted = dtf.format(date); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 Label label = new Label(formatted); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 label.setHeight(15); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 return label; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 /** |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 * This method creates the name field for the collection grid. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 * |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 * @param record The record to be displayed. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 */ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 protected Canvas createNameField(ListGridRecord record) { |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 CollectionRecord rec = (CollectionRecord) record; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 Label label = new Label(rec.getName()); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 label.setHeight(15); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 return label; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 /** |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 * This method creates the field for the collection grid that provides a |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 * button to publish the collection. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 * |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 * @param record The record to be displayed. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 */ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 protected Canvas createPublishField(ListGridRecord record) { |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 IButton button = new IButton(); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 button.setHeight(15); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 button.setWidth(30); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 button.setTitle("PUB"); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 return button; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 /** |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 * This method creates the field for the collection grid that provides a |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 * button to delete the collection. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 * |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 * @param record The record to be displayed. |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 */ |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 protected Canvas createDeleteField(ListGridRecord record) { |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 IButton button = new IButton(); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 button.setHeight(15); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 button.setWidth(30); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 button.setTitle("DEL"); |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 return button; |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 } |
89976499e013
Implemented a ProjectList and added a mockup that displays two collections in that list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |