Changeset 12298 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2017-06-02T15:41:37+02:00 (7 years ago)
Author:
michael2402
Message:

Rename one character variables in filter dialog, add javadoc.

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  
    5757
    5858/**
     59 * The filter dialog displays a list of filters that are active on the current edit layer.
    5960 *
    6061 * @author Petr_Dlouhý
     
    296297    }
    297298
     299    /**
     300     * Updates the headline of this dialog to display the number of active filters.
     301     */
    298302    public void updateDialogHeader() {
    299303        SwingUtilities.invokeLater(() -> setTitle(
     
    301305    }
    302306
     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     */
    303311    public void drawOSDText(Graphics2D g) {
    304312        filterModel.drawOSDText(g);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java

    r12122 r12298  
    3333
    3434/**
     35 * The model that is used for the table in the {@link FilterDialog}.
    3536 *
    3637 * @author Petr_Dlouhý
     
    3839public class FilterTableModel extends AbstractTableModel {
    3940
     41    /**
     42     * The filter enabled column
     43     */
    4044    public static final int COL_ENABLED = 0;
     45    /**
     46     * The column indicating if the filter is hiding.
     47     */
    4148    public static final int COL_HIDING = 1;
     49    /**
     50     * The column that displays the filter text
     51     */
    4252    public static final int COL_TEXT = 2;
     53    /**
     54     * The column to invert the filter
     55     */
    4356    public static final int COL_INVERTED = 3;
    4457
    45     // number of primitives that are disabled but not hidden
     58    /**
     59     * number of primitives that are disabled but not hidden
     60     */
    4661    public int disabledCount;
    47     // number of primitives that are disabled and hidden
     62    /**
     63     * number of primitives that are disabled and hidden
     64     */
    4865    public int disabledAndHiddenCount;
    4966
     
    7996    }
    8097
     98    /**
     99     * Runs the filters on the current edit data set.
     100     */
    81101    public void executeFilters() {
    82102        DataSet ds = Main.getLayerManager().getEditDataSet();
     
    126146    }
    127147
     148    /**
     149     * Runs the filter on a list of primitives that are part of the edit data set.
     150     * @param primitives The primitives
     151     */
    128152    public void executeFilters(Collection<? extends OsmPrimitive> primitives) {
    129153        DataSet ds = Main.getLayerManager().getEditDataSet();
     
    179203    }
    180204
     205    /**
     206     * Clears all filtered flags from all primitives in the dataset
     207     */
    181208    public void clearFilterFlags() {
    182209        DataSet ds = Main.getLayerManager().getEditDataSet();
     
    206233    }
    207234
    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);
    210241        savePrefs();
    211242        updateFilters();
     
    213244    }
    214245
    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)
    217252            return;
    218         filters.add(i + 1, filters.remove(i));
     253        filters.add(rowIndex + 1, filters.remove(rowIndex));
    219254        savePrefs();
    220255        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)
    226265            return;
    227         filters.add(i - 1, filters.remove(i));
     266        filters.add(rowIndex - 1, filters.remove(rowIndex));
    228267        savePrefs();
    229268        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);
    235278        savePrefs();
    236279        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);
    242290        savePrefs();
    243291        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);
    249302    }
    250303
     
    382435    private final OSDLabel lblOSD = new OSDLabel("");
    383436
     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     */
    384441    public void drawOSDText(Graphics2D g) {
    385442        String message = "<html>" + tr("<h2>Filter active</h2>");
Note: See TracChangeset for help on using the changeset viewer.