|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog
public class CombinePrimitiveResolverDialog
This dialog helps to resolve conflicts occurring when ways are combined or
nodes are merged.
Usage: launchIfNecessary(org.openstreetmap.josm.data.osm.TagCollection, java.util.Collection extends org.openstreetmap.josm.data.osm.OsmPrimitive>, java.util.Collection extends org.openstreetmap.josm.data.osm.OsmPrimitive>)
followed by buildResolutionCommands()
.
Prior to launchIfNecessary(org.openstreetmap.josm.data.osm.TagCollection, java.util.Collection extends org.openstreetmap.josm.data.osm.OsmPrimitive>, java.util.Collection extends org.openstreetmap.josm.data.osm.OsmPrimitive>)
, the following usage sequence was needed:
There is a singleton instance of this dialog which can be retrieved using
getInstance()
.
The dialog uses two models: one for resolving tag conflicts, the other
for resolving conflicts in relation memberships. For both models there are accessors,
i.e getTagConflictResolverModel()
and getRelationMemberConflictResolverModel()
.
Models have to be populated before the dialog is launched. Example:
CombinePrimitiveResolverDialog dialog = CombinePrimitiveResolverDialog.getInstance(); dialog.getTagConflictResolverModel().populate(aTagCollection); dialog.getRelationMemberConflictResolverModel().populate(aRelationLinkCollection); dialog.prepareDefaultDecisions();You should also set the target primitive which other primitives (ways or nodes) are merged to, see
setTargetPrimitive(OsmPrimitive)
.
After the dialog is closed use isCanceled()
to check whether the user canceled
the dialog. If it wasn't canceled you may build a collection of Command
objects
which reflect the conflict resolution decisions the user made in the dialog:
see buildResolutionCommands()
Nested Class Summary | |
---|---|
(package private) class |
CombinePrimitiveResolverDialog.AdjustDividerLocationAction
|
(package private) class |
CombinePrimitiveResolverDialog.ApplyAction
|
(package private) static class |
CombinePrimitiveResolverDialog.AutoAdjustingSplitPane
|
(package private) class |
CombinePrimitiveResolverDialog.CancelAction
|
Nested classes/interfaces inherited from class javax.swing.JDialog |
---|
javax.swing.JDialog.AccessibleJDialog |
Nested classes/interfaces inherited from class java.awt.Dialog |
---|
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private SideButton |
btnApply
the apply button |
private boolean |
canceled
|
private ContextSensitiveHelpAction |
helpAction
the private help action |
private static CombinePrimitiveResolverDialog |
instance
the unique instance of the dialog |
private javax.swing.JPanel |
pnlButtons
|
private RelationMemberConflictResolver |
pnlRelationMemberConflictResolver
|
private TagConflictResolver |
pnlTagConflictResolver
|
private CombinePrimitiveResolverDialog.AutoAdjustingSplitPane |
spTagConflictTypes
|
private OsmPrimitive |
targetPrimitive
|
Fields inherited from class javax.swing.JDialog |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Dialog |
---|
DEFAULT_MODALITY_TYPE |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
CombinePrimitiveResolverDialog(java.awt.Component parent)
Constructs a new CombinePrimitiveResolverDialog . |
Method Summary | |
---|---|
protected void |
build()
|
protected javax.swing.JPanel |
buildButtonPanel()
|
protected javax.swing.JPanel |
buildEmptyConflictsPanel()
|
protected javax.swing.JPanel |
buildRelationMemberConflictResolverPanel()
|
java.util.List<Command> |
buildResolutionCommands()
Replies the list of commands needed to apply resolution choices. |
protected java.util.List<Command> |
buildTagChangeCommand(OsmPrimitive primitive,
TagCollection tc)
|
protected javax.swing.JPanel |
buildTagConflictResolverPanel()
|
static CombinePrimitiveResolverDialog |
getInstance()
Deprecated. use launchIfNecessary(org.openstreetmap.josm.data.osm.TagCollection, java.util.Collection extends org.openstreetmap.josm.data.osm.OsmPrimitive>, java.util.Collection extends org.openstreetmap.josm.data.osm.OsmPrimitive>) instead. |
RelationMemberConflictResolverModel |
getRelationMemberConflictResolverModel()
Replies the relation membership conflict resolver model. |
TagConflictResolverModel |
getTagConflictResolverModel()
Replies the tag conflict resolver model. |
OsmPrimitive |
getTargetPrimitmive()
Replies the target primitive the collection of primitives is merged or combined to. |
protected static void |
informAboutRelationMembershipConflicts(java.util.Collection<? extends OsmPrimitive> primitives,
java.util.Set<Relation> parentRelations)
Inform a non-expert user about what relation membership conflict resolution means. |
protected static void |
informAboutTagConflicts(java.util.Collection<? extends OsmPrimitive> primitives,
TagCollection normalizedTags)
Inform a non-expert user about what tag conflict resolution means. |
boolean |
isCanceled()
Determines if this dialog has been cancelled. |
static java.util.List<Command> |
launchIfNecessary(TagCollection tagsOfPrimitives,
java.util.Collection<? extends OsmPrimitive> primitives,
java.util.Collection<? extends OsmPrimitive> targetPrimitives)
Replies the list of commands needed to resolve specified conflicts,
by displaying if necessary a CombinePrimitiveResolverDialog to the user. |
void |
prepareDefaultDecisions()
Prepares the default decisions for populated tag and relation membership conflicts. |
protected void |
prepareDefaultRelationDecisions()
|
protected void |
prepareDefaultTagDecisions()
|
protected void |
prepareGUIBeforeConflictResolutionStarts()
|
protected void |
setCanceled(boolean canceled)
|
void |
setTargetPrimitive(OsmPrimitive primitive)
Sets the primitive the collection of primitives is merged or combined to. |
void |
setVisible(boolean visible)
|
protected void |
updateTitle()
|
Methods inherited from class javax.swing.JDialog |
---|
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
Methods inherited from class java.awt.Dialog |
---|
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, show, toBack |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static CombinePrimitiveResolverDialog instance
private CombinePrimitiveResolverDialog.AutoAdjustingSplitPane spTagConflictTypes
private TagConflictResolver pnlTagConflictResolver
private RelationMemberConflictResolver pnlRelationMemberConflictResolver
private boolean canceled
private javax.swing.JPanel pnlButtons
private OsmPrimitive targetPrimitive
private ContextSensitiveHelpAction helpAction
private SideButton btnApply
Constructor Detail |
---|
public CombinePrimitiveResolverDialog(java.awt.Component parent)
CombinePrimitiveResolverDialog
.
parent
- The parent component in which this dialog will be displayed.Method Detail |
---|
@Deprecated public static CombinePrimitiveResolverDialog getInstance()
launchIfNecessary(org.openstreetmap.josm.data.osm.TagCollection, java.util.Collection extends org.openstreetmap.josm.data.osm.OsmPrimitive>, java.util.Collection extends org.openstreetmap.josm.data.osm.OsmPrimitive>)
instead.
public OsmPrimitive getTargetPrimitmive()
public void setTargetPrimitive(OsmPrimitive primitive)
primitive
- the target primitiveprotected void updateTitle()
protected void build()
protected javax.swing.JPanel buildTagConflictResolverPanel()
protected javax.swing.JPanel buildRelationMemberConflictResolverPanel()
protected javax.swing.JPanel buildButtonPanel()
public TagConflictResolverModel getTagConflictResolverModel()
public RelationMemberConflictResolverModel getRelationMemberConflictResolverModel()
protected java.util.List<Command> buildTagChangeCommand(OsmPrimitive primitive, TagCollection tc)
public java.util.List<Command> buildResolutionCommands()
commands
needed to apply resolution choices.
commands
needed to apply resolution choices.protected void prepareDefaultTagDecisions()
protected void prepareDefaultRelationDecisions()
public void prepareDefaultDecisions()
protected javax.swing.JPanel buildEmptyConflictsPanel()
protected void prepareGUIBeforeConflictResolutionStarts()
protected void setCanceled(boolean canceled)
public boolean isCanceled()
public void setVisible(boolean visible)
setVisible
in class java.awt.Dialog
public static java.util.List<Command> launchIfNecessary(TagCollection tagsOfPrimitives, java.util.Collection<? extends OsmPrimitive> primitives, java.util.Collection<? extends OsmPrimitive> targetPrimitives) throws UserCancelException
commands
needed to resolve specified conflicts,
by displaying if necessary a CombinePrimitiveResolverDialog
to the user.
This dialog will allow the user to choose conflict resolution actions.
Non-expert users are informed first of the meaning of these operations, allowing them to cancel.
tagsOfPrimitives
- The tag collection of the primitives to be combined.
Should generally be equal to TagCollection.unionOfAllPrimitives(primitives)
primitives
- The primitives to be combinedtargetPrimitives
- The primitives the collection of primitives are merged or combined to.
commands
needed to apply resolution actions.
UserCancelException
- If the user cancelled a dialog.protected static void informAboutRelationMembershipConflicts(java.util.Collection<? extends OsmPrimitive> primitives, java.util.Set<Relation> parentRelations) throws UserCancelException
primitives
- The primitives to be combinedparentRelations
- The parent relations of the primitives
UserCancelException
- If the user cancels the dialog.protected static void informAboutTagConflicts(java.util.Collection<? extends OsmPrimitive> primitives, TagCollection normalizedTags) throws UserCancelException
primitives
- The primitives to be combinednormalizedTags
- The normalized tag collection of the primitives to be combined
UserCancelException
- If the user cancels the dialog.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |