コード例 #1
0
ファイル: MainView.java プロジェクト: cah7rf/dsbudget
  public void render(PrintWriter out) {
    out.write("<div id=\"" + getNodeID() + "\">");

    // display each section in the order specified in the configuration
    String section_order = Main.conf.getProperty("section_order");
    String[] items = section_order.split(",");
    for (String item : items) {
      item = item.trim();
      if (item.equals("income")) {
        incomeview.render(out);
      } else if (item.equals("budget")) {
        budgettingview.render(out);
      } else if (item.equals("expense")) {
        expenseview.render(out);
      } else if (item.equals("balance")) {
        balanceview.render(out);
      } else {
        logger.error(Labels.getHtmlEscapedString(MAV_MESSAGE_UNKNOWN_SECTION_ORDER, item));
      }
    }

    income_dialog.render(out);
    category_dialog.render(out);
    expense_dialog.render(out);
    deduction_dialog.render(out);
    removeincomedialog.render(out);
    removecategorydialog.render(out);

    out.write("</div>");
  }
コード例 #2
0
    protected void onPostExecute(JSONObject mainJsonData) {
      if (!ActivityOn) return;
      Log.i("Async-Example", "onPostExecute Called");
      // String userName =
      // SharedResources.getLoginUserName(getActivity());
      if (mainJsonData != null) {
        /*
         * Utils.showToastMessage(getActivity(), userName +
         * " Check your Expenses");
         */
        ArrayList<HashMap<String, String>> expenseList = new ArrayList<HashMap<String, String>>();
        expense_list = (ListView) ExpenseView.findViewById(R.id.expense_list);
        try {
          if (mainJsonData.has("success")) {
            JSONArray expenseJson = new JSONArray(mainJsonData.getString("msg"));
            if (expenseJson.getJSONObject(0).has(EXPENSE_AMOUNT)
                && expenseJson.getJSONObject(0).has(OFFERING_AMOUNT)) {
              for (int i = 0; i < expenseJson.length(); i++) {
                HashMap<String, String> expense = new HashMap<String, String>();
                expense.put(EXPENSE_USER, expenseJson.getJSONObject(i).getString(EXPENSE_USER));
                expense.put(EXPENSE_AMOUNT, expenseJson.getJSONObject(i).getString(EXPENSE_AMOUNT));
                expense.put(
                    OFFERING_AMOUNT, expenseJson.getJSONObject(i).getString(OFFERING_AMOUNT));
                expenseList.add(expense);
              }
              expenseAdapter = new ExpenseListAdapter(getActivity(), expenseList);
              expense_list.setAdapter(expenseAdapter);
            } else {
              HashMap<String, String> expense = new HashMap<String, String>();
              expense.put(BlankListAdapter.Blank_Data, "No data Available");
              expenseList.add(expense);
              blankListAdapter = new BlankListAdapter(getActivity(), expenseList);
              expense_list.setAdapter(blankListAdapter);
            }

          } else {
            Utils.startNewActivity(getActivity(), TryAgainActivity.class);
            getActivity().finish();
          }
        } catch (JSONException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      } else {
        Utils.startNewActivity(getActivity(), TryAgainActivity.class);
        getActivity().finish();
      }
      /*
       * if (null != waitDialog && waitDialog.isShowing()) {
       * waitDialog.dismiss(); }
       */
      getActivity().findViewById(R.id.loadingPanel).setVisibility(View.GONE);
      getActivity().findViewById(R.id.content).setVisibility(View.VISIBLE);
      SharedResources.endLoading(getActivity());
    }
コード例 #3
0
ファイル: MainView.java プロジェクト: cah7rf/dsbudget
 public void setCategories(ArrayList<Category> list) {
   page.categories = list;
   expenseview.initView();
   expenseview.redraw();
 }
コード例 #4
0
ファイル: MainView.java プロジェクト: cah7rf/dsbudget
 public void updateExpenseCategory(Category cat) {
   expenseview.updateExpenseCategory(cat);
   balanceview.redraw();
 }
コード例 #5
0
ファイル: MainView.java プロジェクト: cah7rf/dsbudget
 public void updateCategory(Category cat) {
   budgettingview.redraw();
   expenseview.redraw();
   balanceview.redraw();
 }
コード例 #6
0
ファイル: MainView.java プロジェクト: cah7rf/dsbudget
 public void removeExpense(Category cat, Expense ex) {
   cat.removeExpense(ex);
   expenseview.updateExpenseCategory(cat);
   balanceview.redraw();
 }