Package org.apache.pdfbox.debugger.ui
Class ZoomMenu
- java.lang.Object
-
- org.apache.pdfbox.debugger.ui.ZoomMenu
-
public final class ZoomMenu extends java.lang.Object
- Author:
- Khyrul Bashar A singleton class that provides zoom menu which can be used to show zoom menu in the menubar. To act upon the menu item selection user of the class must add ActionListener which will check for the action command and act accordingly.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMenuListeners(java.awt.event.ActionListener listener)
Add the ActionListener for the menuitems.void
changeZoomSelection(float zoomValue)
Set the zoom selection.float
getImageZoomScale()
static ZoomMenu
getInstance()
Provides the ZoomMenu instance.javax.swing.JMenu
getMenu()
Provide the JMenu instance of the ZoomMenu.float
getPageZoomScale()
static float
getZoomScale()
Tell the current zoom scale.static boolean
isZoomMenu(java.lang.String actionCommand)
Tell whether the command belongs to the zoom menu.void
resetZoom()
When a new file is loaded zoom values should be reset.void
setEnableMenu(boolean isEnable)
Set if the menu should be enabled or disabled.void
setImageZoomScale(float imageZoomValue)
protected void
setMenu(javax.swing.JMenu menu)
void
setPageZoomScale(float pageZoomValue)
-
-
-
Method Detail
-
getInstance
public static ZoomMenu getInstance()
Provides the ZoomMenu instance.- Returns:
- ZoomMenu instance.
-
changeZoomSelection
public void changeZoomSelection(float zoomValue)
Set the zoom selection.- Parameters:
zoomValue
- e.g. 1, 0.25, 4.- Throws:
java.lang.IllegalArgumentException
- if the parameter doesn't belong to a zoom menu item.
-
isZoomMenu
public static boolean isZoomMenu(java.lang.String actionCommand)
Tell whether the command belongs to the zoom menu.- Parameters:
actionCommand
- a menu command string.- Returns:
- true if the command is a zoom menu command, e.g. "100%", false if not.
-
getZoomScale
public static float getZoomScale()
Tell the current zoom scale.- Returns:
- the current zoom scale.
- Throws:
java.lang.IllegalStateException
- if no zoom menu item is selected.
-
getPageZoomScale
public float getPageZoomScale()
-
setPageZoomScale
public void setPageZoomScale(float pageZoomValue)
-
getImageZoomScale
public float getImageZoomScale()
-
setImageZoomScale
public void setImageZoomScale(float imageZoomValue)
-
resetZoom
public void resetZoom()
When a new file is loaded zoom values should be reset.
-
setMenu
protected void setMenu(javax.swing.JMenu menu)
-
getMenu
public javax.swing.JMenu getMenu()
Provide the JMenu instance of the ZoomMenu.- Returns:
- JMenu instance.
-
setEnableMenu
public void setEnableMenu(boolean isEnable)
Set if the menu should be enabled or disabled.- Parameters:
isEnable
- boolean instance.
-
addMenuListeners
public void addMenuListeners(java.awt.event.ActionListener listener)
Add the ActionListener for the menuitems.- Parameters:
listener
- ActionListener.
-
-