Example #1
0
 /**
  * Get Menu favorites for a user
  *
  * @return menu as array list
  */
 public ArrayList<CTreeNode> getMenuFavorites() {
   MUser user = MUser.get(getContext());
   int AD_Tree_ID = user.getAD_Tree_MenuFavorite_ID();
   if (AD_Tree_ID == 0) // favorites has not yet been created
   return new ArrayList<CTreeNode>();
   return getMenuTree(AD_Tree_ID, false);
 } // get favorites menu
Example #2
0
 /**
  * Get Menu tree that directly enter "create new" mode
  *
  * @return menu as array list
  */
 public ArrayList<CTreeNode> getMenuCreateNew() {
   MUser user = MUser.get(getContext());
   int AD_Tree_ID = user.getAD_Tree_MenuNew_ID();
   if (AD_Tree_ID == 0) // create new has not yet been created
   return new ArrayList<CTreeNode>();
   return getMenuTree(AD_Tree_ID, false);
 } // getMenuCreateNew
Example #3
0
 /**
  * Make create new add/remove persistent ("bar" in swing client)
  *
  * @param add true if add - otherwise remove
  * @param Node_ID Node ID
  * @return true if updated
  */
 public boolean updateCreateNew(boolean add, int Node_ID) {
   /*
    * Code logic now uses MUser to store favorites. TODO:
    * VTreePanel.barDBupdate should be similarly updated or deprecated for
    * Swing client.
    */
   MUser user = MUser.get(getContext());
   return user.addUserMenuNewFavorite(Node_ID, 0);
 } // updateCreateNew
Example #4
0
  public Boolean savePreferences(Map<String, String> ctx) {
    CContext cContext = getContext();
    MUser user = MUser.get(cContext);
    MUserPreference preference = user.getPreference();
    String printerName = ctx.get("PrinterName");
    if (printerName != null && printerName.trim().equalsIgnoreCase("")) {
      cContext.setPrinterName(printerName);
      preference.setPrinterName(printerName);
    }
    String autoCommit = ctx.get("AutoCommit");
    if (autoCommit != null) {
      cContext.setAutoCommit(autoCommit.trim().equalsIgnoreCase("Y"));
      preference.setIsAutoCommit(autoCommit.trim().equalsIgnoreCase("Y"));
    }
    String showAdvanced = ctx.get("#ShowAdvanced");
    if (showAdvanced != null) {
      cContext.setContext("#ShowAdvanced", showAdvanced);
      preference.setIsShowAdvanced(showAdvanced.trim().equalsIgnoreCase("Y"));
    }
    String showAccounting = ctx.get("#ShowAcct");
    if (showAccounting != null) {
      cContext.setContext("#ShowAcct", showAccounting);
      preference.setIsShowAcct(showAccounting.trim().equalsIgnoreCase("Y"));
    }
    String showTranslation = ctx.get("#ShowTrl");
    if (showTranslation != null) {
      cContext.setContext("#ShowTrl", showTranslation);
      preference.setIsShowTrl(showTranslation.trim().equalsIgnoreCase("Y"));
    }
    String uiTheme = ctx.get("#UITheme");
    if (uiTheme != null && !uiTheme.trim().equalsIgnoreCase("")) {
      cContext.setContext("#UITheme", uiTheme);
      preference.setUITheme(uiTheme);
    }

    String printPreview = ctx.get("#PrintPreview");
    if (printPreview != null) {
      cContext.setPrintPreview(printPreview.equalsIgnoreCase("Y"));
      Ini.setProperty(Ini.P_PRINTPREVIEW, printPreview.equalsIgnoreCase("Y"));
      Ini.saveProperties(Ini.isClient());
    }

    String date = ctx.get("#Date");
    cContext.setContext("#Date", date);

    return preference.save();
  }
Example #5
0
 /**
  * Update of user favorites for a user with specified ordering for favorites
  *
  * @param menuIDs List<Integer> ordered list of menuIDs to put in the tree
  * @return true if updated
  */
 public boolean updateCreateNew(List<Integer> menuIDs) {
   MUser user = MUser.get(getContext());
   MTree menuTree = null;
   if ((menuTree = user.getUserNewFavoriteTree()) == null) return false;
   return updateUserTree(menuIDs, menuTree);
 } // updateCreateNew