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);
}
}
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;
}
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);
}
}
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);
}
}
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);
}
}
Aggregations