What is the best way to implement default values stored in a DB table?

[JHeadstart 10.1.3 build 78]
[JDeveloper 10.1.3 SU4]
We are struggling on how to best implement default values that are stored in a DB table. What we have is a database table with (CODE_TYPE, TABLE_NAME, COLUMN_NAME, DEFAULT_VALUE) as columns. This way the application administrator can administer default values himself/herself. Now we need to find the best way to set these table supplied default values in new rows. Globally we are aware of two ways:
- override create() method on VO
- probably create a View Object on top of the database table with default values (we are capable of transposing the table and return exactly one row with a column for each default value) and use JHeadstarts item property 'Default Value'.
We prefer the latter, since this is more declarative, however we struggle with the EL expression needed to indicate the default value.
If we have a VO named "DefaultValues" with a SELECT on a view on top of our database table (transposed) returning exactly one row, let us say:
SELECT orglanguage, orgtype, orgstatus [...]
FROM v_default_values
--> returning exactly one row
and we want an EL expression on an item that needs the value from orglanguage. What will the EL expression be? Something like:
#{data.DefaultValuesPageDef.currentrow.orglanguage.inputValue}? We tried several things but they do not work. A static default value works, but every EL expression so far does not. We know that using "data" can be dangerous, but thought JHeadstart takes care of preparing the other Page Definitions, so it might be possible when you use JHeadstart.
Or is overriding the create() method the preferred way? Or do we have to look at a Managed Bean for our default values that we refer to from EL (let us say MyAppDefaultValuesBean) and in that case: how do you associate a Managed Bean with a VO?
Any help would be appreciated. Apart from these default values, things are going rather well in this first J2EE/JHS project for us!
Toine

