Package com.nexirius.ulc.example1.persistence

Examples of com.nexirius.ulc.example1.persistence.PersistenceManager


        return getFactory().getClientResource().getLabel(getApplicationName());
    }

    public void preInit() {
        mainModel = new ItemListModel();
        mainModel.addDataModelListener(new SwingController(mainModel));
        mainModel.appendMethod(new ExitCommand());
        PersistenceManager.init();
        try {
            mainModel.reloadCommand();
        } catch (Exception e) {
View Full Code Here


    }

    public void preInit() {
        mainModel = new ItemListModel();
        mainModel.appendMethod(new ExitCommand());
        mainModel.addDataModelListener(new ULCController(mainModel));
        PersistenceManager.init();
        try {
            mainModel.reloadCommand();
        } catch (Exception e) {
            e.printStackTrace()//TODO
View Full Code Here

    public String getApplicationName() {
        return "ExampleUlcApplication";
    }

    public void preInit() {
        mainModel = new ItemListModel();
        mainModel.appendMethod(new ExitCommand());
        mainModel.addDataModelListener(new ULCController(mainModel));
        PersistenceManager.init();
        try {
            mainModel.reloadCommand();
View Full Code Here

    public String getApplicationTitle() {
        return getFactory().getClientResource().getLabel(getApplicationName());
    }

    public void preInit() {
        mainModel = new ItemListModel();
        mainModel.addDataModelListener(new SwingController(mainModel));
        mainModel.appendMethod(new ExitCommand());
        PersistenceManager.init();
        try {
            mainModel.reloadCommand();
View Full Code Here

    public String getApplicationName() {
        return "ExampleUlcApplication";
    }

    public HTMLTransition[] getHTMLTransistions(DataModel homeModel) {
        ItemListModel list = (ItemListModel) homeModel;
        HTMLState overview = new HTMLState("Overview", list, true, null);
        HTMLState drillDown = new HTMLState("DrillDown", null, true, TEMPLATE_DrillDown);
        HTMLState newItem = new HTMLState("NewItem", list.getSelected(), true, TEMPLATE_NewItem);

        return new HTMLTransition[]{
            new HTMLTransition(overview, HTMLFunction.EVENT_POPUP, drillDown),
            new HTMLTransition(overview, EVENT_reload, new ReloadCommand(), overview),
            new HTMLTransition(overview, "deleteItemCommand", new DeleteCommand(), overview),
View Full Code Here

    public void handleException(HTMLSessionVariable sessionVariable, Exception e) {
    }

    public DataModel createHomeModel() {
        ItemListModel mainModel = new ItemListModel();

        try {
            PersistenceManager.init();
            mainModel.reloadCommand();
        } catch (Exception e) {
            e.printStackTrace()//TODO
        }

        return mainModel;
View Full Code Here

            }

            if (model instanceof ItemModel) {
                ItemModel item = (ItemModel) model;

                ItemListModel homeModel = (ItemListModel) sessionVariable.getApplicationModel();
                homeModel.getArray().sortInsert(item.duplicate(null, null));
                PersistenceManager.save(homeModel.getArray());
            }

            return true;
        }
View Full Code Here

            return false;
        }

        public boolean execute(HTMLSessionVariable sessionVariable) throws Exception {
            String attr = sessionVariable.getRequestParameter("sortAttribute");
            ItemListModel itemListModel = (ItemListModel) sessionVariable.getApplicationModel();

            itemListModel.getArray().sortByAttribute(attr);

            return true;
        }
View Full Code Here

            if (!model.isValid()) {
                return false;
            }

            if (model instanceof ItemModel) {
                ItemModel item = (ItemModel) model;

                ItemListModel homeModel = (ItemListModel) sessionVariable.getApplicationModel();
                homeModel.getArray().sortInsert(item.duplicate(null, null));
                PersistenceManager.save(homeModel.getArray());
            }

            return true;
        }
View Full Code Here

        this.listModel = listModel;
    }

    public void dataModelEdit(DataModelEvent event) {
        if (event.isMethodCall(ItemListModel.EDIT_ITEM_COMMAND)) {
            ItemModel editItem = (ItemModel) listModel.getArray().getHighlightedItem();

            if (editItem != null) {
                ULCDialogManager.instance().popup(editItem, true, dialogListener);
                listModel.getArray().sort();

                try {
                    PersistenceManager.saveItem(editItem) ;
                    int index = listModel.getArray().getChildIndex(editItem);
                    listModel.getArray().setHighlightedItem(index);
                } catch (Exception e) {
                    //ignore
                }
            }
        } else if (event.isMethodCall(ItemListModel.NEW_ITEM_COMMAND)) {
            ItemModel newItem = new ItemModel();

            ULCDialogManager.instance().popup(newItem, true, dialogListener);
            try {
                PersistenceManager.saveItem(newItem) ;
            } catch (Exception e) {
                e.printStackTrace()//TODO
            }
            int index = listModel.getArray().sortInsert(newItem);

            listModel.getArray().setHighlightedItem(index);
        } else if (event.isMethodCall(ItemListModel.DELETE_ITEM_COMMAND)) {
            ItemModel removeItem = (ItemModel) listModel.getArray().getHighlightedItem();

            if (removeItem != null) {
                try {
                    PersistenceManager.remove(removeItem);
                    listModel.getArray().removeItem(removeItem);
View Full Code Here

TOP

Related Classes of com.nexirius.ulc.example1.persistence.PersistenceManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.