// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
-package org.xwt;
+package org.ibex;
import java.lang.reflect.*;
import java.net.*;
import java.io.*;
-import java.util.*;
-import org.xwt.js.*;
-import org.xwt.util.*;
+import org.ibex.js.*;
+import org.ibex.util.*;
/**
* Abstracts away the small irregularities in JVM implementations.
* JVM. Subclasses are provided for other VMs. Methods whose names
* start with an underscore are meant to be overridden by
* subclasses. If you create a subclass of Platform, you should put
- * it in the org.xwt.plat package, and add code to this file's static
+ * it in the org.ibex.plat package, and add code to this file's static
* block to detect the new platform.
*/
public abstract class Platform {
static boolean clipboardReadEnabled = false; ///< true iff inside a C-v/A-v/Press3 trap handler
static Platform platform = null; ///< The appropriate Platform object for this JVM
static boolean alreadyDetectedProxy = false; ///< true if proxy autodetection has already been run
- static org.xwt.HTTP.Proxy cachedProxyInfo = null; ///< the result of proxy autodetection
+ static org.ibex.HTTP.Proxy cachedProxyInfo = null; ///< the result of proxy autodetection
public static String build = "unknown"; ///< the current build
// VM Detection Logic /////////////////////////////////////////////////////////////////////
criticalAbort("Unable to detect JVM");
}
- System.err.println(" " + os_name + " ==> org.xwt.plat." + platform_class);
+ System.err.println(" " + os_name + " ==> org.ibex.plat." + platform_class);
try {
- if (platform_class != null) Class.forName("org.xwt.plat." + platform_class).newInstance();
+ if (platform_class != null) Class.forName("org.ibex.plat." + platform_class).newInstance();
} catch (InstantiationException e) {
throw e.getCause();
}
Log.color = term != null && term.length() != 0 && !term.equals("cygwin");
try {
- build = (String)Class.forName("org.xwt.Build").getField("build").get(null);
- Log.diag(Platform.class, "XWT build: " + build);
+ build = (String)Class.forName("org.ibex.Build").getField("build").get(null);
+ Log.diag(Platform.class, "Ibex build: " + build);
} catch (ClassNotFoundException cnfe) {
- Log.warn(Platform.class, "XWT build: unknown");
+ Log.warn(Platform.class, "Ibex build: unknown");
} catch (Exception e) {
Log.info(Platform.class, "exception while detecting build:");
Log.info(Platform.class, e);
}
- Log.diag(Platform.class, "XWT VM detection: vendor = " + vendor);
+ Log.diag(Platform.class, "Ibex VM detection: vendor = " + vendor);
Log.diag(Platform.class, " version = " + version);
Log.diag(Platform.class, " os = " + os_name + " [version " + os_version + "]");
Log.diag(Platform.class, " platform = " + platform.getDescriptiveName());
protected Surface _createSurface(Box b, boolean framed) { return null; }
protected Picture _createPicture(JS r) { return null; }
protected PixelBuffer _createPixelBuffer(int w, int h, Surface owner) { return null; }
- protected Font.Glyph _createGlyph(org.xwt.Font f, char c) { return new DefaultGlyph(f, c); }
+ protected Font.Glyph _createGlyph(org.ibex.Font f, char c) { return new DefaultGlyph(f, c); }
public static PixelBuffer createPixelBuffer(int w, int h, Surface s) { return platform._createPixelBuffer(w, h, s); }
public static Picture createPicture(JS r) { return platform._createPicture(r); }
- public static Font.Glyph createGlyph(org.xwt.Font f, char c) { return platform._createGlyph(f, c); }
+ public static Font.Glyph createGlyph(org.ibex.Font f, char c) { return platform._createGlyph(f, c); }
public static Surface createSurface(Box b, boolean framed, boolean refreshable) {
Surface ret = platform._createSurface(b, framed);
ret.setInvisible(false);
/** invoked after initialization messages have been printed; useful for additional platform detection log messages */
protected void postInit() { }
- /** the human-readable name of the key mapped to XWT's 'alt' key */
+ /** the human-readable name of the key mapped to Ibex's 'alt' key */
public static String altKeyName() { return platform._altKeyName(); }
protected String _altKeyName() { return "alt"; }
platform._criticalAbort(message);
}
- /** if true, org.xwt.Surface will generate a Click automatically after a press and a release */
+ /** if true, org.ibex.Surface will generate a Click automatically after a press and a release */
public static boolean needsAutoClick() { return platform._needsAutoClick(); }
protected boolean _needsAutoClick() { return false; }
- /** if true, org.xwt.Surface will generate a DoubleClick automatically after recieving two clicks in a short period of time */
+ /** if true, org.ibex.Surface will generate a DoubleClick automatically after recieving two clicks in a short period of time */
public static boolean needsAutoDoubleClick() { return platform._needsAutoDoubleClick(); }
protected boolean _needsAutoDoubleClick() { return false; }
/** returns an InputStream to the builtin xwar */
public static InputStream getBuiltinInputStream() { return platform._getBuiltinInputStream(); }
- protected InputStream _getBuiltinInputStream() {return getClass().getClassLoader().getResourceAsStream("org/xwt/builtin.jar");}
+ protected InputStream _getBuiltinInputStream() {return getClass().getClassLoader().getResourceAsStream("org/ibex/builtin.jar");}
/** returns the value of the environment variable key, or null if no such key exists */
public static String getEnv(String key) { return platform._getEnv(key); }
/** displays a platform-specific "open file" dialog and returns the chosen filename, or null if the user hit cancel */
protected String _fileDialog(String suggestedFileName, boolean write) { return null; }
- public static String fileDialog(String suggestedFileName, boolean write) throws org.xwt.js.JSExn {
+ public static String fileDialog(String suggestedFileName, boolean write) throws org.ibex.js.JSExn {
return platform._fileDialog(suggestedFileName, write);
}
/** opens a new browser window */
public static void newBrowserWindow(String url) {
if (!(url.startsWith("https://") || url.startsWith("http://") || url.startsWith("ftp://") || url.startsWith("mailto:"))) {
- Log.info(Platform.class, "xwt.newBrowserWindow() only supports http and https urls");
+ Log.info(Platform.class, "ibex.newBrowserWindow() only supports http and https urls");
return;
}
// check the URL for well-formedness, as a defense against buffer overflow attacks
}
/** detects proxy settings */
- protected synchronized org.xwt.HTTP.Proxy _detectProxy() { return null; }
- public static synchronized org.xwt.HTTP.Proxy detectProxy() {
+ protected synchronized org.ibex.HTTP.Proxy _detectProxy() { return null; }
+ public static synchronized org.ibex.HTTP.Proxy detectProxy() {
if (cachedProxyInfo != null) return cachedProxyInfo;
if (alreadyDetectedProxy) return null;
alreadyDetectedProxy = true;
Log.info(Platform.class, "attempting environment-variable DNS proxy detection");
- cachedProxyInfo = org.xwt.HTTP.Proxy.detectProxyViaManual();
+ cachedProxyInfo = org.ibex.HTTP.Proxy.detectProxyViaManual();
if (cachedProxyInfo != null) return cachedProxyInfo;
Log.info(Platform.class, "attempting " + platform.getClass().getName() + " proxy detection");
// FEATURE: be more efficient for many of the subclasses
public static class DefaultGlyph extends Font.Glyph {
private Picture p = null;
- public DefaultGlyph(org.xwt.Font f, char c) { super(f, c); }
+ public DefaultGlyph(org.ibex.Font f, char c) { super(f, c); }
public Picture getPicture() {
if (p == null && isLoaded) {
Picture p = createPicture(null);