8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.webkit; 27 28 import com.sun.webkit.graphics.WCRectangle; 29 import java.util.logging.Level; 30 import java.util.logging.Logger; 31 32 class WCWidget { 33 private final static Logger log = Logger.getLogger(WCWidget.class.getName()); 34 35 static { 36 initIDs(); 37 } 38 39 private int x; 40 private int y; 41 private int width; 42 private int height; 43 private final WebPage page; 44 45 WCWidget(WebPage page) { 46 this.page = page; 47 } 48 49 WebPage getPage() { 50 return page; 51 } 52 53 WCRectangle getBounds() { 54 return new WCRectangle(x, y, width, height); 55 } 56 57 void setBounds(int x, int y, int width, int height) { 58 this.x = x; 59 this.y = y; 60 this.width = width; 61 this.height = height; 62 } 63 64 protected void destroy() {} 65 66 protected void requestFocus() {} 67 68 protected void setCursor(long cursorID) {} 69 70 protected void setVisible(boolean visible) {} 71 72 private void fwkDestroy() { 73 log.log(Level.FINER, "destroy"); 74 destroy(); 75 } 76 77 private void fwkSetBounds(int x, int y, int w, int h) { 78 if (log.isLoggable(Level.FINER)) { 79 log.log(Level.FINER, "setBounds({0}, {1}, {2}, {3})", 80 new Object[] { x, y, w, h }); 81 } 82 setBounds(x, y, w, h); 83 } 84 85 private void fwkRequestFocus() { 86 log.log(Level.FINER, "requestFocus"); 87 requestFocus(); 88 } 89 90 private void fwkSetCursor(long cursorID) { 91 if (log.isLoggable(Level.FINER)) { 92 log.log(Level.FINER, "setCursor({0})", cursorID); 93 } 94 setCursor(cursorID); 95 } 96 97 private void fwkSetVisible(boolean visible) { 98 if (log.isLoggable(Level.FINER)) { 99 log.log(Level.FINER, "setVisible({0})", visible); 100 } 101 setVisible(visible); 102 } 103 104 protected int fwkGetScreenDepth() { 105 log.log(Level.FINER, "getScreenDepth"); 106 WebPageClient pageClient = page.getPageClient(); 107 return pageClient != null 108 ? pageClient.getScreenDepth() 109 : 24; 110 } 111 112 protected WCRectangle fwkGetScreenRect(boolean available) { 113 if (log.isLoggable(Level.FINER)) { 114 log.log(Level.FINER, "getScreenRect({0})", available); 115 } 116 WebPageClient pageClient = page.getPageClient(); 117 return pageClient != null 118 ? pageClient.getScreenBounds(available) 119 : null; 120 } 121 122 private static native void initIDs(); 123 } | 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.webkit; 27 28 import com.sun.javafx.logging.PlatformLogger; 29 import com.sun.javafx.logging.PlatformLogger.Level; 30 import com.sun.webkit.graphics.WCRectangle; 31 32 class WCWidget { 33 private final static PlatformLogger log = PlatformLogger.getLogger(WCWidget.class.getName()); 34 35 static { 36 initIDs(); 37 } 38 39 private int x; 40 private int y; 41 private int width; 42 private int height; 43 private final WebPage page; 44 45 WCWidget(WebPage page) { 46 this.page = page; 47 } 48 49 WebPage getPage() { 50 return page; 51 } 52 53 WCRectangle getBounds() { 54 return new WCRectangle(x, y, width, height); 55 } 56 57 void setBounds(int x, int y, int width, int height) { 58 this.x = x; 59 this.y = y; 60 this.width = width; 61 this.height = height; 62 } 63 64 protected void destroy() {} 65 66 protected void requestFocus() {} 67 68 protected void setCursor(long cursorID) {} 69 70 protected void setVisible(boolean visible) {} 71 72 private void fwkDestroy() { 73 log.finer("destroy"); 74 destroy(); 75 } 76 77 private void fwkSetBounds(int x, int y, int w, int h) { 78 if (log.isLoggable(Level.FINER)) { 79 log.finer("setBounds({0}, {1}, {2}, {3})", 80 new Object[] { x, y, w, h }); 81 } 82 setBounds(x, y, w, h); 83 } 84 85 private void fwkRequestFocus() { 86 log.finer("requestFocus"); 87 requestFocus(); 88 } 89 90 private void fwkSetCursor(long cursorID) { 91 if (log.isLoggable(Level.FINER)) { 92 log.finer("setCursor({0})", cursorID); 93 } 94 setCursor(cursorID); 95 } 96 97 private void fwkSetVisible(boolean visible) { 98 if (log.isLoggable(Level.FINER)) { 99 log.finer("setVisible({0})", visible); 100 } 101 setVisible(visible); 102 } 103 104 protected int fwkGetScreenDepth() { 105 log.finer("getScreenDepth"); 106 WebPageClient pageClient = page.getPageClient(); 107 return pageClient != null 108 ? pageClient.getScreenDepth() 109 : 24; 110 } 111 112 protected WCRectangle fwkGetScreenRect(boolean available) { 113 if (log.isLoggable(Level.FINER)) { 114 log.finer("getScreenRect({0})", available); 115 } 116 WebPageClient pageClient = page.getPageClient(); 117 return pageClient != null 118 ? pageClient.getScreenBounds(available) 119 : null; 120 } 121 122 private static native void initIDs(); 123 } |