Package org.olat.core.gui.components.table

Examples of org.olat.core.gui.components.table.TableEvent


  @Override
  protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == revisionListTableCtr) {
      if (event instanceof TableEvent) {
        TableEvent tEvent = (TableEvent) event;
        int row = tEvent.getRowId();
        if (CMD_DOWNLOAD.equals(tEvent.getActionId())) {
         
          MediaResource resource;
          if(row < versionedFile.getVersions().getRevisions().size()) {
            //restore current, do nothing
            VFSRevision version = versionedFile.getVersions().getRevisions().get(row);
            resource = new VFSRevisionMediaResource(version, true);
          } else {
            resource = new VFSMediaResource((VFSLeaf)versionedFile);
            ((VFSMediaResource)resource).setDownloadable(true);
          }
          ureq.getDispatchResult().setResultingMediaResource(resource);
        } else if (CMD_RESTORE.equals(tEvent.getActionId())) {
          if(row >= versionedFile.getVersions().getRevisions().size()) {
            //restore current, do nothing
            status = FolderCommandStatus.STATUS_SUCCESS;
            fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
          } else {
            VFSRevision version = versionedFile.getVersions().getRevisions().get(row);
            String comment = getTranslator().translate("version.restore.comment", new String[]{version.getRevisionNr()});
            if (versionedFile.getVersions().restore(ureq.getIdentity(), version, comment)) {
              status = FolderCommandStatus.STATUS_SUCCESS;
              fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
            } else {
              status = FolderCommandStatus.STATUS_FAILED;
              getWindowControl().setError(getTranslator().translate("version.restore.failed"));
              fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
            }
          }
        }
      } else if (event instanceof TableMultiSelectEvent) {
        TableMultiSelectEvent tEvent = (TableMultiSelectEvent) event;
        if (CMD_CANCEL.equals(tEvent.getAction())) {
          status = FolderCommandStatus.STATUS_CANCELED;
          fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
        } else {
          List<VFSRevision> selectedVersions = getSelectedRevisions(tEvent.getSelection());
          if (!selectedVersions.isEmpty()) {
            if (CMD_DELETE.equals(tEvent.getAction())) {
              String numOfVersionToDelete = Integer.toString(selectedVersions.size());
              confirmDeleteBoxCtr = activateYesNoDialog(ureq, null, getTranslator().translate("version.confirmDelete",
                  new String[] { numOfVersionToDelete }), confirmDeleteBoxCtr);
              confirmDeleteBoxCtr.setUserObject(selectedVersions);
            }
View Full Code Here


  @Override
  protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == deletedFilesListTableCtr) {
      if (event instanceof TableEvent) {
        TableEvent tEvent = (TableEvent) event;
        int row = tEvent.getRowId();
        if (CMD_DOWNLOAD.equals(tEvent.getActionId())) {
          VFSRevision version = getLastRevision(deletedFiles.get(row));
          MediaResource resource = new VFSRevisionMediaResource(version, true);
          ureq.getDispatchResult().setResultingMediaResource(resource);
        } else if (CMD_RESTORE.equals(tEvent.getActionId())) {
          VFSRevision version = getLastRevision(deletedFiles.get(row));
          if (VersionsManager.getInstance().restore(container, version)) {
            status = FolderCommandStatus.STATUS_SUCCESS;
            fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
          } else {
            status = FolderCommandStatus.STATUS_FAILED;
            // ERROR
          }
        }
      } else if (event instanceof TableMultiSelectEvent) {
        TableMultiSelectEvent tEvent = (TableMultiSelectEvent) event;
        if (CMD_CANCEL.equals(tEvent.getAction())) {
          status = FolderCommandStatus.STATUS_CANCELED;
          fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
        } else if (CMD_RESTORE.equals(tEvent.getAction())) {
          List<VFSRevision> selectedRevisions = getSelectedRevisions(tEvent.getSelection());
          boolean allOk = true;
          for (VFSRevision revision : selectedRevisions) {
            allOk &= VersionsManager.getInstance().restore(container, revision);
          }
          if (allOk) {
            status = FolderCommandStatus.STATUS_SUCCESS;
            fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
          } else {
            status = FolderCommandStatus.STATUS_FAILED;
          }
        } else if (CMD_DELETE.equals(tEvent.getAction())) {
          List<Versions> versionsToDelete = getSelectedVersions(tEvent.getSelection());
          if (!versionsToDelete.isEmpty()) {
           
            Translator trans = getTranslator();
            String msg = trans.translate("version.del.confirm") + "<p>" + renderVersionsAsHtml(versionsToDelete) + "</p>";
            // create dialog controller
View Full Code Here

      InstantMessagingClient client = im.getClientManager().getInstantMessagingClient(ureq.getIdentity().getName());
      boolean chattingAllowed = false;
      if (client != null && !client.isChatDisabled()) chattingAllowed = true;
     
      if (chattingAllowed) {
      TableEvent te = (TableEvent) event;
      int row = te.getRowId();
      ConnectedUsersListEntry entry = tableModel.getEntryAt(row);
      chatMgrCtrl.createChat(ureq, getWindowControl(), entry.getJabberId());
      } else {
        getWindowControl().setInfo(translate("im.chat.forbidden"));
      }
View Full Code Here

   */
  public void event(UserRequest ureq, Controller source, Event event) {
    super.event(ureq, source, event);
    if (source == tableCtr) {
      if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        TableEvent te = (TableEvent) event;
        String actionid = te.getActionId();
        if (actionid.equals(CMD_LAUNCH)) {
          int rowid = te.getRowId();
          final EfficiencyStatement efficiencyStatement = efficiencyStatementsListModel.getEfficiencyStatementAt(rowid);
          // will not be disposed on course run dispose, popus up as new browserwindow
          ControllerCreator ctrlCreator = new ControllerCreator() {
            public Controller createController(UserRequest lureq, WindowControl lwControl) {
              return new EfficiencyStatementController(lwControl, lureq, efficiencyStatement.getCourseRepoEntryKey());
View Full Code Here

   */
  public void event(UserRequest ureq, Controller source, Event event) {
    super.event(ureq, source, event);
    if (source == tableCtr) {
      if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        TableEvent te = (TableEvent) event;
        String actionid = te.getActionId();
        if (actionid.equals(CMD_LAUNCH)) {
          int rowid = te.getRowId();
          final NotePortletEntry pe = (NotePortletEntry) notesListModel.getObject(rowid);
          final Note note = pe.getValue();
          // will not be disposed on course run dispose, popus up as new browserwindow
          ControllerCreator ctrlCreator = new ControllerCreator() {
            public Controller createController(UserRequest lureq, WindowControl lwControl) {
View Full Code Here

  /**
   * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
   */
  public void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) {
      TableEvent tEvent = (TableEvent)event;
      if (tEvent.getActionId().equals("sel")) {
        QTIResultSet resultSet = tableModel.getResultSet(tEvent.getRowId());
       
        Document doc = FilePersister.retreiveResultsReporting(identity, type, resultSet.getAssessmentID());
        if (doc == null) {
          getWindowControl().setInfo(getTranslator().translate("error.resreporting.na"));
          return;
View Full Code Here

   */
  public void event(UserRequest ureq, Controller source, Event event) {
    super.event(ureq, source, event);
    if (source == tableCtr) {
      if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        TableEvent te = (TableEvent) event;
        String actionid = te.getActionId();
        if (actionid.equals(CMD_LAUNCH)) {
          int rowid = te.getRowId();
          Subscriber sub = notificationListModel.getSubscriberAt(rowid);
          if (actionid.equals(CMD_LAUNCH)) {
            Publisher pub = sub.getPublisher();
            if (!man.isPublisherValid(pub)) {
              getWindowControl().setError(getTranslator().translate("error.publisherdeleted"));
View Full Code Here

   */
  public void event(UserRequest ureq, Controller source, Event event) {
    // if row has been clicked
    if (source == tableC) {
      if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        TableEvent te = (TableEvent) event;
        String actionid = te.getActionId();
        int rowid = te.getRowId();
        this.chosenN = (Note) nLModel.getObject(rowid);
        if (actionid.equals("choose")) {
          if (nc != null) nc.dispose();
          nc = new NoteController(ureq, getWindowControl(), chosenN);
          nc.addControllerListener(this);
View Full Code Here

   */
  public void event(UserRequest ureq, Controller source, Event event) {
    DialogElement entry = null;
    // process table events
    if (source == tableCtr) {
      TableEvent te = (TableEvent) event;
      String command = te.getActionId();
      int row = te.getRowId();
      entry = tableModel.getEntryAt(row);
      if (command.equals(ACTION_START_FORUM)) {
        selectedElement = dialogElmsMgr.findDialogElement(coursePropMgr, courseNode, entry.getForumKey());
        if(selectedElement == null){
          showInfo("element.already.deleted");
View Full Code Here

   */
  public void event(UserRequest ureq, Controller source, Event event) {
    if (source == nodeListCtr) {
      if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        ICourse course = CourseFactory.loadCourse(ores);
        TableEvent te = (TableEvent) event;
        String actionid = te.getActionId();
        if (actionid.equals(CMD_SELECT_NODE)) {
          int rowid = te.getRowId();
          Map nodeData = (Map) nodeTableModel.getObject(rowid);
          CourseNode node = course.getRunStructure().getNode((String) nodeData.get(AssessmentHelper.KEY_IDENTIFYER));
          this.currentCourseNode = node;
          archiveNode(ureq);         
          showInfo("archive."+nodeType.getType()+".successfully");
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.table.TableEvent

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.