Package com.nexirius.ulc.example1

Examples of com.nexirius.ulc.example1.ExampleSwingApplication$DoubleViewer


        this.listModel = listModel;
    }

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

            if (editItem != null && DialogManager.getPopupEditorAdaptor().popupEdit(editItem)) {
                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();

            if (DialogManager.getPopupEditorAdaptor().popupEdit(newItem)) {
                int index = listModel.getArray().sortInsert(newItem);

                listModel.getArray().setHighlightedItem(index);
                try {
                    PersistenceManager.saveItem(newItem) ;
                } catch (Exception e) {
                    e.printStackTrace()//TODO
                }
            }
        } else if (event.isMethodCall(ItemListModel.DELETE_ITEM_COMMAND)) {
            ItemModel removeItem = (ItemModel) listModel.getArray().getHighlightedItem();

            if (removeItem != null && DialogManager.ask("reallyDelete", "Yes", "No", true)) {
                try {
                    PersistenceManager.remove(removeItem);
                    listModel.getArray().removeItem(removeItem);
View Full Code Here


        DatabaseTableMapping m = JdbcConnectionHandler.instance().getDatabaseTableMapping(ItemModel.class.getName());
        DataModelEnumeration en = array.getEnumeration();
        DataModelVector remove = new DataModelVector();

        while (en.hasMore()) {
            ItemModel model = (ItemModel) en.next();

            if (model.getFlag(ModelFlag.DELETED)) {
                if (model.getInstanceName() == null) {
                    m.delete(model);
                }

                remove.append(model);
            } else {
                if (model.getInstanceName() == null) {
                    m.create(model);
                } else {
                    m.update(model);
                }
            }
View Full Code Here

    }

    public static void load(ItemArrayModel array) throws Exception {
        DatabaseTableMapping m = JdbcConnectionHandler.instance().getDatabaseTableMapping(ItemModel.class.getName());

        m.search(null, new ItemModel(), array);
    }
View Full Code Here

            new HTMLTemplateMapEntry(ItemModel.class, TEMPLATE_Item, true),
        };
    }

    public HTMLFunction[] getHTMLFunctions() {
        return new HTMLFunction[]{new MyColorFunction()};
    }
View Full Code Here

    public void init() {
        ViewerCreatorMap map = getFactory().getViewerCreatorMap();

        map.registerSwingViewer(ItemListModel.class, ItemListViewer.class);
        map.register(ItemArrayModel.class, new ItemArrayLayout(), false);
        //map.registerSwingViewer(DoubleModel.class, DoubleViewer.class);

        try {
            DataViewer viewer = getFactory().createDefaultEditor(mainModel);
            getMainPanel().setLayout(new GridLayout(1, 1));
View Full Code Here

TOP

Related Classes of com.nexirius.ulc.example1.ExampleSwingApplication$DoubleViewer

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.