Search in sources :

Example 1 with SiteViewSecurityCallback

use of org.olat.core.gui.control.navigation.SiteViewSecurityCallback in project OpenOLAT by OpenOLAT.

the class SitesConfigurationController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            if ("up".equals(se.getCommand())) {
                SiteDefRow row = model.getObject(se.getIndex());
                moveUp(row);
                doUpdateOrders();
                tableEl.getComponent().setDirty(true);
            } else if ("down".equals(se.getCommand())) {
                SiteDefRow row = model.getObject(se.getIndex());
                moveDown(row);
                doUpdateOrders();
                tableEl.getComponent().setDirty(true);
            }
        }
    } else if (source instanceof SingleSelection) {
        if (source.getName().startsWith("site.security.") && source.getUserObject() instanceof SiteDefRow) {
            SiteDefRow row = (SiteDefRow) source.getUserObject();
            String selectCallbackId = row.getSecurityCallbackEl().getSelectedKey();
            boolean needAlt = (securityCallbacks.containsKey(selectCallbackId) && securityCallbacks.get(selectCallbackId) instanceof SiteViewSecurityCallback);
            if (row.getAlternativeControllerEl().isVisible() != needAlt) {
                row.getAlternativeControllerEl().setVisible(needAlt);
                tableEl.reset();
            }
        }
        doSaveSettings();
    } else if (source instanceof MultipleSelectionElement || source instanceof SingleSelection) {
        doSaveSettings();
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SiteViewSecurityCallback(org.olat.core.gui.control.navigation.SiteViewSecurityCallback) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)

Example 2 with SiteViewSecurityCallback

use of org.olat.core.gui.control.navigation.SiteViewSecurityCallback in project openolat by klemens.

the class SitesConfigurationController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            if ("up".equals(se.getCommand())) {
                SiteDefRow row = model.getObject(se.getIndex());
                moveUp(row);
                doUpdateOrders();
                tableEl.getComponent().setDirty(true);
            } else if ("down".equals(se.getCommand())) {
                SiteDefRow row = model.getObject(se.getIndex());
                moveDown(row);
                doUpdateOrders();
                tableEl.getComponent().setDirty(true);
            }
        }
    } else if (source instanceof SingleSelection) {
        if (source.getName().startsWith("site.security.") && source.getUserObject() instanceof SiteDefRow) {
            SiteDefRow row = (SiteDefRow) source.getUserObject();
            String selectCallbackId = row.getSecurityCallbackEl().getSelectedKey();
            boolean needAlt = (securityCallbacks.containsKey(selectCallbackId) && securityCallbacks.get(selectCallbackId) instanceof SiteViewSecurityCallback);
            if (row.getAlternativeControllerEl().isVisible() != needAlt) {
                row.getAlternativeControllerEl().setVisible(needAlt);
                tableEl.reset();
            }
        }
        doSaveSettings();
    } else if (source instanceof MultipleSelectionElement || source instanceof SingleSelection) {
        doSaveSettings();
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SiteViewSecurityCallback(org.olat.core.gui.control.navigation.SiteViewSecurityCallback) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)

Aggregations

MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)2 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 SiteViewSecurityCallback (org.olat.core.gui.control.navigation.SiteViewSecurityCallback)2