/** * Get the environment to use for this record owner. * @return Record owner's environment, or null to use the default enviroment. */ public Task getTask() { if (this.getSFieldCount() > 0) return ((AppletScreen)this.getSField(0)).getTask(); // the applet screen has the task return null; // Never } /**
public boolean showHelpScreen(String strURL, int iOptions) { return this.getScreenFieldView().showDocument(strURL, iOptions); } /**
/** * Make a screen window to put a screen in. * <br/>NOTE: This method returns the AppletScreen NOT the FrameScreen, * because the AppletScreen is where you add your controls! */ public static BasePanel makeWindow(App application) { FrameScreen frameScreen = new FrameScreen(null, null, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); AppletScreen appletScreen = new AppletScreen(null, frameScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); appletScreen.setupDefaultTask((Application)application); return appletScreen; } /**
/** * Title for this screen. * @return the screen title. */ public String getTitle() // Standard file maint for this record (returns new record) { for (int i = 0; i < this.getSFieldCount(); i++) { if (this.getSField(i) instanceof BaseScreen) return ((BaseScreen)this.getSField(i)).getTitle(); } return super.getTitle(); } }
/** * Push this command onto the history stack. * @param strHistory The history command to push onto the stack. */ public void pushHistory(String strHistory, boolean bPushToBrowser) { if (m_vHistory == null) m_vHistory = new Vector<String>(); m_vHistory.addElement(strHistory); String strHelp = Utility.fixDisplayURL(strHistory, true, true, true, this); if (this.getAppletScreen() != null) if (this.getAppletScreen().getScreenFieldView() != null) this.getAppletScreen().getScreenFieldView().showDocument(strHelp, MenuConstants.HELP_WINDOW_CHANGE); if (bPushToBrowser) if (this.getAppletScreen() != null) if (this.getAppletScreen().getTask() instanceof BaseAppletReference) ((BaseAppletReference)this.getAppletScreen().getTask()).pushBrowserHistory(strHistory, this.getTitle(), bPushToBrowser); // Let browser know about the new screen } /**
/** * Process the "Help" toolbar command. * @param bUseSameWindow Use the same window? * @retrun true if successful. */ public boolean onHelp(int iOptions) { String strPrevAction = this.getScreenURL(); if ((strPrevAction == null) || (strPrevAction.length() == 0)) return false; // Can't handle help if I'm not the target screen. // Note: The following is a hack to make the demo screen stop displaying after the first help is pressed if (this.getProperty("displayInitialHelp") != null) if ((this.getProperty("helplanguage") != null) && (this.getProperty("helplanguage").length() > 0)) if (this.getTask() != null) if (this.getTask().getApplication() != null) this.getTask().getApplication().setProperty("helplanguage", this.getTask().getApplication().getLanguage(true)); strPrevAction = Utility.fixDisplayURL(strPrevAction, true, true, true, this); BaseApplet applet = null; if (this.getAppletScreen() != null) if (this.getAppletScreen().getScreenFieldView() != null) applet = (BaseApplet)this.getAppletScreen().getScreenFieldView().getControl(); if (applet != null) iOptions = applet.getHelpPageOptions(iOptions); if ((MenuConstants.HELP_WEB_OPTION & iOptions) == MenuConstants.HELP_WEB_OPTION) return this.getScreenFieldView().showDocument(strPrevAction, iOptions & 1); // Not standalone else return this.getAppletScreen().showHelpScreen(strPrevAction, iOptions); } /**
/** * Add the menus that belong with this screen. */ public void addScreenMenus() { AppletScreen appletScreen = this.getAppletScreen(); if (appletScreen != null) { ScreenField menuBar = appletScreen.getSField(0); if ((menuBar == null) || (!(menuBar instanceof SGridMenuBar))) { if (menuBar instanceof SBaseMenuBar) menuBar.free(); // Wrong menu new SGridMenuBar(new ScreenLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), appletScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC); } } } /**
/** * Constructor. * @param itsLocation The location of this component within the parent. * @param parentScreen The parent screen. * @param fieldConverter The field this screen field is linked to. * @param iDisplayFieldDesc Do I display the field desc? */ public AppletScreen(ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, Map<String, Object> properties) { this(); this.init(itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, properties); } /**
/** * Free the resources. */ public void free() { BasePanel parentScreen = this.getParentScreen(); super.free(); if (parentScreen instanceof FrameScreen) parentScreen.free(); // Make sure I remove my frame } /**
/** * Push this command onto the history stack. * @param strHistory The history command to push onto the stack. */ public void pushHistory(String strHistory, boolean bPushToBrowser) { if (m_vHistory == null) m_vHistory = new Vector<String>(); m_vHistory.addElement(strHistory); String strHelp = Utility.fixDisplayURL(strHistory, true, true, true, this); if (this.getAppletScreen() != null) if (this.getAppletScreen().getScreenFieldView() != null) this.getAppletScreen().getScreenFieldView().showDocument(strHelp, MenuConstants.HELP_WINDOW_CHANGE); if (bPushToBrowser) if (this.getAppletScreen() != null) if (this.getAppletScreen().getTask() instanceof BaseApplet) if (((BaseApplet)this.getAppletScreen().getTask()).getBrowserManager() != null) // Let browser know about the new screen ((BaseApplet)this.getAppletScreen().getTask()).getBrowserManager().pushBrowserHistory(strHistory, this.getTitle()); // Let browser know about the new screen } /**
/** * Process the "Help" toolbar command. * @param bUseSameWindow Use the same window? * @retrun true if successful. */ public boolean onHelp(int iOptions) { String strPrevAction = this.getScreenURL(); if ((strPrevAction == null) || (strPrevAction.length() == 0)) return false; // Can't handle help if I'm not the target screen. // Note: The following is a hack to make the demo screen stop displaying after the first help is pressed if (this.getProperty("displayInitialHelp") != null) if ((this.getProperty("helplanguage") != null) && (this.getProperty("helplanguage").length() > 0)) if (this.getTask() != null) if (this.getTask().getApplication() != null) this.getTask().getApplication().setProperty("helplanguage", this.getTask().getApplication().getLanguage(true)); strPrevAction = Utility.fixDisplayURL(strPrevAction, true, true, true, this); BaseAppletReference applet = null; if (this.getAppletScreen() != null) if (this.getAppletScreen().getScreenFieldView() != null) applet = (BaseAppletReference)this.getAppletScreen().getScreenFieldView().getControl(); if (applet != null) iOptions = applet.getHelpPageOptions(iOptions); if ((MenuConstants.HELP_WEB_OPTION & iOptions) == MenuConstants.HELP_WEB_OPTION) return this.getScreenFieldView().showDocument(strPrevAction, iOptions & 1); // Not standalone else return this.getAppletScreen().showHelpScreen(strPrevAction, iOptions); } /**
/** * Title for this screen. * @return the screen title. */ public String getTitle() // Standard file maint for this record (returns new record) { for (int i = 0; i < this.getSFieldCount(); i++) { if (this.getSField(i) instanceof BaseScreen) return ((BaseScreen)this.getSField(i)).getTitle(); } return super.getTitle(); } }
/** * Add the menus that belong with this screen. */ public void addScreenMenus() { AppletScreen appletScreen = this.getAppletScreen(); if (appletScreen != null) { ScreenField menuBar = appletScreen.getSField(0); if ((menuBar == null) || (!(menuBar instanceof SMenuBar))) { if (menuBar instanceof SBaseMenuBar) menuBar.free(); // Wrong menu new SMenuBar(new ScreenLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), appletScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC); } } } /**
/** * Constructor. * @param itsLocation The location of this component within the parent. * @param parentScreen The parent screen. * @param fieldConverter The field this screen field is linked to. * @param iDisplayFieldDesc Do I display the field desc? */ public AppletScreen(ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc) { this(); this.init(itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc); } /**
/** * Free the resources. */ public void free() { BasePanel parentScreen = this.getParentScreen(); super.free(); if (parentScreen instanceof FrameScreen) parentScreen.free(); // Make sure I remove my frame } /**
/** * Get the environment to use for this record owner. * @return Record owner's environment, or null to use the default enviroment. */ public Task getTask() { if (this.getSFieldCount() > 0) return ((AppletScreen)this.getSField(0)).getTask(); // the applet screen has the task return null; // Never } /**
/** * Setup a default task for this screen. * @param application The application for the new task. */ public void setupDefaultTask(App application) { this.getScreenFieldView().setupDefaultTask(application); } public boolean showHelpScreen(String strURL, int iOptions)
/** * Make a screen window to put a screen in. * <br/>NOTE: This method returns the AppletScreen NOT the FrameScreen, * because the AppletScreen is where you add your controls! */ public static BasePanel makeWindow(App application) { FrameScreen frameScreen = new FrameScreen(null, null, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC); AppletScreen appletScreen = new AppletScreen(null, frameScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC); appletScreen.setupDefaultTask((Application)application); return appletScreen; } /**
/** * Add the menus that belong with this screen. */ public void addScreenMenus() { AppletScreen appletScreen = this.getAppletScreen(); if (appletScreen != null) { ScreenField menuBar = appletScreen.getSField(0); if ((menuBar == null) || (!(menuBar instanceof SGridMenuBar))) { if (menuBar instanceof SBaseMenuBar) menuBar.free(); // Wrong menu new SBaseMenuBar(new ScreenLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), appletScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC); } } } /**
/** * Initialize the RecordOwner. * This initializer is required by the RecordOwner interface. * @param record The main record for this screen. * @param parent The parent screen. * @param properties The properties object. * @param location (property) The location of this component within the parent. * @param display (property) Do I display the field desc? */ public AppletScreen(RecordOwnerParent parent, FieldList record, Object properties) { this(); this.init(parent, record, properties); } /**