A dialog that is used to prepare the printing of a report into an Excel
file.
.
Given a report, the dialog is shown and if the user approved the dialog, the
excel file is saved using the settings made in the dialog.
| Methods from java.awt.Component: |
|---|
|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusable, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate |
| Method from org.jfree.report.modules.gui.xls.ExcelExportDialog Detail: |
public void clear() {
txFilename.setText(""); //$NON-NLS-1$
cbStrictLayout.setSelected(false);
}
Clears all selections and input fields. |
protected String getConfigurationPrefix() {
return "org.jfree.report.modules.gui.xls."; //$NON-NLS-1$
}
|
protected String getConfigurationSuffix() {
return "_xlsexport"; //$NON-NLS-1$
}
|
public String getFilename() {
return txFilename.getText();
}
Returns the filename of the excel file. |
protected String getResourceBaseName() {
return ExcelExportPlugin.BASE_RESOURCE_CLASS;
}
|
public JStatusBar getStatusBar() {
return statusBar;
}
|
protected Configuration grabDialogContents(boolean full) {
final DefaultConfiguration p = new DefaultConfiguration();
if (full)
{
p.setProperty("org.jfree.report.modules.gui.xls.FileName", getFilename()); //$NON-NLS-1$
}
p.setConfigProperty("org.jfree.report.modules.output.table.xls.StrictLayout", String.valueOf(isStrictLayout())); //$NON-NLS-1$
return p;
}
Returns a new (and not connected to the default config from the job)
configuration containing all properties from the dialog. |
public boolean isStrictLayout() {
return cbStrictLayout.isSelected();
}
Returns the setting of the 'strict layout' check-box. |
protected boolean performConfirm() {
final String filename = getFilename();
final File f = new File(filename);
if (f.exists())
{
final String key1 = "excelexportdialog.targetOverwriteConfirmation"; //$NON-NLS-1$
final String key2 = "excelexportdialog.targetOverwriteTitle"; //$NON-NLS-1$
if (JOptionPane.showConfirmDialog(this,
MessageFormat.format(getResources().getString(key1),
new Object[]{getFilename()}),
getResources().getString(key2),
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)
== JOptionPane.NO_OPTION)
{
return false;
}
}
return true;
}
|
protected void performSelectFile() {
if (fileChooser == null)
{
fileChooser = new JFileChooser();
final FilesystemFilter filter = new FilesystemFilter(ExcelExportDialog.XLS_FILE_EXTENSION,
getResources().getString("excelexportdialog.excel-file-description")); //$NON-NLS-1$
fileChooser.addChoosableFileFilter(filter);
fileChooser.setMultiSelectionEnabled(false);
}
final File file = new File(getFilename());
fileChooser.setCurrentDirectory(file);
fileChooser.setSelectedFile(file);
final int option = fileChooser.showSaveDialog(this);
if (option == JFileChooser.APPROVE_OPTION)
{
final File selFile = fileChooser.getSelectedFile();
String selFileName = selFile.getAbsolutePath();
// Test if ends on xls
if (StringUtils.endsWithIgnoreCase(selFileName, ExcelExportDialog.XLS_FILE_EXTENSION) == false)
{
selFileName = selFileName + ExcelExportDialog.XLS_FILE_EXTENSION;
}
setFilename(selFileName);
}
}
Selects a file to use as target for the report processing. |
public boolean performValidate() {
getStatusBar().clear();
final String filename = getFilename();
if (filename.trim().length() == 0)
{
getStatusBar().setStatus(StatusType.ERROR,
getResources().getString("excelexportdialog.targetIsEmpty")); //$NON-NLS-1$
return false;
}
final File f = new File(filename);
if (f.exists())
{
if (f.isFile() == false)
{
getStatusBar().setStatus(StatusType.ERROR,
getResources().getString("excelexportdialog.targetIsNoFile")); //$NON-NLS-1$
return false;
}
if (f.canWrite() == false)
{
getStatusBar().setStatus(StatusType.ERROR,
getResources().getString("excelexportdialog.targetIsNotWritable")); //$NON-NLS-1$
return false;
}
final String message = MessageFormat.format(getResources().getString
("excelexportdialog.targetExistsWarning"), //$NON-NLS-1$
new Object[]{filename});
getStatusBar().setStatus(StatusType.WARNING, message);
}
return true;
}
Validates the contents of the dialog's input fields. If the selected file
exists, it is also checked for validity. |
protected void setDialogContents(Configuration config) {
final String strict = config.getConfigProperty("org.jfree.report.modules.output.table.xls.StrictLayout"); //$NON-NLS-1$
setStrictLayout("true".equals(strict)); //$NON-NLS-1$
final String defaultFileName = config.getConfigProperty
("org.jfree.report.modules.gui.xls.FileName"); //$NON-NLS-1$
if (defaultFileName != null)
{
setFilename(resolvePath(defaultFileName).getAbsolutePath());
}
}
Initialises the Excel export dialog from the settings in the report
configuration. |
public void setFilename(String filename) {
this.txFilename.setText(filename);
}
Defines the filename of the excel file. |
public void setStrictLayout(boolean strictLayout) {
cbStrictLayout.setSelected(strictLayout);
}
Sets the 'strict-layout' check-box. |