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); } }
private void setDateRetrieved() { java.util.GregorianCalendar now = new java.util.GregorianCalendar(); int month = now.get( java.util.Calendar.MONTH ) + 1; int date = now.get( java.util.Calendar.DATE ); String monthStr, dateStr; if( month < 10 ) { monthStr = "0" + month; } else { monthStr = String.valueOf( month ); } if( date < 10 ) { dateStr = "0" + date; } else { dateStr = String.valueOf( date ); } String dateRetrieved = now.get( java.util.Calendar.YEAR ) + "-" + monthStr + "-" + dateStr; try { record.createPart( DateRetrievedPartStructure.getInstance().getId(), dateRetrieved ); } catch( org.osid.repository.RepositoryException re ) { log.warn( "setDateRetrieved() failed " + "creating new dateRetrieved Part.", re ); } }
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());
org.osid.repository.PartIterator partIterator = record.getParts(); while (partIterator.hasNextPart())
public org.osid.repository.RecordIterator getRecordsByRecordStructureType(org.osid.shared.Type recordStructureType) throws org.osid.repository.RepositoryException { if (recordStructureType == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } if ( (!recordStructureType.isEqual(this.recordStructureType)) ) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_TYPE); } java.util.Vector results = new java.util.Vector(); for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record r = (org.osid.repository.Record)this.recordVector.elementAt(i); if (r.getRecordStructure().getType().isEqual(recordStructureType)) { results.addElement(r); } } return new RecordIterator(results); } }
public org.osid.repository.Part getPart(org.osid.shared.Id partId) throws org.osid.repository.RepositoryException { if (partId == 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); org.osid.repository.PartIterator partIterator = record.getParts(); while (partIterator.hasNextPart()) { org.osid.repository.Part part = partIterator.nextPart(); if (part.getId().isEqual(partId)) { return part; } } } 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.RecordIterator getRecordsByRecordStructureType(org.osid.shared.Type recordStructureType) throws org.osid.repository.RepositoryException { if (recordStructureType == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } if ( (!recordStructureType.isEqual(this.recordStructureType)) ) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_TYPE); } java.util.Vector results = new java.util.Vector(); for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record r = (org.osid.repository.Record)this.recordVector.elementAt(i); if (r.getRecordStructure().getType().isEqual(recordStructureType)) { results.addElement(r); } } return new RecordIterator(results); } }
org.osid.repository.PartIterator partIterator = record.getParts(); while (partIterator.hasNextPart())
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); } }
private void setDateRetrieved() { java.util.GregorianCalendar now = new java.util.GregorianCalendar(); int month = now.get( java.util.Calendar.MONTH ) + 1; int date = now.get( java.util.Calendar.DATE ); String monthStr, dateStr; if( month < 10 ) { monthStr = "0" + month; } else { monthStr = String.valueOf( month ); } if( date < 10 ) { dateStr = "0" + date; } else { dateStr = String.valueOf( date ); } String dateRetrieved = now.get( java.util.Calendar.YEAR ) + "-" + monthStr + "-" + dateStr; try { record.createPart( DateRetrievedPartStructure.getInstance().getId(), dateRetrieved ); } catch( org.osid.repository.RepositoryException re ) { log.warn( "setDateRetrieved() failed " + "creating new dateRetrieved Part.", re ); } }
public org.osid.repository.RecordIterator getRecordsByRecordStructureType(org.osid.shared.Type recordStructureType) throws org.osid.repository.RepositoryException { if (recordStructureType == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } if ( (!recordStructureType.isEqual(this.recordStructureType)) && (!recordStructureType.isEqual(this.dcRecordStructureType)) && (!recordStructureType.isEqual(this.vueRecordStructureType)) ) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_TYPE); } java.util.Vector results = new java.util.Vector(); for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record r = (org.osid.repository.Record)this.recordVector.elementAt(i); if (r.getRecordStructure().getType().isEqual(recordStructureType)) { results.addElement(r); } } return new RecordIterator(results); } }
org.osid.repository.PartIterator partIterator = record.getParts(); while (partIterator.hasNextPart())
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); } }
private void createPagesPart( String text ) throws org.osid.repository.RepositoryException { if( text.charAt( 0 ) == ',' ) { // getting a poorly formatted field return; } record.createPart( PagesPartStructure.getInstance().getId(), text ); // get start and end page if possible String [] pages = text.split( "-" ); if( pages.length == 0 ) { // cannot create start/end page. return; } String spage = pages[ 0 ].trim(); // delete all non-digit chars (ie: p., pp., etc.) spage = spage.replaceAll( "\\D", "" ); // create startPage part record.createPart( StartPagePartStructure.getInstance().getId(), spage ); // end page if( pages.length == 2 ) { String epage = pages[ 1 ].trim(); epage = epage.replaceAll( "\\D", "" ); record.createPart( EndPagePartStructure.getInstance().getId(), epage ); } }
public org.osid.repository.RecordIterator getRecordsByRecordStructureType(org.osid.shared.Type recordStructureType) throws org.osid.repository.RepositoryException { if (recordStructureType == null) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.NULL_ARGUMENT); } if ( (!recordStructureType.isEqual(this.recordStructureType)) && (!recordStructureType.isEqual(this.dcRecordStructureType)) && (!recordStructureType.isEqual(this.vueRecordStructureType)) ) { throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_TYPE); } java.util.Vector results = new java.util.Vector(); for (int i=0, size = this.recordVector.size(); i < size; i++) { org.osid.repository.Record r = (org.osid.repository.Record)this.recordVector.elementAt(i); if (r.getRecordStructure().getType().isEqual(recordStructureType)) { results.addElement(r); } } return new RecordIterator(results); } }
org.osid.repository.PartIterator partIterator = record.getParts(); while (partIterator.hasNextPart())
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); } }
private void createPagesPart( String text ) throws org.osid.repository.RepositoryException { if( text.charAt( 0 ) == ',' ) { // getting a poorly formatted field return; } record.createPart( PagesPartStructure.getInstance().getId(), text ); // get start and end page if possible String [] pages = text.split( "-" ); if( pages.length == 0 ) { // cannot create start/end page. return; } String spage = pages[ 0 ].trim(); // delete all non-digit chars (ie: p., pp., etc.) spage = spage.replaceAll( "\\D", "" ); // create startPage part record.createPart( StartPagePartStructure.getInstance().getId(), spage ); // end page if( pages.length == 2 ) { String epage = pages[ 1 ].trim(); epage = epage.replaceAll( "\\D", "" ); record.createPart( EndPagePartStructure.getInstance().getId(), epage ); } }
public org.osid.repository.Part getPart(org.osid.shared.Id partId) throws org.osid.repository.RepositoryException { if (partId == 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); org.osid.repository.PartIterator partIterator = record.getParts(); while (partIterator.hasNextPart()) { org.osid.repository.Part part = partIterator.nextPart(); if (part.getId().isEqual(partId)) { return part; } } } 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); } }