@Test public void testHasDifferenceInParameters_NoDifference() { final MindMapPanelConfig one = new MindMapPanelConfig(); final MindMapPanelConfig two = new MindMapPanelConfig(); assertFalse(one.hasDifferenceInParameters(two)); }
public boolean hasDifferenceInParameters(@Nonnull final MindMapPanelConfig etalon) { for (final Field f : MindMapPanelConfig.class.getDeclaredFields()) { if ((f.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT | Modifier.FINAL)) != 0) { continue; } try { final Object thisValue = f.get(this); final Object thatValue = f.get(etalon); if (thisValue == null && thatValue == null) { continue; } if (thisValue == null || thatValue == null || !thisValue.equals(thatValue)) { return true; } } catch (IllegalAccessException ex) { throw new Error("IllegalAccessException [" + f.getName() + ']', ex); } catch (IllegalArgumentException ex) { throw new Error("IllegalArgumentException [" + f.getName() + ']', ex); } } final Map<String, KeyShortcut> thisShortcuts = this.mapShortCut; final Map<String, KeyShortcut> thatShortcuts = etalon.mapShortCut; if (thatShortcuts.size() != thatShortcuts.size()) { return true; } for (final Map.Entry<String, KeyShortcut> e : thisShortcuts.entrySet()) { if (!thatShortcuts.containsKey(e.getKey())) { return true; } if (!thatShortcuts.get(e.getKey()).equals(thisShortcuts.get(e.getKey()))) { return true; } } return false; }
MindMapPanelConfig implements Serializable { public boolean hasDifferenceInParameters(@Nonnull final MindMapPanelConfig etalon) { for (final Field f : MindMapPanelConfig.class.getDeclaredFields()) { if ((f.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT | Modifier.FINAL)) != 0) { continue; } try { final Object thisValue = f.get(this); final Object thatValue = f.get(etalon); if (thisValue == null && thatValue == null) { continue; } if (thisValue == null || thatValue == null || !thisValue.equals(thatValue)) { return true; } } catch (IllegalAccessException ex) { throw new Error("IllegalAccessException [" + f.getName() + ']', ex); } catch (IllegalArgumentException ex) { throw new Error("IllegalArgumentException [" + f.getName() + ']', ex); } } final Map<String, KeyShortcut> thisShortcuts = this.mapShortCut; final Map<String, KeyShortcut> thatShortcuts = etalon.mapShortCut; if (thatShortcuts.size() != thatShortcuts.size()) { return true; } for (final Map.Entry<String, KeyShortcut> e : thisShortcuts.entrySet()) { if (!thatShortcuts.containsKey(e.getKey())) { return true; } if (!thatShortcuts.get(e.getKey()).equals(thisShortcuts.get(e.getKey()))) { return true; } } return false; } }
MindMapPanelConfig implements Serializable { public boolean hasDifferenceInParameters(@Nonnull final MindMapPanelConfig etalon) { for (final Field f : MindMapPanelConfig.class.getDeclaredFields()) { if ((f.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT | Modifier.FINAL)) != 0) { continue; } try { final Object thisValue = f.get(this); final Object thatValue = f.get(etalon); if (thisValue == null && thatValue == null) { continue; } if (thisValue == null || thatValue == null || !thisValue.equals(thatValue)) { return true; } } catch (IllegalAccessException ex) { throw new Error("IllegalAccessException [" + f.getName() + ']', ex); } catch (IllegalArgumentException ex) { throw new Error("IllegalArgumentException [" + f.getName() + ']', ex); } } final Map<String, KeyShortcut> thisShortcuts = this.mapShortCut; final Map<String, KeyShortcut> thatShortcuts = etalon.mapShortCut; if (thatShortcuts.size() != thatShortcuts.size()) { return true; } for (final Map.Entry<String, KeyShortcut> e : thisShortcuts.entrySet()) { if (!thatShortcuts.containsKey(e.getKey())) { return true; } if (!thatShortcuts.get(e.getKey()).equals(thisShortcuts.get(e.getKey()))) { return true; } } return false; } MindMapPanelConfig(@Nonnull final MindMapPanelConfig cfg, final boolean copyListeners);  MindMapPanelConfig(); }
MindMapPanelConfig implements Serializable { public boolean hasDifferenceInParameters(@Nonnull final MindMapPanelConfig etalon) { for (final Field f : MindMapPanelConfig.class.getDeclaredFields()) { if ((f.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT | Modifier.FINAL)) != 0) { continue; } try { final Object thisValue = f.get(this); final Object thatValue = f.get(etalon); if (thisValue == null && thatValue == null) { continue; } if (thisValue == null || thatValue == null || !thisValue.equals(thatValue)) { return true; } } catch (IllegalAccessException ex) { throw new Error("IllegalAccessException [" + f.getName() + ']', ex); } catch (IllegalArgumentException ex) { throw new Error("IllegalArgumentException [" + f.getName() + ']', ex); } } final Map<String, KeyShortcut> thisShortcuts = this.mapShortCut; final Map<String, KeyShortcut> thatShortcuts = etalon.mapShortCut; if (thatShortcuts.size() != thatShortcuts.size()) { return true; } for (final Map.Entry<String, KeyShortcut> e : thisShortcuts.entrySet()) { if (!thatShortcuts.containsKey(e.getKey())) { return true; } if (!thatShortcuts.get(e.getKey()).equals(thisShortcuts.get(e.getKey()))) { return true; } } return false; } MindMapPanelConfig(@Nonnull final MindMapPanelConfig cfg, final boolean copyListeners);  MindMapPanelConfig(); boolean isKeyEvent(@Nonnull final String id, @Nonnull final KeyEvent event, final int modifiersMask); boolean isKeyEvent(@Nonnull final String id, @Nonnull final KeyEvent event); @Nullable KeyShortcut getKeyShortCut(@Nonnull final String id); void setKeyShortCut(@Nonnull final KeyShortcut shortCut); @Nullable Map<String, KeyShortcut> getKeyShortcutMap(); boolean hasDifferenceInParameters(@Nonnull final MindMapPanelConfig etalon); @Nullable @ReturnsOriginal Preferences saveTo(@Nullable final Preferences prefs); @Nullable Preferences loadFrom(@Nullable final Preferences prefs); void makeAtomicChange(@Nonnull final Runnable runnable); float safeScaleFloatValue(final float value, final float minimal); void makeFullCopyOf(@Nullable final MindMapPanelConfig src, final boolean copyListeners, final boolean makeNotification); void addConfigurationListener(@Nonnull final MindMapConfigListener l); void removeConfigurationListener(@Nonnull final MindMapConfigListener l); boolean isShortcutConflict(@Nullable final KeyStroke keyStroke); boolean isKeyEventDetected(@Nonnull final KeyEvent event, @Nonnull final int effectiveModifiers, @Nonnull @MustNotContainNull final String... shortCutIDs); boolean isKeyEventDetected(@Nonnull final KeyEvent event, @Nonnull @MustNotContainNull final String... shortCutIDs); int getHorizontalBlockGap(); void setHorizontalBlockGap(final int gap); float getSelectLineWidth(); void setSelectLineWidth(final float f); float getJumpLinkWidth(); void setJumpLinkWidth(final float f); @Nonnull Color getJumpLinkColor(); void setJumpLinkColor(@Nonnull final Color color); int getScaleModifiers(); void setScaleModifiers(final int value); @Nonnull Color getSelectLineColor(); void setSelectLineColor(@Nonnull final Color color); int getPaperMargins(); void setPaperMargins(final int size); boolean isSmartTextPaste(); void setSmartTextPaste(final boolean flag); boolean isDrawBackground(); void setDrawBackground(final boolean flag); int getOtherLevelVerticalInset(); void setOtherLevelVerticalInset(final int value); int getOtherLevelHorizontalInset(); void setOtherLevelHorizontalInset(final int value); int getFirstLevelVerticalInset(); void setFirstLevelVerticalInset(final int value); int getFirstLevelHorizontalInset(); void setFirstLevelHorizontalInset(final int value); @Nonnull Color getPaperColor(); void setPaperColor(@Nonnull final Color color); @Nonnull Color getGridColor(); void setGridColor(@Nonnull final Color color); boolean isShowGrid(); void setShowGrid(final boolean flag); int getGridStep(); void setGridStep(final int step); @Nonnull Color getRootBackgroundColor(); void setRootBackgroundColor(@Nonnull final Color color); @Nonnull Color getFirstLevelBackgroundColor(); void setFirstLevelBackgroundColor(@Nonnull final Color color); @Nonnull Color getOtherLevelBackgroundColor(); void setOtherLevelBackgroundColor(@Nonnull final Color color); @Nonnull Color getRootTextColor(); void setRootTextColor(@Nonnull final Color color); @Nonnull Color getFirstLevelTextColor(); void setFirstLevelTextColor(@Nonnull final Color color); @Nonnull Color getOtherLevelTextColor(); void setOtherLevelTextColor(@Nonnull final Color color); @Nonnull Color getElementBorderColor(); void setElementBorderColor(@Nonnull final Color color); @Nonnull Color getConnectorColor(); void setConnectorColor(@Nonnull final Color color); @Nonnull Color getShadowColor(); void setShadowColor(@Nonnull final Color color); @Nonnull Color getCollapsatorBorderColor(); void setCollapsatorBorderColor(@Nonnull final Color color); @Nonnull Color getCollapsatorBackgroundColor(); void setCollapsatorBackgroundColor(@Nonnull final Color color); float getElementBorderWidth(); void setElementBorderWidth(final float value); float getCollapsatorBorderWidth(); void setCollapsatorBorderWidth(final float width); float getShadowOffset(); void setShadowOffset(final float value); float getConnectorWidth(); void setConnectorWidth(final float value); @Nonnull Font getFont(); void setFont(@Nonnull final Font f); double getScale(); void setScale(final double value); void setScaleWithoutListenerNotification(final double value); boolean isDropShadow(); void setDropShadow(final boolean value); @Nonnull RenderQuality getRenderQuality(); void setRenderQuality(@Nullable final RenderQuality value); int getCollapsatorSize(); void setCollapsatorSize(final int size); int getTextMargins(); void setTextMargins(final int value); int getSelectLineGap(); void setSelectLineGap(final int value); }
MindMapPanelConfig implements Serializable { public boolean hasDifferenceInParameters(@Nonnull final MindMapPanelConfig etalon) { for (final Field f : MindMapPanelConfig.class.getDeclaredFields()) { if ((f.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT | Modifier.FINAL)) != 0) { continue; } try { final Object thisValue = f.get(this); final Object thatValue = f.get(etalon); if (thisValue == null && thatValue == null) { continue; } if (thisValue == null || thatValue == null || !thisValue.equals(thatValue)) { return true; } } catch (IllegalAccessException ex) { throw new Error("IllegalAccessException [" + f.getName() + ']', ex); } catch (IllegalArgumentException ex) { throw new Error("IllegalArgumentException [" + f.getName() + ']', ex); } } final Map<String, KeyShortcut> thisShortcuts = this.mapShortCut; final Map<String, KeyShortcut> thatShortcuts = etalon.mapShortCut; if (thatShortcuts.size() != thatShortcuts.size()) { return true; } for (final Map.Entry<String, KeyShortcut> e : thisShortcuts.entrySet()) { if (!thatShortcuts.containsKey(e.getKey())) { return true; } if (!thatShortcuts.get(e.getKey()).equals(thisShortcuts.get(e.getKey()))) { return true; } } return false; } MindMapPanelConfig(@Nonnull final MindMapPanelConfig cfg, final boolean copyListeners);  MindMapPanelConfig(); boolean isKeyEvent(@Nonnull final String id, @Nonnull final KeyEvent event, final int modifiersMask); boolean isKeyEvent(@Nonnull final String id, @Nonnull final KeyEvent event); @Nullable KeyShortcut getKeyShortCut(@Nonnull final String id); void setKeyShortCut(@Nonnull final KeyShortcut shortCut); @Nullable Map<String, KeyShortcut> getKeyShortcutMap(); boolean hasDifferenceInParameters(@Nonnull final MindMapPanelConfig etalon); @Nullable @ReturnsOriginal Preferences saveTo(@Nullable final Preferences prefs); @Nullable Preferences loadFrom(@Nullable final Preferences prefs); void makeAtomicChange(@Nonnull final Runnable runnable); float safeScaleFloatValue(final float value, final float minimal); void makeFullCopyOf(@Nullable final MindMapPanelConfig src, final boolean copyListeners, final boolean makeNotification); void addConfigurationListener(@Nonnull final MindMapConfigListener l); void removeConfigurationListener(@Nonnull final MindMapConfigListener l); boolean isShortcutConflict(@Nullable final KeyStroke keyStroke); boolean isKeyEventDetected(@Nonnull final KeyEvent event, @Nonnull final int effectiveModifiers, @Nonnull @MustNotContainNull final String... shortCutIDs); boolean isKeyEventDetected(@Nonnull final KeyEvent event, @Nonnull @MustNotContainNull final String... shortCutIDs); int getHorizontalBlockGap(); void setHorizontalBlockGap(final int gap); float getSelectLineWidth(); void setSelectLineWidth(final float f); float getJumpLinkWidth(); void setJumpLinkWidth(final float f); @Nonnull Color getJumpLinkColor(); void setJumpLinkColor(@Nonnull final Color color); int getScaleModifiers(); void setScaleModifiers(final int value); @Nonnull Color getSelectLineColor(); void setSelectLineColor(@Nonnull final Color color); int getPaperMargins(); void setPaperMargins(final int size); boolean isSmartTextPaste(); void setSmartTextPaste(final boolean flag); boolean isDrawBackground(); void setDrawBackground(final boolean flag); int getOtherLevelVerticalInset(); void setOtherLevelVerticalInset(final int value); int getOtherLevelHorizontalInset(); void setOtherLevelHorizontalInset(final int value); int getFirstLevelVerticalInset(); void setFirstLevelVerticalInset(final int value); int getFirstLevelHorizontalInset(); void setFirstLevelHorizontalInset(final int value); @Nonnull Color getPaperColor(); void setPaperColor(@Nonnull final Color color); @Nonnull Color getGridColor(); void setGridColor(@Nonnull final Color color); boolean isShowGrid(); void setShowGrid(final boolean flag); int getGridStep(); void setGridStep(final int step); @Nonnull Color getRootBackgroundColor(); void setRootBackgroundColor(@Nonnull final Color color); @Nonnull Color getFirstLevelBackgroundColor(); void setFirstLevelBackgroundColor(@Nonnull final Color color); @Nonnull Color getOtherLevelBackgroundColor(); void setOtherLevelBackgroundColor(@Nonnull final Color color); @Nonnull Color getRootTextColor(); void setRootTextColor(@Nonnull final Color color); @Nonnull Color getFirstLevelTextColor(); void setFirstLevelTextColor(@Nonnull final Color color); @Nonnull Color getOtherLevelTextColor(); void setOtherLevelTextColor(@Nonnull final Color color); @Nonnull Color getElementBorderColor(); void setElementBorderColor(@Nonnull final Color color); @Nonnull Color getConnectorColor(); void setConnectorColor(@Nonnull final Color color); @Nonnull Color getShadowColor(); void setShadowColor(@Nonnull final Color color); @Nonnull Color getCollapsatorBorderColor(); void setCollapsatorBorderColor(@Nonnull final Color color); @Nonnull Color getCollapsatorBackgroundColor(); void setCollapsatorBackgroundColor(@Nonnull final Color color); float getElementBorderWidth(); void setElementBorderWidth(final float value); float getCollapsatorBorderWidth(); void setCollapsatorBorderWidth(final float width); float getShadowOffset(); void setShadowOffset(final float value); float getConnectorWidth(); void setConnectorWidth(final float value); @Nonnull Font getFont(); void setFont(@Nonnull final Font f); double getScale(); void setScale(final double value); void setScaleWithoutListenerNotification(final double value); boolean isDropShadow(); void setDropShadow(final boolean value); @Nonnull RenderQuality getRenderQuality(); void setRenderQuality(@Nullable final RenderQuality value); int getCollapsatorSize(); void setCollapsatorSize(final int size); int getTextMargins(); void setTextMargins(final int value); int getSelectLineGap(); void setSelectLineGap(final int value); static final String KEY_ADD_CHILD_AND_START_EDIT; static final String KEY_ADD_SIBLING_AND_START_EDIT; static final String KEY_FOCUS_ROOT_OR_START_EDIT; static final String KEY_CANCEL_EDIT; static final String KEY_TOPIC_FOLD; static final String KEY_TOPIC_FOLD_ALL; static final String KEY_TOPIC_UNFOLD; static final String KEY_TOPIC_UNFOLD_ALL; static final String KEY_FOCUS_MOVE_UP; static final String KEY_FOCUS_MOVE_DOWN; static final String KEY_FOCUS_MOVE_LEFT; static final String KEY_FOCUS_MOVE_RIGHT; static final String KEY_FOCUS_MOVE_UP_ADD_FOCUSED; static final String KEY_FOCUS_MOVE_DOWN_ADD_FOCUSED; static final String KEY_FOCUS_MOVE_LEFT_ADD_FOCUSED; static final String KEY_FOCUS_MOVE_RIGHT_ADD_FOCUSED; static final String KEY_DELETE_TOPIC; static final String KEY_TOPIC_TEXT_NEXT_LINE; static final String KEY_ZOOM_IN; static final String KEY_ZOOM_OUT; static final String KEY_ZOOM_RESET; static final String KEY_SHOW_POPUP; }