Ejemplo n.º 1
0
 /**
  * This will return the cell XML.
  *
  * @param colValue
  * @return the cell XML.
  */
 public static String getCellXML(String colValue) {
   StringBuffer cellXML = new StringBuffer(300);
   cellXML.append(GridUtil.getCellStartTag());
   if (colValue != null) {
     cellXML.append(formatString(org.apache.commons.lang.StringEscapeUtils.escapeXml(colValue)));
   }
   cellXML.append(GridUtil.getCellEndTag());
   return cellXML.toString();
 }
  @Override
  public void setDocuments(GUIDocument[] documents) {
    Record[] records = new Record[0];
    if (documents == null || documents.length == 0) setData(records);

    records = new Record[documents.length];
    for (int i = 0; i < documents.length; i++) {
      GUIDocument doc = documents[i];
      Record record = GridUtil.fromDocument(doc);
      records[i] = record;
    }

    setData(records);
  }
  @Override
  public void updateDocument(GUIDocument document) {
    Record record = null;

    // Find the record the corresponds to the given document
    Record[] records = getData();
    for (Record rec : records)
      if (Long.parseLong(rec.getAttribute("id")) == document.getId()) record = rec;

    if (record != null) {
      GridUtil.updateRecord(document, record);
      redraw();
    }
  }
 @Override
 public long[] getIds() {
   return GridUtil.getIds(getRecordList().toArray());
 }
 @Override
 public long[] getSelectedIds() {
   return GridUtil.getIds(getSelection());
 }
 @Override
 public GUIDocument[] getSelectedDocuments() {
   return GridUtil.toDocuments(getSelection());
 }
 @Override
 public GUIDocument getSelectedDocument() {
   return GridUtil.toDocument(getSelectedRecord());
 }
Ejemplo n.º 8
0
 /**
  * This will return the values of the user data for a row.
  *
  * @param valueForUserData
  * @return values of the user data for a row.
  */
 public static String getUserDataForRow(String valueForUserData) {
   StringBuffer userdata = new StringBuffer(300);
   userdata.append(valueForUserData);
   userdata.append(GridUtil.getUserDataEndTag());
   return userdata.toString();
 }
Ejemplo n.º 9
0
 /**
  * This will return the column XML.
  *
  * @param width width of the column
  * @param type
  * @param caption
  * @param align alignment of column
  * @return
  */
 public static String getColumnXML(
     String width, String type, String caption, String align, String sort) {
   return GridUtil.getColumnStartTag(type, width, align, sort)
       + caption
       + GridUtil.getColumnEndTag();
 }