コード例 #1
0
  public ExportDataAction(Frame owner, PresentationModel model, IUserSettings settings) {
    super(owner, model, settings);

    setName(textBundle.textFor("ExportDataAction.Name")); // $NON-NLS-1$
    setTooltip(textBundle.textFor("ExportDataAction.ShortDescription")); // $NON-NLS-1$
    putValue(
        SMALL_ICON,
        new ImageIcon(getClass().getResource("/icons/package-x-generic.png"))); // $NON-NLS-1$
  }
コード例 #2
0
/**
 * Action to export data to a data file.
 *
 * @author remast
 */
@SuppressWarnings("serial")
public class ExportDataAction extends AbstractExportAction {

  /** The bundle for internationalized texts. */
  private static final TextResourceBundle textBundle =
      TextResourceBundle.getBundle(ExportDataAction.class);

  /** File extension of data files. */
  private static final String DATA_FILE_EXTENSION = ".ptd.xml";

  /** File filter for data files. */
  private static final FileFilter DATA_FILE_FILTER = new FileFilters.DataExportFileFilter();

  public ExportDataAction(Frame owner, PresentationModel model, IUserSettings settings) {
    super(owner, model, settings);

    setName(textBundle.textFor("ExportDataAction.Name")); // $NON-NLS-1$
    setTooltip(textBundle.textFor("ExportDataAction.ShortDescription")); // $NON-NLS-1$
    putValue(
        SMALL_ICON,
        new ImageIcon(getClass().getResource("/icons/package-x-generic.png"))); // $NON-NLS-1$
  }

  /** {@inheritDoc} */
  @Override
  public Exporter createExporter() {
    return new RawDataExporter();
  }

  /** {@inheritDoc} */
  @Override
  protected String getFileExtension() {
    return DATA_FILE_EXTENSION;
  }

  /** {@inheritDoc} */
  @Override
  protected FileFilter getFileFilter() {
    return DATA_FILE_FILTER;
  }

  /** {@inheritDoc} */
  @Override
  protected String getLastExportLocation() {
    return getSettings().getLastDataExportLocation();
  }

  /** {@inheritDoc} */
  @Override
  protected void setLastExportLocation(final String lastExportLocation) {
    getSettings().setLastDataExportLocation(lastExportLocation);
  }
}