Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/DATT/src/org/litesoft/datt/client/ui/views/home/Home.java

Diff revisions: vs.
  @@ -1,12 +1,10 @@
1 1 package org.litesoft.datt.client.ui.views.home;
2 2
3 - import org.litesoft.commonfoundation.typeutils.Objects;
4 - import java.util.*;
5 -
6 3 import org.litesoft.GWT.client.command.*;
7 4 import org.litesoft.GWT.client.view.*;
8 5 import org.litesoft.GWT.client.widgets.*;
9 6 import org.litesoft.bo.views.*;
7 + import org.litesoft.commonfoundation.typeutils.Objects;
10 8 import org.litesoft.core.*;
11 9 import org.litesoft.core.simpletypes.*;
12 10 import org.litesoft.datt.client.*;
  @@ -18,31 +16,27 @@
18 16 import com.google.gwt.event.dom.client.*;
19 17 import com.google.gwt.user.client.ui.*;
20 18
21 - public class Home extends ScreenView implements ViewDefs
22 - {
19 + import java.util.*;
20 +
21 + public class Home extends ScreenView implements ViewDefs {
23 22 public static final String TITLE = "Distributed Agile Task Tracker";
24 23
25 24 @Override
26 - protected UriFragmentIdParams createRefreshParams()
27 - {
25 + protected UriFragmentIdParams createRefreshParams() {
28 26 return null;
29 27 }
30 28
31 - public Home()
32 - {
29 + public Home() {
33 30 super( title( TITLE ) );
34 31 addStandardTitleBar();
35 32
36 - add( new BigButtonScreenHelper()
37 - {
33 + add( new BigButtonScreenHelper() {
38 34 @Override
39 - public Widget build()
40 - {
35 + public Widget build() {
41 36 UserView zUser = ClientContext.get().get( CurrentUserViewAccessor.class ).getUser();
42 37 List<Widget> zSections = new ArrayList<Widget>();
43 38 Role zLastRole = Objects.deNull( Role.valueFor( zUser.getLastRestrictedResourceRole() ), Role.EndUser );
44 - switch ( zLastRole )
45 - {
39 + switch ( zLastRole ) {
46 40 default:
47 41 zLastRole = Role.EndUser;
48 42 // Fall Thru
  @@ -63,8 +57,7 @@
63 57 break;
64 58 }
65 59 Widget zRestrictedResource = createButton( ADMIN_RESTRICTED_RESOURCE_MANAGEMENT );
66 - if ( zRestrictedResource == null )
67 - {
60 + if ( zRestrictedResource == null ) {
68 61 zRestrictedResource = createButton( ADMIN_RESTRICTED_RESOURCE_EDITOR );
69 62 }
70 63 zSections.add( createSection( HOME_SECTION_STORIES, STORY_STORIES, STORY_MERGE_STORIES, INITIAL_PRIORITIZING_STORIES, REPRIORITIZE_STORIES ) );
  @@ -75,31 +68,24 @@
75 68 }
76 69
77 70 @Override
78 - protected Widget createScreenButton( ViewDef pViewDef )
79 - {
71 + protected Widget createScreenButton( ViewDef pViewDef ) {
80 72 String zUiString = pViewDef.getUiString();
81 73 ShowScreenCommand zScreenCommand = new ShowScreenCommand( pViewDef );
82 74 return ScreenBigButton.factory( zUiString ).add( zScreenCommand ).create();
83 75 }
84 76
85 - private SizeableHorizontalPanel createSwitchHomeButtons( TextLines pAllowedRoles, Role pCurrentRole )
86 - {
77 + private SizeableHorizontalPanel createSwitchHomeButtons( TextLines pAllowedRoles, Role pCurrentRole ) {
87 78 Set<Role> zAllowedRoles = new HashSet<Role>();
88 - for ( TextLine zAllowedRole : pAllowedRoles )
89 - {
79 + for ( TextLine zAllowedRole : pAllowedRoles ) {
90 80 zAllowedRoles.add( Role.valueFor( zAllowedRole.getLine() ) );
91 81 }
92 82 List<Widget> zButtons = new ArrayList<Widget>();
93 - for ( Role zRole : Role.values() )
94 - {
95 - if ( (zRole != pCurrentRole) && zAllowedRoles.contains( zRole ) )
96 - {
83 + for ( Role zRole : Role.values() ) {
84 + if ( (zRole != pCurrentRole) && zAllowedRoles.contains( zRole ) ) {
97 85 ViewDef[] zViewDefs = ViewDefs.ROLES_MAP.get( zRole );
98 - if ( (zViewDefs != null) && (zViewDefs.length > 0) )
99 - {
86 + if ( (zViewDefs != null) && (zViewDefs.length > 0) ) {
100 87 ViewDef zViewDef = zViewDefs[0];
101 - if ( zViewDef != null )
102 - {
88 + if ( zViewDef != null ) {
103 89 zButtons.add( createSwitchHomeButton( zViewDef, zRole ) );
104 90 }
105 91 }
  @@ -108,17 +94,13 @@
108 94 return createButtons( zButtons );
109 95 }
110 96
111 - private Widget createSwitchHomeButton( ViewDef pViewDef, final Role pRole )
112 - {
113 - return ScreenBigButton.factory( pViewDef.getUiString() ).add( new ClickHandler()
114 - {
97 + private Widget createSwitchHomeButton( ViewDef pViewDef, final Role pRole ) {
98 + return ScreenBigButton.factory( pViewDef.getUiString() ).add( new ClickHandler() {
115 99 @Override
116 - public void onClick( ClickEvent event )
117 - {
100 + public void onClick( ClickEvent event ) {
118 101 CurrentUserViewAccessor zAccessor = ClientContext.get().get( CurrentUserViewAccessor.class );
119 102 UserView zUser = zAccessor.getUser();
120 - if ( zUser.getTransactionSet() == null )
121 - {
103 + if ( zUser.getTransactionSet() == null ) {
122 104 zAccessor.setUser( zUser = zUser.copyInto( ClientTransactionSet.create() ) );
123 105 }
124 106 zUser.setLastRestrictedResourceRole( pRole.toString() );
  @@ -128,28 +110,23 @@
128 110 } ).create();
129 111 }
130 112
131 - private void populateSections_EndUser( List<Widget> pSections )
132 - {
113 + private void populateSections_EndUser( List<Widget> pSections ) {
133 114 pSections.add( createSection( "END USERS", ENDUSERS_SAMPLE ) );
134 115 }
135 116
136 - private void populateSections_EndUserManager( List<Widget> pSections )
137 - {
117 + private void populateSections_EndUserManager( List<Widget> pSections ) {
138 118 pSections.add( createSection( "END USER MANAGER", ENDUSERMANAGERS_SAMPLE ) );
139 119 }
140 120
141 - private void populateSections_Developer( List<Widget> pSections )
142 - {
121 + private void populateSections_Developer( List<Widget> pSections ) {
143 122 pSections.add( createSection( "DEVELOPER", DEVELOPERS_SAMPLE ) );
144 123 }
145 124
146 - private void populateSections_Customer( List<Widget> pSections )
147 - {
125 + private void populateSections_Customer( List<Widget> pSections ) {
148 126 pSections.add( createSection( "CUSTOMER", CUSTOMERS_SAMPLE ) );
149 127 }
150 128
151 - private void populateSections_ProjectAdmin( List<Widget> pSections )
152 - {
129 + private void populateSections_ProjectAdmin( List<Widget> pSections ) {
153 130 pSections.add( createSection( "PROJECT ADMINISTRATOR", PROJECTADMINS_SAMPLE ) );
154 131 }
155 132 }.build() );