コード例 #1
0
 void removeGroupByColumn(ColumnDefinition cd) {
   try {
     TableUtil.get()
         .atomicRemoveGroupByColumn(
             Tables.getInstance(), getAppName(), getTableId(), cd.getElementKey());
   } catch (ServicesAvailabilityException e) {
     Toast.makeText(getActivity(), "Unable to remove column from Group By list", Toast.LENGTH_LONG)
         .show();
   }
 }
コード例 #2
0
 void setColumnAsIndexedCol(ColumnDefinition cd) {
   try {
     TableUtil.get()
         .atomicSetIndexColumn(
             Tables.getInstance(),
             getAppName(),
             getTableId(),
             (cd == null) ? null : cd.getElementKey());
   } catch (ServicesAvailabilityException e) {
     Toast.makeText(getActivity(), "Unable to set Index Column", Toast.LENGTH_LONG).show();
   }
 }
コード例 #3
0
  @Override
  public void prepHeaderCellOccm(ContextMenu menu, CellInfo cellInfo)
      throws ServicesAvailabilityException {
    this.mLastHeaderCellMenued = cellInfo;

    String sortColumn;
    String indexColumn;
    ArrayList<String> groupByColumns;
    DbHandle db = null;
    try {
      db = Tables.getInstance().getDatabase().openDatabase(getAppName());
      sortColumn =
          TableUtil.get().getSortColumn(Tables.getInstance(), getAppName(), db, getTableId());
      indexColumn =
          TableUtil.get().getIndexColumn(Tables.getInstance(), getAppName(), db, getTableId());
      groupByColumns =
          TableUtil.get()
              .getColumnOrder(
                  Tables.getInstance(),
                  getAppName(),
                  db,
                  getTableId(),
                  spreadsheetTable.getColumnDefinitions());
    } finally {
      if (db != null) {
        Tables.getInstance().getDatabase().closeDatabase(getAppName(), db);
      }
    }

    ColumnDefinition cd = spreadsheetTable.getColumnByElementKey(cellInfo.elementKey);
    if (groupByColumns.contains(cd.getElementKey())) {
      menu.add(
          ContextMenu.NONE,
          MENU_ITEM_ID_UNSET_COLUMN_AS_GROUP_BY,
          ContextMenu.NONE,
          "Unset as Group By");
    } else if ((sortColumn != null) && cellInfo.elementKey.equals(sortColumn)) {
      menu.add(
          ContextMenu.NONE, MENU_ITEM_ID_UNSET_COLUMN_AS_SORT, ContextMenu.NONE, "Unset as Sort");
    } else {
      menu.add(
          ContextMenu.NONE,
          MENU_ITEM_ID_SET_COLUMN_AS_GROUP_BY,
          ContextMenu.NONE,
          "Set as Group By");
      menu.add(ContextMenu.NONE, MENU_ITEM_ID_SET_COLUMN_AS_SORT, ContextMenu.NONE, "Set as Sort");
    }
    if (cellInfo.elementKey.equals(indexColumn)) {
      menu.add(
          ContextMenu.NONE, MENU_ITEM_ID_UNSET_AS_INDEXED_COL, ContextMenu.NONE, "Unfreeze Column");
    } else {
      menu.add(
          ContextMenu.NONE, MENU_ITEM_ID_SET_AS_INDEXED_COL, ContextMenu.NONE, "Freeze Column");
    }

    menu.add(
        ContextMenu.NONE,
        MENU_ITEM_ID_EDIT_COLUMN_COLOR_RULES,
        ContextMenu.NONE,
        getString(R.string.edit_column_color_rules));
  }