Package org.richfaces.json

Examples of org.richfaces.json.JSONObject


   * Converts its state from String representation or create default state if it is not set.
   */
  private void init(UIExtendedDataTable extendedDataTable, JSONMap state){
    value = null;
    if ((state != null) && (state.size()>0)){
      value = new JSONObject(state);
    }
   
    if (value == null){
      createDefaultColumnsVisibility(extendedDataTable);
    }
View Full Code Here


      JSONWriter writer = new JSONStringer().object();
      for (Iterator<UIColumn> iter = extendedDataTable.getChildColumns(); iter.hasNext();) {
        UIColumn col = iter.next();
        writer.key(col.getId()).value(col.isVisible() ? TRUE : FALSE);
      }
      value = new JSONObject(writer.endObject().toString());
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }//createDefaultColumnsVisibility
View Full Code Here

            columnsSortState = new ColumnsSort((JSONMap) json.get("columnsSortState"));
        }
    }

    public JSONObject toJSON() {
        JSONObject json = new JSONObject();
        try {
            if (columnsWidthState != null && !columnsWidthState.isEmpty()) {
                json.put("columnsWidthState", columnsWidthState.toJSON());
            }
            if (columnsOrderState != null && !columnsOrderState.isEmpty()) {
                json.put("columnsOrderState", columnsOrderState.toJSON());
            }
            if (columnsFilterState != null && !columnsFilterState.isEmpty()) {
                json.put("columnsFilterState", columnsFilterState.toJSON());
            }
            if (columnsSortState != null && !columnsSortState.isEmpty()) {
                json.put("columnsSortState", columnsSortState.toJSON());
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return json;
View Full Code Here

            while (iterator.hasNext()) { // initialize a map of all the columns
                UIComponent component = iterator.next();
                AbstractColumn column = (AbstractColumn) component;
                writer.key(column.getId()).value(getValueFromColumn(column));
            }
            json = new JSONObject(writer.endObject().toString());
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

    /**
     * Initialize state from JSON
     */
    ColumnsState (JSONMap json) {
        if ((json != null) && (json.size() > 0)) {
            this.json = new JSONObject(json);
        }
    }
View Full Code Here

TOP

Related Classes of org.richfaces.json.JSONObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.