Examples of XulMessageBox


Examples of org.pentaho.ui.xul.components.XulMessageBox

       
        // first, verify the file exists
        // make sure this is generic enough for SSAS support
       
        if (!connectionModel.getSelectedSchemaModel().schemaExists()) {
          XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
          msgBox.setMessage(connectionModel.getSelectedSchemaModel().getSchemaDoesNotExistErrorMessage());
          msgBox.open();
          return;
        }
       
        // second, verify the checksum
       
        long checksum = connectionModel.getSelectedSchemaModel().recalculateSchemaChecksum();
        if (checksum != connectionModel.getSelectedSchemaModel().getSchemaChecksum()) {
          // display warning message
          XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
          msgBox.setMessage(Messages.getString("MainController.WarningSchemaChanged"));
          msgBox.open();
        }
       
        // reset state of app into connected mode
        String cubeName = connectionModel.getCubeName();
        if(StringUtils.isEmpty(cubeName)) {
          throw new IllegalArgumentException("Could not initialize workspace: cubeName is empty");
        }

        // Note: apply sets the cube name to null, so we need to reset it.
        connectionController.apply();
       
        // resync the cube name
        connectionModel.setCubeName(cubeName);
       
        // TODO: should connect throw a reasonable error message if db info is invalid?
        connectionController.connect();

        // if application is not unlocked, then we failed to connect to the app.
       
        if (!workspace.isApplicationUnlocked()) {
          XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
          msgBox.setMessage(Messages.getString("MainController.ErrorFailedToConnect"));
          msgBox.open();
          return;
        }

        // populate aggregates
               
        serializationService.deserializeAggList(connectionModel.getSchema(), connAndAgg[2]);

        // update state flag
       
        workspace.setWorkspaceUpToDate(true);
       
      } catch (AggDesignerException e) {
        XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
        msgBox.setMessage(e.getMessage());
        msgBox.open();
        e.printStackTrace();
       
      } catch (Exception e) {
        XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
        msgBox.setMessage(Messages.getString("MainController.OpenExceptionMessage"));
        msgBox.open();
        e.printStackTrace();
      }
    }
  }
View Full Code Here

Examples of org.pentaho.ui.xul.components.XulMessageBox

    Schema schema = workspace.getSchema();
   
    // only allow saving if the app is unlocked
    if (!workspace.isApplicationUnlocked()) {
      // display warning
      XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
      msgBox.setMessage(Messages.getString("MainController.CannotSaveUntilConnected"));
      msgBox.open();
      return false;
    }
   
    File selectedFile = workspace.getWorkspaceLocation();
    if (saveAs || selectedFile == null) {
      // display file dialog
      XulFileDialog fc = (XulFileDialog) document.createElement("filedialog");
      // TODO: last browsed in directory?
      RETURN_CODE retVal = fc.showSaveDialog();
      if (retVal == RETURN_CODE.OK) {
        selectedFile = (File) fc.getFile();
      } else {
        return false;
      }
    }
    try {
      PrintWriter pw = new PrintWriter(new FileWriter(selectedFile));
      pw.println(serializationService.serializeWorkspace(schema));
      pw.close();
     
      workspace.setWorkspaceLocation(selectedFile);
      workspace.setWorkspaceUpToDate(true);
     
      return true;
     
    } catch (Exception e) {
      XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
      msgBox.setMessage(Messages.getString("MainController.SaveExceptionMessage"));
      msgBox.open();
      e.printStackTrace();
    }
   
    return false;
  }
View Full Code Here

