|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.data.osm.visitor.AbstractVisitor
org.openstreetmap.josm.data.validation.Test
public class Test
Parent class for all validation tests.
A test is a primitive visitor, so that it can access to all data to be validated. These primitives are always visited in the same order: nodes first, then ways.
Field Summary | |
---|---|
protected javax.swing.JCheckBox |
checkBeforeUpload
The preferences check for validation on upload |
protected javax.swing.JCheckBox |
checkEnabled
The preferences check for validation |
protected java.lang.String |
description
Description of the test |
boolean |
enabled
Whether this test is enabled. |
protected java.util.List<TestError> |
errors
The list of errors |
protected boolean |
isBeforeUpload
Whether this test is performing just before an upload |
protected java.lang.String |
name
Name of the test |
protected boolean |
partialSelection
Whether the test is run on a partial selection data |
protected ProgressMonitor |
progressMonitor
the progress monitor to use |
boolean |
testBeforeUpload
Whether this test must check before upload. |
Constructor Summary | |
---|---|
Test(java.lang.String name)
Constructor |
|
Test(java.lang.String name,
java.lang.String description)
Constructor |
Method Summary | |
---|---|
void |
addGui(javax.swing.JPanel testPanel)
Allow the tester to manage its own preferences |
protected Command |
deletePrimitivesIfNeeded(java.util.Collection<? extends OsmPrimitive> primitives)
Build a Delete command on all primitives that have not yet been deleted manually by user, or by another error fix. |
void |
endTest()
Notification of the end of the test. |
Command |
fixError(TestError testError)
Fixes the error with the appropriate command |
java.util.List<TestError> |
getErrors()
Gets the validation errors accumulated until this moment. |
java.lang.String |
getName()
|
void |
initialize()
Initializes any global data used this tester. |
protected static boolean |
isBuilding(OsmPrimitive p)
Determines if the specified primitive denotes a building. |
boolean |
isCanceled()
|
boolean |
isFixable(TestError testError)
Returns true if the given error can be fixed automatically |
boolean |
ok()
Called when the used submits the preferences |
void |
setBeforeUpload(boolean isUpload)
Sets the flag that marks an upload check |
void |
setPartialSelection(boolean partialSelection)
Flag notifying that this test is run over a partial data selection |
void |
startTest(ProgressMonitor progressMonitor)
Start the test using a given progress monitor |
boolean |
testBeforeUpload()
Returns true if this plugin must check the uploaded data before uploading |
void |
visit(java.util.Collection<OsmPrimitive> selection)
Visits all primitives to be tested. |
void |
visit(Node n)
Visiting call for points. |
void |
visit(Relation r)
Visiting call for relations. |
void |
visit(Way w)
Visiting call for lines. |
Methods inherited from class org.openstreetmap.josm.data.osm.visitor.AbstractVisitor |
---|
visit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.lang.String name
protected final java.lang.String description
public boolean enabled
protected javax.swing.JCheckBox checkEnabled
protected javax.swing.JCheckBox checkBeforeUpload
public boolean testBeforeUpload
protected boolean isBeforeUpload
protected java.util.List<TestError> errors
protected boolean partialSelection
protected ProgressMonitor progressMonitor
Constructor Detail |
---|
public Test(java.lang.String name, java.lang.String description)
name
- Name of the testdescription
- Description of the testpublic Test(java.lang.String name)
name
- Name of the testMethod Detail |
---|
public void initialize() throws java.lang.Exception
java.lang.Exception
- When cannot initialize the testpublic void startTest(ProgressMonitor progressMonitor)
progressMonitor
- the progress monitorpublic void setPartialSelection(boolean partialSelection)
partialSelection
- Whether the test is on a partial selection datapublic java.util.List<TestError> getErrors()
public void endTest()
If you override this method, don't forget to cleanup progressMonitor
(most overrides call super.endTest()
to do this).
public void visit(java.util.Collection<OsmPrimitive> selection)
selection
- The primitives to be testedpublic void visit(Node n)
Visitor
n
- The node to inspect.public void visit(Way w)
Visitor
w
- The way to inspect.public void visit(Relation r)
Visitor
r
- The relation to inspect.public void addGui(javax.swing.JPanel testPanel)
testPanel
- The panel to add any preferences componentpublic boolean ok()
public Command fixError(TestError testError)
testError
-
public boolean isFixable(TestError testError)
testError
- The error to check if can be fixed
public boolean testBeforeUpload()
public void setBeforeUpload(boolean isUpload)
isUpload
- if true, the test is before uploadpublic java.lang.String getName()
public boolean isCanceled()
protected final Command deletePrimitivesIfNeeded(java.util.Collection<? extends OsmPrimitive> primitives)
primitives
- The primitives wanted for deletion
protected static final boolean isBuilding(OsmPrimitive p)
p
- The primitive to be tested
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |