Reorganizes bikeshed/src/com/google/gwt/samples/expenses to a more ideal
layout. In particular sets patterns for multiple entry points and
shared code.
Review at http://gwt-code-reviews.appspot.com/294802
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7876 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/bikeshed/eclipse.README b/bikeshed/eclipse.README
index 73a1c00..952072b 100644
--- a/bikeshed/eclipse.README
+++ b/bikeshed/eclipse.README
@@ -13,9 +13,13 @@
classes/
# Matches gwtc output in the war directory, e.g. war/com.google.gwt.bikeshed.tree.Tree/
com.google.gwt.*
-bikeshed/war/expenses/
+bikeshed/war/expensesCustomized/
bikeshed/war/expensesScaffold/
-bikeshed/war/stocks/
+bikeshed/war/mail/
+bikeshed/war/pagedExpenses/
+bikeshed/war/simplecelllist/
+bikeshed/war/stocksdesktop/
+bikeshed/war/stocksmobile/
bikeshed/war/tree/
bikeshed/war/validation/
diff --git a/bikeshed/src/com/google/gwt/requestfactory/RequestFactory.gwt.xml b/bikeshed/src/com/google/gwt/requestfactory/RequestFactory.gwt.xml
index 495b94f..596b46c 100644
--- a/bikeshed/src/com/google/gwt/requestfactory/RequestFactory.gwt.xml
+++ b/bikeshed/src/com/google/gwt/requestfactory/RequestFactory.gwt.xml
@@ -1,3 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.1/distro-source/core/src/gwt-module.dtd">
<!--
Copyright 2010 Google Inc.
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/Expenses.gwt.xml b/bikeshed/src/com/google/gwt/sample/expenses/Expenses.gwt.xml
deleted file mode 100644
index 10961e0..0000000
--- a/bikeshed/src/com/google/gwt/sample/expenses/Expenses.gwt.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 0.0.999//EN" "http://google-web-toolkit.googlecode.com/svn/tags/0.0.999/distro-source/core/src/gwt-module.dtd">
-<module rename-to='expenses'>
-
- <inherits name='com.google.gwt.user.User'/>
- <inherits name='com.google.gwt.user.theme.standard.Standard'/>
- <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
- <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
- <inherits name='com.google.gwt.app.App' />
- <inherits name='com.google.gwt.requestfactory.RequestFactory'/>
- <inherits name="com.google.gwt.bikeshed.list.List" />
-
- <!-- Specify the app entry point class. -->
- <entry-point class='com.google.gwt.sample.expenses.client.Expenses'/>
-
- <!-- Specify the paths for translatable code -->
- <source path='client'/>
- <source path='shared'/>
- <source path='gen'/>
-</module>
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/ExpensesScaffold.gwt.xml b/bikeshed/src/com/google/gwt/sample/expenses/ExpensesScaffold.gwt.xml
deleted file mode 100644
index 30e7a84..0000000
--- a/bikeshed/src/com/google/gwt/sample/expenses/ExpensesScaffold.gwt.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Could not determine the version of your GWT SDK; using the module DTD from GWT 1.6.4. You may want to change this. -->
-<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.4//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.4/distro-source/core/src/gwt-module.dtd">
-<module rename-to='expensesScaffold'>
- <inherits name='com.google.gwt.user.User' />
- <inherits name='com.google.gwt.app.App' />
- <inherits name='com.google.gwt.user.theme.standard.Standard' />
-
- <inherits name="com.google.gwt.requestfactory.RequestFactory" />
- <inherits name="com.google.gwt.bikeshed.list.List" />
-
- <source path='client' />
- <source path='shared' />
- <source path='gen' />
- <entry-point
- class="com.google.gwt.sample.expenses.client.ExpensesScaffold" />
-</module>
\ No newline at end of file
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/EntityListView.java b/bikeshed/src/com/google/gwt/sample/expenses/client/EntityListView.java
deleted file mode 100644
index 30e46d2..0000000
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/EntityListView.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.sample.expenses.client;
-
-import com.google.gwt.user.client.Command;
-
-import java.util.List;
-
-/**
- * Simple display of a list of entities.
- */
-public interface EntityListView {
-
- /**
- * Interface implemented by a row of data to display.
- */
- interface Row {
- /**
- * @return command to edit this row
- */
- Command getEditCommand();
-
- /**
- * @return command to show the details for this row
- */
- Command getShowDetailsCommand();
-
- /**
- * @return the strings to render for this row
- */
- List<String> getValues();
- }
-
- void setHeading(String text);
-
- void setRowData(List<String> columnNames, List<Row> rows);
-}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/ExpensesScaffold.java b/bikeshed/src/com/google/gwt/sample/expenses/client/ExpensesScaffold.java
deleted file mode 100644
index a914a86..0000000
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/ExpensesScaffold.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.sample.expenses.client;
-
-import com.google.gwt.app.place.PlaceChanged;
-import com.google.gwt.app.place.PlaceController;
-import com.google.gwt.app.place.PlacePicker;
-import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.shared.HandlerManager;
-import com.google.gwt.sample.expenses.client.place.AbstractExpensesPlace;
-import com.google.gwt.sample.expenses.client.place.EntityListPlace;
-import com.google.gwt.sample.expenses.client.place.Places;
-import com.google.gwt.sample.expenses.shared.ExpenseRequestFactory;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.RootLayoutPanel;
-
-/**
- * Application for browsing the entities of the Expenses app.
- */
-public class ExpensesScaffold implements EntryPoint {
-
- public void onModuleLoad() {
-
- // App controllers and services
- final HandlerManager eventBus = new HandlerManager(null);
- final ExpenseRequestFactory requestFactory = GWT.create(ExpenseRequestFactory.class);
- requestFactory.init(eventBus);
-
- final PlaceController<AbstractExpensesPlace> placeController = new PlaceController<AbstractExpensesPlace>(
- eventBus);
- final Places places = new Places(placeController);
-
- // Renderers
- final EntityNameRenderer entityNamer = new EntityNameRenderer();
- final ListPlaceRenderer listPlaceNamer = new ListPlaceRenderer(entityNamer);
-
- // Top level UI
- final ExpensesScaffoldShell shell = new ExpensesScaffoldShell();
-
- // Left side
- PlacePicker<EntityListPlace> placePicker = new PlacePicker<EntityListPlace>(
- shell.getPlacesBox(), placeController, listPlaceNamer);
- placePicker.setPlaces(places.getListPlaces());
-
- // Shows entity lists
- eventBus.addHandler(PlaceChanged.TYPE, new ListRequester(places,
- shell.getBody(), requestFactory, listPlaceNamer));
-
- // Shared view for entity details.
- // TODO Real app should not share
- final HTML detailsView = new HTML();
- eventBus.addHandler(PlaceChanged.TYPE, new DetailsRequester(entityNamer,
- shell.getBody(), detailsView));
-
- // Hide the loading message
- Element loading = Document.get().getElementById("loading");
- loading.getParentElement().removeChild(loading);
-
- RootLayoutPanel.get().add(shell);
- }
-}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/ListRequester.java b/bikeshed/src/com/google/gwt/sample/expenses/client/ListRequester.java
deleted file mode 100644
index 254c732..0000000
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/ListRequester.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.sample.expenses.client;
-
-import com.google.gwt.app.place.PlaceChanged;
-import com.google.gwt.sample.expenses.client.place.EntityListPlace;
-import com.google.gwt.sample.expenses.client.place.Places;
-import com.google.gwt.sample.expenses.shared.EmployeeKey;
-import com.google.gwt.sample.expenses.shared.ExpenseRequestFactory;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityKey;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityVisitor;
-import com.google.gwt.sample.expenses.shared.ReportKey;
-import com.google.gwt.user.client.ui.Renderer;
-import com.google.gwt.user.client.ui.SimplePanel;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * In charge of requesting and displaying the appropriate entity lists when the
- * user goes to an {@link EntityListPlace}.
- */
-public final class ListRequester implements PlaceChanged.Handler {
-
- private final SimplePanel panel;
- private final ExpenseRequestFactory requests;
- private final Renderer<EntityListPlace> placeRenderer;
- private final Places places;
-
- // TODO This dependency on view classes prevents testing this class in JRE.
- // Get a factory in here or something
- private final Map<EntityListPlace, ValuesListViewTable<?>> viewMap = new HashMap<EntityListPlace, ValuesListViewTable<?>>();
-
- public ListRequester(Places places, SimplePanel panel,
- ExpenseRequestFactory requests, Renderer<EntityListPlace> renderer) {
- this.places = places;
- this.panel = panel;
- this.requests = requests;
- this.placeRenderer = renderer;
- }
-
- public void onPlaceChanged(PlaceChanged event) {
- if (!(event.getNewPlace() instanceof EntityListPlace)) {
- return;
- }
- final EntityListPlace newPlace = (EntityListPlace) event.getNewPlace();
- ExpensesEntityKey<?> key = newPlace.getKey();
-
- key.accept(new ExpensesEntityVisitor() {
-
- public void visit(EmployeeKey employeeKey) {
- ValuesListViewTable<?> view = viewMap.get(newPlace);
- if (null == view) {
- view = new EmployeeListView(placeRenderer.render(newPlace), places,
- requests);
- viewMap.put(newPlace, view);
- }
- }
-
- public void visit(ReportKey reportKey) {
- ValuesListViewTable<?> view = viewMap.get(newPlace);
- if (null == view) {
- view = new ReportListView(placeRenderer.render(newPlace), places,
- requests);
- viewMap.put(newPlace, view);
- }
- }
- });
-
- ValuesListViewTable<?> entitiesView = viewMap.get(newPlace);
- if (entitiesView.getParent() == null) {
- panel.clear();
- panel.add(entitiesView);
- }
- }
-}
\ No newline at end of file
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/place/Places.java b/bikeshed/src/com/google/gwt/sample/expenses/client/place/Places.java
deleted file mode 100644
index 21f01e5..0000000
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/place/Places.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.sample.expenses.client.place;
-
-import com.google.gwt.app.place.PlaceController;
-import com.google.gwt.bikeshed.cells.client.ActionCell;
-import com.google.gwt.sample.expenses.shared.EmployeeKey;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityKey;
-import com.google.gwt.sample.expenses.shared.ReportKey;
-import com.google.gwt.valuestore.shared.Values;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Object with knowledge of the places of the ExpensesScaffold app.
- */
-public class Places {
- private final PlaceController<AbstractExpensesPlace> controller;
-
- private final List<EntityListPlace> listPlaces;
-
- public Places(PlaceController<AbstractExpensesPlace> controller) {
- this.controller = controller;
-
- ArrayList<EntityListPlace> places = new ArrayList<EntityListPlace>();
- places.add(new EntityListPlace(EmployeeKey.get()));
- places.add(new EntityListPlace(ReportKey.get()));
- listPlaces = Collections.unmodifiableList(places);
- }
-
- public <K extends ExpensesEntityKey<K>> ActionCell.Delegate<Values<K>> getDetailsGofer() {
- return new ActionCell.Delegate<Values<K>>() {
- public void execute(Values<K> object) {
- goToDetailsFor(object);
- }
- };
- }
-
- public <K extends ExpensesEntityKey<K>> ActionCell.Delegate<Values<K>> getEditorGofer() {
- return new ActionCell.Delegate<Values<K>>() {
- public void execute(Values<K> object) {
- goToEditorFor(object);
- }
- };
- }
-
- public List<EntityListPlace> getListPlaces() {
- return listPlaces;
- }
-
- private void goToDetailsFor(Values<? extends ExpensesEntityKey<?>> e) {
- controller.goTo(new EntityDetailsPlace(e));
- }
-
- private void goToEditorFor(Values<? extends ExpensesEntityKey<?>> e) {
- controller.goTo(new EditEntityPlace(e));
- }
-}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ExpensesCommon.gwt.xml b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ExpensesCommon.gwt.xml
new file mode 100644
index 0000000..2510e8c
--- /dev/null
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ExpensesCommon.gwt.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 0.0.999//EN" "http://google-web-toolkit.googlecode.com/svn/tags/0.0.999/distro-source/core/src/gwt-module.dtd">
+<module>
+ <inherits name='com.google.gwt.app.App' />
+ <inherits name='com.google.gwt.requestfactory.RequestFactory'/>
+ <inherits name="com.google.gwt.bikeshed.list.List" />
+
+ <source path='request'/>
+ <source path='place'/>
+ <source path='ui'/>
+</module>
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ExpensesCustomized.gwt.xml b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ExpensesCustomized.gwt.xml
new file mode 100644
index 0000000..0206721
--- /dev/null
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ExpensesCustomized.gwt.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 0.0.999//EN" "http://google-web-toolkit.googlecode.com/svn/tags/0.0.999/distro-source/core/src/gwt-module.dtd">
+<module rename-to="expensesCustomized">
+ <inherits name="com.google.gwt.user.User" />
+ <inherits name="com.google.gwt.user.theme.standard.Standard" />
+
+ <inherits name="com.google.gwt.sample.expenses.gwt.ExpensesCommon" />
+
+ <source path="customized" />
+ <entry-point
+ class="com.google.gwt.sample.expenses.gwt.customized.Customized" />
+</module>
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ExpensesScaffold.gwt.xml b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ExpensesScaffold.gwt.xml
new file mode 100644
index 0000000..f3e5ba4
--- /dev/null
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ExpensesScaffold.gwt.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.1/distro-source/core/src/gwt-module.dtd">
+<!--
+ Copyright 2010 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ use this file except in compliance with the License. You may obtain a copy of
+ the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ License for the specific language governing permissions and limitations under
+ the License.
+-->
+<module rename-to="expensesScaffold">
+ <inherits name="com.google.gwt.user.User" />
+ <inherits name="com.google.gwt.user.theme.standard.Standard" />
+
+ <inherits name="com.google.gwt.sample.expenses.gwt.ExpensesCommon" />
+
+ <source path="scaffold" />
+ <entry-point
+ class="com.google.gwt.sample.expenses.gwt.scaffold.Scaffold" />
+</module>
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/Expenses.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/Customized.java
similarity index 83%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/Expenses.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/Customized.java
index 7124305..1fa5b9e 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/Expenses.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/Customized.java
@@ -13,15 +13,15 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.sample.expenses.gwt.customized;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
-import com.google.gwt.sample.expenses.shared.EmployeeKey;
-import com.google.gwt.sample.expenses.shared.ExpenseRequestFactory;
-import com.google.gwt.sample.expenses.shared.ReportChanged;
-import com.google.gwt.sample.expenses.shared.ReportKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory;
+import com.google.gwt.sample.expenses.gwt.request.EmployeeKey;
+import com.google.gwt.sample.expenses.gwt.request.ReportChanged;
+import com.google.gwt.sample.expenses.gwt.request.ReportKey;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.valuestore.shared.DeltaValueStore;
import com.google.gwt.valuestore.shared.Property;
@@ -37,24 +37,24 @@
* This app is a mess right now, but it will become the showcase example of a
* custom app written to RequestFactory
*/
-public class Expenses implements EntryPoint {
+public class Customized implements EntryPoint {
/**
* This is the entry point method.
*/
public void onModuleLoad() {
final HandlerManager eventBus = new HandlerManager(null);
- final ExpenseRequestFactory requestFactory = GWT.create(ExpenseRequestFactory.class);
+ final ExpensesRequestFactory requestFactory = GWT.create(ExpensesRequestFactory.class);
requestFactory.init(eventBus);
RootLayoutPanel root = RootLayoutPanel.get();
- final Shell shell = new Shell();
+ final CustomizedShell shell = new CustomizedShell();
final EmployeeList employees = new EmployeeList(shell.users);
root.add(shell);
- shell.setListener(new Shell.Listener() {
+ shell.setListener(new CustomizedShell.Listener() {
public void setFirstPurpose(String purpose) {
DeltaValueStore deltaValueStore = requestFactory.getValueStore().spawnDeltaView();
Values<ReportKey> report = shell.getValues().get(0);
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/Shell.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/CustomizedShell.java
similarity index 91%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/Shell.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/CustomizedShell.java
index ecef4a5..2e059f4 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/Shell.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/CustomizedShell.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.sample.expenses.gwt.customized;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
@@ -25,8 +25,8 @@
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.sample.expenses.shared.ReportChanged;
-import com.google.gwt.sample.expenses.shared.ReportKey;
+import com.google.gwt.sample.expenses.gwt.request.ReportChanged;
+import com.google.gwt.sample.expenses.gwt.request.ReportKey;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
@@ -47,12 +47,12 @@
* UI shell for expenses sample app. A horrible clump of stuff that should be
* refactored into proper MVP pieces.
*/
-public class Shell extends Composite implements TakesValueList<Values<ReportKey>>, ReportChanged.Handler {
+public class CustomizedShell extends Composite implements TakesValueList<Values<ReportKey>>, ReportChanged.Handler {
interface Listener {
void setFirstPurpose(String purpose);
}
- interface ShellUiBinder extends UiBinder<Widget, Shell> {
+ interface ShellUiBinder extends UiBinder<Widget, CustomizedShell> {
}
private static ShellUiBinder uiBinder = GWT.create(ShellUiBinder.class);
@@ -73,7 +73,7 @@
Button save;
private List<Values<ReportKey>> values;
- public Shell() {
+ public CustomizedShell() {
initWidget(uiBinder.createAndBindUi(this));
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/Shell.ui.xml b/bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/CustomizedShell.ui.xml
similarity index 93%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/Shell.ui.xml
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/CustomizedShell.ui.xml
index 9e08c7e..4c36cc6 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/Shell.ui.xml
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/CustomizedShell.ui.xml
@@ -1,6 +1,6 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:e='urn:import:com.google.gwt.sample.expenses.client'>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:style>
.disabled {
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/EmployeeList.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/EmployeeList.java
similarity index 91%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/EmployeeList.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/EmployeeList.java
index 2131d4b..1634658 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/EmployeeList.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/customized/EmployeeList.java
@@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.sample.expenses.gwt.customized;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.sample.expenses.shared.EmployeeKey;
+import com.google.gwt.sample.expenses.gwt.request.EmployeeKey;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TakesValueList;
import com.google.gwt.valuestore.shared.Values;
@@ -26,7 +26,7 @@
/**
* Manages the Employee ListBox. This should grow into a proper View, with a
- * corresponding Presenter factored out of {@link Expenses}
+ * corresponding Presenter factored out of {@link Customized}
*/
public final class EmployeeList implements TakesValueList<Values<EmployeeKey>> {
interface Listener {
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/place/EntityDetailsPlace.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesDetailsPlace.java
similarity index 68%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/place/EntityDetailsPlace.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesDetailsPlace.java
index ee91140..c59f613 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/place/EntityDetailsPlace.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesDetailsPlace.java
@@ -13,20 +13,18 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client.place;
+package com.google.gwt.sample.expenses.gwt.place;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKey;
import com.google.gwt.valuestore.shared.Values;
/**
- * Place in the app to see details of an entity.
+ * Place in an app to see details of a particular
+ * {@link com.google.gwt.valuestore.shared.ValueStore ValueStore} record.
*/
-public class EntityDetailsPlace extends ExpenseEntityPlace {
+public class ExpensesDetailsPlace extends ExpensesValuesPlace {
- /**
- * @param e
- */
- public EntityDetailsPlace(Values<? extends ExpensesEntityKey<?>> entity) {
+ public ExpensesDetailsPlace(Values<? extends ExpensesKey<?>> entity) {
// TODO it is bad to be passing the values rather than an id. Want
// to force UI code to request the data it needs
super(entity);
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/place/EditEntityPlace.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesEditorPlace.java
similarity index 64%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/place/EditEntityPlace.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesEditorPlace.java
index 23bf521..914dd99 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/place/EditEntityPlace.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesEditorPlace.java
@@ -13,17 +13,18 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client.place;
+package com.google.gwt.sample.expenses.gwt.place;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKey;
import com.google.gwt.valuestore.shared.Values;
/**
- * Place in the app to edit an entity.
+ * Place in an app to edit the values of a particular
+ * {@link com.google.gwt.valuestore.shared.ValueStore ValueStore} record.
*/
-public class EditEntityPlace extends ExpenseEntityPlace {
+public class ExpensesEditorPlace extends ExpensesValuesPlace {
- public EditEntityPlace(Values<? extends ExpensesEntityKey<?>> entity) {
+ public ExpensesEditorPlace(Values<? extends ExpensesKey<?>> entity) {
super(entity);
}
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/place/EntityListPlace.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesListPlace.java
similarity index 63%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/place/EntityListPlace.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesListPlace.java
index 5575542..85a9ea8 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/place/EntityListPlace.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesListPlace.java
@@ -13,24 +13,26 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client.place;
+package com.google.gwt.sample.expenses.gwt.place;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKey;
/**
- * Place in the app that lists all Entities of a type.
+ * Place in an app that lists
+ * {@link com.google.gwt.valuestore.shared.ValueStore ValueStore} records of a
+ * particular type.
*/
-public class EntityListPlace extends AbstractExpensesPlace {
- private final ExpensesEntityKey<?> key;
+public class ExpensesListPlace extends ExpensesPlace {
+ private final ExpensesKey<?> key;
/**
* @param key the schema of the entities at this place
*/
- public EntityListPlace(ExpensesEntityKey<?> key) {
+ public ExpensesListPlace(ExpensesKey<?> key) {
this.key = key;
}
-
- public ExpensesEntityKey<?> getKey() {
+
+ public ExpensesKey<?> getKey() {
return key;
}
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/place/AbstractExpensesPlace.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesPlace.java
similarity index 70%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/place/AbstractExpensesPlace.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesPlace.java
index 4401c56..bf0d22f 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/place/AbstractExpensesPlace.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesPlace.java
@@ -13,13 +13,14 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client.place;
+package com.google.gwt.sample.expenses.gwt.place;
import com.google.gwt.app.place.Place;
/**
- * Base type of places for the Expenses Scaffold app.
+ * Base type of places for an app.
*/
-public abstract class AbstractExpensesPlace extends Place {
- // TODO is there actual value in this base class?
+public abstract class ExpensesPlace extends Place {
+ // TODO is there actual value in this base class? Yes, if visitors
+ // and fiters leave the keys and come back to places.
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesPlaces.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesPlaces.java
new file mode 100644
index 0000000..807e521
--- /dev/null
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesPlaces.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.sample.expenses.gwt.place;
+
+import com.google.gwt.app.place.PlaceController;
+import com.google.gwt.bikeshed.cells.client.ActionCell;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKey;
+import com.google.gwt.valuestore.shared.Values;
+
+/**
+ * Object with knowledge of the places of an app.
+ */
+public class ExpensesPlaces {
+ private final PlaceController<ExpensesPlace> controller;
+
+ public ExpensesPlaces(PlaceController<ExpensesPlace> controller) {
+ this.controller = controller;
+ }
+
+ public <K extends ExpensesKey<K>> ActionCell.Delegate<Values<K>> getDetailsGofer() {
+ return new ActionCell.Delegate<Values<K>>() {
+ public void execute(Values<K> object) {
+ goToDetailsFor(object);
+ }
+ };
+ }
+
+ public <K extends ExpensesKey<K>> ActionCell.Delegate<Values<K>> getEditorGofer() {
+ return new ActionCell.Delegate<Values<K>>() {
+ public void execute(Values<K> object) {
+ goToEditorFor(object);
+ }
+ };
+ }
+
+ private void goToDetailsFor(Values<? extends ExpensesKey<?>> e) {
+ controller.goTo(new ExpensesDetailsPlace(e));
+ }
+
+ private void goToEditorFor(Values<? extends ExpensesKey<?>> e) {
+ controller.goTo(new ExpensesEditorPlace(e));
+ }
+}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/place/ExpenseEntityPlace.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesValuesPlace.java
similarity index 60%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/place/ExpenseEntityPlace.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesValuesPlace.java
index 57436d3..6ce0972 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/place/ExpenseEntityPlace.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/place/ExpensesValuesPlace.java
@@ -13,22 +13,23 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client.place;
+package com.google.gwt.sample.expenses.gwt.place;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKey;
import com.google.gwt.valuestore.shared.Values;
/**
- * A place in the app focused on a particular entity.
+ * A place in the app focused on the {@link Values} of a particular type of
+ * {@link com.google.gwt.valuestore.shared.ValueStore ValueStore} record.
*/
-public abstract class ExpenseEntityPlace extends AbstractExpensesPlace {
+public abstract class ExpensesValuesPlace extends ExpensesPlace {
- private final Values<? extends ExpensesEntityKey<?>> entity;
+ private final Values<? extends ExpensesKey<?>> entity;
/**
* @param entity
*/
- public ExpenseEntityPlace(Values<? extends ExpensesEntityKey<?>> entity) {
+ public ExpensesValuesPlace(Values<? extends ExpensesKey<?>> entity) {
this.entity = entity;
}
@@ -36,7 +37,7 @@
/**
* @return the entity
*/
- public Values<? extends ExpensesEntityKey<?>> getEntity() {
+ public Values<? extends ExpensesKey<?>> getEntity() {
return entity;
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/shared/EmployeeChanged.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/EmployeeChanged.java
similarity index 96%
rename from bikeshed/src/com/google/gwt/sample/expenses/shared/EmployeeChanged.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/request/EmployeeChanged.java
index e51e4c2..bace733 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/shared/EmployeeChanged.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/EmployeeChanged.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.shared;
+package com.google.gwt.sample.expenses.gwt.request;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/shared/EmployeeKey.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/EmployeeKey.java
similarity index 93%
rename from bikeshed/src/com/google/gwt/sample/expenses/shared/EmployeeKey.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/request/EmployeeKey.java
index 39965b4..d4854a9 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/shared/EmployeeKey.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/EmployeeKey.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.shared;
+package com.google.gwt.sample.expenses.gwt.request;
import com.google.gwt.requestfactory.shared.Id;
import com.google.gwt.requestfactory.shared.LongString;
@@ -35,7 +35,7 @@
* <p>
* IRL this class will be generated by a JPA-savvy tool run before compilation.
*/
-public class EmployeeKey implements ExpensesEntityKey<EmployeeKey> {
+public class EmployeeKey implements ExpensesKey<EmployeeKey> {
private static EmployeeKey instance;
public static EmployeeKey get() {
@@ -73,11 +73,11 @@
}
}
- public <T> T accept(ExpensesEntityFilter<T> filter) {
+ public <T> T accept(ExpensesKeyFilter<T> filter) {
return filter.filter(this);
}
- public void accept(ExpensesEntityVisitor visitor) {
+ public void accept(ExpensesKeyVisitor visitor) {
visitor.visit(this);
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/shared/ExpensesEntityKey.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKey.java
similarity index 80%
rename from bikeshed/src/com/google/gwt/sample/expenses/shared/ExpensesEntityKey.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKey.java
index 13c3511..1ffca08 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/shared/ExpensesEntityKey.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKey.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.shared;
+package com.google.gwt.sample.expenses.gwt.request;
import com.google.gwt.valuestore.shared.ValuesKey;
@@ -26,8 +26,8 @@
*
* @param <K> this entity type
*/
-public interface ExpensesEntityKey<K extends ExpensesEntityKey<K>> extends ValuesKey<K> {
- void accept(ExpensesEntityVisitor visitor);
+public interface ExpensesKey<K extends ExpensesKey<K>> extends ValuesKey<K> {
+ void accept(ExpensesKeyVisitor visitor);
- <T> T accept(ExpensesEntityFilter<T> filter);
+ <T> T accept(ExpensesKeyFilter<T> filter);
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/shared/ExpensesEntityFilter.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyFilter.java
similarity index 88%
rename from bikeshed/src/com/google/gwt/sample/expenses/shared/ExpensesEntityFilter.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyFilter.java
index 771bea9..cff83d5 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/shared/ExpensesEntityFilter.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyFilter.java
@@ -13,16 +13,16 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.shared;
+package com.google.gwt.sample.expenses.gwt.request;
/**
- * "API Generated" base interface implemented by filters of {@link ExpensesEntityKey}.
+ * "API Generated" base interface implemented by filters of {@link ExpensesKey}.
* <p>
* IRL this class will be generated by a JPA-savvy tool run before compilation.
*
* @param <T> the type to filter to
*/
-public interface ExpensesEntityFilter<T> {
+public interface ExpensesKeyFilter<T> {
T filter(EmployeeKey employeeKey);
T filter(ReportKey reportKey);
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/shared/ExpensesEntityVisitor.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyVisitor.java
similarity index 87%
rename from bikeshed/src/com/google/gwt/sample/expenses/shared/ExpensesEntityVisitor.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyVisitor.java
index ecd260e..c0b4f81 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/shared/ExpensesEntityVisitor.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyVisitor.java
@@ -13,14 +13,14 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.shared;
+package com.google.gwt.sample.expenses.gwt.request;
/**
- * "API Generated" base interface implemented by visitors of {@link ExpensesEntityKey}.
+ * "API Generated" base interface implemented by visitors of {@link ExpensesKey}.
* <p>
* IRL this class will be generated by a JPA-savvy tool run before compilation.
*/
-public interface ExpensesEntityVisitor {
+public interface ExpensesKeyVisitor {
void visit(EmployeeKey employeeKey);
void visit(ReportKey reportKey);
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/shared/ExpenseRequestFactory.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesRequestFactory.java
similarity index 91%
rename from bikeshed/src/com/google/gwt/sample/expenses/shared/ExpenseRequestFactory.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesRequestFactory.java
index 280df5f..2307d30 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/shared/ExpenseRequestFactory.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesRequestFactory.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.shared;
+package com.google.gwt.sample.expenses.gwt.request;
import com.google.gwt.requestfactory.shared.EntityListRequest;
import com.google.gwt.requestfactory.shared.LongString;
@@ -29,7 +29,7 @@
* IRL this interface will be generated by a JPA-savvy tool run before
* compilation.
*/
-public interface ExpenseRequestFactory extends RequestFactory {
+public interface ExpensesRequestFactory extends RequestFactory {
/**
* Request selector.
@@ -70,14 +70,14 @@
public enum ServerSideOperation implements RequestDefinition {
FIND_ALL_EMPLOYEES("com.google.gwt.sample.expenses.server.domain.Employee",
"findAllEmployees", null,
- com.google.gwt.sample.expenses.shared.EmployeeKey.class), //
+ com.google.gwt.sample.expenses.gwt.request.EmployeeKey.class), //
FIND_ALL_REPORTS("com.google.gwt.sample.expenses.server.domain.Report",
"findAllReports", null,
- com.google.gwt.sample.expenses.shared.ReportKey.class), //
+ com.google.gwt.sample.expenses.gwt.request.ReportKey.class), //
FIND_REPORTS_BY_EMPLOYEE(
"com.google.gwt.sample.expenses.server.domain.Report",
"findReportsByEmployee", new Class[] {java.lang.Long.class},
- com.google.gwt.sample.expenses.shared.ReportKey.class); //
+ com.google.gwt.sample.expenses.gwt.request.ReportKey.class); //
/**
* the server side domain class.
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/shared/ReportChanged.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportChanged.java
similarity index 96%
rename from bikeshed/src/com/google/gwt/sample/expenses/shared/ReportChanged.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportChanged.java
index 1a625a9..b2c6200 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/shared/ReportChanged.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportChanged.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.shared;
+package com.google.gwt.sample.expenses.gwt.request;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/shared/ReportKey.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportKey.java
similarity index 93%
rename from bikeshed/src/com/google/gwt/sample/expenses/shared/ReportKey.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportKey.java
index 7e5530e..66e6845 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/shared/ReportKey.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportKey.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.shared;
+package com.google.gwt.sample.expenses.gwt.request;
import com.google.gwt.requestfactory.shared.Id;
import com.google.gwt.requestfactory.shared.LongString;
@@ -36,7 +36,7 @@
* <p>
* IRL this class will be generated by a JPA-savvy tool run before compilation.
*/
-public class ReportKey implements ExpensesEntityKey<ReportKey> {
+public class ReportKey implements ExpensesKey<ReportKey> {
private static ReportKey instance;
public static ReportKey get() {
@@ -73,11 +73,11 @@
}
}
- public <T> T accept(ExpensesEntityFilter<T> filter) {
+ public <T> T accept(ExpensesKeyFilter<T> filter) {
return filter.filter(this);
}
- public void accept(ExpensesEntityVisitor visitor) {
+ public void accept(ExpensesKeyVisitor visitor) {
visitor.visit(this);
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/Scaffold.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/Scaffold.java
new file mode 100644
index 0000000..d39c091
--- /dev/null
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/Scaffold.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.sample.expenses.gwt.scaffold;
+
+import com.google.gwt.app.place.PlaceChanged;
+import com.google.gwt.app.place.PlaceController;
+import com.google.gwt.app.place.PlacePicker;
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesListPlace;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesPlace;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesPlaces;
+import com.google.gwt.sample.expenses.gwt.request.EmployeeKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory;
+import com.google.gwt.sample.expenses.gwt.request.ReportKey;
+import com.google.gwt.sample.expenses.gwt.ui.ExpensesKeyNameRenderer;
+import com.google.gwt.sample.expenses.gwt.ui.ListPlaceRenderer;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.RootLayoutPanel;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Application for browsing the entities of the Expenses app.
+ */
+public class Scaffold implements EntryPoint {
+
+ public void onModuleLoad() {
+
+ // App controllers and services
+ final HandlerManager eventBus = new HandlerManager(null);
+ final ExpensesRequestFactory requestFactory = GWT.create(ExpensesRequestFactory.class);
+ requestFactory.init(eventBus);
+
+ final PlaceController<ExpensesPlace> placeController = new PlaceController<ExpensesPlace>(
+ eventBus);
+ final ExpensesPlaces places = new ExpensesPlaces(placeController);
+
+ // Renderers
+ final ExpensesKeyNameRenderer entityNamer = new ExpensesKeyNameRenderer();
+ final ListPlaceRenderer listPlaceNamer = new ListPlaceRenderer(entityNamer);
+
+ // Top level UI
+ final ScaffoldShell shell = new ScaffoldShell();
+
+ // Left side
+ PlacePicker<ExpensesListPlace> placePicker = new PlacePicker<ExpensesListPlace>(
+ shell.getPlacesBox(), placeController, listPlaceNamer);
+ List<ExpensesListPlace> topPlaces = new ArrayList<ExpensesListPlace>();
+ topPlaces.add(new ExpensesListPlace(EmployeeKey.get()));
+ topPlaces.add(new ExpensesListPlace(ReportKey.get()));
+ topPlaces = Collections.unmodifiableList(topPlaces);
+ placePicker.setPlaces(topPlaces);
+
+ // Shows entity lists
+ eventBus.addHandler(PlaceChanged.TYPE, new ScaffoldListRequester(places,
+ shell.getBody(), requestFactory, listPlaceNamer));
+
+ // Shared view for entity details.
+ // TODO Real app should not share
+ final HTML detailsView = new HTML();
+ eventBus.addHandler(PlaceChanged.TYPE, new ScaffoldDetailsRequester(entityNamer,
+ shell.getBody(), detailsView));
+
+ // Hide the loading message
+ Element loading = Document.get().getElementById("loading");
+ loading.getParentElement().removeChild(loading);
+
+ RootLayoutPanel.get().add(shell);
+ }
+}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/DetailsRequester.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldDetailsRequester.java
similarity index 73%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/DetailsRequester.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldDetailsRequester.java
index d013f5b..1b75f13 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/DetailsRequester.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldDetailsRequester.java
@@ -13,29 +13,31 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.sample.expenses.gwt.scaffold;
import com.google.gwt.app.place.PlaceChanged;
-import com.google.gwt.sample.expenses.client.place.EntityDetailsPlace;
-import com.google.gwt.sample.expenses.shared.EmployeeKey;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityKey;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityVisitor;
-import com.google.gwt.sample.expenses.shared.ReportKey;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesDetailsPlace;
+import com.google.gwt.sample.expenses.gwt.request.EmployeeKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKeyVisitor;
+import com.google.gwt.sample.expenses.gwt.request.ReportKey;
+import com.google.gwt.sample.expenses.gwt.ui.ExpensesKeyNameRenderer;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.valuestore.shared.Values;
/**
- * In charge of requesting and displaying all info when the user goes to an
- * {@link EntityDetailsPlace}.
+ * In charge of requesting and displaying details of a particular record in the
+ * appropriate view when the user goes to an {@link ExpensesDetailsPlace} in the
+ * Scaffold app.
*/
-public final class DetailsRequester implements PlaceChanged.Handler {
+public final class ScaffoldDetailsRequester implements PlaceChanged.Handler {
- private final EntityNameRenderer entityNamer;
+ private final ExpensesKeyNameRenderer entityNamer;
private final SimplePanel panel;
private final HTML detailsView;
- public DetailsRequester(EntityNameRenderer entityNamer,
+ public ScaffoldDetailsRequester(ExpensesKeyNameRenderer entityNamer,
SimplePanel simplePanel, HTML detailsView) {
this.entityNamer = entityNamer;
this.panel = simplePanel;
@@ -43,12 +45,12 @@
}
public void onPlaceChanged(PlaceChanged event) {
- if (!(event.getNewPlace() instanceof EntityDetailsPlace)) {
+ if (!(event.getNewPlace() instanceof ExpensesDetailsPlace)) {
return;
}
- EntityDetailsPlace newPlace = (EntityDetailsPlace) event.getNewPlace();
- final Values<? extends ExpensesEntityKey<?>> entity = newPlace.getEntity();
- ExpensesEntityKey<?> key = entity.getKey();
+ ExpensesDetailsPlace newPlace = (ExpensesDetailsPlace) event.getNewPlace();
+ final Values<? extends ExpensesKey<?>> entity = newPlace.getEntity();
+ ExpensesKey<?> key = entity.getKey();
// TODO make a pretty uibinder page, not least because we're rendering
// user strings here, which is dangerous
@@ -62,12 +64,12 @@
// at the moment we know we already have them, such as they are.
// And we haven't implemented the fake findEmployee call yet, ahem.
- key.accept(new ExpensesEntityVisitor() {
+ key.accept(new ExpensesKeyVisitor() {
@SuppressWarnings("unchecked")
public void visit(EmployeeKey employeeKey) {
// wow, this cast is nasty. Perhaps visitor should actually
- // be on the Values themselves?
+ // be on the Values themselves?
Values<EmployeeKey> eValues = (Values<EmployeeKey>) entity;
String user = eValues.get(EmployeeKey.get().getUserName());
list.append("<div>");
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldListRequester.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldListRequester.java
new file mode 100644
index 0000000..6920a39
--- /dev/null
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldListRequester.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.sample.expenses.gwt.scaffold;
+
+import com.google.gwt.app.place.PlaceChanged;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesListPlace;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesPlaces;
+import com.google.gwt.sample.expenses.gwt.request.EmployeeKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKeyVisitor;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory;
+import com.google.gwt.sample.expenses.gwt.request.ReportKey;
+import com.google.gwt.sample.expenses.gwt.ui.employee.EmployeeListView;
+import com.google.gwt.sample.expenses.gwt.ui.report.ReportListView;
+import com.google.gwt.user.client.ui.Renderer;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.valuestore.client.ValuesListViewTable;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * In charge of requesting and displaying the appropriate record lists in the
+ * appropriate view when the user goes to an {@link ExpensesListPlace} in the
+ * Scaffold app.
+ */
+public final class ScaffoldListRequester implements PlaceChanged.Handler {
+
+ private final SimplePanel panel;
+ private final ExpensesRequestFactory requests;
+ private final Renderer<ExpensesListPlace> placeRenderer;
+ private final ExpensesPlaces places;
+
+ // TODO This dependency on view classes prevents testing this class in JRE.
+ // Get a factory in here or something
+ private final Map<ExpensesListPlace, ValuesListViewTable<?>> viewMap = new HashMap<ExpensesListPlace, ValuesListViewTable<?>>();
+
+ public ScaffoldListRequester(ExpensesPlaces places, SimplePanel panel,
+ ExpensesRequestFactory requests, Renderer<ExpensesListPlace> renderer) {
+ this.places = places;
+ this.panel = panel;
+ this.requests = requests;
+ this.placeRenderer = renderer;
+ }
+
+ public void onPlaceChanged(PlaceChanged event) {
+ if (!(event.getNewPlace() instanceof ExpensesListPlace)) {
+ return;
+ }
+ final ExpensesListPlace newPlace = (ExpensesListPlace) event.getNewPlace();
+ ExpensesKey<?> key = newPlace.getKey();
+
+ key.accept(new ExpensesKeyVisitor() {
+
+ public void visit(EmployeeKey employeeKey) {
+ ValuesListViewTable<?> view = viewMap.get(newPlace);
+ if (null == view) {
+ view = new EmployeeListView(placeRenderer.render(newPlace), places,
+ requests);
+ viewMap.put(newPlace, view);
+ }
+ }
+
+ public void visit(ReportKey reportKey) {
+ ValuesListViewTable<?> view = viewMap.get(newPlace);
+ if (null == view) {
+ view = new ReportListView(placeRenderer.render(newPlace), places,
+ requests);
+ viewMap.put(newPlace, view);
+ }
+ }
+ });
+
+ ValuesListViewTable<?> entitiesView = viewMap.get(newPlace);
+ if (entitiesView.getParent() == null) {
+ panel.clear();
+ panel.add(entitiesView);
+ }
+ }
+}
\ No newline at end of file
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/ExpensesScaffoldShell.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldShell.java
similarity index 76%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/ExpensesScaffoldShell.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldShell.java
index 9555b5e..d603341 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/ExpensesScaffoldShell.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldShell.java
@@ -13,12 +13,12 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.sample.expenses.gwt.scaffold;
import com.google.gwt.app.client.ListBoxPlacePickerView;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.DivElement;
-import com.google.gwt.sample.expenses.client.place.EntityListPlace;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesListPlace;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
@@ -26,18 +26,18 @@
import com.google.gwt.user.client.ui.Widget;
/**
- * The outermost UI for the scaffold app.
+ * The outermost UI of the application.
*/
-public class ExpensesScaffoldShell extends Composite {
- interface Binder extends UiBinder<Widget, ExpensesScaffoldShell> {
+public class ScaffoldShell extends Composite {
+ interface Binder extends UiBinder<Widget, ScaffoldShell> {
}
private static final Binder BINDER = GWT.create(Binder.class);
@UiField SimplePanel body;
- @UiField ListBoxPlacePickerView<EntityListPlace> placesBox;
+ @UiField ListBoxPlacePickerView<ExpensesListPlace> placesBox;
@UiField DivElement error;
- public ExpensesScaffoldShell() {
+ public ScaffoldShell() {
initWidget(BINDER.createAndBindUi(this));
}
@@ -51,7 +51,7 @@
/**
* @return the banner
*/
- public ListBoxPlacePickerView<EntityListPlace> getPlacesBox() {
+ public ListBoxPlacePickerView<ExpensesListPlace> getPlacesBox() {
return placesBox;
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/ExpensesScaffoldShell.ui.xml b/bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldShell.ui.xml
similarity index 100%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/ExpensesScaffoldShell.ui.xml
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/scaffold/ScaffoldShell.ui.xml
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/EntityNameRenderer.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ExpensesKeyNameRenderer.java
similarity index 60%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/EntityNameRenderer.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ExpensesKeyNameRenderer.java
index b99320a..ff9b333 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/EntityNameRenderer.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ExpensesKeyNameRenderer.java
@@ -13,20 +13,20 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.sample.expenses.gwt.ui;
-import com.google.gwt.sample.expenses.shared.EmployeeKey;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityKey;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityFilter;
-import com.google.gwt.sample.expenses.shared.ReportKey;
+import com.google.gwt.sample.expenses.gwt.request.EmployeeKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKey;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKeyFilter;
+import com.google.gwt.sample.expenses.gwt.request.ReportKey;
import com.google.gwt.user.client.ui.Renderer;
/**
- * Renders the name of {@link ExpensesEntityKey}s.
+ * Renders the name of an {@link ExpensesKey}.
*/
//TODO i18n
-public class EntityNameRenderer implements Renderer<ExpensesEntityKey<?>> {
- private final ExpensesEntityFilter<String> filter = new ExpensesEntityFilter<String>() {
+public class ExpensesKeyNameRenderer implements Renderer<ExpensesKey<?>> {
+ private final ExpensesKeyFilter<String> filter = new ExpensesKeyFilter<String>() {
public String filter(EmployeeKey employeeKey) {
return "Employees";
}
@@ -36,7 +36,7 @@
}
};
- public String render(ExpensesEntityKey<?> entity) {
+ public String render(ExpensesKey<?> entity) {
return entity.accept(filter);
}
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/ListPlaceRenderer.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ListPlaceRenderer.java
similarity index 61%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/ListPlaceRenderer.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ListPlaceRenderer.java
index 155af25..82be353 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/ListPlaceRenderer.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ListPlaceRenderer.java
@@ -13,27 +13,27 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.sample.expenses.gwt.ui;
-import com.google.gwt.sample.expenses.client.place.EntityListPlace;
-import com.google.gwt.sample.expenses.shared.ExpensesEntityKey;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesListPlace;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesKey;
import com.google.gwt.user.client.ui.Renderer;
/**
- * Renders {@link EntityListPlace}s for display to users.
+ * Renders {@link ExpensesListPlace}s for display to users.
*/
-public class ListPlaceRenderer implements Renderer<EntityListPlace> {
+public class ListPlaceRenderer implements Renderer<ExpensesListPlace> {
- private final Renderer<ExpensesEntityKey<?>> entityRenderer;
+ private final Renderer<ExpensesKey<?>> entityRenderer;
/**
* @param entityRenderer
*/
- public ListPlaceRenderer(Renderer<ExpensesEntityKey<?>> entityRenderer) {
+ public ListPlaceRenderer(Renderer<ExpensesKey<?>> entityRenderer) {
this.entityRenderer = entityRenderer;
}
- public String render(EntityListPlace object) {
+ public String render(ExpensesListPlace object) {
return entityRenderer.render(object.getKey());
}
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/EmployeeListView.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListView.java
similarity index 84%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/EmployeeListView.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListView.java
index 6d32ccf..ef3757a 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/EmployeeListView.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListView.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.sample.expenses.gwt.ui.employee;
import com.google.gwt.bikeshed.cells.client.ActionCell;
import com.google.gwt.bikeshed.list.client.Column;
@@ -22,9 +22,11 @@
import com.google.gwt.bikeshed.list.client.TextColumn;
import com.google.gwt.bikeshed.list.client.TextHeader;
import com.google.gwt.bikeshed.list.shared.ListModel;
-import com.google.gwt.sample.expenses.client.place.Places;
-import com.google.gwt.sample.expenses.shared.EmployeeKey;
-import com.google.gwt.sample.expenses.shared.ExpenseRequestFactory;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesPlaces;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory;
+import com.google.gwt.sample.expenses.gwt.request.EmployeeKey;
+import com.google.gwt.valuestore.client.ListModelAdapter;
+import com.google.gwt.valuestore.client.ValuesListViewTable;
import com.google.gwt.valuestore.shared.Property;
import com.google.gwt.valuestore.shared.Values;
@@ -39,7 +41,7 @@
public class EmployeeListView extends ValuesListViewTable<EmployeeKey> {
private static List<Column<Values<EmployeeKey>, ?, ?>> getColumns(
- final Places places) {
+ final ExpensesPlaces places) {
List<Column<Values<EmployeeKey>, ?, ?>> columns = new ArrayList<Column<Values<EmployeeKey>, ?, ?>>();
columns.add(new TextColumn<Values<EmployeeKey>>() {
@@ -76,7 +78,7 @@
}
private static ListModel<Values<EmployeeKey>> getModel(
- final ExpenseRequestFactory requests) {
+ final ExpensesRequestFactory requests) {
return new ListModelAdapter<EmployeeKey>() {
@Override
@@ -94,8 +96,8 @@
return properties;
}
- public EmployeeListView(String headingMessage, Places places,
- ExpenseRequestFactory requests) {
+ public EmployeeListView(String headingMessage, ExpensesPlaces places,
+ ExpensesRequestFactory requests) {
super(headingMessage, getModel(requests), getColumns(places), getHeaders());
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/ReportListView.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListView.java
similarity index 85%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/ReportListView.java
rename to bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListView.java
index ba1eb64..cc4385b 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/ReportListView.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListView.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.sample.expenses.gwt.ui.report;
import com.google.gwt.bikeshed.cells.client.ActionCell;
import com.google.gwt.bikeshed.cells.client.DateCell;
@@ -25,9 +25,11 @@
import com.google.gwt.bikeshed.list.client.TextHeader;
import com.google.gwt.bikeshed.list.shared.ListModel;
import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.sample.expenses.client.place.Places;
-import com.google.gwt.sample.expenses.shared.ExpenseRequestFactory;
-import com.google.gwt.sample.expenses.shared.ReportKey;
+import com.google.gwt.sample.expenses.gwt.place.ExpensesPlaces;
+import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory;
+import com.google.gwt.sample.expenses.gwt.request.ReportKey;
+import com.google.gwt.valuestore.client.ListModelAdapter;
+import com.google.gwt.valuestore.client.ValuesListViewTable;
import com.google.gwt.valuestore.shared.Property;
import com.google.gwt.valuestore.shared.Values;
@@ -43,7 +45,7 @@
public class ReportListView extends ValuesListViewTable<ReportKey> {
private static List<Column<Values<ReportKey>, ?, ?>> getColumns(
- final Places places) {
+ final ExpensesPlaces places) {
List<Column<Values<ReportKey>, ?, ?>> columns = new ArrayList<Column<Values<ReportKey>, ?, ?>>();
DateCell dateCell = new DateCell(DateTimeFormat.getShortDateFormat());
@@ -81,7 +83,7 @@
}
private static ListModel<Values<ReportKey>> getModel(
- final ExpenseRequestFactory requests) {
+ final ExpensesRequestFactory requests) {
return new ListModelAdapter<ReportKey>() {
@Override
@@ -99,8 +101,8 @@
return properties;
}
- public ReportListView(String headingMessage, Places places,
- ExpenseRequestFactory requests) {
+ public ReportListView(String headingMessage, ExpensesPlaces places,
+ ExpensesRequestFactory requests) {
super(headingMessage, getModel(requests), getColumns(places), getHeaders());
}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/server/ExpensesDataServlet.java b/bikeshed/src/com/google/gwt/sample/expenses/server/ExpensesDataServlet.java
index 9a4b1af..db425fb 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/server/ExpensesDataServlet.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/server/ExpensesDataServlet.java
@@ -16,9 +16,9 @@
package com.google.gwt.sample.expenses.server;
import com.google.gwt.requestfactory.server.RequestFactoryServlet;
+import com.google.gwt.sample.expenses.gwt.request.ReportKey;
import com.google.gwt.sample.expenses.server.domain.Report;
import com.google.gwt.sample.expenses.server.domain.Storage;
-import com.google.gwt.sample.expenses.shared.ReportKey;
import org.json.JSONArray;
import org.json.JSONException;
diff --git a/bikeshed/src/com/google/gwt/valuestore/ValueStore.gwt.xml b/bikeshed/src/com/google/gwt/valuestore/ValueStore.gwt.xml
index f9804cc..28774e5 100644
--- a/bikeshed/src/com/google/gwt/valuestore/ValueStore.gwt.xml
+++ b/bikeshed/src/com/google/gwt/valuestore/ValueStore.gwt.xml
@@ -1,3 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.1/distro-source/core/src/gwt-module.dtd">
<!--
Copyright 2010 Google Inc.
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/ListModelAdapter.java b/bikeshed/src/com/google/gwt/valuestore/client/ListModelAdapter.java
similarity index 96%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/ListModelAdapter.java
rename to bikeshed/src/com/google/gwt/valuestore/client/ListModelAdapter.java
index a1f03cf..22dd0a5 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/ListModelAdapter.java
+++ b/bikeshed/src/com/google/gwt/valuestore/client/ListModelAdapter.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.valuestore.client;
import com.google.gwt.bikeshed.list.shared.AsyncListModel;
import com.google.gwt.user.client.ui.TakesValueList;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/ValuesListViewTable.java b/bikeshed/src/com/google/gwt/valuestore/client/ValuesListViewTable.java
similarity index 83%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/ValuesListViewTable.java
rename to bikeshed/src/com/google/gwt/valuestore/client/ValuesListViewTable.java
index 4c46b46..fcad0e4 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/client/ValuesListViewTable.java
+++ b/bikeshed/src/com/google/gwt/valuestore/client/ValuesListViewTable.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.sample.expenses.client;
+package com.google.gwt.valuestore.client;
import com.google.gwt.bikeshed.list.client.Column;
import com.google.gwt.bikeshed.list.client.Header;
@@ -31,14 +31,24 @@
import java.util.Iterator;
import java.util.List;
+/**
+ * A widget that displays lists of {@link com.google.gwt.valuestore.ValueStore
+ * ValueStore} records in a {@link PagingTableListView}
+ * <p>
+ * TODO needs MVP separation
+ *
+ * @param <K> the type of the ValuesKey shared by these records
+ */
public class ValuesListViewTable<K extends ValuesKey<K>> extends Composite {
interface Binder extends UiBinder<HTMLPanel, ValuesListViewTable<?>> {
}
private static final Binder BINDER = GWT.create(Binder.class);
- @UiField(provided = true) PagingTableListView<Values<K>> table;
- @UiField HeadingElement heading;
+ @UiField(provided = true)
+ PagingTableListView<Values<K>> table;
+ @UiField
+ HeadingElement heading;
public ValuesListViewTable(String headingMessage, ListModel<Values<K>> model,
List<Column<Values<K>, ?, ?>> columns, List<Header<?>> headers) {
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/client/ValuesListViewTable.ui.xml b/bikeshed/src/com/google/gwt/valuestore/client/ValuesListViewTable.ui.xml
similarity index 100%
rename from bikeshed/src/com/google/gwt/sample/expenses/client/ValuesListViewTable.ui.xml
rename to bikeshed/src/com/google/gwt/valuestore/client/ValuesListViewTable.ui.xml
diff --git a/bikeshed/war/Expenses.css b/bikeshed/war/Expenses.css
deleted file mode 100644
index 7aca7ac..0000000
--- a/bikeshed/war/Expenses.css
+++ /dev/null
@@ -1,34 +0,0 @@
-/** Add css rules here for your application. */
-
-
-/** Example rules used by the template application (remove for your app) */
-h1 {
- font-size: 2em;
- font-weight: bold;
- color: #777777;
- margin: 40px 0px 70px;
- text-align: center;
-}
-
-.sendButton {
- display: block;
- font-size: 16pt;
-}
-
-/** Most GWT widgets already have a style name defined */
-.gwt-DialogBox {
- width: 400px;
-}
-
-.dialogVPanel {
- margin: 5px;
-}
-
-.serverResponseLabelError {
- color: red;
-}
-
-/** Set ids using widget.getElement().setId("idOfElement") */
-#closeButton {
- margin: 15px 6px 6px;
-}
diff --git a/bikeshed/war/Expenses.html b/bikeshed/war/ExpensesCustomized.html
similarity index 96%
rename from bikeshed/war/Expenses.html
rename to bikeshed/war/ExpensesCustomized.html
index 6182ba0..04e5c6b 100644
--- a/bikeshed/war/Expenses.html
+++ b/bikeshed/war/ExpensesCustomized.html
@@ -17,7 +17,7 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Expenses</title>
- <script type="text/javascript" language="javascript" src="expenses/expenses.nocache.js"></script>
+ <script type="text/javascript" language="javascript" src="expensesCustomized/expensesCustomized.nocache.js"></script>
<script type="text/javascript" language="javascript" src="json2.js"></script>
</head>
diff --git a/bikeshed/war/ExpensesScaffold.html b/bikeshed/war/ExpensesScaffold.html
index ff55275..ec58934 100644
--- a/bikeshed/war/ExpensesScaffold.html
+++ b/bikeshed/war/ExpensesScaffold.html
@@ -1,4 +1,18 @@
<!doctype html>
+
+<!-- Copyright 2010 Google Inc. -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you -->
+<!-- may not use this file except in compliance with the License. You may -->
+<!-- may obtain a copy of the License at -->
+<!-- -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
+<!-- -->
+<!-- Unless required by applicable law or agreed to in writing, software -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -->
+<!-- implied. License for the specific language governing permissions and -->
+<!-- limitations under the License. -->
+
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
@@ -10,4 +24,4 @@
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
<span id='loading'><i>…loading…</i></span>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/bikeshed/war/WEB-INF/web.xml b/bikeshed/war/WEB-INF/web.xml
index f962f53..a308f02 100644
--- a/bikeshed/war/WEB-INF/web.xml
+++ b/bikeshed/war/WEB-INF/web.xml
@@ -8,7 +8,7 @@
<!-- Configures expensesData servlet -->
<context-param>
<param-name>servlet.serverOperation</param-name>
- <param-value>com.google.gwt.sample.expenses.shared.ExpenseRequestFactory$ServerSideOperation</param-value>
+ <param-value>com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory$ServerSideOperation</param-value>
</context-param>
<!-- Servlets -->