3939import com .google .gwt .cell .client .Cell ;
4040import com .google .gwt .cell .client .CheckboxCell ;
4141import com .google .gwt .core .client .GWT ;
42- import com .google .gwt .core .client .Scheduler ;
4342import com .google .gwt .i18n .client .DateTimeFormat ;
4443import com .google .gwt .i18n .client .TimeZone ;
4544import com .google .gwt .safehtml .shared .SafeHtml ;
4645import com .google .gwt .safehtml .shared .SafeHtmlBuilder ;
4746import com .google .gwt .safehtml .shared .SafeHtmlUtils ;
4847import com .google .gwt .user .cellview .client .Column ;
49- import com .google .gwt .user .client .Command ;
5048import com .google .gwt .user .client .ui .Button ;
5149import com .google .gwt .user .client .ui .CheckBox ;
5250import com .google .gwt .user .client .ui .FlowPanel ;
@@ -236,17 +234,6 @@ private FlowPanel getGroupsTables() {
236234 public Boolean getValue (AuthorizationGroup group ) {
237235 return databasePermissionGroups .contains (group .getAttributeValue ());
238236 }
239-
240- @ Override
241- public String getCellStyleNames (Cell .Context context , AuthorizationGroup group ) {
242- if (groupDetails .getOrDefault (group .getAttributeValue (), new AuthorizationDetails ()).hasExpiryDate ()) {
243- Date now = new Date ();
244- if (now .after (groupDetails .get (group .getAttributeValue ()).getExpiry ())) {
245- return "expired" ;
246- }
247- }
248- return "" ;
249- }
250237 };
251238
252239 checkbox .setFieldUpdater ((index , group , value ) -> {
@@ -255,7 +242,6 @@ public String getCellStyleNames(Cell.Context context, AuthorizationGroup group)
255242 if (!databasePermissionGroups .contains (group .getAttributeValue ())) {
256243 databasePermissionGroups .add (group .getAttributeValue ());
257244 }
258- deferSetIndeterminateCheckboxes ();
259245 } else {
260246 // Remove
261247 databasePermissionGroups .remove (group .getAttributeValue ());
@@ -277,13 +263,24 @@ public String getValue(AuthorizationGroup database) {
277263 return ret ;
278264 }
279265
266+ @ Override
267+ public String getCellStyleNames (Cell .Context context , AuthorizationGroup group ) {
268+ if (groupDetails .getOrDefault (group .getAttributeValue (), new AuthorizationDetails ()).hasExpiryDate ()) {
269+ Date now = new Date ();
270+ if (now .after (groupDetails .get (group .getAttributeValue ()).getExpiry ())) {
271+ return "expiry_column expired" ;
272+ }
273+ }
274+ return "expiry_column" ;
275+ }
276+
280277 @ Override
281278 public void render (Cell .Context context , AuthorizationGroup object , SafeHtmlBuilder sb ) {
282279 String value = getValue (object );
283280 if (databasePermissionGroups .contains (object .getAttributeValue ())) {
284- sb .appendHtmlConstant ("<button class=\" btn btn-link-info \" type=\" button\" tabindex=\" -1\" >" );
281+ sb .appendHtmlConstant ("<button class=\" btn tag-button \" type=\" button\" tabindex=\" -1\" >" );
285282 } else {
286- sb .appendHtmlConstant ("<button class=\" btn btn-link-info \" type=\" button\" tabindex=\" -1\" disabled>" );
283+ sb .appendHtmlConstant ("<button class=\" btn tag-button \" type=\" button\" tabindex=\" -1\" disabled>" );
287284 }
288285 if (value != null ) {
289286 sb .append (SafeHtmlUtils .fromString (value ));
@@ -392,7 +389,6 @@ public void onSuccess(Boolean confirmation) {
392389 }
393390 groupDetails .put (currentGroup .getAttributeValue (), authorizationDetails );
394391 cellTable .refresh ();
395- deferSetIndeterminateCheckboxes ();
396392 }
397393 }
398394 });
@@ -436,7 +432,6 @@ public SafeHtml getValue(AuthorizationGroup group) {
436432 new BasicTablePanel .ColumnInfo <AuthorizationGroup >(
437433 messages .SIARDHomePageLabelForPermissionsTableGroupExpiryDate (), 12 , expiry ,
438434 "force_column_ellipsis expiry_column" ));
439- deferSetIndeterminateCheckboxes ();
440435 }
441436
442437 private void doSearch (String searchValue , FlowPanel permissionListPanel ) {
@@ -493,12 +488,4 @@ private Map<String, AuthorizationDetails> createDatabasePermissionsMap() {
493488 }
494489 return permissions ;
495490 }
496-
497- private void deferSetIndeterminateCheckboxes () {
498- Scheduler .get ().scheduleDeferred (new Command () {
499- public void execute () {
500- JavascriptUtils .setIndeterminate (".expired input" );
501- }
502- });
503- }
504491}
0 commit comments