org.pentaho.ui.xul.containers.XulTreeRow Java Examples

The following examples show how to use org.pentaho.ui.xul.containers.XulTreeRow. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataHandler.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void poolingRowChange( int idx ) {

    if ( idx != -1 ) {

      if ( idx >= BaseDatabaseMeta.poolingParameters.length ) {
        idx = BaseDatabaseMeta.poolingParameters.length - 1;
      }
      if ( idx < 0 ) {
        idx = 0;
      }
      poolingDescription.setValue( BaseDatabaseMeta.poolingParameters[ idx ].getDescription() );

      XulTreeRow row = poolParameterTree.getRootChildren().getItem( idx ).getRow();
      if ( row.getSelectedColumnIndex() == 2 ) {
        row.addCellText( 0, "true" );
      }

    }
  }
 
Example #2
Source File: PreviewRowsSwingDialog.java    From pentaho-mongodb-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * TODO: replace this method with XUL bindings
 * <p/>
 * This is a bad bad method. We need a way to load the column definitions and
 * data through standard XUL bindings.
 *
 * @param data
 * @param columns
 */
protected void createPreviewRows( List<Object[]> data, List<String> columns ) {

  // Adds table rows.
  Object[] theObj = null;
  XulTreeRow theRow = null;
  Object theValue = null;
  SwingTreeCell theCell = null;

  XulTree table = (XulTree) super.document.getElementById( "tableData" );
  table.getRootChildren().removeAll();
  Iterator<Object[]> theItr = data.iterator();
  while ( theItr.hasNext() ) {
    theObj = theItr.next();
    theRow = table.getRootChildren().addNewRow();
    for ( int i = 0; i < theObj.length; i++ ) {
      theValue = theObj[i];
      theCell = new SwingTreeCell( null );
      theCell.setLabel( theValue == null ? "" : theValue.toString() );
      theRow.addCell( theCell );
    }
  }

  // Adds table columns.
  SwingTreeCol theColumn = null;

  SwingTreeCols theColumns = new SwingTreeCols( null, table, null, null );
  for ( int i = 0; i < columns.size(); i++ ) {
    theColumn = new SwingTreeCol( null, null, null, null );
    theColumn.setWidth( 100 );
    theColumn.setLabel( columns.get( i ) );
    theColumns.addColumn( theColumn );
  }
  table.setColumns( theColumns );
  table.update();

}
 
Example #3
Source File: DataHandler.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void editOptions( int index ) {
  if ( index + 1 == optionsParameterTree.getRows() ) {
    // editing last row add a new one below

    Object[][] values = optionsParameterTree.getValues();
    Object[] row = values[ values.length - 1 ];
    if ( row != null && ( !StringUtils.isEmpty( (String) row[ 0 ] ) || !StringUtils.isEmpty( (String) row[ 1 ] ) ) ) {
      // acutally have something in current last row
      XulTreeRow newRow = optionsParameterTree.getRootChildren().addNewRow();

      newRow.addCellText( 0, "" );
      newRow.addCellText( 1, "" );
    }
  }
}
 
Example #4
Source File: DataHandler.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void setDefaultPoolParameters() {
  if ( poolParameterTree != null ) {
    for ( DatabaseConnectionPoolParameter parameter : BaseDatabaseMeta.poolingParameters ) {
      XulTreeRow row = poolParameterTree.getRootChildren().addNewRow();
      row.addCellText( 0, "false" );
      row.addCellText( 1, parameter.getParameter() );
      row.addCellText( 2, parameter.getDefaultValue() );
    }
  }
}
 
Example #5
Source File: AggListController.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
public void saveAggChange(int idx) {
  UIAggregate agg = getAggList().getAgg(idx);
  XulTree aggTable = (XulTree) document.getElementById("definedAggTable");
  XulTreeRow row = aggTable.getRootChildren().getItem(idx).getRow();
  agg.setEnabled((Boolean) row.getCell(0).getValue());

  // get row count estimate
  Aggregate algoAggregate = algorithm.createAggregate(connectionModel.getSchema(), agg.getAttributes());
  agg.setEstimateRowCount(algoAggregate.estimateRowCount());
  agg.setEstimateSpace(algoAggregate.estimateSpace());
  getAggList().aggChanged(agg);
  System.out.println("Saving agg, enabled? " + row.getCell(0).getValue());
  
}
 
Example #6
Source File: XulPreviewRowsController.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void createPreviewRows() {
  GetPreviewTableProgressDialog theProgressDialog =
    new GetPreviewTableProgressDialog( this.shell, this.databaseMeta, this.schema, this.table, this.limit );
  List<Object[]> thePreviewData = theProgressDialog.open();

  // Adds table rows.
  Object[] theObj = null;
  XulTreeRow theRow = null;
  Object theValue = null;
  SwtTreeCell theCell = null;
  int theRowCount = 0;

  XulTree thePreviewTable = (XulTree) super.document.getElementById( "table_data" );
  thePreviewTable.getRootChildren().removeAll();
  Iterator<Object[]> theItr = thePreviewData.iterator();
  while ( theItr.hasNext() ) {
    theObj = theItr.next();
    theRow = thePreviewTable.getRootChildren().addNewRow();
    theRowCount++;
    for ( int i = 0; i < theObj.length; i++ ) {
      theValue = theObj[i];
      theCell = new SwtTreeCell( null );
      theCell.setLabel( theValue == null ? "" : theValue.toString() );
      theRow.addCell( theCell );
    }
  }

  // Adds table columns.
  SwtTreeCol theColumn = null;
  String[] theFieldNames = theProgressDialog.getRowMeta().getFieldNames();
  SwtTreeCols theColumns = new SwtTreeCols( null, thePreviewTable, null, null );
  for ( int i = 0; i < theFieldNames.length; i++ ) {
    theColumn = new SwtTreeCol( null, null, null, null );
    theColumn.setWidth( 100 );
    theColumn.setLabel( theFieldNames[i] );
    theColumns.addColumn( theColumn );
  }
  thePreviewTable.setColumns( theColumns );
  thePreviewTable.update();

  setRowCount( "Rows of step: " + this.table + " (" + theRowCount + " rows)" );
}