Class MapperPanel

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected class  MapperPanel.MinimapScaler  
      protected class  MapperPanel.TooltipShortcut  
      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • 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

      Fields 
      Modifier and Type Field Description
      protected MagellanContext context  
      protected float lastScale  
      protected Minimapper minimap  
      protected javax.swing.JScrollPane minimapPane  
      protected MapperPanel.MinimapScaler minimapScaler  
      protected boolean resizeMinimap  
      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent ae)
      Action event handler for timer events related to the scaling slider.
      void assignHotSpot​(java.lang.String name)
      Assign the currently visible part of the map (the region at the center), a hot spot, an id and add it to the list of hot spots.
      PreferencesAdapter createPreferencesAdapter()
      Creates the component for the preferences.
      void gameDataChanged​(GameDataEvent e)
      Updates components (like hotspot selection etc).
      Region getActiveRegion()
      Get the active region.
      java.lang.String getComponentConfiguration()
      Returns the current configuration of this mapper panel.
      MagellanContext getContext()
      Returns the value of context.
      ShortcutListener getExtendedShortcutListener​(javax.swing.KeyStroke stroke)
      Returns the listener responsible for the sub-short-cuts
      int getLevel()
      Returns the mapper's current level.
      java.lang.String getListenerDescription()
      Returns a (localized) description (or name) for this listener.
      Mapper getMapper()
      Returns the value of mapper.
      Minimapper getMinimap()
      Returns the value of minimap.
      java.awt.Component getMinimapComponent()
      Returns the minimap's main component.
      int getMinimapMode()
      Returns the minimap's paint mode.
      int getMinimapScale()
      DOCUMENT-ME
      float getScaleFactor()
      Returns the current scaling factor applied to the map.
      java.util.Map<CoordinateID,​Region> getSelectedRegions()
      Get the selected Regions.
      java.lang.String getShortcutDescription​(javax.swing.KeyStroke stroke)
      Returns a short description for the specified thing...
      java.util.Iterator<javax.swing.KeyStroke> getShortCuts()
      Should return all short cuts this class want to be informed.
      java.awt.Component getView()
      Returns the component that draws the map.
      void initComponent​(java.lang.String p1)
      Initializes the component according to the given string.
      protected void initMinimap()
      Creates the Minimap Panel.
      boolean isAutoScaling()
      Returns the value of the auto scaling property.
      boolean isExtendedShortcut​(javax.swing.KeyStroke stroke)
      Returns whether the given stroke is for an extended short-cut.
      boolean isShowNavigation()
      Returns the value of showNavi.
      void quit()
      Stores the region that is at the center of the currently visible area.
      void reloadGraphicSet()
      Get the cell geometry from the resources and make all renderers that use images reload the graphics files.
      void removeHotSpot​(Bookmark h)
      Remove the specified hot spot.
      protected void rescale()  
      void selectionChanged​(SelectionEvent se)
      Selection event handler, updating the map if a new region is selected.
      void setAutoScaling​(boolean bool)
      Sets the autoscale property.
      void setCenter​(CoordinateID center)
      Centers the map on a certain region.
      void setContext​(MagellanContext context)
      Sets the value of context.
      void setLevel​(int level)
      Changes the mappers' map level
      void setMapper​(Mapper mapper)
      Sets the value of mapper.
      void setMinimapCenter​(CoordinateID center)
      Centers the minimap on a certain region.
      void setMinimapMode​(int mode)
      Change the minimap's paint mode.
      void setMinimapScale​(int scale)
      Change scale of the minimap.
      void setNewScaleFactor​(float fScale)
      sets new scale factor for map, centers on same position and repaints
      void setRenderer​(HexCellRenderer renderer)
      Set a cell renderer object for its default rendering plane.
      void setRenderer​(HexCellRenderer renderer, int plane)
      Set a cell renderer object for a certain plane of the map.
      void setScaleFactor​(float fScale)
      Sets a new scaling factor for the map.
      void setShowNavigation​(boolean showNavi)
      Sets the value of showNavi.
      void setUseSeasonImages​(boolean use)  
      void shortCut​(javax.swing.KeyStroke shortcut)
      This method is called when a shortcut from getShortCuts() is recognized.
      void showHotSpot​(Bookmark h)
      Center the map on the specified hot spot.
      void stateChanged​(javax.swing.event.ChangeEvent p1)
      Called when the viewed rect of the main mapper changes.
      void synchronizeMinimap()
      Update the minimap's colors.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, 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

      • minimapPane

        protected javax.swing.JScrollPane minimapPane
      • resizeMinimap

        protected boolean resizeMinimap
      • lastScale

        protected float lastScale
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent ae)
        Action event handler for timer events related to the scaling slider.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        See Also:
        ActionListener.actionPerformed(java.awt.event.ActionEvent)
      • initMinimap

        protected void initMinimap()
        Creates the Minimap Panel.
      • setMinimapScale

        public void setMinimapScale​(int scale)
        Change scale of the minimap.
        Parameters:
        scale - A value greater than 1. Larger scale means larger regions.
        Throws:
        java.lang.IllegalArgumentException - if scaleFactor <= 0.
      • getMinimapScale

        public int getMinimapScale()
        DOCUMENT-ME
      • setAutoScaling

        public void setAutoScaling​(boolean bool)
        Sets the autoscale property.
        Parameters:
        bool - the new value
      • isAutoScaling

        public boolean isAutoScaling()
        Returns the value of the auto scaling property.
      • rescale

        protected void rescale()
      • setScaleFactor

        public void setScaleFactor​(float fScale)
        Sets a new scaling factor for the map.
        Parameters:
        fScale - the new scaling factor, values may range from minScale to maxScale
      • setNewScaleFactor

        public void setNewScaleFactor​(float fScale)
        sets new scale factor for map, centers on same position and repaints
        Parameters:
        fScale -
      • getScaleFactor

        public float getScaleFactor()
        Returns the current scaling factor applied to the map.
      • setRenderer

        public void setRenderer​(HexCellRenderer renderer)
        Set a cell renderer object for its default rendering plane. See com.eressea.swing.map.Mapper for further reference.
        Parameters:
        renderer - the object responsible for rendering a graphical representation of regions.
      • setRenderer

        public void setRenderer​(HexCellRenderer renderer,
                                int plane)
        Set a cell renderer object for a certain plane of the map. See com.eressea.swing.map.Mapper for further reference.
        Parameters:
        renderer - the object responsible for rendering a graphical representation of regions.
        plane - the plane the renderer will draw to. Lower planes are painted over by higher planes.
      • getSelectedRegions

        public java.util.Map<CoordinateID,​Region> getSelectedRegions()
        Get the selected Regions. The returned map can be empty but is never null.
      • getActiveRegion

        public Region getActiveRegion()
        Get the active region.
      • getLevel

        public int getLevel()
        Returns the mapper's current level.
        See Also:
        Mapper.getLevel()
      • setLevel

        public void setLevel​(int level)
        Changes the mappers' map level
        Parameters:
        level - the new level
        See Also:
        Mapper.setLevel(int)
      • setCenter

        public void setCenter​(CoordinateID center)
        Centers the map on a certain region.
        Parameters:
        center - the coordinate of the region to center the map on.
      • setMinimapCenter

        public void setMinimapCenter​(CoordinateID center)
        Centers the minimap on a certain region.
        Parameters:
        center - the coordinate of the region to center the map on.
      • assignHotSpot

        public void assignHotSpot​(java.lang.String name)
        Assign the currently visible part of the map (the region at the center), a hot spot, an id and add it to the list of hot spots.
        Parameters:
        name - the id to assign to the hot spot.
      • showHotSpot

        public void showHotSpot​(Bookmark h)
        Center the map on the specified hot spot.
        Parameters:
        h - the hot spot to move the map to.
      • removeHotSpot

        public void removeHotSpot​(Bookmark h)
        Remove the specified hot spot.
        Parameters:
        h - the hot spot to remove.
      • reloadGraphicSet

        public void reloadGraphicSet()
        Get the cell geometry from the resources and make all renderers that use images reload the graphics files.
      • quit

        public void quit()
        Stores the region that is at the center of the currently visible area.
        Overrides:
        quit in class InternationalizedDataPanel
      • getView

        public java.awt.Component getView()
        Returns the component that draws the map.
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent p1)
        Called when the viewed rect of the main mapper changes. In further implementations a rect of the visible bounds should be displayed in the minimap.
        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
        See Also:
        ChangeListener.stateChanged(javax.swing.event.ChangeEvent)
      • getMinimapComponent

        public java.awt.Component getMinimapComponent()
        Returns the minimap's main component.
      • getShortCuts

        public java.util.Iterator<javax.swing.KeyStroke> getShortCuts()
        Should return all short cuts this class want to be informed. The elements should be of type javax.swing.KeyStroke
        Specified by:
        getShortCuts in interface ShortcutListener
        Returns:
        Iterator over all short
      • getComponentConfiguration

        public java.lang.String getComponentConfiguration()
        Returns the current configuration of this mapper panel. The current implementation divides all the information by "_". First the scale factor is stored, then planes(plane index, renderer class name, renderer configuration).
        Specified by:
        getComponentConfiguration in interface Initializable
      • getMapper

        public Mapper getMapper()
        Returns the value of mapper.
        Returns:
        Returns mapper.
      • setMapper

        public void setMapper​(Mapper mapper)
        Sets the value of mapper.
        Parameters:
        mapper - The value for mapper.
      • getContext

        public MagellanContext getContext()
        Returns the value of context.
        Returns:
        Returns context.
      • setContext

        public void setContext​(MagellanContext context)
        Sets the value of context.
        Parameters:
        context - The value for context.
      • getMinimap

        public Minimapper getMinimap()
        Returns the value of minimap.
      • isShowNavigation

        public boolean isShowNavigation()
        Returns the value of showNavi.
        Returns:
        Returns showNavi.
      • setShowNavigation

        public void setShowNavigation​(boolean showNavi)
        Sets the value of showNavi.
        Parameters:
        showNavi - The value for showNavi.
      • setUseSeasonImages

        public void setUseSeasonImages​(boolean use)
        Parameters:
        use -