ButtonCell(String text){ cellButton = new Button(); cellButton.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent t) { // do something when button clicked Record record = (Record) getTableRow().getItem(); // do something dependent on record.... } }); } //Display button if the row is not empty @Override protected void updateItem(Boolean t, boolean empty) { super.updateItem(t, empty); if(!empty){ final Record record = (Record)getTableRow().getItem(); cellButton.setText("Do something with "+record.getId()); setGraphic(cellButton); } else { // you must always do the following in cell subclasses: setGraphic(null); } }
public int saveOrUpdate(Record record) { if(record.getId() != null) { return record.update(); } return record.store(); }
public void deleteRecord(org.osid.shared.Id recordId) throws org.osid.repository.RepositoryException { if (recordId == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } try { for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record record = (org.osid.repository.Record)this.recordVector.elementAt(i); if (record.getId().isEqual(recordId)) { this.recordVector.removeElementAt(i); return; } } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); } catch (Throwable t) { log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } }
public void deleteRecord(org.osid.shared.Id recordId) throws org.osid.repository.RepositoryException { if (recordId == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } try { for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record record = (org.osid.repository.Record)this.recordVector.elementAt(i); if (record.getId().isEqual(recordId)) { this.recordVector.removeElementAt(i); return; } } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); } catch (Throwable t) { log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } }
public void deleteRecord(org.osid.shared.Id recordId) throws org.osid.repository.RepositoryException { if (recordId == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } try { for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record record = (org.osid.repository.Record)this.recordVector.elementAt(i); if (record.getId().isEqual(recordId)) { this.recordVector.removeElementAt(i); return; } } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); } catch (Throwable t) { log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } }
public void deleteRecord(org.osid.shared.Id recordId) throws org.osid.repository.RepositoryException { if (recordId == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } try { for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record record = (org.osid.repository.Record)this.recordVector.elementAt(i); if (record.getId().isEqual(recordId)) { this.recordVector.removeElementAt(i); return; } } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); } catch (Throwable t) { log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } }
public org.osid.repository.Record getRecord(org.osid.shared.Id recordId) throws org.osid.repository.RepositoryException { if (recordId == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } try { for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record record = (org.osid.repository.Record)this.recordVector.elementAt(i); if (record.getId().isEqual(recordId)) { return record; } } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); } catch (Throwable t) { log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } }
public org.osid.repository.Record getRecord(org.osid.shared.Id recordId) throws org.osid.repository.RepositoryException { if (recordId == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } try { for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record record = (org.osid.repository.Record)this.recordVector.elementAt(i); if (record.getId().isEqual(recordId)) { return record; } } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); } catch (Throwable t) { log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } }
public org.osid.repository.Record getRecord(org.osid.shared.Id recordId) throws org.osid.repository.RepositoryException { if (recordId == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } try { for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record record = (org.osid.repository.Record)this.recordVector.elementAt(i); if (record.getId().isEqual(recordId)) { return record; } } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); } catch (Throwable t) { log.warn(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } }
public org.osid.repository.Record getRecord(org.osid.shared.Id recordId) throws org.osid.repository.RepositoryException { if (recordId == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } try { for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record record = (org.osid.repository.Record)this.recordVector.elementAt(i); if (record.getId().isEqual(recordId)) { return record; } } throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID); } catch (Throwable t) { log.error(t.getMessage()); throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED); } }
super.updateItem(record, empty); if(!empty){ cellButton.setText("Something with "+record.getId()); setGraphic(cellButton); } else {
StringArrayVector.Builder id = new StringArrayVector.Builder(); StringArrayVector.Builder country = new StringArrayVector.Builder(); DoubleArrayVector.Builder revenue = new DoubleArrayVector.Builder(); for(Record record : records) { id.add(record.getId()); country.add(record.getCountry()); revenue.add(record.getRevenue()); } ListVector.NamedBuilder myDf = new ListVector.NamedBuilder(); myDf.setAttribute(Symbols.CLASS, "data.frame"); myDf.setAttribute(Symbols.ROW_NAMES, new RowNamesVector(records.size()); myDf.add("id", id.build()); myDf.add("country", country.build()); myDf.add("revenue", revenue.build());