コード例 #1
0
  public void changeSortOrder(Widget sender, int sortOrder) {

    if (sender instanceof DisplayColumnWidget) {
      DisplayColumnWidget displayColumnWidget = (DisplayColumnWidget) sender;
      SortColumnWidget sortWidget = sortColMap.get(displayColumnWidget);

      if (sortOrder != SortField.SORT_NULL) {
        if (sortWidget == null) {
          sortWidget = new SortColumnWidget(sortOrder, this);
          sortPanel.add(sortWidget);
          sortColMap.put(displayColumnWidget, sortWidget);
          dispColMap.put(sortWidget, displayColumnWidget);
        } else sortWidget.setSortOrder(sortOrder);

        sortWidget.setText(displayColumnWidget.getText());
      } else if (sortPanel.getWidgetIndex(sortWidget) > -1) {
        sortPanel.remove(sortWidget);
        dispColMap.remove(sortColMap.remove(displayColumnWidget));
      }
    } else if (sender instanceof SortColumnActionHyperlink) {
      SortColumnWidget sortWidget = (SortColumnWidget) sender.getParent().getParent();
      sortWidget.setSortOrder(sortOrder);
      dispColMap.get(sortWidget).setSortOrder(sortOrder);
    } else dispColMap.get((SortColumnWidget) sender).setSortOrder(sortOrder);
  }
コード例 #2
0
  public List<SortField> getSortFields() {

    List<SortField> sortFields = new ArrayList<SortField>();

    int count = sortPanel.getWidgetCount();
    for (int i = 1; i < count; i++) {
      DisplayColumnWidget displayColumnWidget = dispColMap.get(sortPanel.getWidget(i));
      sortFields.add(
          new SortField(displayColumnWidget.getName(), displayColumnWidget.getSortOrder()));
    }

    return sortFields;
  }
コード例 #3
0
  public void deleteColumn(Widget sender) {
    if (sender instanceof ColumnActionHyperlink) {
      DisplayColumnWidget displayColumnWidget =
          (DisplayColumnWidget) sender.getParent().getParent();
      columnPanel.remove(displayColumnWidget);
      dispColMap.remove(sortColMap.remove(displayColumnWidget));
    } else {
      SortColumnWidget sortColumnWidget = (SortColumnWidget) sender.getParent().getParent();
      sortPanel.remove(sortColumnWidget);

      DisplayColumnWidget displayColumnWidget = dispColMap.remove(sortColumnWidget);
      sortColMap.remove(displayColumnWidget);
      displayColumnWidget.setSortOrder(SortField.SORT_NULL);
    }
  }
コード例 #4
0
 private void loadSortFields(Element rootNode, HashMap<String, DisplayColumnWidget> displayCols) {
   NodeList nodes = rootNode.getChildNodes();
   for (int index = 0; index < nodes.getLength(); index++) {
     Node node = nodes.item(index);
     if (node.getNodeType() == Node.ELEMENT_NODE
         && node.getNodeName().equalsIgnoreCase(XmlBuilder.NODE_NAME_FIELD)) {
       Element element = (Element) node;
       DisplayColumnWidget widget =
           displayCols.get(element.getAttribute(XmlBuilder.ATTRIBUTE_NAME_NAME));
       int sortOrder =
           Integer.parseInt(element.getAttribute(XmlBuilder.ATTRIBUTE_NAME_SORT_ORDER));
       widget.setSortOrder(sortOrder);
       changeSortOrder(widget, sortOrder);
     }
   }
 }
コード例 #5
0
  private HashMap<String, DisplayColumnWidget> loadDisplayFields(
      Element rootNode, HashMap<String, DisplayColumnWidget> displayCols) {

    NodeList nodes = rootNode.getChildNodes();
    for (int index = 0; index < nodes.getLength(); index++) {
      Node node = nodes.item(index);
      if (node.getNodeType() == Node.ELEMENT_NODE
          && node.getNodeName().equalsIgnoreCase(XmlBuilder.NODE_NAME_FIELD)) {
        Element element = (Element) node;
        DisplayColumnWidget widget = addColumn(this);
        widget.setName(element.getAttribute(XmlBuilder.ATTRIBUTE_NAME_NAME));
        widget.setText(element.getAttribute(XmlBuilder.ATTRIBUTE_NAME_TEXT));
        widget.setAggregateFunction(element.getAttribute(XmlBuilder.ATTRIBUTE_NAME_AGG_FUNC));

        displayCols.put(widget.getName(), widget);
      }
    }

    return displayCols;
  }
コード例 #6
0
  public List<DisplayField> getDisplayFields() {

    List<DisplayField> displayFields = new ArrayList<DisplayField>();

    int count = columnPanel.getWidgetCount();
    for (int i = 1; i < count; i++) {
      Widget widget = columnPanel.getWidget(i);
      if (widget instanceof DisplayColumnWidget) {
        DisplayColumnWidget displayColumnWidget = (DisplayColumnWidget) widget;
        displayFields.add(
            new DisplayField(
                displayColumnWidget.getName(),
                displayColumnWidget.getText(),
                displayColumnWidget.getAggregateFunction(),
                displayColumnWidget.getDataType()));
      }
    }

    return displayFields;
  }