Examples of UpdateContainer


Examples of edu.isi.karma.controller.update.UpdateContainer

    boolean isExecute = Boolean.parseBoolean(request.getParameter("execute"));
    if (isUserInteraction) {
      String commandId = request.getParameter("commandId");
      Command currentCommand = (Command) ctrl.getWorkspace().getCommandHistory().getPreviewCommand(commandId);
      try {
        UpdateContainer updateContainer;
        if (!isExecute)
          updateContainer = ((IPreviewable) currentCommand).handleUserActions(request);
        else {
          ((IPreviewable) currentCommand).handleUserActions(request);
          updateContainer = ctrl.invokeCommand(currentCommand);
        }
        updateContainer.applyUpdates(vWorkspace);
        responseString = updateContainer.generateJson(vWorkspace);
      } catch (Exception e) {
        responseString = getErrorMessage(vWorkspace, e);
      }
    }
    else if (isPreview) {
      Command command = ctrl.getCommand(request);
      try {
        UpdateContainer updateContainer = ((IPreviewable) command).showPreview(request);
        ctrl.getWorkspace().getCommandHistory().addPreviewCommand(command);
        updateContainer.applyUpdates(vWorkspace);
        responseString = updateContainer.generateJson(vWorkspace);
      } catch (CommandException e) {
        responseString = getErrorMessage(vWorkspace, e);
      }

    }
    else {
      Command command = ctrl.getCommand(request);
      try {
        UpdateContainer updateContainer =ctrl.invokeCommand(command);
        updateContainer.applyUpdates(vWorkspace);
        responseString = updateContainer.generateJson(vWorkspace);
      } catch(Exception e) {
        responseString = getErrorMessage(vWorkspace, e);
      }
    }
View Full Code Here

Examples of edu.isi.karma.controller.update.UpdateContainer

    response.flushBuffer();
  }

  private String getErrorMessage(VWorkspace vWorkspace, Throwable e) {
    e.printStackTrace();
    UpdateContainer updateContainer = new UpdateContainer();
    updateContainer.add(new ErrorUpdate("Error:" + e.getMessage()));
    return updateContainer.generateJson(vWorkspace);
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.UpdateContainer

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    orderColumns(orderedColumns);

    UpdateContainer c =  new UpdateContainer();
    c.append(WorksheetUpdateFactory.createWorksheetHierarchicalUpdates(worksheetId, SuperSelectionManager.DEFAULT_SELECTION));
    c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));

    return c;
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.UpdateContainer

  @Override
  public UpdateContainer undoIt(Workspace workspace) {
    if(prevOrderedColumns != null) {
      orderColumns(prevOrderedColumns);
    }
    UpdateContainer c =  new UpdateContainer();
    c.append(WorksheetUpdateFactory.createWorksheetHierarchicalUpdates(worksheetId, SuperSelectionManager.DEFAULT_SELECTION));
    c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
    return c;
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.UpdateContainer

  }

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    Worksheet wk = workspace.getWorksheet(worksheetId);
    UpdateContainer c = new UpdateContainer();
    SuperSelection selection = getSuperSelection(wk);
    // Get the HNode
    hNode = workspace.getFactory().getHNode(hNodeId);
    // The column should not have a nested table but check to make sure!
    if (hNode.hasNestedTable()) {
      c.add(new ErrorUpdate("Cannot split column with nested table!"));
      return c;
    }
    columnName = hNode.getColumnName();
   
    SplitColumnByDelimiter split = new SplitColumnByDelimiter(hNodeId, wk, delimiter, workspace, selection);
    split.split(oldNodeValueMap, oldNodeStatusMap);
    splitValueHNodeId = split.getSplitValueHNodeId();

    c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(wk)));
   
    /** Add the alignment update **/
    c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
   
    return c;
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.UpdateContainer

          + " has a nested table. It cannot be edited.");
    }   
    node.setValue(newValueArg, Node.NodeStatus.edited,
        workspace.getFactory());
    WorksheetUpdateFactory.detectSelectionStatusChange(worksheetId, workspace, this);
    UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, sel);
    uc.add(new NodeChangedUpdate(worksheetId,
        nodeIdArg, newValueArg, Node.NodeStatus.edited));
    return uc;
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.UpdateContainer

  @Override
  public UpdateContainer undoIt(Workspace workspace) {
    Node node = workspace.getFactory().getNode(nodeIdArg);
    SuperSelection sel = getSuperSelection(workspace);
    node.setValue(previousValue, previousStatus, workspace.getFactory());
    UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, sel);
    uc.add(new NodeChangedUpdate(worksheetId,
        nodeIdArg, previousValue, previousStatus));
    return uc;
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.UpdateContainer

        c.doIt(workspace);
      } catch (Exception e) {
       
      }
    }
    UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, currentSel);
    uc.add(new HistoryUpdate(workspace.getCommandHistory()));
    return uc;
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.UpdateContainer

     
    }catch (Exception e) {
      return getErrorUpdate("The operation is undefined");
    }
    WorksheetUpdateFactory.detectSelectionStatusChange(worksheetId, workspace, this);
    UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, superSel);
    return uc;
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.UpdateContainer

    if (currentSel != null) {
      worksheet.getSelectionManager().removeSelection(currentSel);
      superSel.removeSelection(currentSel);
    }
    WorksheetUpdateFactory.detectSelectionStatusChange(worksheetId, workspace, this);
    UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, superSel)
    uc.add(new WorksheetSuperSelectionListUpdate(worksheetId));
    return uc;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.