private void populateAppRightsCombo(boolean bOnUpdate) { form.lyrRights().tabRightsGranted().cmbRights().clear(); AppRight[] rights = AppRight.getAllRights(); AppRightVo[] voRights = AppRightVo.domArrayToVo(rights); Arrays.sort(voRights, new AppRightComparator()); for (int i = 0; i < voRights.length; i++) { AppRightVo voRight = voRights[i]; if(bOnUpdate && isAlreadySelected(voRight)) continue; form.lyrRights().tabRightsGranted().cmbRights().newRow(voRight, voRight.getName()); } }
protected void onBtnAddClick() throws PresentationLogicException { AppRightVo val = form.lyrRights().tabRightsGranted().cmbRights().getValue(); if (val == null) return; if (form.lyrRights().tabRightsGranted().grdRights().getRowByValue(val) != null) return; GenForm.lyrRightsLayer.tabRightsGrantedContainer.grdRightsRow row = form.lyrRights().tabRightsGranted().grdRights().getRows().newRow(); row.setValue(val); row.setAppRight(val.getName()); row.setTooltip(val.getComment()); removeItemFromRightsCombo(val); form.lyrRights().tabRightsGranted().grdRights().getValues().sort(new AppRightComparator()); }
private boolean isAlreadySelected(AppRightVo voRight) { //WDEV-20617 AppRightVoCollection collSelectedRights; if (form.getLocalContext().getIsPdsRight()) collSelectedRights = form.getGlobalContext().Admin.getSelectedPdsRoleRights(); else collSelectedRights = form.getGlobalContext().Admin.getSelectedRoleRigths(); //WDEV-20617 ends here if (collSelectedRights != null && collSelectedRights.size() > 0) { for (int i = 0; i < collSelectedRights.size(); i++) { AppRightVo voSelectedRight = collSelectedRights.get(i); if(voSelectedRight.getName().equals(voRight.getName())) return true; } } return false; }
private void removeRightFromSelection(AppRightVo value) { //WDEV-20617 AppRightVoCollection formSelectedRigrts; if (form.getLocalContext().getIsPdsRight()) formSelectedRigrts = form.getGlobalContext().Admin.getSelectedPdsRoleRights(); else formSelectedRigrts = form.getGlobalContext().Admin.getSelectedRoleRigths(); //WDEV-20617 ends here if (formSelectedRigrts == null || formSelectedRigrts.size() < 1) return; for(int i=0; i<formSelectedRigrts.size(); i++) { if(formSelectedRigrts.get(i).getName() != null && value.getName() != null && formSelectedRigrts.get(i).getName().toUpperCase().equals(value.getName().toUpperCase())) formSelectedRigrts.remove(i); } }
private String getText(AppRightVo vo) { if (vo == null || !vo.getNameIsNotNull()) return ""; return vo.getName(); }
private boolean isAlreadySelected(AppRightVo voRight) { AppRoleVo voRole = form.getLocalContext().getRoleSelected(); AppRightVoCollection collSelectedRights = voRole.getAppRights(); for (int i = 0; i < collSelectedRights.size(); i++) { AppRightVo voSelectedRight = collSelectedRights.get(i); if(voSelectedRight.getName().equals(voRight.getName())) return true; } return false; }
private void removeItemFromRightsCombo(AppRightVo val) { for(int i=0;i<form.lyrRights().tabRightsGranted().cmbRights().getValues().size();i++) { if(((AppRightVo)form.lyrRights().tabRightsGranted().cmbRights().getValues().get(i)).getName().equals(val.getName())) form.lyrRights().tabRightsGranted().cmbRights().removeRow(((AppRightVo)form.lyrRights().tabRightsGranted().cmbRights().getValues().get(i))); } }
private boolean hasPDSSynchRight(AppRightVoCollection coll) { if (coll == null) return false; for (AppRightVo right : coll) { if (AppRight.PDS_SYNCHRONISE_INTERACTIVE.getName().equals(right.getName())) return true; } return false; }
private void populateAppRightsGRid(String value) { form.grdRights().getRows().clear(); AppRight[] rights = AppRight.getAllRights(); AppRightVo[] voRights = AppRightVo.domArrayToVo(rights); Arrays.sort(voRights, new AppRightComparator()); String roleRight = ""; if (value != null && value.length() > 0) roleRight = value.replaceAll("%", ""); for (int i = 0; i < voRights.length; i++) { AppRightVo voRight = voRights[i]; if(voRight != null && voRight.getNameIsNotNull() && (voRight.getName().toUpperCase().contains(roleRight.toUpperCase()) || roleRight.length() == 0)) //WDEV-20617 { boolean bAddRow = form.getLocalContext().getIsPdsRight() && voRight.getName().substring(0,PDSSTRING.length()).toUpperCase().equals(PDSSTRING.toUpperCase()) || !form.getLocalContext().getIsPdsRight() && !voRight.getName().substring(0,PDSSTRING.length()).toUpperCase().equals(PDSSTRING.toUpperCase()); if (bAddRow) newRow(voRight); } //WDEV-20617 ends here } if (form.grdRights().getRows().size() == 0) engine.showMessage("No records matching your search criteria were found!", "No results",MessageButtons.OK, MessageIcon.INFORMATION); }
private void newRow(AppRightVo voRight) { grdRightsRow row = form.grdRights().getRows().newRow(); row.setAppRight(voRight.getName()); row.setColSelect(isAlreadySelected(voRight) ? true : false); //WDEV-20577 AppRight right = AppRight.getRight(voRight.getName()); if (right != null) row.setTooltip(right.getComment()); //WDEV-20577 row.setValue(voRight); }
private void addItemToRightsCombo(AppRightVo value) { form.lyrRights().tabRightsGranted().cmbRights().newRow(value, value.getName()); }
public int compare(AppRightVo arg0, AppRightVo arg1) { return getText(arg0).compareToIgnoreCase(getText(arg1)); }