Search in sources :

Example 1 with StoredObject

use of com.storedobject.core.StoredObject in project SODevelopment by syampillai.

the class ObjectBlockEditor method clicked.

@Override
public void clicked(Component c) {
    if (c == cancel) {
        close();
        return;
    }
    if (c == save) {
        ArrayListSet<StoredObject> changed = new ArrayListSet<>();
        if (!canSave() || !saveBlockTextInt(changed)) {
            return;
        }
        if (changed.isEmpty()) {
            message("No changed made!");
            return;
        }
        if (transact(t -> {
            for (StoredObject storedObject : changed) {
                storedObject.save(t);
            }
        })) {
            close();
        }
        return;
    }
    if (c == expand) {
        expand.setVisible(false);
        collapse.setVisible(true);
        for (TextArea ta : blocks) {
            if (!ta.isEnabled()) {
                ta.setVisible(true);
            }
        }
        return;
    }
    if (c == collapse) {
        expand.setVisible(true);
        collapse.setVisible(false);
        for (TextArea ta : blocks) {
            if (!ta.isEnabled()) {
                ta.setVisible(false);
            }
        }
    }
}
Also used : StoredObject(com.storedobject.core.StoredObject) TextArea(com.storedobject.vaadin.TextArea) ArrayListSet(com.storedobject.common.ArrayListSet)

Example 2 with StoredObject

use of com.storedobject.core.StoredObject in project SODevelopment by syampillai.

the class DataTransfer method process.

@Override
protected boolean process() {
    if (getObjectClass() == null) {
        return true;
    }
    if (actionField.getValue() == 0) {
        TextContentProducer cp = new TextContentProducer() {

            @Override
            public void generateContent() throws Exception {
                Writer w = getWriter();
                for (StoredObject so : StoredObject.list(objectClass, where, orderBy, any)) {
                    so.save(w);
                }
            }
        };
        ((Application) getApplication()).view(cp);
        return true;
    }
    return true;
}
Also used : StoredObject(com.storedobject.core.StoredObject) TextContentProducer(com.storedobject.core.TextContentProducer) Application(com.storedobject.ui.Application) Writer(java.io.Writer)

Aggregations

StoredObject (com.storedobject.core.StoredObject)2 ArrayListSet (com.storedobject.common.ArrayListSet)1 TextContentProducer (com.storedobject.core.TextContentProducer)1 Application (com.storedobject.ui.Application)1 TextArea (com.storedobject.vaadin.TextArea)1 Writer (java.io.Writer)1