Skip to content
Browse files

Add a list view to the Admin User Mgm page

  • Loading branch information...
1 parent 4294adc commit 6d2fc665612e946e65737c891fd26a8d9e8ad0d5 @jcosmo committed
View
10 src/main/java/au/com/stocksoftware/tide/client/view/ui/AdminUI.java
@@ -1,7 +1,5 @@
package au.com.stocksoftware.tide.client.view.ui;
-import au.com.stocksoftware.tide.client.activity.AdminUsersPresenter;
-import au.com.stocksoftware.tide.client.ioc.TideGinjector;
import au.com.stocksoftware.tide.client.place.AdminPlace;
import au.com.stocksoftware.tide.client.place.AdminPlace.AdminTask;
import au.com.stocksoftware.tide.client.view.AdminView;
@@ -50,14 +48,14 @@ public void showTask( final AdminTask task )
{
_contentArea.remove( 0 );
}
-
+
switch ( task )
{
case PROJECTS:
_contentArea.setWidget( ensureProjectUI() );
_currentView = task;
break;
-
+
case USERS:
_contentArea.setWidget( ensureUsersUI() );
_currentView = task;
@@ -78,7 +76,7 @@ private IsWidget ensureProjectUI()
{
if ( null == _projectsUI )
{
- _projectsUI = new Label("This is the Projects UI!");
+ _projectsUI = new Label( "This is the Projects UI!" );
}
return _projectsUI;
}
@@ -93,7 +91,7 @@ private IsWidget ensureProjectUI()
private static AdminViewUiBinder _uiBinder = GWT.create( AdminViewUiBinder.class );
@Inject
- public AdminUI( final PlaceHistoryMapper placeHistoryMapper )
+ public AdminUI( final PlaceHistoryMapper placeHistoryMapper )
{
_widget = _uiBinder.createAndBindUi( this );
_usersLink.setTargetHistoryToken( placeHistoryMapper.getToken( new AdminPlace( AdminTask.USERS ) ) );
View
34 src/main/java/au/com/stocksoftware/tide/client/view/ui/AdminUsersUI.java
@@ -1,22 +1,32 @@
package au.com.stocksoftware.tide.client.view.ui;
-import au.com.stocksoftware.tide.client.place.AdminPlace;
-import au.com.stocksoftware.tide.client.place.AdminPlace.AdminTask;
+import au.com.stocksoftware.tide.client.entity.UserVO;
import au.com.stocksoftware.tide.client.view.AdminUsersView;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.place.shared.PlaceHistoryMapper;
+import com.google.gwt.editor.client.Editor.Path;
import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiFactory;
+import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
+import com.sencha.gxt.core.client.ValueProvider;
+import com.sencha.gxt.data.shared.ListStore;
+import com.sencha.gxt.data.shared.ModelKeyProvider;
+import com.sencha.gxt.data.shared.PropertyAccess;
import com.sencha.gxt.widget.core.client.Component;
+import com.sencha.gxt.widget.core.client.ListView;
public class AdminUsersUI
extends AbstractUI<AdminUsersView.Presenter>
implements AdminUsersView, IsWidget
{
private Component _widget;
+
+ @UiField
+ ListView _userList;
+
@UiTemplate( "AdminUsersView.ui.xml" )
interface AdminUsersViewUiBinder
extends UiBinder<Component, AdminUsersUI>
@@ -36,4 +46,22 @@ public Widget asWidget()
{
return _widget;
}
+
+ @UiFactory
+ ListView createListView()
+ {
+ final UserProperties userProperties = GWT.create( UserProperties.class );
+
+ return new ListView<UserVO, String>(
+ new ListStore<UserVO>( userProperties.key() ), userProperties.name() );
+ }
+
+ interface UserProperties extends PropertyAccess<UserVO>
+ {
+ @Path("id")
+ ModelKeyProvider<UserVO> key();
+
+ @Path("name")
+ ValueProvider<UserVO, String> name();
+ }
}
View
18 src/main/java/au/com/stocksoftware/tide/client/view/ui/AdminUsersView.ui.xml
@@ -1,17 +1,23 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container"
+ xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
- <container:SimpleContainer>
+ <ui:style>
+ .userPanel {
+ background: white;
+ }
+ </ui:style>
+ <container:SimpleContainer addStyleNames="{style.userPanel}">
<container:child>
- <container:BorderLayoutContainer borders="true">
- <container:north>
- <g:Label>Foo</g:Label>
- </container:north>
+ <container:BorderLayoutContainer borders="false">
<container:west>
- <g:Label>Bar</g:Label>
+ <gxt:ListView ui:field="_userList"/>
</container:west>
+ <container:center>
+ <g:Label>Bar</g:Label>
+ </container:center>
</container:BorderLayoutContainer>
</container:child>
</container:SimpleContainer>

0 comments on commit 6d2fc66

Please sign in to comment.
Something went wrong with that request. Please try again.