Class BrowserComponent
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel
com.inductiveautomation.webbrowser.BrowserComponent
- All Implemented Interfaces:
DynamicPropertyProvider
,LocaleListener
,MutableDynamicPropertyProvider
,StyleProvider
,ComponentLifecycle
,ExtensibleComponent
,QualityMonitor
,VisionComponent
,ImageObserver
,MenuContainer
,Serializable
,Accessible
public class BrowserComponent
extends AbstractVisionPanel
implements LocaleListener, ExtensibleComponent
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BrowserInstanceManager
static final int
static final int
Fields inherited from class com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel
antialias, context, cursorCode, dynamicProps
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 com.inductiveautomation.vision.api.client.components.model.ComponentLifecycle
COMPONENT_RUNNING
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface com.inductiveautomation.ignition.client.model.LocaleListener
LOCAL_CHANGE_EVENT
Fields inherited from interface com.inductiveautomation.vision.api.client.binding.MutableDynamicPropertyProvider
RESERVED_SET_KEY
Fields inherited from interface com.inductiveautomation.vision.api.client.components.model.VisionComponent
COMPONENT_LOCKED, COMPONENT_PERMISSIONS, COMPONENT_SECURITY, COMPONENT_TRANSLATIONS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
back()
If the browser is able to go back, it will, otherwise does nothing.protected void
void
void
executeJavaScript
(String javaScript) Tries to execute a script.void
forward()
If the browser is able to go forward, it will, otherwise does nothing.com.teamdev.jxbrowser.browser.Browser
Gets the browser object so advanced users can have at the browser's api.com.teamdev.jxbrowser.view.swing.BrowserView
Returns the JComponent that thatBrowser
is held within.boolean
int
protected String
int
protected String
int
protected String
byte[]
getImage()
Returns a byte array with a jpg of a screen shot of the current browser window.boolean
int
getMode()
boolean
int
protected String
getTitle()
int
boolean
double
protected void
Does the initialization for the JxBrowser browser.void
boolean
boolean
protected void
loadHtml()
protected void
protected void
loadUrl()
protected void
void
localeChanged
(Locale newLocale) protected JButton
protected void
Subclasses should override this to provide shutdown logic.protected void
Subclasses should override this to provide startup logic.void
refresh()
Reloads the existing browser object, or creates a new one.protected void
protected void
protected void
void
setComponentEnabled
(boolean componentEnabled) void
void
setCurrentHtml
(String notUsed) void
void
setCurrentUrl
(String currentUrl) void
void
setFtpProxyPort
(int ftpProxyPort) void
setFtpProxyServer
(String ftpProxyServer) void
setHttpProxyPort
(int httpProxyPort) void
setHttpProxyServer
(String httpProxyServer) void
setHttpsProxyPort
(int httpsProxyPort) void
setHttpsProxyServer
(String httpsProxyServer) void
setIsLoaded
(boolean isLoaded) void
setMode
(int mode) void
setPopupsAllowed
(boolean popupsAllowed) void
setProxyExceptions
(String proxyExceptions) void
setProxyPassword
(String proxyPassword) void
setProxyUsername
(String proxyUsername) void
setShowNavigation
(boolean showNavigation) void
setSocksProxyPort
(int socksProxyPort) void
setSocksProxyServer
(String socksProxyServer) void
setStartingHtml
(String html) void
setStartingUrl
(String url) void
void
setTouchscreenMode
(int touchscreenMode) void
setUseProxies
(boolean useProxies) void
setUseProxyAuthentication
(boolean useAuthentication) void
setZoomLevel
(double zoomLevel) protected void
Methods inherited from class com.inductiveautomation.vision.api.client.components.model.AbstractVisionPanel
getAppContext, getCursorCode, getDataQuality, getDynamicProps, getProperties, getPropertyValue, getQuality, getStyles, getToolTipText, initStyleListener, isAntialias, isComponentRunning, isPropertyDefined, paintChildren, paintComponent, paintOverlayOverChildren, setAntialias, setCursorCode, setDataQuality, setDynamicProps, setName, setPropertyValue, setQuality, setStyles, setToolTipText, setVisible, shutdownComponent, startupComponent, translate, updateQuality
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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, 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, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, 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, 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
Methods inherited from interface com.inductiveautomation.vision.api.client.components.model.ComponentLifecycle
getAppContext, shutdownComponent, startupComponent
-
Field Details
-
MODE_URL
public static final int MODE_URL- See Also:
-
MODE_HTML
public static final int MODE_HTML- See Also:
-
INSTANCE_MANAGER
-
-
Constructor Details
-
BrowserComponent
public BrowserComponent()
-
-
Method Details
-
initBrowser
protected void initBrowser()Does the initialization for the JxBrowser browser. May be called multiple times during the lifecycle of the web browser component, because some changes in settings may require closing of the old browser and creating a new one.Engine should only be null if no supported OS was detected. In that case, we'll have added a UNSUPPORTED_OS_LABEL which will get displayed. The nullness of browserContext won't change while the client is open.
-
getHttpServerPair
-
getHttpsServerPair
-
getFtpServerPair
-
getSocksServerPair
-
onStartup
protected void onStartup()Description copied from class:AbstractVisionPanel
Subclasses should override this to provide startup logic.- Overrides:
onStartup
in classAbstractVisionPanel
-
onShutdown
protected void onShutdown()Description copied from class:AbstractVisionPanel
Subclasses should override this to provide shutdown logic.- Overrides:
onShutdown
in classAbstractVisionPanel
-
getBrowser
public com.teamdev.jxbrowser.browser.Browser getBrowser()Gets the browser object so advanced users can have at the browser's api. In previous versions of this module, the Browser object was a JComponent that provided component interaction features. Since module version 4.0.0, this object is now only a reference to the internal browser object, which is wrapped in aBrowserView
component for display purposes. If trying access to theBrowserView
JComponent, callgetBrowserView()
.Note that the Browser may be in a 'closed' state, and must be checked for this state before using.
- Returns:
- the instance of the
Browser
- Since:
- 4.0.0
-
getBrowserView
@Nullable public com.teamdev.jxbrowser.view.swing.BrowserView getBrowserView()Returns the JComponent that thatBrowser
is held within.- Returns:
- the
BrowserView
component. - Since:
- WebBrowser Module version 4.0.0
-
setStartingUrl
-
getStartingUrl
-
setStartingHtml
-
getStartingHtml
-
setTitle
-
getTitle
-
setCurrentUrl
public void setCurrentUrl() -
setCurrentUrl
-
getComponentEnabled
public boolean getComponentEnabled() -
setComponentEnabled
public void setComponentEnabled(boolean componentEnabled) -
enableComponent
public void enableComponent() -
getCurrentUrl
-
setCurrentHtml
public void setCurrentHtml() -
setCurrentHtml
-
getCurrentHtml
-
setIsLoaded
public void setIsLoaded(boolean isLoaded) -
getIsLoaded
public boolean getIsLoaded() -
getMode
public int getMode() -
setMode
public void setMode(int mode) -
setPopupsAllowed
public void setPopupsAllowed(boolean popupsAllowed) -
getPopupsAllowed
public boolean getPopupsAllowed() -
setZoomLevel
public void setZoomLevel(double zoomLevel) -
getZoomLevel
public double getZoomLevel() -
setUseProxies
public void setUseProxies(boolean useProxies) -
getUseProxies
public boolean getUseProxies() -
setHttpProxyServer
-
getHttpProxyServer
-
setHttpsProxyServer
-
getHttpsProxyServer
-
setFtpProxyServer
-
getFtpProxyServer
-
setProxyExceptions
-
getProxyExceptions
-
setHttpProxyPort
public void setHttpProxyPort(int httpProxyPort) -
getHttpProxyPort
public int getHttpProxyPort() -
setHttpsProxyPort
public void setHttpsProxyPort(int httpsProxyPort) -
getHttpsProxyPort
public int getHttpsProxyPort() -
setFtpProxyPort
public void setFtpProxyPort(int ftpProxyPort) -
getSocksProxyServer
-
setSocksProxyServer
-
getSocksProxyPort
public int getSocksProxyPort() -
setSocksProxyPort
public void setSocksProxyPort(int socksProxyPort) -
getFtpProxyPort
public int getFtpProxyPort() -
setUseProxyAuthentication
public void setUseProxyAuthentication(boolean useAuthentication) -
isUseProxyAuthentication
public boolean isUseProxyAuthentication() -
setProxyUsername
-
getProxyUsername
-
setProxyPassword
-
getProxyPassword
-
getTouchscreenMode
public int getTouchscreenMode() -
setTouchscreenMode
public void setTouchscreenMode(int touchscreenMode) -
reloadStarting
protected void reloadStarting() -
reloadCurrent
protected void reloadCurrent() -
reload
-
loadUrl
protected void loadUrl() -
loadUrl
-
loadHtml
protected void loadHtml() -
loadHtml
-
stopLoading
protected void stopLoading() -
initPopupBehavior
public void initPopupBehavior() -
back
public void back()If the browser is able to go back, it will, otherwise does nothing. -
forward
public void forward()If the browser is able to go forward, it will, otherwise does nothing. -
refresh
public void refresh()Reloads the existing browser object, or creates a new one. This allows reload to work even if the browser has crashed. -
disposeAndInit
protected void disposeAndInit() -
executeJavaScript
Tries to execute a script. Does not check to see if the script parses, is valid javascript, or will actually do anything useful- Parameters:
javaScript
- String with JavaScript to execute.
-
getImage
public byte[] getImage()Returns a byte array with a jpg of a screen shot of the current browser window. -
newButton
-
localeChanged
- Specified by:
localeChanged
in interfaceLocaleListener
- Overrides:
localeChanged
in classAbstractVisionPanel
-
getExtensionFunctions
- Specified by:
getExtensionFunctions
in interfaceExtensibleComponent
-
setExtensionFunctions
- Specified by:
setExtensionFunctions
in interfaceExtensibleComponent
-