Commit 51b3c98e96ab6c779319fdd10b7180d8fcdef4ca
- Diff rendering mode:
- inline
- side by side
ChangeLog
(28 / 0)
|   | |||
| 1 | 1 | 2012-01-26 Murray Cumming <murrayc@murrayc.com> | |
| 2 | 2 | ||
| 3 | Use the ?locale= query param instead of the &lang= token param. | ||
| 4 | |||
| 5 | * src/main/java/org/glom/web/client/place/ListPlace.java | ||
| 6 | * src/main/java/org/glom/web/client/place/DetailsPlace.java | ||
| 7 | * src/main/java/org/glom/web/client/place/HasSelectableTablePlace.java | ||
| 8 | Remove the lang token key and value. | ||
| 9 | |||
| 10 | * src/main/java/org/glom/web/client/ui/TableSelectionView.java | ||
| 11 | * src/main/java/org/glom/web/client/ui/TableSelectionViewImpl.java: | ||
| 12 | When the user selects a different locale from the chooser, use | ||
| 13 | Window.Location.assign() to change the URL, which then causes a reload. | ||
| 14 | |||
| 15 | * src/main/java/org/glom/web/client/Utils.java: Added getCurrentLocaleID(). | ||
| 16 | * src/main/java/org/glom/web/client/activity/DetailsActivity.java | ||
| 17 | * src/main/java/org/glom/web/client/activity/DocumentSelectionActivity.java | ||
| 18 | * src/main/java/org/glom/web/client/activity/ListActivity.java | ||
| 19 | * src/main/java/org/glom/web/client/activity/TableSelectionActivity | ||
| 20 | * src/main/java/org/glom/web/client/ui/DocumentSelectionView.java | ||
| 21 | * src/main/java/org/glom/web/client/ui/DocumentSelectionViewImpl.java: | ||
| 22 | * src/main/java/org/glom/web/client/ui/ListView.java: | ||
| 23 | * src/main/java/org/glom/web/client/ui/ListViewImpl.java: | ||
| 24 | |||
| 25 | Remove localeID member variables and method/constructor parameters, instead | ||
| 26 | using Utils.getCurrentLocaleID() when we need a localID to pass to | ||
| 27 | OnlineGlomService. | ||
| 28 | |||
| 29 | 2012-01-26 Murray Cumming <murrayc@murrayc.com> | ||
| 30 | |||
| 3 | 31 | Internationalize the UI strings. | |
| 4 | 32 | ||
| 5 | 33 | * pom.xml: gwt-maven-plugin: Add the i18n goal and specify a |
|   | |||
| 27 | 27 | import com.google.gwt.core.client.GWT; | |
| 28 | 28 | import com.google.gwt.dom.client.Document; | |
| 29 | 29 | import com.google.gwt.dom.client.Style.Visibility; | |
| 30 | import com.google.gwt.i18n.client.LocaleInfo; | ||
| 30 | 31 | import com.google.gwt.i18n.client.NumberFormat; | |
| 32 | import com.google.gwt.user.client.Window; | ||
| 31 | 33 | import com.google.gwt.user.client.ui.Widget; | |
| 32 | 34 | ||
| 33 | 35 | /** | |
| … | … | ||
| 110 | 110 | } | |
| 111 | 111 | ||
| 112 | 112 | return primaryKeyItem; | |
| 113 | } | ||
| 114 | |||
| 115 | public static String getCurrentLocaleName() { | ||
| 116 | String localeID = LocaleInfo.getCurrentLocale().getLocaleName(); | ||
| 117 | if(localeID == "default") | ||
| 118 | { | ||
| 119 | localeID = ""; //This is how libglom refers to the default locale. | ||
| 120 | } | ||
| 121 | |||
| 122 | if(StringUtils.isEmpty(localeID)) | ||
| 123 | { | ||
| 124 | // LocaleInfo.getCurrentLocale() returns "default" even if a real locale was specified in the URL, | ||
| 125 | // if the locale is not specified as supported in our OnlineGlom.gwt.xml file, | ||
| 126 | // but people could use locales in .glom files that we have not thought of, | ||
| 127 | // so we should allow their use by getting the query parameter value directly: | ||
| 128 | final String paramValue = Window.Location.getParameter(LocaleInfo.getLocaleQueryParam()); | ||
| 129 | localeID = paramValue; | ||
| 130 | } | ||
| 131 | |||
| 132 | return localeID; | ||
| 113 | 133 | } | |
| 114 | 134 | ||
| 115 | 135 | } |
|   | |||
| 107 | 107 | private String documentID = ""; | |
| 108 | 108 | private String tableName = ""; | |
| 109 | 109 | private TypedDataItem primaryKeyValue; | |
| 110 | private String localeID = ""; | ||
| 111 | 110 | private final ClientFactory clientFactory; | |
| 112 | 111 | private final DetailsView detailsView; | |
| 113 | 112 | ArrayList<DetailsCell> detailsCells; | |
| … | … | ||
| 116 | 116 | this.documentID = place.getDocumentID(); | |
| 117 | 117 | this.tableName = place.getTableName(); | |
| 118 | 118 | this.primaryKeyValue = place.getPrimaryKeyValue(); | |
| 119 | this.localeID = place.getLocaleID(); | ||
| 120 | 119 | this.clientFactory = clientFactory; | |
| 121 | 120 | detailsView = clientFactory.getDetailsView(); | |
| 122 | 121 | } | |
| … | … | ||
| 141 | 141 | @Override | |
| 142 | 142 | public void onTableChange(final TableChangeEvent event) { | |
| 143 | 143 | // note the empty primary key item | |
| 144 | goTo(new DetailsPlace(documentID, event.getNewTableName(), localeID, new TypedDataItem())); | ||
| 144 | goTo(new DetailsPlace(documentID, event.getNewTableName(), new TypedDataItem())); | ||
| 145 | 145 | } | |
| 146 | 146 | }); | |
| 147 | 147 | ||
| … | … | ||
| 167 | 167 | } | |
| 168 | 168 | ||
| 169 | 169 | }; | |
| 170 | |||
| 171 | final String localeID = Utils.getCurrentLocaleID(); | ||
| 170 | 172 | OnlineGlomServiceAsync.Util.getInstance().getDetailsLayoutAndData(documentID, tableName, primaryKeyValue, | |
| 171 | 173 | localeID, callback); | |
| 172 | 174 | ||
| … | … | ||
| 178 | 178 | public void onQuickFindChange(final QuickFindChangeEvent event) { | |
| 179 | 179 | // We switch to the List view, to show search results. | |
| 180 | 180 | // TODO: Show the details view if there is only one result. | |
| 181 | goTo(new ListPlace(documentID, tableName, localeID, event.getNewQuickFindText())); | ||
| 181 | goTo(new ListPlace(documentID, tableName, event.getNewQuickFindText())); | ||
| 182 | 182 | } | |
| 183 | 183 | }); | |
| 184 | 184 | ||
| … | … | ||
| 187 | 187 | @Override | |
| 188 | 188 | public void onLocaleChange(final LocaleChangeEvent event) { | |
| 189 | 189 | // note the empty primary key item | |
| 190 | goTo(new DetailsPlace(documentID, tableName, event.getNewLocaleID(), primaryKeyValue)); | ||
| 190 | goTo(new DetailsPlace(documentID, tableName, primaryKeyValue)); | ||
| 191 | 191 | } | |
| 192 | 192 | }); | |
| 193 | 193 | ||
| … | … | ||
| 340 | 340 | if (navigationPrimaryKeyValue != null && !navigationPrimaryKeyValue.isEmpty()) { | |
| 341 | 341 | if (!newTableName.equals(tableName)) { | |
| 342 | 342 | // Go to a new DetailsPlace because the table name has changed. | |
| 343 | goTo(new DetailsPlace(documentID, newTableName, localeID, navigationPrimaryKeyValue)); | ||
| 343 | goTo(new DetailsPlace(documentID, newTableName, navigationPrimaryKeyValue)); | ||
| 344 | 344 | } else { | |
| 345 | 345 | // Refresh the details view with the new primary because the table name has not changed. | |
| 346 | 346 | primaryKeyValue = navigationPrimaryKeyValue; |
|   | |||
| 62 | 62 | if (documents.getCount() > 0) { | |
| 63 | 63 | for (int i = 0; i < documents.getCount(); i++) { | |
| 64 | 64 | documentSelectionView | |
| 65 | .addDocumentLink(documents.getDocumentID(i), documents.getTitle(i), "" /* localeID */); | ||
| 65 | .addDocumentLink(documents.getDocumentID(i), documents.getTitle(i)); | ||
| 66 | 66 | // TODO: Get default locale. | |
| 67 | 67 | } | |
| 68 | 68 | } else { |
|   | |||
| 22 | 22 | import org.glom.web.client.StringUtils; | |
| 23 | 23 | import org.glom.web.client.ClientFactory; | |
| 24 | 24 | import org.glom.web.client.OnlineGlomServiceAsync; | |
| 25 | import org.glom.web.client.Utils; | ||
| 25 | 26 | import org.glom.web.client.event.LocaleChangeEvent; | |
| 26 | 27 | import org.glom.web.client.event.LocaleChangeEventHandler; | |
| 27 | 28 | import org.glom.web.client.event.QuickFindChangeEvent; | |
| … | … | ||
| 49 | 49 | ||
| 50 | 50 | private final String documentID; | |
| 51 | 51 | private final String tableName; | |
| 52 | private final String localeID; | ||
| 53 | 52 | private final String quickFind; | |
| 54 | 53 | private final ClientFactory clientFactory; | |
| 55 | 54 | private final ListView listView; | |
| … | … | ||
| 57 | 57 | public ListActivity(final ListPlace place, final ClientFactory clientFactory) { | |
| 58 | 58 | this.documentID = place.getDocumentID(); // TODO: Just store the place? | |
| 59 | 59 | this.tableName = place.getTableName(); | |
| 60 | this.localeID = place.getLocaleID(); | ||
| 61 | 60 | this.quickFind = place.getQuickFind(); | |
| 62 | 61 | this.clientFactory = clientFactory; | |
| 63 | 62 | listView = clientFactory.getListView(); | |
| … | … | ||
| 94 | 94 | eventBus.addHandler(TableChangeEvent.TYPE, new TableChangeEventHandler() { | |
| 95 | 95 | @Override | |
| 96 | 96 | public void onTableChange(final TableChangeEvent event) { | |
| 97 | goTo(new ListPlace(documentID, event.getNewTableName(), localeID, "")); | ||
| 97 | goTo(new ListPlace(documentID, event.getNewTableName(), "")); | ||
| 98 | 98 | } | |
| 99 | 99 | }); | |
| 100 | 100 | ||
| … | … | ||
| 110 | 110 | public void onSuccess(final LayoutGroup result) { | |
| 111 | 111 | // TODO check if result.getTableName() is the same as the tableName field. Update it if it's not the | |
| 112 | 112 | // same. | |
| 113 | listView.setCellTable(documentID, result, localeID, quickFind); | ||
| 113 | listView.setCellTable(documentID, result, quickFind); | ||
| 114 | 114 | } | |
| 115 | 115 | }; | |
| 116 | |||
| 117 | final String localeID = Utils.getCurrentLocaleID(); | ||
| 116 | 118 | OnlineGlomServiceAsync.Util.getInstance().getListViewLayout(documentID, tableName, localeID, callback); | |
| 117 | 119 | ||
| 118 | 120 | // TODO: Avoid the code duplication with DetailsActivity. | |
| … | … | ||
| 124 | 124 | public void onQuickFindChange(final QuickFindChangeEvent event) { | |
| 125 | 125 | // We switch to the List view, to show search results. | |
| 126 | 126 | // TODO: Show the details view if there is only one result. | |
| 127 | goTo(new ListPlace(documentID, tableName, localeID, event.getNewQuickFindText())); | ||
| 127 | goTo(new ListPlace(documentID, tableName, event.getNewQuickFindText())); | ||
| 128 | 128 | } | |
| 129 | 129 | }); | |
| 130 | 130 | ||
| … | … | ||
| 133 | 133 | @Override | |
| 134 | 134 | public void onLocaleChange(final LocaleChangeEvent event) { | |
| 135 | 135 | // note the empty primary key item | |
| 136 | goTo(new ListPlace(documentID, tableName, event.getNewLocaleID(), quickFind)); | ||
| 136 | goTo(new ListPlace(documentID, tableName, quickFind)); | ||
| 137 | 137 | } | |
| 138 | 138 | }); | |
| 139 | 139 |
|   | |||
| 22 | 22 | import org.glom.web.client.StringUtils; | |
| 23 | 23 | import org.glom.web.client.ClientFactory; | |
| 24 | 24 | import org.glom.web.client.OnlineGlomServiceAsync; | |
| 25 | import org.glom.web.client.Utils; | ||
| 25 | 26 | import org.glom.web.client.event.LocaleChangeEvent; | |
| 26 | 27 | import org.glom.web.client.event.QuickFindChangeEvent; | |
| 27 | 28 | import org.glom.web.client.event.TableChangeEvent; | |
| … | … | ||
| 40 | 40 | import com.google.gwt.event.dom.client.HasChangeHandlers; | |
| 41 | 41 | import com.google.gwt.event.shared.EventBus; | |
| 42 | 42 | import com.google.gwt.event.shared.HandlerRegistration; | |
| 43 | import com.google.gwt.i18n.client.LocaleInfo; | ||
| 43 | 44 | import com.google.gwt.place.shared.Place; | |
| 44 | 45 | import com.google.gwt.user.client.Window; | |
| 45 | 46 | import com.google.gwt.user.client.rpc.AsyncCallback; | |
| … | … | ||
| 54 | 54 | private String documentID; | |
| 55 | 55 | private String documentTitle; | |
| 56 | 56 | private String tableName; | |
| 57 | private String localeID; | ||
| 58 | 57 | private String quickFind; | |
| 59 | 58 | private HandlerRegistration tableChangeHandlerRegistration = null; | |
| 60 | 59 | private HandlerRegistration quickFindChangeHandlerRegistration = null; | |
| … | … | ||
| 108 | 108 | @Override | |
| 109 | 109 | public void onChange(final ChangeEvent event) { | |
| 110 | 110 | // Show the translated version of the document title and the table names: | |
| 111 | localeID = tableSelectionView.getSelectedLocale(); | ||
| 111 | final String localeID = tableSelectionView.getSelectedLocale(); | ||
| 112 | 112 | fillView(tableSelectionView); | |
| 113 | |||
| 114 | final String newURL = Window.Location.createUrlBuilder().setParameter(LocaleInfo.getLocaleQueryParam(), localeID).buildString(); | ||
| 115 | Window.Location.assign(newURL); | ||
| 113 | 116 | ||
| 114 | 117 | // Fire a locale change event so that other views (e.g. the details view) know about the change and can | |
| 115 | 118 | // update themselves. | |
| … | … | ||
| 146 | 146 | tableSelectionView.setSelectedTableName(tableName); | |
| 147 | 147 | ||
| 148 | 148 | tableSelectionView.setLocaleList(result.getLocaleIDs(), result.getLocaleTitles()); | |
| 149 | |||
| 150 | final String localeID = Utils.getCurrentLocaleID(); | ||
| 149 | 151 | tableSelectionView.setSelectedLocale(localeID); | |
| 150 | 152 | ||
| 151 | 153 | documentTitle = result.getTitle(); | |
| … | … | ||
| 155 | 155 | Window.setTitle(documentTitle + ": " + tableSelectionView.getSelectedTableTitle()); | |
| 156 | 156 | } | |
| 157 | 157 | }; | |
| 158 | final String localeID = Utils.getCurrentLocaleID(); | ||
| 158 | 159 | OnlineGlomServiceAsync.Util.getInstance().getDocumentInfo(documentID, localeID, callback); | |
| 159 | 160 | ||
| 160 | 161 | // Show the quickFind text that was specified by the URL token: | |
| … | … | ||
| 167 | 167 | public void setPlace(final HasSelectableTablePlace place) { | |
| 168 | 168 | documentID = place.getDocumentID(); | |
| 169 | 169 | tableName = place.getTableName(); | |
| 170 | localeID = place.getLocaleID(); | ||
| 171 | 170 | ||
| 172 | 171 | try { | |
| 173 | 172 | final ListPlace asPlace = (ListPlace) place; | |
| … | … | ||
| 185 | 185 | // show the 'back to list' link if we're at a DetailsPlace, hide it otherwise | |
| 186 | 186 | if (place instanceof DetailsPlace) { | |
| 187 | 187 | tableSelectionView.setBackLinkVisible(true); | |
| 188 | tableSelectionView.setBackLink(documentID, tableName, localeID, ""); // TODO: quickfind? | ||
| 188 | tableSelectionView.setBackLink(documentID, tableName, ""); // TODO: quickfind? | ||
| 189 | 189 | } else if (place instanceof ListPlace) { | |
| 190 | 190 | tableSelectionView.setBackLinkVisible(false); | |
| 191 | 191 | } |
|   | |||
| 31 | 31 | public class DetailsPlace extends HasSelectableTablePlace { | |
| 32 | 32 | private final TypedDataItem primaryKeyValue; | |
| 33 | 33 | ||
| 34 | public DetailsPlace(final String documentID, final String tableName, final String localeID, | ||
| 34 | public DetailsPlace(final String documentID, final String tableName, | ||
| 35 | 35 | final TypedDataItem primarykeyValue) { | |
| 36 | super(documentID, tableName, localeID); | ||
| 36 | super(documentID, tableName); | ||
| 37 | 37 | this.primaryKeyValue = primarykeyValue; | |
| 38 | 38 | } | |
| 39 | 39 | ||
| … | … | ||
| 102 | 102 | final HashMap<String, String> params = new HashMap<String, String>(); | |
| 103 | 103 | params.put(documentKey, place.getDocumentID()); | |
| 104 | 104 | params.put(tableKey, place.getTableName()); | |
| 105 | params.put(localeKey, place.getLocaleID()); | ||
| 106 | 105 | params.put(primaryKeyValueKey, primaryKeyValueString); | |
| 107 | 106 | return buildParamsToken(params); | |
| 108 | 107 | } | |
| … | … | ||
| 119 | 119 | // default empty values | |
| 120 | 120 | String documentID = ""; | |
| 121 | 121 | String tableName = ""; // an empty value represents the default table | |
| 122 | String localeID = ""; | ||
| 123 | 122 | ||
| 124 | 123 | final TypedDataItem primaryKeyValue = new TypedDataItem(); | |
| 125 | 124 | ||
| 126 | 125 | final HashMap<String, String> params = getTokenParams(token); | |
| 127 | 126 | ||
| 128 | 127 | if (params == null) { | |
| 129 | return new DetailsPlace("", "", "", primaryKeyValue); | ||
| 128 | return new DetailsPlace("", "", primaryKeyValue); | ||
| 130 | 129 | } | |
| 131 | 130 | ||
| 132 | 131 | if (params.get(documentKey) != null) { | |
| … | … | ||
| 136 | 136 | tableName = params.get(tableKey); | |
| 137 | 137 | } | |
| 138 | 138 | ||
| 139 | if (params.get(localeKey) != null) { | ||
| 140 | localeID = params.get(localeKey); | ||
| 141 | } | ||
| 142 | |||
| 143 | 139 | if (params.get(primaryKeyValueKey) != null) { | |
| 144 | 140 | final String primaryKeyValueString = params.get(primaryKeyValueKey); | |
| 145 | 141 | // Set as unknown because the type of the primary key is not known at this point. A proper primary key | |
| … | … | ||
| 145 | 145 | ||
| 146 | 146 | if (StringUtils.isEmpty(documentID)) { | |
| 147 | 147 | // The documentID was not retrieved from the URL. Use empty values for the details place. | |
| 148 | return new DetailsPlace("", "", localeID, primaryKeyValue); | ||
| 148 | return new DetailsPlace("", "", primaryKeyValue); | ||
| 149 | 149 | } | |
| 150 | 150 | ||
| 151 | return new DetailsPlace(documentID, tableName, localeID, primaryKeyValue); | ||
| 151 | return new DetailsPlace(documentID, tableName, primaryKeyValue); | ||
| 152 | 152 | } | |
| 153 | 153 | } | |
| 154 | 154 |
|   | |||
| 36 | 36 | ||
| 37 | 37 | private final String documentID; | |
| 38 | 38 | private final String tableName; | |
| 39 | private final String localeID; | ||
| 40 | 39 | ||
| 41 | public HasSelectableTablePlace(final String documentID, final String tableName, final String localeID) { | ||
| 40 | public HasSelectableTablePlace(final String documentID, final String tableName) { | ||
| 42 | 41 | this.documentID = documentID; | |
| 43 | 42 | this.tableName = tableName; | |
| 44 | this.localeID = localeID; | ||
| 45 | 43 | } | |
| 46 | 44 | ||
| 47 | 45 | public String getDocumentID() { | |
| … | … | ||
| 50 | 50 | return tableName; | |
| 51 | 51 | } | |
| 52 | 52 | ||
| 53 | public String getLocaleID() { | ||
| 54 | return localeID; | ||
| 55 | } | ||
| 56 | |||
| 57 | 53 | public static class Tokenizer { | |
| 58 | 54 | protected final String documentKey = "document"; | |
| 59 | 55 | protected final String tableKey = "table"; | |
| 60 | protected final String localeKey = "lang"; | ||
| 61 | 56 | private final String separator = "&"; | |
| 62 | 57 | private final String equals = "="; | |
| 63 | 58 |
|   | |||
| 30 | 30 | ||
| 31 | 31 | private final String quickFind; | |
| 32 | 32 | ||
| 33 | public ListPlace(final String documentID, final String tableName, final String localeID, final String quickFind) { | ||
| 34 | super(documentID, tableName, localeID); | ||
| 33 | public ListPlace(final String documentID, final String tableName, final String quickFind) { | ||
| 34 | super(documentID, tableName); | ||
| 35 | 35 | this.quickFind = quickFind; | |
| 36 | 36 | } | |
| 37 | 37 | ||
| … | … | ||
| 48 | 48 | final HashMap<String, String> params = new HashMap<String, String>(); | |
| 49 | 49 | params.put(documentKey, place.getDocumentID()); | |
| 50 | 50 | params.put(tableKey, place.getTableName()); | |
| 51 | params.put(localeKey, place.getLocaleID()); | ||
| 52 | 51 | params.put(quickFindKey, place.getQuickFind()); | |
| 53 | 52 | return buildParamsToken(params); | |
| 54 | 53 | } | |
| … | … | ||
| 57 | 57 | // default empty values | |
| 58 | 58 | String documentID = ""; | |
| 59 | 59 | String tableName = ""; // an empty value represents the default table | |
| 60 | String localeID = ""; | ||
| 61 | 60 | String quickFind = ""; | |
| 62 | 61 | ||
| 63 | 62 | final HashMap<String, String> params = getTokenParams(token); | |
| 64 | 63 | ||
| 65 | 64 | if (params == null) { | |
| 66 | return new ListPlace("", "", "", ""); | ||
| 65 | return new ListPlace("", "", ""); | ||
| 67 | 66 | } | |
| 68 | 67 | ||
| 69 | 68 | if (params.get(documentKey) != null) { | |
| … | … | ||
| 73 | 73 | tableName = params.get(tableKey); | |
| 74 | 74 | } | |
| 75 | 75 | ||
| 76 | if (params.get(localeKey) != null) { | ||
| 77 | localeID = params.get(localeKey); | ||
| 78 | } | ||
| 79 | |||
| 80 | 76 | if (params.get(quickFindKey) != null) { | |
| 81 | 77 | quickFind = params.get(quickFindKey); | |
| 82 | 78 | } | |
| 83 | 79 | ||
| 84 | 80 | if (StringUtils.isEmpty(documentID)) { | |
| 85 | 81 | // The documentID was not retrieved from the URL. Use empty values for the list place. | |
| 86 | return new ListPlace("", "", localeID, ""); | ||
| 82 | return new ListPlace("", "", ""); | ||
| 87 | 83 | } | |
| 88 | 84 | ||
| 89 | return new ListPlace(documentID, tableName, localeID, quickFind); | ||
| 85 | return new ListPlace(documentID, tableName, quickFind); | ||
| 90 | 86 | } | |
| 91 | 87 | } | |
| 92 | 88 |
|   | |||
| 21 | 21 | ||
| 22 | 22 | public interface DocumentSelectionView extends View { | |
| 23 | 23 | ||
| 24 | void addDocumentLink(String documentID, String title, String localeID); | ||
| 24 | void addDocumentLink(String documentID, String title); | ||
| 25 | 25 | ||
| 26 | 26 | void clearHyperLinks(); | |
| 27 | 27 |
|   | |||
| 52 | 52 | } | |
| 53 | 53 | ||
| 54 | 54 | @Override | |
| 55 | public void addDocumentLink(final String documentID, final String title, final String localeID) { | ||
| 55 | public void addDocumentLink(final String documentID, final String title) { | ||
| 56 | 56 | final Anchor link = new Anchor(title); | |
| 57 | 57 | link.setStyleName("documentLink"); | |
| 58 | 58 | link.addClickHandler(new ClickHandler() { | |
| 59 | 59 | @Override | |
| 60 | 60 | public void onClick(final ClickEvent event) { | |
| 61 | presenter.goTo(new ListPlace(documentID, "", localeID, "")); | ||
| 61 | presenter.goTo(new ListPlace(documentID, "", "")); | ||
| 62 | 62 | } | |
| 63 | 63 | }); | |
| 64 | 64 | documentLinks.add(link); |
|   | |||
| 26 | 26 | */ | |
| 27 | 27 | public interface ListView extends View { | |
| 28 | 28 | ||
| 29 | public void setCellTable(final String documentID, LayoutGroup layoutGroup, String localeID, String quickFind); | ||
| 29 | public void setCellTable(final String documentID, LayoutGroup layoutGroup, String quickFind); | ||
| 30 | 30 | } |
|   | |||
| 39 | 39 | private class ListViewNavigationButtonCell extends NavigationButtonCell { | |
| 40 | 40 | private final String documentID; | |
| 41 | 41 | private final String tableName; | |
| 42 | private final String localeID; | ||
| 43 | 42 | ||
| 44 | public ListViewNavigationButtonCell(final String documentID, final String tableName, final String localeID) { | ||
| 43 | public ListViewNavigationButtonCell(final String documentID, final String tableName) { | ||
| 45 | 44 | this.documentID = documentID; | |
| 46 | 45 | this.tableName = tableName; | |
| 47 | this.localeID = localeID; | ||
| 48 | 46 | } | |
| 49 | 47 | ||
| 50 | 48 | /* | |
| … | … | ||
| 55 | 55 | @Override | |
| 56 | 56 | protected void onEnterKeyDown(final Context context, final Element parent, final String value, | |
| 57 | 57 | final NativeEvent event, final ValueUpdater<String> valueUpdater) { | |
| 58 | presenter.goTo(new DetailsPlace(documentID, tableName, localeID, (TypedDataItem) context.getKey())); | ||
| 58 | presenter.goTo(new DetailsPlace(documentID, tableName, (TypedDataItem) context.getKey())); | ||
| 59 | 59 | } | |
| 60 | 60 | ||
| 61 | 61 | } | |
| … | … | ||
| 73 | 73 | } | |
| 74 | 74 | ||
| 75 | 75 | @Override | |
| 76 | public void setCellTable(final String documentID, final LayoutGroup layoutGroup, final String localeID, | ||
| 76 | public void setCellTable(final String documentID, final LayoutGroup layoutGroup, | ||
| 77 | 77 | final String quickFind) { | |
| 78 | 78 | // This is not really in the MVP style because we're creating a new ListTable (really just a configured | |
| 79 | 79 | // CellTable) for every document and table name change. The issue with creating a re-usable CellTable with | |
| … | … | ||
| 87 | 87 | mainPanel.clear(); | |
| 88 | 88 | ||
| 89 | 89 | final ListViewTable listViewTable = new ListViewTable(documentID, layoutGroup, | |
| 90 | new ListViewNavigationButtonCell(documentID, layoutGroup.getTableName(), localeID), quickFind); | ||
| 90 | new ListViewNavigationButtonCell(documentID, layoutGroup.getTableName()), quickFind); | ||
| 91 | 91 | ||
| 92 | 92 | if (layoutGroup.getExpectedResultSize() <= listViewTable.getMinNumVisibleRows()) { | |
| 93 | 93 | // Set the table row count to the minimum row count if the data row count is less than or equal to |
|   | |||
| 60 | 60 | ||
| 61 | 61 | void setBackLinkVisible(boolean visible); | |
| 62 | 62 | ||
| 63 | void setBackLink(final String documentID, final String tableName, final String localeID, String quickFind); | ||
| 63 | void setBackLink(final String documentID, final String tableName, String quickFind); | ||
| 64 | 64 | ||
| 65 | 65 | void setDocumentTitle(String documentTitle); | |
| 66 | 66 | } |
|   | |||
| 86 | 86 | ||
| 87 | 87 | localesChooser.setStyleName("localeschooser"); // TODO: This is tedious. | |
| 88 | 88 | ||
| 89 | // headbox with the table selector | ||
| 89 | // headbox with the table selector | ||
| 90 | 90 | final FlowPanel headbox = new FlowPanel(); | |
| 91 | 91 | DOM.setElementAttribute(headbox.getElement(), "id", "headbox"); | |
| 92 | 92 | headbox.add(tablesChooser); | |
| … | … | ||
| 133 | 133 | } | |
| 134 | 134 | ||
| 135 | 135 | @Override | |
| 136 | public void setBackLink(final String documentID, final String tableName, final String localeID, | ||
| 136 | public void setBackLink(final String documentID, final String tableName, | ||
| 137 | 137 | final String quickFind) { | |
| 138 | 138 | backLinkHandlerReg.removeHandler(); | |
| 139 | 139 | backLinkHandlerReg = backLink.addClickHandler(new ClickHandler() { | |
| 140 | 140 | @Override | |
| 141 | 141 | public void onClick(final ClickEvent event) { | |
| 142 | presenter.goTo(new ListPlace(documentID, tableName, localeID, "")); | ||
| 142 | presenter.goTo(new ListPlace(documentID, tableName, "")); | ||
| 143 | 143 | } | |
| 144 | 144 | }); | |
| 145 | 145 | } |