Steven,
Thanks for the reply. Unfortunately whatever we try, we cannot get it to work. We started looking at the second option (since we do need default values also in table lay-out new rows). We created a DefaultValues ViewObject, added it to the Application Module, added an EL expressiona to the Default Display Value property (replacing your ending ")" with a "}" offcourse ;-)), ran the JAG so that a page definition was generated for DefaultValues and we managed to get it prepared when loading for example the Organisation's jspx page. However no default value appears in a new row (not in Form, not in Table layout).
I then created a quick application on top of the HR schema, added a DefaultValues ViewObject using one calculated attribute (set Salary fixed to 1000), added the EL expression to the Salary Default Display Value property in the Employees Group, made sure the DefaultValuesPageDef is prepared by adding it to the parameter section and I see it getting prepared. I also see a managed Bean is created in the Employees-bean.xml.
In the Embedded OC4J log we see:
16:01:01 DEBUG (JhsPageLifecycle) -executing onCreate
16:01:01 DEBUG (JhsPageLifecycle) -CreateEmployeesDefaultValues bean found, applying default values to new row
2006-08-02 16:01:01.825 WARNING [ADFc] Warning: No Method onCreateEmployees and no actionBinding CreateEmployees found.
Is it this warning we should be worried about? Since no default value is created.
The managed bean (Employees-beans.xml) looks like:
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config xmlns="http://java.sun.com/JSF/Configuration">
<managed-bean>
<managed-bean-name>CreateEmployeesDefaultValues</managed-bean-name>
<managed-bean-class>oracle.jheadstart.controller.jsf.bean.DefaultValuesBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>iteratorBinding</property-name>
<value>#{bindings.EmployeesIterator}</value>
</managed-property>
<managed-property>
<property-name>defaultValues</property-name>
<map-entries>
<map-entry>
<key>Salary</key>
<value>#{data.DefaultValuesPageDef.DefaultValuesIterator.currentRow.Salary}</value>
</map-entry>
</map-entries>
</managed-property>
<managed-property>
<property-name>actionResult</property-name>
<value>CreateEmployees</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>searchEmployees</managed-bean-name>
<managed-bean-class>oracle.jheadstart.controller.jsf.bean.JhsSearchBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>bindings</property-name>
<value>#{data.EmployeesPageDef}</value>
</managed-property>
<managed-property>
<property-name>searchBinding</property-name>
<value>#{data.EmployeesPageDef.advancedSearchEmployees}</value>
</managed-property>
<managed-property>
<property-name>searchAttribute</property-name>
<value>EmployeeId</value>
</managed-property>
<managed-property>
<property-name>dataCollection</property-name>
<value>EmployeesView1</value>
</managed-property>
<managed-property>
<property-name>autoquery</property-name>
<value>true</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>EmployeesCollectionModel</managed-bean-name>
<managed-bean-class>oracle.jheadstart.controller.jsf.bean.JhsCollectionModel</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>jhsPageLifecycle</property-name>
<value>#{jhsPageLifecycle}</value>
</managed-property>
<managed-property>
<property-name>bindings</property-name>
<value>#{bindings}</value>
</managed-property>
<managed-property>
<property-name>rangeBinding</property-name>
<value>#{bindings.EmployeesTable}</value>
</managed-property>
<managed-property>
<property-name>defaultValues</property-name>
<value>#{CreateEmployeesDefaultValues.defaultValues}</value>
</managed-property>
</managed-bean>
</faces-config>
This is the DefaultValues.xml:
<?xml version='1.0' encoding='windows-1252' ?>
<!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
<ViewObject
Name="DefaultValues"
BindingStyle="OracleName"
CustomQuery="true"
ComponentClass="hr.model.DefaultValuesImpl"
UseGlueCode="false" >
<DesignTime>
<Attr Name="_version" Value="10.1.3.36.73" />
<Attr Name="_codeGenFlag2" Value="Access|Coll|VarAccess" />
</DesignTime>
<ViewAttribute
Name="Salary"
IsUpdateable="false"
IsPersistent="false"
Precision="255"
Type="java.lang.String"
ColumnType="VARCHAR2"
AliasName="SALARY"
Expression="1000"
SQLType="VARCHAR" >
</ViewAttribute>
</ViewObject>
The PageDef for Defaultvalues is like:
<?xml version="1.0" encoding="UTF-8" ?>
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
version="10.1.3.36.73" id="DefaultValuesPageDef"
Package="hr.view.pagedefs" EnableTokenValidation="false">
<parameters/>
<executables>
<iterator id="DefaultValuesIterator"
Binds="AppModuleDataControl.DefaultValues1"
DataControl="AppModuleDataControl" RangeSize="10"/>
</executables>
<bindings>
<attributeValues id="DefaultValuesSalary"
IterBinding="DefaultValuesIterator">
<AttrNames>
<Item Value="Salary"/>
</AttrNames>
</attributeValues>
<table id="DefaultValuesTable" IterBinding="DefaultValuesIterator">
<AttrNames>
<Item Value="Salary"/>
</AttrNames>
</table>
<action id="FirstDefaultValues" IterBinding="DefaultValuesIterator"
DataControl="AppModuleDataControl" RequiresUpdateModel="true"
Action="12"/>
<action id="PreviousDefaultValues" IterBinding="DefaultValuesIterator"
DataControl="AppModuleDataControl" RequiresUpdateModel="true"
Action="11"/>
<action id="NextDefaultValues" IterBinding="DefaultValuesIterator"
DataControl="AppModuleDataControl" RequiresUpdateModel="true"
Action="10"/>
<action id="LastDefaultValues" IterBinding="DefaultValuesIterator"
DataControl="AppModuleDataControl" RequiresUpdateModel="true"
Action="13"/>
<methodAction RequiresUpdateModel="true" Action="999"
id="advancedSearchDefaultValues"
IterBinding="DefaultValuesIterator"
DataControl="AppModuleDataControl"
InstanceName="AppModuleDataControl.dataProvider"
MethodName="advancedSearch"
ReturnName="AppModuleDataControl.methodResults.AppModuleDataControl_dataProvider_advancedSearch_result"
IsViewObjectMethod="false">
<NamedData NDName="viewObjectUsage"
NDValue="#{searchDefaultValues.dataCollection}"
NDType="java.lang.String"/>
<NamedData NDName="arguments" NDValue="#{searchDefaultValues.arguments}"
NDType="java.util.ArrayList"/>
<NamedData NDName="allConditionsMet"
NDValue="#{searchDefaultValues.allConditionsMet}"
NDType="java.lang.Boolean"/>
</methodAction>
<action id="setCurrentRowWithKeyDefaultValues"
IterBinding="DefaultValuesIterator"
InstanceName="AppModuleDataControl.DefaultValues1"
DataControl="AppModuleDataControl" RequiresUpdateModel="false"
Action="96">
<NamedData NDName="rowKeyStr" NDValue="#{row.rowKeyStr}"
NDType="java.lang.String"/>
</action>
<action id="CreateDefaultValues" IterBinding="DefaultValuesIterator"
DataControl="AppModuleDataControl" RequiresUpdateModel="true"
Action="40"/>
<action id="DeleteDefaultValues" IterBinding="DefaultValuesIterator"
DataControl="AppModuleDataControl" RequiresUpdateModel="false"
Action="30"/>
<action id="Commit" RequiresUpdateModel="true" Action="100"
DataControl="AppModuleDataControl"/>
<action id="Rollback" RequiresUpdateModel="false" Action="101"
DataControl="AppModuleDataControl"/>
</bindings>
</pageDefinition>
We do not understand what is wrong and why the default values do not get created in the new rows (and it is taking us far too much time). Any chance the EL expression is still wrong? It is a shame that any syntax errors in EL expressions are not visible in some logfile. It looks like when EL expressions are wrong, they are ignored instead of raising an error...
Toine