Examples of org.pentaho.ui.xul.components.XulMessageBox

  }
 
  public boolean promptIfSaveRequired() throws XulException {
    // prompt to save if the app is in a non-saved state
    if (workspace.isApplicationUnlocked() && !workspace.getWorkspaceUpToDate()) {
      XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
      msgBox.setTitle(Messages.getString("MainController.SaveWorkspaceTitle"));
      msgBox.setMessage(Messages.getString("MainController.SaveWorkspaceMessage"));
      msgBox.setButtons(new String[]{
          Messages.getString("MainController.SaveButton"),
          Messages.getString("MainController.DoNotSaveButton"),
          Messages.getString("MainController.CancelButton")});

      int id = msgBox.open();
      if (id == 2) { // CANCEL
        return false;
      } else if (id == 0) { // SAVE
        // what if they click cancel?
        return saveWorkspace(false);
View Full Code Here

Examples of org.pentaho.ui.xul.components.XulMessageBox

          if (userGuideFile != null) {
            edu.stanford.ejalbert.BrowserLauncher launcher = new edu.stanford.ejalbert.BrowserLauncher(null);
           
            launcher.openURLinBrowser("file:" + userGuideFile.getAbsolutePath()); //$NON-NLS-1$\
          } else {
            XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
            msgBox.setMessage(Messages.getString("MainController.UserGuideMissing"));
            msgBox.open();
          }
        } catch (BrowserLaunchingInitializingException ex) {
          logger.error("an exception occurred", ex);
        } catch (UnsupportedOperatingSystemException ex) {
          logger.error("an exception occurred", ex);
View Full Code Here

Examples of org.pentaho.ui.xul.components.XulMessageBox

     
      Result result = algorithmRunner.getResult();
      logger.debug("result=" + result);
 
      if (result == null || result.getAggregates() == null || result.getAggregates().size() == 0) {
        XulMessageBox box = (XulMessageBox) document.createElement("messagebox");
        box.setTitle(Messages.getString("AlgorithmController.NoResultsTitle"));
        box.setMessage(Messages.getString("AlgorithmController.NoResultsMessage"));
        box.open();
        return;
      }
     
      List<UIAggregate> algorithmAggs = new ArrayList<UIAggregate>();
     
      for (Aggregate agg : result.getAggregates()) {
          UIAggregateImpl cagg = new UIAggregateImpl();
          cagg.setName(agg.getCandidateTableName());
          cagg.setAlgoAgg(true);
          cagg.setDescription(agg.getDescription());
          cagg.setEstimateRowCount(agg.estimateRowCount());
          cagg.setEstimateSpace(agg.estimateSpace());
         
          List<Attribute> list = new ArrayList<Attribute>(agg.getAttributes());
          cagg.setAttributes(list);
 
          List<Measure> measureList = new ArrayList<Measure>(agg.getMeasures());
          cagg.setMeasures(measureList);
 
          algorithmAggs.add(cagg);
      }
     
      // reverse the collection, the results from the algorithm seem to
      // come back in reverse order of benefit
     
      Collections.reverse(algorithmAggs);
     
      // rename the aggregates appropriately
      aggNamingService.nameAggregates(algorithmAggs, getAggList(), connectionModel.getSchema());
     
      // add all the uiaggs to the agg list
      for (UIAggregate agg : algorithmAggs) {
        try {
          agg.setOutput(outputService.generateDefaultOutput(agg));
        } catch (OutputValidationException e) {
          System.err.println("Failed to create output, skipping UIAggregate");
          e.printStackTrace();
        }
  //      getAggList().addAgg(agg);
      }
      getAggList().addAggs(algorithmAggs);
     
      closeDialog();
    } catch (ValidationException validationException) {
      logger.error("error", validationException);
      XulMessageBox box = (XulMessageBox) document.createElement("messagebox");
      box.setTitle(Messages.getString("AlgorithmController.ErrorTitle"));
      box.setMessage(Messages.getString("AlgorithmController.ValidationErrorMessage", validationException.getMessage()));
      box.open();
    } catch (Throwable throwable) {
      logger.error("error", throwable);
      XulMessageBox box = (XulMessageBox) document.createElement("messagebox");
      box.setTitle(Messages.getString("AlgorithmController.ErrorTitle"));
      box.setMessage(Messages.getString("AlgorithmController.GeneralErrorMessage"));
      box.open();
    }
  }
View Full Code Here

Examples of org.pentaho.ui.xul.components.XulMessageBox

        } catch (AggDesignerException e) {
          logger.error("Error loading OLAP schema", e);

          try {
            XulMessageBox box = (XulMessageBox) document.createElement("messagebox");
            box.setTitle("Error");
            box.setMessage(Messages.getString("Olap.apply.error"));
            box.open();
          } catch (XulException ex) {
          }

        } finally {
          logger.debug("hiding dialog if it isn't already hidden");
          waitDialog.hide();
        }

      }

    }.start();
    logger.debug("showing wait dialog");
    waitDialog.show();

    if (selectedSchemaProvider == null) {
      XulMessageBox box = (XulMessageBox) document.createElement("messagebox");
      box.setTitle("Error");
      box.setMessage("Error applying OLAP schema");
      box.open();
      return;
    }
    connectionModel.setCubeNames(cubeNames);
    connectionModel.setSelectedSchemaModel(selectedSchemaProvider.getSchemaModel());
