Changeset 12298 in josm for trunk/src/org
- Timestamp:
- 2017-06-02T15:41:37+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r12279 r12298 57 57 58 58 /** 59 * The filter dialog displays a list of filters that are active on the current edit layer. 59 60 * 60 61 * @author Petr_Dlouhý … … 296 297 } 297 298 299 /** 300 * Updates the headline of this dialog to display the number of active filters. 301 */ 298 302 public void updateDialogHeader() { 299 303 SwingUtilities.invokeLater(() -> setTitle( … … 301 305 } 302 306 307 /** 308 * Draws a text on the map display that indicates that filters are active. 309 * @param g The graphics to draw that text on. 310 */ 303 311 public void drawOSDText(Graphics2D g) { 304 312 filterModel.drawOSDText(g); -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java
r12122 r12298 33 33 34 34 /** 35 * The model that is used for the table in the {@link FilterDialog}. 35 36 * 36 37 * @author Petr_Dlouhý … … 38 39 public class FilterTableModel extends AbstractTableModel { 39 40 41 /** 42 * The filter enabled column 43 */ 40 44 public static final int COL_ENABLED = 0; 45 /** 46 * The column indicating if the filter is hiding. 47 */ 41 48 public static final int COL_HIDING = 1; 49 /** 50 * The column that displays the filter text 51 */ 42 52 public static final int COL_TEXT = 2; 53 /** 54 * The column to invert the filter 55 */ 43 56 public static final int COL_INVERTED = 3; 44 57 45 // number of primitives that are disabled but not hidden 58 /** 59 * number of primitives that are disabled but not hidden 60 */ 46 61 public int disabledCount; 47 // number of primitives that are disabled and hidden 62 /** 63 * number of primitives that are disabled and hidden 64 */ 48 65 public int disabledAndHiddenCount; 49 66 … … 79 96 } 80 97 98 /** 99 * Runs the filters on the current edit data set. 100 */ 81 101 public void executeFilters() { 82 102 DataSet ds = Main.getLayerManager().getEditDataSet(); … … 126 146 } 127 147 148 /** 149 * Runs the filter on a list of primitives that are part of the edit data set. 150 * @param primitives The primitives 151 */ 128 152 public void executeFilters(Collection<? extends OsmPrimitive> primitives) { 129 153 DataSet ds = Main.getLayerManager().getEditDataSet(); … … 179 203 } 180 204 205 /** 206 * Clears all filtered flags from all primitives in the dataset 207 */ 181 208 public void clearFilterFlags() { 182 209 DataSet ds = Main.getLayerManager().getEditDataSet(); … … 206 233 } 207 234 208 public void addFilter(Filter f) { 209 filters.add(f); 235 /** 236 * Adds a new filter to the filter list. 237 * @param filter The new filter 238 */ 239 public void addFilter(Filter filter) { 240 filters.add(filter); 210 241 savePrefs(); 211 242 updateFilters(); … … 213 244 } 214 245 215 public void moveDownFilter(int i) { 216 if (i >= filters.size() - 1) 246 /** 247 * Moves down the filter in the given row. 248 * @param rowIndex The filter row 249 */ 250 public void moveDownFilter(int rowIndex) { 251 if (rowIndex >= filters.size() - 1) 217 252 return; 218 filters.add( i+ 1, filters.remove(i));253 filters.add(rowIndex + 1, filters.remove(rowIndex)); 219 254 savePrefs(); 220 255 updateFilters(); 221 fireTableRowsUpdated(i, i + 1); 222 } 223 224 public void moveUpFilter(int i) { 225 if (i == 0) 256 fireTableRowsUpdated(rowIndex, rowIndex + 1); 257 } 258 259 /** 260 * Moves up the filter in the given row 261 * @param rowIndex The filter row 262 */ 263 public void moveUpFilter(int rowIndex) { 264 if (rowIndex == 0) 226 265 return; 227 filters.add( i- 1, filters.remove(i));266 filters.add(rowIndex - 1, filters.remove(rowIndex)); 228 267 savePrefs(); 229 268 updateFilters(); 230 fireTableRowsUpdated(i - 1, i); 231 } 232 233 public void removeFilter(int i) { 234 filters.remove(i); 269 fireTableRowsUpdated(rowIndex - 1, rowIndex); 270 } 271 272 /** 273 * Removes the filter that is displayed in the given row 274 * @param rowIndex 275 */ 276 public void removeFilter(int rowIndex) { 277 filters.remove(rowIndex); 235 278 savePrefs(); 236 279 updateFilters(); 237 fireTableRowsDeleted(i, i); 238 } 239 240 public void setFilter(int i, Filter f) { 241 filters.set(i, f); 280 fireTableRowsDeleted(rowIndex, rowIndex); 281 } 282 283 /** 284 * Sets/replaces the filter for a given row. 285 * @param rowIndex The row index 286 * @param filter The filter that should be placed in that row 287 */ 288 public void setFilter(int rowIndex, Filter filter) { 289 filters.set(rowIndex, filter); 242 290 savePrefs(); 243 291 updateFilters(); 244 fireTableRowsUpdated(i, i); 245 } 246 247 public Filter getFilter(int i) { 248 return filters.get(i); 292 fireTableRowsUpdated(rowIndex, rowIndex); 293 } 294 295 /** 296 * Gets the filter by row index 297 * @param rowIndex The row index 298 * @return The filter in that row 299 */ 300 public Filter getFilter(int rowIndex) { 301 return filters.get(rowIndex); 249 302 } 250 303 … … 382 435 private final OSDLabel lblOSD = new OSDLabel(""); 383 436 437 /** 438 * Draws a text on the map display that indicates that filters are active. 439 * @param g The graphics to draw that text on. 440 */ 384 441 public void drawOSDText(Graphics2D g) { 385 442 String message = "<html>" + tr("<h2>Filter active</h2>");
Note:
See TracChangeset
for help on using the changeset viewer.