Similar Messages

  • What is the best way to verify default heap size in Java

    Hi All,
    What is the best way to verify default heap size in Java ? does it vary over JVM to JVM . I was reading this article http://javarevisited.blogspot.sg/2011/05/java-heap-space-memory-size-jvm.html , and it says default size is 128 MB but When I run following code :
    public static void main(String args[]) {
    int MB = 1024*1024;
    System.out.println(Runtime.getRuntime().totalMemory()/MB);
    It print "870" i.e. 870 MB.
    I am bit confused, what is the best way to verify default heap size in any JVM ?
    Edited by: 938864 on Jun 5, 2012 11:16 PM

    938864 wrote:
    Hi Kayaman,
    Sorry but I don't agree with you on verification part, Why not I can verify it ? to me default means value when I don't specify -Xms and -Xmx and by the way I was testing that program on 32 bit JRE 1.6 on Windows. I am also curious significant difference between 128MB and 870MB I saw, do you see anything obviously wrong ?That spec is outdated. Since Java 6 update 18 (Sun/Oracle implementation) the default maximum heap space is calculated based on total memory availability, but never more than 1GB on 32 bits JVMs / client VMs. On a 64 bits server VM the default can go as high as 32gb.
    The best way to verify ANYTHING is to address multiple sources of information and especially those produced by the source, not some page you find on the big bad internet. Even wikipedia is a whole lot better than any random internet site IMO. That's common sense, I can't believe you put much thought into it that you have to ask in a forum.

  • What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide
    object ID generator?Always use 3 because it is prime.
    Alternatively more information about the system and the needs of the system might prompt alternative ideas some of which are likely to be better than others for your particular implementation and system constraints.

  • What is the best way to implement writable many-to-many relations

    As everyone knows, the many-to-many associations provided by BC4J are quite good to read many-to-many associations, but they are not able to write such associations.
    There are other solutions using composite associations or cascading-delete foreign keys, but as I was tought now, they are also quite problematic. See thread Internal error: Entity.afterRollback.status_dead   -- What does this mean? for more details.
    So I ask you: What is the best way to implement writable many to many associations? Do you really have to manage them "by hand"?
    Thanks for your ideas
    Frank

    I'd appreciate any hint
    Thanks

  • What is the best way to implement Spiceworks and get started?

    Yes this is the most basic question of all, how do you use it?I did search for some articles but there are tutorials that are 6 years old, or maybe a year or two old. I want to make sure I'm up to date on best practice.I've got a network of 8 PCs and 6 laptops or so as well as phones and tablets (if SW cares).I've got this community user which I created long ago when I first tried to test SW.My question is, what is the best way to get SW going? I mean, do I create a new user that is specific to the company? Is the community user different from the SW admin user? I want to separate my community user (which is me personally) from any local business/network implementation of SW.Do I need a server to run this or is something run on each workstation? Does each computer need something done to it so SW can work right?Basically I just need to...
    This topic first appeared in the Spiceworks Community

    In Settings tap on Reset at the bottom then tap on Erase all Content and Settings. This returns it to the condition of being "new."

  • What is the best way to implement a scheduled task?

    Dear kind sirs...
    let us say I have a JSF application, and it is working perfectly fine...
    I need the method like
    void DoProcessing()
    *// processing code here*
    to execute everyday at 7AM...
    so what is the best way to do it? I need this to be part of the JSF application... not in a different process... and I want the method to execute at that exact time every day.
    and what are the main steps to do that?
    best regards

    Dear Mr. Chris...
    the reason I am asking about this is because we are required to provide reports for a number of customers by email every day... each report requires retrieving values from a DB.
    I made a test few hours ago about making a thread sleeps and check the time when it wakes up, it works, no problem about that...
    I placed a thread in the servlet context and started it... and it kept working for about an hour writing in the log every 5 seconds... so I guess the idea works...
    but do you think that this way of implementing the scheduler is ok? for I have not done it before and I don't know the cons of such a method.
    thanks for any advice or comment.
    best regards

  • What is the best way to implement Carousel i.e. web part in a site page on office 365 site?

    We can implement the Carousel web part in many ways like content By Query Web Part , jquery (nivo) plugin or content search web part etc. But among these which one is the best way to implement to get best performance of the page?
    Thanks

    content search web part always provides best performance because it uses the search. only consideration you need to take is, it does not display the changes immediately and you need to wait for the incremental crawl to happen.
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • What's the best way to delete 2.4 million of records from table?

    We are having two tables one is production one and another is temp table which data we want to insert into production table. temp table having 2.5 million of records and on the other side production table is having billions of records. the thing which we want to do just simple delete already existed records from production table and then insert the remaining records from temp to production table.
    Can anyone guide what's the best way to do this?
    Thanks,
    Waheed.

    Waheed Azhar wrote:
    production table is live and data is appending in this table on random basis. if i go insert data from temp to prod table a pk voilation exception occured bcoz already a record is exist in prod table which we are going to insert from temp to prod
    If you really just want to insert the records and don't want to update the matching ones and you're already on 10g you could use the "DML error logging" facility of the INSERT command, which would log all failed records but succeeds for the remaining ones.
    You can create a suitable exception table using the DBMS_ERRLOG.CREATE_ERROR_LOG procedure and then use the "LOG ERRORS INTO" clause of the INSERT command. Note that you can't use the "direct-path" insert mode (APPEND hint) if you expect to encounter UNIQUE CONSTRAINT violations, because this can't be logged and cause the direct-path insert to fail. Since this is a "live" table you probably don't want to use the direct-path insert anyway.
    See the manuals for more information: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#BGBEIACB
    Sample taken from 10g manuals:
    CREATE TABLE raises (emp_id NUMBER, sal NUMBER
       CONSTRAINT check_sal CHECK(sal > 8000));
    EXECUTE DBMS_ERRLOG.CREATE_ERROR_LOG('raises', 'errlog');
    INSERT INTO raises
       SELECT employee_id, salary*1.1 FROM employees
       WHERE commission_pct > .2
       LOG ERRORS INTO errlog ('my_bad') REJECT LIMIT 10;
    SELECT ORA_ERR_MESG$, ORA_ERR_TAG$, emp_id, sal FROM errlog;
    ORA_ERR_MESG$               ORA_ERR_TAG$         EMP_ID SAL
    ORA-02290: check constraint my_bad               161    7700
    (HR.SYS_C004266) violatedIf the number of rows in the temp table is not too large and you have a suitable index on the large table for the lookup you could also try to use a NOT EXISTS clause in the insert command:
    INSERT INTO <large_table>
    SELECT ...
    FROM TEMP A
    WHERE NOT EXISTS (
    SELECT NULL
    FROM <large_table> B
    WHERE B.<lookup> = A.<key>
    );But you need to check the execution plan, because a hash join using a full table scan on the <large_table> is probably something you want to avoid.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • What's the best way to define some values based on the URL?

    Let's say for example I want all my URLs for servlets to take the form:
    http://mysite.com/module/action?arguments
    What's the most scalable way to handle mapping the values in place of "module" and "action"? For example, I might have a "forum" module and have an action to "deleteThread", called like so:
    http://mysite.com/forum/deleteThread?id=321
    I know I can just parse it myself, but is there a better way to handle this via some settings in web.xml or similar? All my requests go through a Front Controller which needs to know which module and action have been requested so that it can run the appropriate action controller.
    Cheers,
    Chris

    At the risk of repeat-posting, I'll clarify. Say I create a file named routing.xml which defines some routes like this:
    <routing-config>
      <route>
        <name>Standard rule</name>
        <description>
          This route maps the first two parts in the path with the module and action
        </description>
        <url-pattern>/:module/:action.do</url-pattern>
      </route>
      <route>
        <name>Default Index</name>
        <description>
          Allows the module to be specified without the action for "Index" actions.
        </description>
        <url-pattern>/:module.do</url-pattern>
        <request-parameters>
          <parameter key="action" value="Index" />
        </request-parameters>
      </route>
      <route>
        <name>Homepage</name>
        <description>
          Loads the Home page
        </description>
        <url-pattern>/</url-pattern>
        <request-parameters>
          <parameter key="module" value="Home" />
          <parameter key="action" value="Index" />
        </request-parameters>
      </route>
    </routing-config>The bits like ":module" which be represented by the actual name of the module in the URL. Does anyone know if something like this already exists? :)
    I wrote this exact same thing in PHP5 just a few weeks ago but I really don't have the motivation to write it all over again in Java :P On a side-note, things like this usually come with helpers for turning unclean URIs into clean URIs.

  • What is the best way to trust DSCP values on 6509 interfaces?

    I have 6509's with 2 Ten-gig interfaces configured into a Port Channel (routed with IP addressing) - the IOS is 12.2(18)SXE3. I want to trust the DSCP values of packets traveling through the interfaces and have applied 'mls qos trust dscp' on both the physical Ten-gig interfaces as well as the L3 Port Channel interface.
    1.Is it necessary to have the statement on all the interfaces, or is just having it on the Port channel enough?
    Here is the config right now:
    interface Port-channel4
    description to 6509-Core-A P4 (T1/3, T2/3)
    ip address 164.xxx.xx.xx 255.255.255.252
    ip pim sparse-mode
    ip route-cache flow
    mls qos trust dscp
    interface TenGigabitEthernet1/1
    description to 6509-Core-A T1/3 (P4)
    no ip address
    ip route-cache flow
    mls qos trust dscp
    channel-group 4 mode desirable
    interface TenGigabitEthernet1/2
    description to 6509-Core-A T2/3 (P4)
    no ip address
    ip route-cache flow
    mls qos trust dscp
    channel-group 4 mode desirable
    Also, what command can I use to see the dscp counters? In the 3560/3750 catalyst line you can enter: 'sh mls qos int f0/1 statistics' and get a display of all the dscp/cos input/output packet counts, but I can't find a comparable command in the 6509.
    2. Is there one?

    I think you do this on the individual port interfaces, not the port-channel interface, becasue the queueing mechanisims associated with DSCP values are port based.
    By doing this, if you have policy maps you want to use, you attach them to the ports not the port-channel.
    For the command on 6509, you can use:
    sh mls qos ip gigabitEthernet 1/1
    Hope this helps and let me know how that works out.
    Gary

  • What's the best way to implement an array on OOP?

    Hello,
    In the attached image, I do a database query with one query string. It opens the connection, makes the query, and closes the connection. The output array is scanned for certain conditions later.
    If I have 10 queries I could simply make an array of queries and make an array of replies. Then I could decompose the output array in a for loop and run my evaluations.
    In OOP however, I find myself wanting to make each query as an object, to encapsulate it. That is a problem though, because the database resides in a server in another building across town, and the connection to it is slow. So multiple queries take too long.
    How do I approach this in OOP?

    Or yet another approach...
    Use "Composition" pattern to say the connection is a part of the query and implement the connection class using the Singlton pattern.
    The Connection method that crates the connection would only make the connection when an open is invoked and the connection does not alreday exist.
    So your queries are an array like what seems natural (is that "Cohesion").
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • What's the best way to implement LOVs in OBIEE?

    Hi All,
    Does anyone have any good ideas on how to go about implementing LOVs in OBIEE?
    At the moment we have created reports and dashboard prompts from the relevant SQL views which report off an Oracle EBS database. Our problem is that when we create a dashboard prompt from this view, that the generation of the LOV will take an extremely long time as it would need to run the whole query and do a distinct on the relevant column, before the LOVs are returned to the user.
    I'd like to find out what possible solutions exist to implement and manage LOVs in OBIEE, and which is the preferred and recommended approach?
    Thanks,
    Lance

    Hi Lance,
    I can think about two things which are indexing and using a dimensional model rather than OLTP.
    Are the views based on huge transaction tables? Are the LOVs based on transactional dates.
    Thanks,
    Manoj.

  • What is the best way to implement CSS UDP service keepalive?

    I would like a way to do this without changing the application. Below I found one way to do this in this forum but can one do this? I didn't see a way in the css scripting language to check for the ICMP error.
    Is it possible to write such CSS script:
    - to send UDP traffic to UDP port on server,
    - if there is no answer -service is active,
    - if ICMP port unreachable is received - server is declared down.
    If this isn't possible, is there another way to do this?
    Thanks
    Linda

    Linda,
    the above is not possible.
    The solution is to send real application data and inspect the response.
    You can do this by sniffing a request from a client directly to a server, and capturing the response as well.
    Extract the data portion - beyond the udp header, and convert to a chain of hex numbers.
    Use those numbers in the socket send function with the raw option.
    You can find an example of such a script on your CSS by doing a
    sho script ap-kal-dns
    To analyse the response, you can also use socket receive with the raw option.
    Regards,
    Gilles.

  • What is the best way to double buffer in this case and how to do it....

    currently I have
    public class Frame1 extends JFrame{
    //inside this class I call up circle class, rectangle class, etc.... to draw
    }I am making a "paint" program, and I have individual classes to handle the paint methods heres an example:
    abstract public class Shape {
        public Shape() {
        public abstract void draw(Graphics g, Color c, int x, int y, int width,int height);
    }and then....
    public class Circle extends Shape{
        public Circle() {
        public void draw(Graphics g, Color c, int oldx, int oldy, int newx, int newy) {
            g.setColor(c);
            g.drawOval(Math.min(oldx, newx), Math.min(oldy, newy), Math.abs(oldx - newx), Math.abs(oldy - newy));
    }There is also a Rectangle class, line class.... etc! So my question to you is the following... what is the best way to implement double buffer in the individual classes? And how to do it?? And also.... the drawings should be kept inside a jPanel.
    Any bit of help is much appreciated Thank you!!

    You don't need to do double-buffering. Swing
    components are double-buffered by default. Just make
    sure you override paintComponent() and not paint().
    And even if you had to, why would there be any
    difference in implementation for your classes whether
    they paint to on- or off-screen graphics?I need to override paintComponent()? what if I don't...
    I am using JBuilder2005 and they automate somethings for me. So thats how they did it when they created the application they did this....
    public class Frame1 extends JFrame{
    /*** all my code here***/
    public class Application1 {
        boolean packFrame = false;
         * Construct and show the application.
        public Application1() {
            Frame1 frame = new Frame1();
            // Validate frames that have preset sizes
            // Pack frames that have useful preferred size info, e.g. from their layout
            if (packFrame) {
                frame.pack();
            } else {
                frame.validate();
            // Center the window
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            Dimension frameSize = frame.getSize();
            if (frameSize.height > screenSize.height) {
                frameSize.height = screenSize.height;
            if (frameSize.width > screenSize.width) {
                frameSize.width = screenSize.width;
            frame.setLocation((screenSize.width - frameSize.width) / 2,
                              (screenSize.height - frameSize.height) / 2);
            frame.setVisible(true);
            try {
                jbInit();
            } catch (Exception ex) {
                ex.printStackTrace();
         * Application entry point.
         * @param args String[]
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    try {
                        UIManager.setLookAndFeel(UIManager.
                                                 getSystemLookAndFeelClassName());
                    } catch (Exception exception) {
                        exception.printStackTrace();
                    new Application1();
        private void jbInit() throws Exception {
    }

  • What is the best way to create a bookmark for a returning user??

    Hello all... hello again Steve...I am back with another question- what is the best way to implement a bookmark system so returning users can pick up where they left off in an AW lesson? I have tried the usual internet searches, always do, but the few samples/answers I have found were AW5, not much help...
    I have a dozen or so maps attached to my framework, I would like a user to return to the last map he viewed before closing. (My AW is communicating fine with an Access database, so if passing a variable to Access and then back to AW when the lesson starts is on the right track, let me know...) If the answer here is too complicated, maybe nudge me in the right direction and I will dive back in.
    Thanks in advance to anyone who has some guidance, I really do appreciate it!
    Terry

    Try this outline, see if it helps ...
    Grab a reference to the Map as you enter it, then save that to the database when you leave.
    You want something that will give you the equivalent to a page number - if you have 7 maps hanging off the Framework, and the user is in the 6th map when he exits, you want to save the number 6.
    There are scores of ways to do this, but probably the easiest is just to attach a calc to each map that has this code
    (I don't have Authorwar handy to check syntax, so you should check!)
    BookMarkPage = ChildIDtoNum(IconParent(IconID), IconID) <-- tells Authorware to return the "page number" of the current map
    Save BookMarkPage to your Access database on exit .
    On return, read the bookmark back into BookMarkPage, ask the user if he wants to return to bookmark. If yes, use a calculated navigation that uses
    ChildNumToID(@the name of your Framework or it's ID, BookMarkPage)
    Note that you could wrangle something similar by saving the IconID of your Map, or the IconTitle, but both of these can break if you ever update your file by adding or removing pages, renaming them etc. With this method, all you need is a simple page count check that ensures that you are not trying to nav to a page number that does not exist (use IconNumChildren).
    Steve

Maybe you are looking for