View Full Code Here

Examples of org.pentaho.ui.xul.components.XulMessageBox

   
  }

  public void openDialog() throws Exception {
    if (getEnabledAggs().size() == 0) {
      XulMessageBox msgBox = (XulMessageBox) document.createElement(ELEM_ID_MESSAGEBOX);
      msgBox.setMessage(Messages.getString("ExportHandler.NoAggsDefinedOrEnabled")); //$NON-NLS-1$
      msgBox.open();

      logger.info("Exiting showRelationalPreview as there are no Aggs defined");
      return;
    }
    XulDialog dialog = (XulDialog) document.getElementById(ELEM_ID_EXPORT_DIALOG);
View Full Code Here

Examples of org.pentaho.ui.xul.components.XulMessageBox

    Assert.notNull(dialog, "could not find element with id '" + ELEM_ID_EXEC_PROGRESS_DIALOG + "'");

    dialog.hide();

    if (null != e) {
      XulMessageBox msgBox;
      try {
        msgBox = (XulMessageBox) document.createElement(ELEM_ID_MESSAGEBOX);
      } catch (XulException e1) {
        logger.error("an exception occurred", e1);
        return;
      }
      msgBox.setMessage(e.getLocalizedMessage());
      msgBox.setTitle(Messages.getString("ExportHandler.DdlDmlExecutionErrorDialogTitle"));
      msgBox.setScrollable(true);
      msgBox.setHeight(300);
      msgBox.setWidth(400);
      msgBox.open();
    }

    if (logger.isDebugEnabled()) {
      logger.debug("exit executeDdlDmlDone");
    }
View Full Code Here

Examples of org.pentaho.ui.xul.components.XulMessageBox

  public File saveOlap() throws XulException {

    // If we're not dealing with a MondrianFileSchemaModel object, something
    // has gone wrong with the UI application state.
    if (!(connectionModel.getSelectedSchemaModel() instanceof MondrianFileSchemaModel)) {
      XulMessageBox msgBox = (XulMessageBox) document.createElement(ELEM_ID_MESSAGEBOX);
      msgBox.setMessage("Inconsistent application state: Only MondrianFileSchemaModel should call into this method");
      msgBox.open();
      logger.error("Inconsistent application state: Only MondrianFileSchemaModel should call into this method");
      return null;
    }
   
    XulFileDialog fc = (XulFileDialog) document.createElement(ELEM_ID_FILEDIALOG);
View Full Code Here

Examples of org.pentaho.ui.xul.components.XulMessageBox

    // first, determine if new schema has been written
   
    // If we're not dealing with a MondrianFileSchemaModel object, something
    // has gone wrong with the UI application state.
    if (!(connectionModel.getSelectedSchemaModel() instanceof MondrianFileSchemaModel)) {
      XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
      msgBox.setMessage("Inconsistent application state: Only MondrianFileSchemaModel should call into this method");
      msgBox.open();
      logger.error("Inconsistent application state: Only MondrianFileSchemaModel should call into this method");
      return;
    }
   
    File schemaFile = new File(((MondrianFileSchemaModel)connectionModel.getSelectedSchemaModel()).getMondrianSchemaFilename());

    // if not, display save options
    if (!connectionModel.getSchemaUpToDate()) {

      XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
      msgBox.setTitle(Messages.getString("SchemaModifiedWarning.Title"));
      msgBox.setMessage(Messages.getString("SchemaModifiedWarning.Message"));
      msgBox.setButtons(new String[] {"Yes", "No", "Cancel"});
      int option = msgBox.open();
     
      if (option == 0) {
        schemaFile = exportHandler.saveOlap();
      } else if (option == 2) {
        return;
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.