/** * Constructor * @param selection * @param sourceName * @param dataManager */ public TableEditableElementImpl(Set<Long> selection, String sourceName, DataManager dataManager) { super(sourceName, dataManager); this.selectedGeometries = new LongUnion(selection); }
/** * Constructor * @param sourceName * @param dataManager */ public TableEditableElementImpl(String sourceName, DataManager dataManager) { super(sourceName, dataManager); this.selectedGeometries = new LongUnion(); }
@Override public void setSelection(Set<Long> newSelection) { LongUnion oldSelection = selection; selection = new LongUnion(newSelection); propertyChangeSupport.firePropertyChange(PROP_SELECTION, oldSelection, selection); } }
private LongUnion readSelection(InputStream in) { try { ObjectInputStream selectionIn = new ObjectInputStream(in); return (LongUnion)selectionIn.readObject(); } catch (ClassNotFoundException | IOException ex) { LOGGER.error(I18N.tr("Selection deserialisation failed"),ex); } return new LongUnion(); } @Override
@Override public void setSelection(Set<Long> selection) { LOGGER.debug("Editable selection change"); Set<Long> oldSelection = this.selectedGeometries; this.selectedGeometries = new LongUnion(selection); propertyChangeSupport.firePropertyChange(PROP_SELECTION, oldSelection, getSelection()); }
public static SortedSet<Long> getRowPkFromRowNumber(ReadRowSet rowSet, SortedSet<Integer> rowNumber) throws SQLException { SortedSet<Long> modelRows = new LongUnion(); for (int rowNum : rowNumber) { rowSet.absolute(rowNum); modelRows.add(rowSet.getPk()); } return modelRows; }
private void writeSelection(OutputStream out) throws IOException { ObjectOutputStream selectionOut = new ObjectOutputStream(out); //Do not save byte consuming selection LongUnion mergedSelection; Set<Long> selection = tableEditableElement.getSelection(); if(selection instanceof LongUnion) { mergedSelection = (LongUnion) selection; } else { mergedSelection = new LongUnion(selection); } if(mergedSelection.getValueRanges().size()>MAX_SELECTION_SERIALISATION_SIZE) { selectionOut.writeObject(new IntegerUnion()); } else { selectionOut.writeObject(mergedSelection); } selectionOut.flush(); selectionOut.close(); }
public DeleteSelectedRows(SortedSet<Long> rowPkToDelete, String tableName, DataSource dataSource) { this.rowPkToDelete = new LongUnion(rowPkToDelete); this.tableName = tableName; this.dataSource = dataSource; setTaskName(I18N.tr("Delete selected rows")); }
@Override public void setSelectionTableRow(SortedSet<Integer> selection) throws EditableElementException { SortedSet<Long> modelRows = new LongUnion(); for(int rowNum : selection) { modelRows.add(getRowSet().getRowPK(rowNum)); } setSelection(modelRows); }
/** * Compute the envelope based on the selection * @param pm * @param data * @param tableReference * @return * @throws SQLException */ private Envelope getLayerSelectionEnvelope(ProgressMonitor pm, Set<Long> data,String tableReference) throws SQLException { SortedSet<Long> sortedSet; if(data instanceof SortedSet) { sortedSet = (SortedSet<Long>)data; } else { sortedSet = new LongUnion(data); } return ReadTable.getTableSelectionEnvelope(mapContext.getDataManager(), tableReference,sortedSet, pm); }
@Override protected void done() { try { if (controlDown) { LongUnion newSel = new LongUnion(activeLayer.getSelection()); for (long el : get()) { if (!newSel.remove(el)) { newSel.add(el); } } activeLayer.setSelection(newSel); } else { activeLayer.setSelection(get()); } if (activeLayer.getSelection().isEmpty()) { automaton.transition(Code.NO_SELECTION); } else { automaton.transition(Code.SELECTION); } } catch (Exception ex) { try { automaton.transition(Code.NO_SELECTION); } catch (TransitionException | FinishedAutomatonException e) { // Ignore } automaton.logger.error(ex.getLocalizedMessage(), ex); } } }