protected JPanel createHeaderPanel() {
    final JPanel publishHeaderPanel = new JPanel(new GridBagLayout());

    final GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 5, 5);
    publishHeaderPanel.add(
        new JLabel(Messages.getInstance().getString("RepositoryPublishDialog.ReportName")), c);

    c.gridy = 1;
    c.insets = new Insets(2, 5, 0, 5);
    publishHeaderPanel.add(getFileNameTextField(), c);

    c.gridy = 2;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 5, 5);
    publishHeaderPanel.add(
        new JLabel(Messages.getInstance().getString("RepositoryPublishDialog.ReportTitle")), c);

    c.gridy = 3;
    c.insets = new Insets(2, 5, 0, 5);
    publishHeaderPanel.add(titleTextField, c);

    c.gridy = 4;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 5, 5);
    publishHeaderPanel.add(
        new JLabel(Messages.getInstance().getString("RepositoryPublishDialog.ReportDescription")),
        c);

    c.gridy = 5;
    c.insets = new Insets(2, 5, 0, 5);
    publishHeaderPanel.add(desciptionTextField, c);

    c.gridy = 6;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(2, 5, 0, 5);
    publishHeaderPanel.add(
        new JLabel(Messages.getInstance().getString("RepositoryPublishDialog.Location")), c);

    c.insets = new Insets(0, 0, 0, 0);
    c.gridx = 0;
    c.gridy = 7;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.anchor = GridBagConstraints.WEST;
    publishHeaderPanel.add(createLocationFieldPanel(), c);
    return publishHeaderPanel;
  }
 private KeyedComboBoxModel<String, String> createExportTypeModel() {
   final KeyedComboBoxModel<String, String> keyedComboBoxModel =
       new KeyedComboBoxModel<String, String>();
   keyedComboBoxModel.add(null, null);
   keyedComboBoxModel.add(
       PdfPageableModule.PDF_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.PDF"));
   keyedComboBoxModel.add(
       HtmlTableModule.TABLE_HTML_STREAM_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.HTMLStream"));
   keyedComboBoxModel.add(
       ExcelTableModule.EXCEL_FLOW_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.XLS"));
   keyedComboBoxModel.add(
       ExcelTableModule.XLSX_FLOW_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.XLSX"));
   keyedComboBoxModel.add(
       CSVTableModule.TABLE_CSV_STREAM_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.CSV"));
   keyedComboBoxModel.add(
       RTFTableModule.TABLE_RTF_FLOW_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.RTF"));
   keyedComboBoxModel.add(
       PlainTextPageableModule.PLAINTEXT_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.TEXT"));
   keyedComboBoxModel.add(
       HtmlTableModule.TABLE_HTML_PAGE_EXPORT_TYPE,
       Messages.getInstance().getString("RepositoryPublishDialog.ExportType.HTMLPage"));
   return keyedComboBoxModel;
 }
 public PublishToServerAction() {
   putValue(Action.NAME, Messages.getInstance().getString("PublishToServerAction.Text"));
   putValue(
       Action.SHORT_DESCRIPTION,
       Messages.getInstance().getString("PublishToServerAction.Description"));
   final URL url =
       PublishToServerAction.class.getResource(
           "/org/pentaho/reporting/designer/extensions/pentaho/repository/resources/PublishToServerIcon.png");
   if (url != null) {
     putValue(Action.SMALL_ICON, new ImageIcon(url));
   }
   putValue(
       Action.ACCELERATOR_KEY,
       Messages.getInstance().getKeyStroke("PublishToServerAction.Accelerator"));
 }
  private JPanel createPublishSettingsPanel() {
    final JComboBox fileFormat = new JComboBox(exportFormatModel);

    final GridBagConstraints c = new GridBagConstraints();
    final JPanel publishSettingsPanel = new JPanel(new GridBagLayout());

    c.insets = new Insets(5, 5, 0, 5);
    c.gridwidth = 1;
    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    publishSettingsPanel.add(
        new JLabel(Messages.getInstance().getString("RepositoryPublishDialog.OutputType")), c);

    c.insets = new Insets(5, 5, 5, 0);
    c.gridwidth = 1;
    c.gridx = 0;
    c.gridy = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.weightx = 0.0;
    publishSettingsPanel.add(fileFormat, c);

    c.insets = new Insets(0, 5, 5, 5);
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    c.gridx = 1;
    c.gridy = 1;
    c.weightx = 1.0;
    publishSettingsPanel.add(lockOutputTypeCheckBox, c);
    return publishSettingsPanel;
  }
  protected boolean validateInputs(final boolean onConfirm) {
    if (super.validateInputs(onConfirm) == false) {
      return false;
    }

    if (onConfirm == false) {
      return true;
    }

    final String reportName = getFileNameTextField().getText();
    if (StringUtils.isEmpty(reportName) == false
        && reportName.endsWith(REPORT_BUNDLE_EXTENSION) == false) {
      final String safeReportName = reportName + REPORT_BUNDLE_EXTENSION;
      getFileNameTextField().setText(safeReportName);
    }

    try {
      final FileObject selectedView = getSelectedView();
      final String validateName = getSelectedFile();
      if (validateName == null || selectedView == null) {
        return false;
      }

      final FileObject targetFile = selectedView.resolveFile(getFileNameTextField().getText());
      final FileObject fileObject = selectedView.getFileSystem().resolveFile(targetFile.getName());
      if (fileObject.getType() == FileType.IMAGINARY) {
        return true;
      }

      final int result =
          JOptionPane.showConfirmDialog(
              this,
              Messages.getInstance()
                  .formatMessage("PublishToServerAction.FileExistsOverride", validateName),
              Messages.getInstance().getString("PublishToServerAction.Information.Title"),
              JOptionPane.YES_NO_OPTION);
      return result == JOptionPane.YES_OPTION;
    } catch (FileSystemException fse) {
      UncaughtExceptionsModel.getInstance().addException(fse);
      return false;
    }
  }
 /** Defines an <code>Action</code> object with a default description string and default icon. */
 private NewFolderAction() {
   final URL location =
       RepositoryTreeDialog.class.getResource(
           "/org/pentaho/reporting/designer/extensions/pentaho/repository/resources/newfolder.png");
   if (location != null) {
     putValue(Action.SMALL_ICON, new ImageIcon(location));
   } else {
     putValue(
         Action.NAME,
         Messages.getInstance().getString("SolutionRepositoryTreeDialog.NewFolderAction.Name"));
   }
 }
  public void init() {
    exportFormatModel = createExportTypeModel();

    desciptionTextField = new JTextField();
    titleTextField = new JTextField();

    lockOutputTypeCheckBox =
        new JCheckBox(Messages.getInstance().getString("RepositoryPublishDialog.Lock"));
    super.init();

    getTable().getSelectionModel().addListSelectionListener(new FileSelectionHandler());
  }
  /** Invoked when an action occurs. */
  public void actionPerformed(final ActionEvent e) {

    final ReportDesignerContext reportDesignerContext = getReportDesignerContext();
    final ReportRenderContext activeContext = getActiveContext();
    if (activeContext == null) {
      return;
    }

    if (activeContext.isChanged()) {
      // ask the user and maybe save the report..
      final int option =
          JOptionPane.showConfirmDialog(
              reportDesignerContext.getParent(),
              Messages.getInstance()
                  .getString("PublishToServerAction.ReportModifiedWarning.Message"),
              Messages.getInstance().getString("PublishToServerAction.ReportModifiedWarning.Title"),
              JOptionPane.YES_NO_CANCEL_OPTION,
              JOptionPane.WARNING_MESSAGE);
      if (option == JOptionPane.YES_OPTION) {
        if (SaveReportAction.saveReport(
                reportDesignerContext, activeContext, reportDesignerContext.getParent())
            == false) {
          return;
        }
      }
      if (option == JOptionPane.CANCEL_OPTION) {
        return;
      }
    }

    final PublishToServerTask publishToServerTask =
        new PublishToServerTask(reportDesignerContext, reportDesignerContext.getParent());
    final LoginTask loginTask =
        new LoginTask(
            reportDesignerContext, reportDesignerContext.getParent(), publishToServerTask);

    SwingUtilities.invokeLater(loginTask);
  }