/** * Fix the weird screen resize problem. Someone changes my size to these weird dimensions. When * they do, I have to resize to the right size again. This is a HACK! */ public void setBounds(int x, int y, int width, int height) { super.setBounds(x, y, width, height); if ((x == 0) && (y == 0) && (width == 22) && (height == 30)) if (m_screenField != null) if (!m_bInResizeLoop) { m_bInResizeLoop = true; // No endless loop m_screenField.resizeToContent(m_screenField.getTitle()); } m_bInResizeLoop = false; }
public void setupLookAndFeel(PropertyOwner propertyOwner) { if (m_screenField == null) return; // Now that the physical screen is set up, make sure the screeninfo has access to the screen // default properties ScreenInfo screenInfo = ((VAppletScreen) m_screenField.getScreenFieldView()).getScreenInfo(); if (propertyOwner == null) propertyOwner = m_screenField.retrieveUserProperties(Params.SCREEN); screenInfo.setScreenProperties(propertyOwner, null); super.setupLookAndFeel(propertyOwner); }
/** * STANDALONE APPLICATION SUPPORT The main() method acts as the applet's entry point when it is * run as a standalone application. It is ignored if the applet is run from within an HTML page. */ public static void main(String args[]) { BaseApplet.main(args); // call super.main(); // Create Toplevel Window to contain applet SApplet // Create the form, passing it the recordset FrameScreen frameScreen = new FrameScreen(null, null, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); // The following code starts the applet running within the frame window. // It also calls GetParameters() to retrieve parameter values from the // command line, and sets m_fStandAlone to true to prevent init() from // trying to get them from the HTML page. AppletScreen appletScreen = new AppletScreen(null, frameScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); SApplet applet = (SApplet) appletScreen.getScreenFieldView().getControl(); applet.init(); applet.start(); }
/** Free/Destroy the control. */ public void free() { String servicePid = this.getProperty(BundleConstants.SERVICE_PID); if (m_screenField != null) if (m_screenField.getScreenFieldView() != null) if (m_screenField.getScreenFieldView().getControl() == this) { m_screenField .getScreenFieldView() .setControl(null); // keep ~ScreenField from deleteing me! m_screenField.free(); m_screenField = null; } super.free(); if (ClassServiceUtility.getClassService().getClassFinder(null) != null) if (!ClassServiceUtility.getClassService() .getClassFinder(null) .shutdownService(this.getClass().getName(), servicePid)) // Try again using my pid ClassServiceUtility.getClassService() .getClassFinder(null) .shutdownService(null, this); // Careful of circular calls }
/** * The start() method is called when the page containing the applet first appears on the screen. * The AppletWizard's initial implementation of this method starts execution of the applet's * thread. */ public void start() { super.start(); if (m_screenField == null) { // This is the code that runs if this is an applet m_screenField = new AppletScreen(); m_screenField.setTask(this); m_screenField.setScreenFieldView(m_screenField.setupScreenFieldView(true)); // NOTE: When an Applet Screen passes no parent, the SApplet peer is not created, set it! m_screenField.init(null, null, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); // x this.addRecordOwner(m_screenField); this.setupLookAndFeel(null); Container container = this.getBottomPane(); while (container != null) { if (container.getParent() == null) container.setFocusTraversalPolicy( new MyFocusTraversalPolicy()); // Set the traversal policy for an applet container = container.getParent(); } } BaseScreen.makeScreenFromParams( this, null, m_screenField, ScreenConstants.DONT_PUSH_TO_BROWSER, null); }
/** * If this task object was created from a class name, call init(xxx) for the task. You may want to * put logic in here that checks to make sure this object was not already inited. Typically, you * init a Task object and pass it to the job scheduler. The job scheduler will check to see if * this task is owned by an application... if not, initTask() is called. */ public void initTask(App application, Map<String, Object> properties) { if (m_application != null) return; // No, already inited! m_application = (Application) application; if (properties != null) { if (m_properties != null) m_properties.putAll(properties); else m_properties = properties; } if (m_screenField == null) { FrameScreen frameScreen = new FrameScreen(null, null, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); m_screenField = new AppletScreen(); m_screenField.setTask(this); m_screenField.setScreenFieldView(m_screenField.setupScreenFieldView(true)); // NOTE: When an Applet Screen passes no parent, the SApplet peer is not created, set it! m_screenField.init(null, frameScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); this.init(null); this.addRecordOwner(m_screenField); BaseScreen.makeScreenFromParams(this, null, m_screenField, 0, null); } }
/** This is a special method that runs some code when this screen is opened as a task. */ public void run() { if (m_screenField != null) m_screenField.run(); }