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


Ignore:
Timestamp:
2017-06-09T20:50:22+02:00 (7 years ago)
Author:
michael2402
Message:

Document upload dialog classes

Location:
trunk/src/org/openstreetmap/josm/gui/io
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java

    r11366 r12370  
    3939 */
    4040public class BasicUploadSettingsPanel extends JPanel {
     41    /**
     42     * Preference name for history collection
     43     */
    4144    public static final String HISTORY_KEY = "upload.comment.history";
     45    /**
     46     * Preference name for last used upload comment
     47     */
    4248    public static final String HISTORY_LAST_USED_KEY = "upload.comment.last-used";
     49    /**
     50     * Preference name for the max age search comments may have
     51     */
    4352    public static final String HISTORY_MAX_AGE_KEY = "upload.comment.max-age";
     53    /**
     54     * Preference name for the history of source values
     55     */
    4456    public static final String SOURCE_HISTORY_KEY = "upload.source.history";
    4557
  • trunk/src/org/openstreetmap/josm/gui/io/MaxChangesetSizeExceededPolicy.java

    r3083 r12370  
    22package org.openstreetmap.josm.gui.io;
    33
     4/**
     5 * This determines what to do when the max changeset size was exceeded by a upload.
     6 */
    47public enum MaxChangesetSizeExceededPolicy {
    58    /**
  • trunk/src/org/openstreetmap/josm/gui/io/UploadOrSaveState.java

    r4310 r12370  
    22package org.openstreetmap.josm.gui.io;
    33
     4/**
     5 * The state a layer may have after attempting to upload it
     6 */
    47public enum UploadOrSaveState {
    58    /**
  • trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java

    r11608 r12370  
    2222import org.openstreetmap.josm.tools.ImageProvider;
    2323
    24 // FIXME this class should extend HtmlPanel instead (duplicated code in here)
     24/**
     25 * A panel that displays a summary of data the user is about to upload
     26 * <p>
     27 * FIXME this class should extend HtmlPanel instead (duplicated code in here)
     28 */
    2529public class UploadParameterSummaryPanel extends JPanel implements HyperlinkListener, PropertyChangeListener {
    2630    private transient UploadStrategySpecification spec = new UploadStrategySpecification();
     
    129133    }
    130134
     135    /**
     136     * Sets the {@link UploadStrategySpecification} the user chose
     137     * @param spec The specification to display
     138     */
    131139    public void setUploadStrategySpecification(UploadStrategySpecification spec) {
    132140        this.spec = spec;
     
    134142    }
    135143
     144    /**
     145     * Sets the number of objects that will be uploaded
     146     * @param numObjects The number to display
     147     */
    136148    public void setNumObjects(int numObjects) {
    137149        this.numObjects = numObjects;
     
    139151    }
    140152
     153    /**
     154     * Display that the changeset will be closed after the upload
     155     * @param value <code>true</code> if it will be closed
     156     */
    141157    public void setCloseChangesetAfterNextUpload(boolean value) {
    142158        this.closeChangesetAfterNextUpload = value;
  • trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java

    r11747 r12370  
    145145    }
    146146
     147    /**
     148     * See if the user pressed the cancel button
     149     * @return <code>true</code> if the user canceled the upload
     150     */
    147151    public boolean isCanceled() {
    148152        return canceled;
     
    153157    }
    154158
     159    /**
     160     * Gets the list of primitives the user selected
     161     * @return The primitives
     162     */
    155163    public List<OsmPrimitive> getSelectedPrimitives() {
    156164        List<OsmPrimitive> ret = new ArrayList<>();
  • trunk/src/org/openstreetmap/josm/gui/io/UploadStrategy.java

    r11489 r12370  
    88import org.openstreetmap.josm.Main;
    99
     10/**
     11 * The chunk mode to use when uploading
     12 */
    1013public enum UploadStrategy {
    1114    /**
     
    2831    }
    2932
     33    /**
     34     * Reads the value from preferences
     35     * @param preferenceValue The preference value
     36     * @return The {@link UploadStrategy} for that preference or <code>null</code> if unknown
     37     */
    3038    public static UploadStrategy fromPreference(String preferenceValue) {
    3139        if (preferenceValue == null) return null;
  • trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java

    r10626 r12370  
    234234    }
    235235
     236    /**
     237     * Sets the number of uploaded objects to display
     238     * @param numUploadedObjects The number of objects
     239     */
    236240    public void setNumUploadedObjects(int numUploadedObjects) {
    237241        this.numUploadedObjects = Math.max(numUploadedObjects, 0);
     
    239243    }
    240244
     245    /**
     246     * Fills the inputs using a {@link UploadStrategySpecification}
     247     * @param strategy The strategy
     248     */
    241249    public void setUploadStrategySpecification(UploadStrategySpecification strategy) {
    242250        if (strategy == null)
     
    253261    }
    254262
     263    /**
     264     * Gets the upload strategy the user chose
     265     * @return The strategy
     266     */
    255267    public UploadStrategySpecification getUploadStrategySpecification() {
    256268        UploadStrategy strategy = getUploadStrategy();
     
    301313    }
    302314
     315    /**
     316     * Load the panel contents from preferences
     317     */
    303318    public void initFromPreferences() {
    304319        UploadStrategy strategy = UploadStrategy.getFromPreferences();
     
    309324    }
    310325
     326    /**
     327     * Stores the values that the user has input into the preferences
     328     */
    311329    public void rememberUserInput() {
    312330        UploadStrategy strategy = getUploadStrategy();
     
    376394    }
    377395
     396    /**
     397     * Sets the focus on the chunk size field
     398     */
    378399    public void initEditingOfChunkSize() {
    379400        tfChunkSize.requestFocusInWindow();
  • trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySpecification.java

    r10378 r12370  
    5656    }
    5757
     58    /**
     59     * Gets the chunk size
     60     * @return The max size of each upload chunk
     61     */
    5862    public int getChunkSize() {
    5963        return chunkSize;
    6064    }
    6165
     66    /**
     67     * Gets a special value that is used to indicate that the chunk size was not specified
     68     * @return A special integer
     69     */
    6270    public static int getUnspecifiedChunkSize() {
    6371        return UNSPECIFIED_CHUNK_SIZE;
    6472    }
    6573
     74    /**
     75     * Gets the policy that is used when the server max changeset size is exceeded.
     76     * @return What to do when the changeset size is exceeded
     77     */
    6678    public MaxChangesetSizeExceededPolicy getPolicy() {
    6779        return policy;
    6880    }
    6981
     82    /**
     83     * Sets the upload strategy (chunk mode)
     84     * @param strategy The upload strategy
     85     * @return This object, for easy chaining
     86     */
    7087    public UploadStrategySpecification setStrategy(UploadStrategy strategy) {
    7188        this.strategy = strategy;
     
    7390    }
    7491
     92    /**
     93     * Sets the upload chunk size
     94     * @param chunkSize The chunk size
     95     * @return This object, for easy chaining
     96     */
    7597    public UploadStrategySpecification setChunkSize(int chunkSize) {
    7698        this.chunkSize = chunkSize;
     
    78100    }
    79101
     102    /**
     103     * Sets the policy to use when the max changeset size is exceeded
     104     * @param policy The policy
     105     * @return This object, for easy chaining
     106     */
    80107    public UploadStrategySpecification setPolicy(MaxChangesetSizeExceededPolicy policy) {
    81108        this.policy = policy;
     
    83110    }
    84111
     112    /**
     113     * Sets whether to close the changeset after this upload
     114     * @param closeChangesetAfterUpload <code>true</code> to close it
     115     * @return This object, for easy chaining
     116     */
    85117    public UploadStrategySpecification setCloseChangesetAfterUpload(boolean closeChangesetAfterUpload) {
    86118        this.closeChangesetAfterUpload = closeChangesetAfterUpload;
     
    88120    }
    89121
     122    /**
     123     * Gets if the changeset should be closed after this upload
     124     * @return <code>true</code> to close it
     125     */
    90126    public boolean isCloseChangesetAfterUpload() {
    91127        return closeChangesetAfterUpload;
    92128    }
    93129
     130    /**
     131     * Gets the number of requests that will be required to upload the objects
     132     * @param numObjects The number of objects
     133     * @return The number of requests
     134     */
    94135    public int getNumRequests(int numObjects) {
    95136        if (numObjects <= 0)
  • trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java

    r11553 r12370  
    2525 */
    2626public class UploadedObjectsSummaryPanel extends JPanel {
     27    /**
     28     * The swing property name for the number of objects to upload
     29     */
    2730    public static final String NUM_OBJECTS_TO_UPLOAD_PROP = UploadedObjectsSummaryPanel.class.getName() + ".numObjectsToUpload";
    2831
Note: See TracChangeset for help on using the changeset viewer.