package NET.worlds.console; public class WebControl extends RenderCanvasOverlay { private final int ID_GO_BACK = 32768; private final int ID_GO_FORWARD = 32769; private final int ID_VIEW_STOP = 32770; private final int ID_VIEW_REFRESH = 32771; private final int ID_GO_HOME = 32772; private final int ID_EXIT = 32773; private WebControlImp imp = null; public WebControl(RenderCanvas pCanvas, boolean hasToolbar) throws NoWebControlException { super(pCanvas); try { this.imp = WebControlFactory.createWebControlImp(this.getNativeWindowHandle(), hasToolbar, false); } catch (NoWebControlException var4) { super.detach(); throw var4; } } public WebControl(RenderCanvas pCanvas, int xPer, int yPer, boolean hasToolbar, boolean isFixedSize, boolean isBanner) throws NoWebControlException { super(pCanvas, xPer, yPer, isFixedSize, !isBanner); this.imp = WebControlFactory.createWebControlImp(this.getNativeWindowHandle(), hasToolbar, isBanner); } public boolean setURL(String pURL) { if (this.imp == null) { System.out.println("Null implementation in WebControl.setURL"); return false; } else { return this.imp.setURL(pURL); } } public boolean setURL(String pURL, String pPostData) { if (this.imp == null) { System.out.println("Null implementation in WebControl.setURL"); return false; } else { return pPostData != null && !pPostData.equals("") ? this.imp.setURL(pURL, pPostData) : this.imp.setURL(pURL); } } @Override protected void handleCommand(int commandID) { if (this.imp == null) { System.out.println("Now this should be impossible. Null imp in WebControl.handleCommand."); } else { switch (commandID) { case 32768: this.imp.goBack(); break; case 32769: this.imp.goForward(); break; case 32770: this.imp.stop(); break; case 32771: this.imp.refresh(); break; case 32772: this.imp.home(); break; case 32773: this.detach(); } } } @Override void detach() { if (this.imp != null) { this.imp.detach(); } super.detach(); } @Override void canvasResized(int parentX, int parentY) { super.canvasResized(parentX, parentY); if (this.imp == null) { System.out.println("Null imp in WebControl.canvasResized"); } else { this.imp.resize(parentX, parentY, this.getXPercent(), this.getYPercent()); } } }