Search in sources :

Example 1 with CollectionOfItemsSource

use of org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource in project openolat by klemens.

the class ItemListMyListsController method initButtons.

@Override
protected void initButtons(UserRequest ureq, FormItemContainer formLayout) {
    getItemsTable().setMultiSelect(true);
    selectLink = uifactory.addFormLink("select-to-import", "select", null, formLayout, Link.BUTTON);
    myCollections = qpoolService.getCollections(getIdentity());
    int numOfCollections = myCollections.size();
    String[] myListKeys;
    String[] myListValues;
    if (numOfCollections == 0) {
        myListKeys = new String[1];
        myListValues = new String[1];
        myListKeys[0] = "";
        myListValues[0] = "";
    } else {
        myListKeys = new String[numOfCollections];
        myListValues = new String[numOfCollections];
        for (int i = numOfCollections; i-- > 0; ) {
            QuestionItemCollection myCollection = myCollections.get(i);
            myListKeys[i] = myCollection.getKey().toString();
            myListValues[i] = myCollection.getName();
        }
    }
    myListEl = uifactory.addDropdownSingleselect("source.selector", "my.list", formLayout, myListKeys, myListValues, null);
    myListEl.setDomReplacementWrapperRequired(false);
    myListEl.getLabelC().setDomReplaceable(false);
    myListEl.addActionListener(FormEvent.ONCHANGE);
    if (numOfCollections > 0) {
        myListEl.select(myListKeys[0], true);
        QuestionItemCollection firstCollection = myCollections.get(0);
        CollectionOfItemsSource source = new CollectionOfItemsSource(firstCollection, getIdentity(), ureq.getUserSession().getRoles());
        source.setRestrictToFormat(restrictToFormat);
        updateSource(source);
    } else {
        myListEl.setEnabled(false);
    }
}
Also used : QuestionItemCollection(org.olat.modules.qpool.QuestionItemCollection) CollectionOfItemsSource(org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource)

Example 2 with CollectionOfItemsSource

use of org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource in project OpenOLAT by OpenOLAT.

the class CollectionTreeNode method getController.

@Override
public Controller getController(UserRequest ureq, WindowControl wControl) {
    QuestionItemsSource source = new CollectionOfItemsSource(questionItemCollection, ureq.getIdentity(), ureq.getUserSession().getRoles());
    if (questionsCtrl == null) {
        WindowControl swControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, questionItemCollection, null, wControl, true);
        questionsCtrl = new QuestionsController(ureq, swControl, stackPanel, source, securityCallback, TABLE_PREFERENCE_PREFIX + questionItemCollection.getKey(), false);
        questionsCtrl.setQuestionItemCollection(questionItemCollection);
    } else {
        questionsCtrl.updateSource(source);
    }
    return questionsCtrl;
}
Also used : QuestionItemsSource(org.olat.modules.qpool.ui.QuestionItemsSource) WindowControl(org.olat.core.gui.control.WindowControl) QuestionsController(org.olat.modules.qpool.ui.QuestionsController) CollectionOfItemsSource(org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource)

Example 3 with CollectionOfItemsSource

use of org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource in project OpenOLAT by OpenOLAT.

the class ItemListMyListsController method initButtons.

@Override
protected void initButtons(UserRequest ureq, FormItemContainer formLayout) {
    getItemsTable().setMultiSelect(true);
    selectLink = uifactory.addFormLink("select-to-import", "select", null, formLayout, Link.BUTTON);
    myCollections = qpoolService.getCollections(getIdentity());
    int numOfCollections = myCollections.size();
    String[] myListKeys;
    String[] myListValues;
    if (numOfCollections == 0) {
        myListKeys = new String[1];
        myListValues = new String[1];
        myListKeys[0] = "";
        myListValues[0] = "";
    } else {
        myListKeys = new String[numOfCollections];
        myListValues = new String[numOfCollections];
        for (int i = numOfCollections; i-- > 0; ) {
            QuestionItemCollection myCollection = myCollections.get(i);
            myListKeys[i] = myCollection.getKey().toString();
            myListValues[i] = myCollection.getName();
        }
    }
    myListEl = uifactory.addDropdownSingleselect("source.selector", "my.list", formLayout, myListKeys, myListValues, null);
    myListEl.setDomReplacementWrapperRequired(false);
    myListEl.getLabelC().setDomReplaceable(false);
    myListEl.addActionListener(FormEvent.ONCHANGE);
    if (numOfCollections > 0) {
        myListEl.select(myListKeys[0], true);
        QuestionItemCollection firstCollection = myCollections.get(0);
        CollectionOfItemsSource source = new CollectionOfItemsSource(firstCollection, getIdentity(), ureq.getUserSession().getRoles());
        source.setRestrictToFormat(restrictToFormat);
        updateSource(source);
    } else {
        myListEl.setEnabled(false);
    }
}
Also used : QuestionItemCollection(org.olat.modules.qpool.QuestionItemCollection) CollectionOfItemsSource(org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource)

Example 4 with CollectionOfItemsSource

use of org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource in project OpenOLAT by OpenOLAT.

the class ItemListMyListsController method doSelectCollection.

private void doSelectCollection(UserRequest ureq, Long collectionKey) {
    QuestionItemCollection myCollection = null;
    for (QuestionItemCollection coll : myCollections) {
        if (collectionKey.equals(coll.getKey())) {
            myCollection = coll;
        }
    }
    if (myCollection == null) {
        updateSource(new EmptyItemsSource());
    } else {
        CollectionOfItemsSource source = new CollectionOfItemsSource(myCollection, getIdentity(), ureq.getUserSession().getRoles());
        source.setRestrictToFormat(restrictToFormat);
        updateSource(source);
    }
}
Also used : QuestionItemCollection(org.olat.modules.qpool.QuestionItemCollection) EmptyItemsSource(org.olat.modules.qpool.ui.datasource.EmptyItemsSource) CollectionOfItemsSource(org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource)

Example 5 with CollectionOfItemsSource

use of org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource in project openolat by klemens.

the class ItemListMyListsController method doSelectCollection.

private void doSelectCollection(UserRequest ureq, Long collectionKey) {
    QuestionItemCollection myCollection = null;
    for (QuestionItemCollection coll : myCollections) {
        if (collectionKey.equals(coll.getKey())) {
            myCollection = coll;
        }
    }
    if (myCollection == null) {
        updateSource(new EmptyItemsSource());
    } else {
        CollectionOfItemsSource source = new CollectionOfItemsSource(myCollection, getIdentity(), ureq.getUserSession().getRoles());
        source.setRestrictToFormat(restrictToFormat);
        updateSource(source);
    }
}
Also used : QuestionItemCollection(org.olat.modules.qpool.QuestionItemCollection) EmptyItemsSource(org.olat.modules.qpool.ui.datasource.EmptyItemsSource) CollectionOfItemsSource(org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource)

Aggregations

CollectionOfItemsSource (org.olat.modules.qpool.ui.datasource.CollectionOfItemsSource)6 QuestionItemCollection (org.olat.modules.qpool.QuestionItemCollection)4 WindowControl (org.olat.core.gui.control.WindowControl)2 QuestionItemsSource (org.olat.modules.qpool.ui.QuestionItemsSource)2 QuestionsController (org.olat.modules.qpool.ui.QuestionsController)2 EmptyItemsSource (org.olat.modules.qpool.ui.datasource.EmptyItemsSource)2