Package org.pentaho.aggdes.ui.model

Examples of org.pentaho.aggdes.ui.model.AggList


    AggListListener aggListListener = new AggListListener() {

      public void listChanged(AggListEvent e) {
        final String ESTIMATE_UNKNOWN = "unknown";

        AggList list = (AggList) e.getSource();
        switch (e.getType()) {
        case AGGS_ADDED:
          try {
            for (int i = e.getIndex(); i < list.getSize(); i++) {
              UIAggregate newAgg = list.getAgg(i);
 
              XulTreeRow newRow = (XulTreeRow) document.createElement("treerow");
 
              XulTreeCell newCell = (XulTreeCell) document.createElement("treecell");
              newCell.setValue(newAgg.getEnabled());
              newRow.addCell(newCell);
 
              newCell = (XulTreeCell) document.createElement("treecell");
              newCell.setLabel(newAgg.isAlgoAgg() ? Messages.getString("agg_type_advisor") : Messages.getString("agg_type_custom"));
              newRow.addCell(newCell);
 
              newCell = (XulTreeCell) document.createElement("treecell");
              newCell.setLabel(newAgg.getName());
              newRow.addCell(newCell);
 
              newCell = (XulTreeCell) document.createElement("treecell");
              double rowCount = newAgg.estimateRowCount();
              if (rowCount == 0) {
                newCell.setLabel(ESTIMATE_UNKNOWN);
              } else {
                newCell.setLabel(format.format(rowCount));
              }
              newRow.addCell(newCell);
 
              newCell = (XulTreeCell) document.createElement("treecell");
              double space = newAgg.estimateSpace();
              if (space == 0) {
                newCell.setLabel(ESTIMATE_UNKNOWN);
              } else {
                newCell.setLabel(format.format(space));
              }
              newRow.addCell(newCell);
 
              aggTable.addTreeRow(newRow);
            }
            changeInAggregates();
           
          } catch (XulException xe) {
            logger.error("Error adding new row to Agg table", xe);
          }
          break;
       
          case AGG_ADDED:
            try {
              UIAggregate newAgg = list.getAgg(e.getIndex());

              XulTreeRow newRow = (XulTreeRow) document.createElement("treerow");

              XulTreeCell newCell = (XulTreeCell) document.createElement("treecell");
              newCell.setValue(newAgg.getEnabled());
              newRow.addCell(newCell);

              newCell = (XulTreeCell) document.createElement("treecell");
              newCell.setLabel(newAgg.isAlgoAgg() ? Messages.getString("agg_type_advisor") : Messages.getString("agg_type_custom"));
              newRow.addCell(newCell);

              newCell = (XulTreeCell) document.createElement("treecell");
              newCell.setLabel(newAgg.getName());
              newRow.addCell(newCell);

              newCell = (XulTreeCell) document.createElement("treecell");
              double rowCount = newAgg.estimateRowCount();
              if (rowCount == 0) {
                newCell.setLabel(ESTIMATE_UNKNOWN);
              } else {
                newCell.setLabel(format.format(rowCount));
              }
              newRow.addCell(newCell);

              newCell = (XulTreeCell) document.createElement("treecell");
              double space = newAgg.estimateSpace();
              if (space == 0) {
                newCell.setLabel(ESTIMATE_UNKNOWN);
              } else {
                newCell.setLabel(format.format(space));
              }
              newRow.addCell(newCell);

              aggTable.addTreeRow(newRow);

              changeInAggregates();
             
            } catch (XulException xe) {
              logger.error("Error adding new row to Agg table", xe);
            }
            break;
          case AGGS_CLEARED:
            aggTable.getRootChildren().removeAll();
            aggModel.setThinAgg(null);
            changeInAggregates();
            break;
          case AGG_REMOVED:
            aggTable.removeTreeRows(new int[] { e.getIndex() });
            aggTable.clearSelection();
            int[] tableSelection = aggTable.getSelectedRows();
            if (e.getIndex() < list.getSize()) {
              //we're single selection
              list.setSelectedIndex(e.getIndex());
            }
            //There's aready a selection listener on the table firing the same.
            UIAggregate tempAgg = list.getSelectedValue();
           
            aggModel.setThinAgg(list.getSelectedValue());
           
            changeInAggregates();
                       
            break;
          case SELECTION_CHANGED:
           
            if (aggTable.getSelectedRows().length > 0) {
              logger.info("Event index: " + e.getIndex() + " aggTable.selectedRow0: " + aggTable.getSelectedRows()[0]);
            }
            int[] rows = aggTable.getSelectedRows();
            if (aggTable.getSelectedRows().length > 0 && e.getIndex() == aggTable.getSelectedRows()[0]) {
              aggModel.setThinAgg(list.getSelectedValue());
            }
            //check to see if it's already selected, ignore if so
            int[] curSelection = aggTable.getSelectedRows();
//            if(curSelection.length > 0 && e.getIndex() == curSelection[0]){
//              logger.debug("already selected row");
//              break;
//            }
            logger.debug("selecting new row");
            aggTable.setSelectedRows(new int[] { e.getIndex() });
            aggModel.setThinAgg(list.getSelectedValue());
            break;
          case AGG_CHANGED:
            logger.debug("agg list controller responding to AGG_CHANGED event from aggList");
            int idx = e.getIndex();
            UIAggregate agg = list.getAgg(idx);
            aggTable.getRootChildren().getItem(idx).getRow().getCell(0).setValue(agg.getEnabled());
            aggTable.getRootChildren().getItem(idx).getRow().getCell(1).setLabel(
                agg.isAlgoAgg()
                ? Messages.getString("agg_type_advisor")
                : Messages.getString("agg_type_custom")
View Full Code Here


    // update the checksum
    connectionModel.getSelectedSchemaModel().setSchemaChecksum(
        connectionModel.getSelectedSchemaModel().recalculateSchemaChecksum());
   
    List<Object> systemObjects = new ArrayList<Object>();
    AggList aggList = getAggList();
    XStream xstream = getXStream(schema);
    systemObjects.add(SERIALIZATION_VERSION);
    systemObjects.add(connectionModel.getDatabaseMeta());
    systemObjects.add(connectionModel.getSelectedSchemaModel());
    systemObjects.add(aggList);
View Full Code Here

  public AggListConverter(AggList aggList){
    this.aggList = aggList;
  }
 
  public void marshal(Object arg0, HierarchicalStreamWriter writer, MarshallingContext context) {
    AggList impl = (AggList)arg0;
    for (int i = 0; i < impl.getSize(); i++) {
      writer.startNode("aggregation");
      context.convertAnother(impl.getAgg(i));
      writer.endNode();
    }
  }
View Full Code Here

TOP

Related Classes of org.pentaho.aggdes.ui.model.AggList

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.