Design advice - batch data entry

Hi:
I am translating an Oracle Forms application that does batch data entry (among other things) to Cuba. We have files loaded with information attached to a “PIN” number. To do data entry, the user opens a “batch” (represented by a Batch Header record). Then they enter multiple transaction records by entering the PIN number. For each PIN number, once they leave the PIN number field, the application looks up all the details from the previously loaded table and populates the transaction record. The user then enters the pieces (like dollar amounts) that aren’t in the loaded data and then moves to the next record (using the keyboard down-arrow key).

The goal is speed of entry so the cursor movement is closely managed. The cursor jumps from PIN number to amount. The user then enters the amount and presses the down arrow key to move to the next record. When that happens, the cursor/focus moves to the PIN number field again.

I need to create something efficient for the browser/web environment in Cuba. Currently I have an accordion split. The top section contains the batch headers. The bottom section will contain the transactions. I’m thinking of using a horizontal accordion in the bottom section. On the left would be a table of PIN numbers. On the right would be the corresponding fields for the transaction corresponding to the chosen PIN.

I’m looking for advice on how to structure the screen. Is this an application for Frames? How can I best use the framework to minimize my coding and still get the navigation I need? I’m thinking that the vertical table on the lower left is a “transaction$browse” frame and the fields on the lower right are a “transaction$edit” frame? Does this make sense?

Eric

Hi Eric,

Thank you for the complex question.

There is no down-arrow key press handler in CUBA UI components and you cannot handle this event. By default all focus transitions are performed by TAB / SHIFT TAB (back) short cuts.

Also you can use EnterPressListener if you want to handle Enter shortcut inside of TextField:


textField.addEnterPressListener(e -> showNotification("Enter pressed"));

In version 6.5 you will be able to assign tabIndex attribute for input fields to control focus traverse sequence.

To focus certain field you can use short cuts, defined for actions in window scope:


<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        class="com.haulmont.refapp.gui.app.colour.ColourBrowser"
        lookupComponent="coloursTable"
        caption="msg://browserCaption"
        focusComponent="coloursTable">

    <actions>
        <action id="focusTable" shortcut="CTRL-ALT-C" invoke="focusTable"/>
    </actions>

    <dsContext>
        <groupDatasource id="coloursDs" class="com.haulmont.refapp.core.entity.Colour" view="_local">
            <query>
                select c from ref$Colour c order by c.name
            </query>
        </groupDatasource>
    </dsContext>

    <layout>
        <groupTable id="coloursTable" height="100%" width="100%">
            <buttonsPanel alwaysVisible="true">
                <button action="coloursTable.create"/>
                <button action="coloursTable.edit"/>
                <button action="coloursTable.remove"/>
            </buttonsPanel>
            <columns>
                <column id="name"/>
                <column id="description"/>
            </columns>
            <rows datasource="coloursDs"/>
        </groupTable>
    </layout>
</window>

And call requestFocus method to set focus to a component:


groupTable.requestFocus();

If you want to reuse your panels in multiple windows I recommend that you create a Frame in Studio. Create a Blank screen and then change base class of window to com.haulmont.cuba.gui.components.AbstractFrame on Properties tab of Screen Designer.

It is not recommended to use existing browse/edit windows as frames, since Frame has different initialization lifecycle. It is the best practice to create each Frame as reusable unit in respect that it will be used from multiple places.

Regards,

Yuriy

frame-window

Thank you for the pointers. I didn’t know about EnterPressListener or the focusTable built-in action.

Component.requestFocus method is available for all input fields and some focus aware components, such as Tree and Table.

Thanks. I actually have another topic open regarding that. I’m having trouble getting focus into my tables. No errors, but it just isn’t working all the time. I can get focus to the table itself, but I can’t get focus to fields within the table using table.requestFocus(entity, “column”). I’m still trying to figure it out.