aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/lowagie/tools/arguments
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/lowagie/tools/arguments')
-rw-r--r--src/main/java/com/lowagie/tools/arguments/BitsetArgument.java136
-rw-r--r--src/main/java/com/lowagie/tools/arguments/DirFilter.java65
-rw-r--r--src/main/java/com/lowagie/tools/arguments/FileArgument.java165
-rw-r--r--src/main/java/com/lowagie/tools/arguments/ImageArgument.java117
-rw-r--r--src/main/java/com/lowagie/tools/arguments/ImageFilter.java135
-rw-r--r--src/main/java/com/lowagie/tools/arguments/LabelAccessory.java158
-rw-r--r--src/main/java/com/lowagie/tools/arguments/OptionArgument.java210
-rw-r--r--src/main/java/com/lowagie/tools/arguments/PageSelectionTableDialog.java243
-rw-r--r--src/main/java/com/lowagie/tools/arguments/PageSelectorToolArgument.java112
-rw-r--r--src/main/java/com/lowagie/tools/arguments/PageSizeArgument.java172
-rw-r--r--src/main/java/com/lowagie/tools/arguments/PageTableModel.java146
-rw-r--r--src/main/java/com/lowagie/tools/arguments/PdfFilter.java77
-rw-r--r--src/main/java/com/lowagie/tools/arguments/TableMap.java89
-rw-r--r--src/main/java/com/lowagie/tools/arguments/TableSorter.java367
-rw-r--r--src/main/java/com/lowagie/tools/arguments/ToolArgument.java281
15 files changed, 0 insertions, 2473 deletions
diff --git a/src/main/java/com/lowagie/tools/arguments/BitsetArgument.java b/src/main/java/com/lowagie/tools/arguments/BitsetArgument.java
deleted file mode 100644
index 63d79af..0000000
--- a/src/main/java/com/lowagie/tools/arguments/BitsetArgument.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * $Id: BitsetArgument.java,v 1.5 2006/05/30 09:13:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.JCheckBox;
-import javax.swing.JOptionPane;
-
-import com.lowagie.tools.plugins.AbstractTool;
-
-/**
- * Argument that results in a set of "1" and "0" values.
- */
-public class BitsetArgument extends ToolArgument {
- /** These are the different options that can be true or false. */
- private JCheckBox[] options;
-
- /**
- * Constructs an BitsetArgument.
- * @param tool the tool that needs this argument
- * @param name the name of the argument
- * @param description the description of the argument
- * @param options the different options that can be true or false
- */
- public BitsetArgument(AbstractTool tool, String name, String description, String[] options) {
- super(tool, name, description, String.class.getName());
- this.options = new JCheckBox[options.length];
- for (int i = 0; i < options.length; i++) {
- this.options[i] = new JCheckBox(options[i]);
- }
- }
-
- /**
- * Gets the argument as an object.
- * @return an object
- * @throws InstantiationException
- */
- public Object getArgument() throws InstantiationException {
- return value;
- }
-
- /**
- * @see com.lowagie.tools.arguments.ToolArgument#getUsage()
- */
- public String getUsage() {
- StringBuffer buf = new StringBuffer(super.getUsage());
- buf.append(" possible options:\n");
- for (int i = 0; i < options.length; i++) {
- buf.append(" - ");
- buf.append(options[i].getText());
- buf.append("\n");
- }
- return buf.toString();
- }
-
- /**
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent evt) {
- Object[] message = new Object[1 + options.length];
- message[0] = "Check the options you need:";
- for(int i = 0; i < options.length; i++ ) {
- message[i+1] = options[i];
- }
- int result = JOptionPane.showOptionDialog(
- tool.getInternalFrame(),
- message,
- description,
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null,
- null,
- null
- );
- if (result == 0) {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < options.length; i++) {
- if (options[i].isSelected()) {
- buf.append("1");
- }
- else {
- buf.append("0");
- }
- }
- setValue(buf.toString());
- }
- }
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/DirFilter.java b/src/main/java/com/lowagie/tools/arguments/DirFilter.java
deleted file mode 100644
index def64a4..0000000
--- a/src/main/java/com/lowagie/tools/arguments/DirFilter.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2005 by Johannes Schindelin.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.io.File;
-
-import javax.swing.filechooser.FileFilter;
-
-/**
- * Filters directories in a JFileChooser.
- */
-public class DirFilter extends FileFilter {
-
- /**
- * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
- */
- public boolean accept(File f) {
- if (f.isDirectory()) return true;
- return false;
- }
-
- /**
- * @see javax.swing.filechooser.FileFilter#getDescription()
- */
- public String getDescription() {
- return "directories";
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/FileArgument.java b/src/main/java/com/lowagie/tools/arguments/FileArgument.java
deleted file mode 100644
index f110bbe..0000000
--- a/src/main/java/com/lowagie/tools/arguments/FileArgument.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * $Id: FileArgument.java,v 1.7 2006/05/30 09:13:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-
-import javax.swing.JFileChooser;
-import javax.swing.filechooser.FileFilter;
-
-import com.lowagie.tools.plugins.AbstractTool;
-
-/**
- * ToolArgument class if the argument is a java.io.File.
- */
-public class FileArgument extends ToolArgument {
- /** a filter to put on the FileChooser. */
- private FileFilter filter;
- /** indicates if the argument has to point to a new or an existing file. */
- private boolean newFile;
- /** the label */
- LabelAccessory label = null;
-// final static String PROPERTYFILENAME="inputfilename";
- /**
- * Constructs a FileArgument.
- * @param tool the tool that needs this argument
- * @param name the name of the argument
- * @param description the description of the argument
- * @param newFile makes the difference between an Open or Save dialog
- * @param filter
- */
- public FileArgument(AbstractTool tool, String name, String description, boolean newFile, FileFilter filter) {
- super(tool, name, description, File.class.getName());
- this.newFile = newFile;
- this.filter = filter;
- }
- /**
- * Constructs a FileArgument.
- * @param tool the tool that needs this argument
- * @param name the name of the argument
- * @param description the description of the argument
- * @param newFile makes the difference between an Open or Save dialog
- */
- public FileArgument(AbstractTool tool, String name, String description, boolean newFile) {
- this(tool, name, description, newFile, null);
- }
-
- /**
- * Gets the argument as an object.
- * @return an object
- * @throws InstantiationException
- */
- public Object getArgument() throws InstantiationException {
- if (value == null) return null;
- try {
- return new File(value);
- } catch (Exception e) {
- throw new InstantiationException(e.getMessage());
- }
- }
-
- /**
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e) {
- JFileChooser fc = new JFileChooser();
-
- if (filter != null) {
- fc.setFileFilter(filter);
- if (filter instanceof DirFilter)
- fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- }
- if (label != null) {
- fc.setAccessory(label);
- fc.addPropertyChangeListener(
- JFileChooser.SELECTED_FILE_CHANGED_PROPERTY, label);
- }
- if (newFile) {
- fc.showSaveDialog(tool.getInternalFrame());
- }
- else {
- fc.showOpenDialog(tool.getInternalFrame());
- }
- try {
- setValue(fc.getSelectedFile().getAbsolutePath());
- }
- catch(NullPointerException npe) {
- }
- }
-
- /**
- * @return Returns the filter.
- */
- public FileFilter getFilter() {
- return filter;
- }
- /**
- * @param filter The filter to set.
- */
- public void setFilter(FileFilter filter) {
- this.filter = filter;
- }
- /**
- * @return Returns the label.
- */
- public LabelAccessory getLabel() {
- return label;
- }
- /**
- * @param label The label to set.
- */
- public void setLabel(LabelAccessory label) {
- this.label = label;
- }
-
-
-
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/ImageArgument.java b/src/main/java/com/lowagie/tools/arguments/ImageArgument.java
deleted file mode 100644
index 063d347..0000000
--- a/src/main/java/com/lowagie/tools/arguments/ImageArgument.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * $Id: ImageArgument.java,v 1.4 2006/05/30 09:13:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.JFileChooser;
-import javax.swing.filechooser.FileFilter;
-
-import com.lowagie.text.Image;
-import com.lowagie.tools.plugins.AbstractTool;
-
-/**
- * ToolArgument class if the argument is a com.lowagie.text.Image.
- */
-public class ImageArgument extends ToolArgument {
- /** a filter to put on the FileChooser. */
- private FileFilter filter;
-
- /**
- * Constructs a FileArgument.
- * @param tool the tool that needs this argument
- * @param name the name of the argument
- * @param description the description of the argument
- * @param filter a custom filter
- */
- public ImageArgument(AbstractTool tool, String name, String description, FileFilter filter) {
- super(tool, name, description, Image.class.getName());
- this.filter = filter;
- }
-
- /**
- * Constructs a FileArgument.
- * @param tool the tool that needs this argument
- * @param name the name of the argument
- * @param description the description of the argument
- */
- public ImageArgument(AbstractTool tool, String name, String description) {
- this(tool, name, description, new ImageFilter());
- }
-
- /**
- * Gets the argument as an object.
- * @return an object
- * @throws InstantiationException
- */
- public Object getArgument() throws InstantiationException {
- if (value == null) return null;
- try {
- return Image.getInstance(value);
- } catch (Exception e) {
- throw new InstantiationException(e.getMessage());
- }
- }
-
- /**
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e) {
- JFileChooser fc = new JFileChooser();
- if (filter != null) fc.setFileFilter(filter);
- fc.showOpenDialog(tool.getInternalFrame());
- try {
- setValue(fc.getSelectedFile().getAbsolutePath());
- }
- catch(NullPointerException npe) {
- }
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/ImageFilter.java b/src/main/java/com/lowagie/tools/arguments/ImageFilter.java
deleted file mode 100644
index 24c1d64..0000000
--- a/src/main/java/com/lowagie/tools/arguments/ImageFilter.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * $Id: ImageFilter.java,v 1.2 2006/02/02 18:50:07 psoares33 Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.io.File;
-
-import javax.swing.filechooser.FileFilter;
-
-/**
- * Filters images in a FileChooser.
- */
-public class ImageFilter extends FileFilter {
-
- /** Array with all kinds of image extensions. */
- public static final String[] IMAGES = new String[8];
- static {
- IMAGES[0] = ".jpg";
- IMAGES[1] = ".jpeg";
- IMAGES[2] = ".png";
- IMAGES[3] = ".gif";
- IMAGES[4] = ".bmp";
- IMAGES[5] = ".wmf";
- IMAGES[6] = ".tif";
- IMAGES[7] = ".tiff";
- }
-
- /** array that enables you to filter on imagetypes. */
- public boolean[] filter = new boolean[8];
-
- /**
- * Constructs an ImageFilter allowing all images.
- */
- public ImageFilter() {
- for (int i = 0; i < filter.length; i++) {
- filter[i] = true;
- }
- }
-
- /**
- * Constructs an ImageFilter allowing some images.
- * @param jpeg indicates if jpegs are allowed
- * @param png indicates if pngs are allowed
- * @param gif indicates if gifs are allowed
- * @param bmp indicates if bmps are allowed
- * @param wmf indicates if wmfs are allowed
- * @param tiff indicates if tiffs are allowed
- */
- public ImageFilter(boolean jpeg, boolean png, boolean gif, boolean bmp, boolean wmf, boolean tiff) {
- if (jpeg) {
- filter[0] = true;
- filter[1] = true;
- }
- if (png) {
- filter[2] = true;
- }
- if (gif) {
- filter[3] = true;
- }
- if (bmp) {
- filter[4] = true;
- }
- if (wmf) {
- filter[5] = true;
- }
- if (tiff) {
- filter[6] = true;
- filter[7] = true;
- }
- }
-
- /**
- * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
- */
- public boolean accept(File f) {
- if (f.isDirectory()) return true;
- for (int i = 0; i < IMAGES.length; i++) {
- if (filter[i] && f.getName().toLowerCase().endsWith(IMAGES[i])) return true;
- }
- return false;
- }
-
- /**
- * @see javax.swing.filechooser.FileFilter#getDescription()
- */
- public String getDescription() {
- return "Image files";
- }
-} \ No newline at end of file
diff --git a/src/main/java/com/lowagie/tools/arguments/LabelAccessory.java b/src/main/java/com/lowagie/tools/arguments/LabelAccessory.java
deleted file mode 100644
index dff5adc..0000000
--- a/src/main/java/com/lowagie/tools/arguments/LabelAccessory.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * $Id: LabelAccessory.java,v 1.4 2005/12/19 07:51:35 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Carsten Hammer.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.beans.*;
-import java.io.*;
-
-import java.awt.*;
-import javax.swing.*;
-
-import com.lowagie.text.pdf.*;
-import java.util.HashMap;
-import java.util.TimeZone;
-import java.util.Calendar;
-import java.util.Locale;
-import java.util.Date;
-
-/**
- * Label for the FileChooser
- */
-public class LabelAccessory
- extends JPanel implements PropertyChangeListener {
-
- String filename = "";
-
- BorderLayout borderLayout1 = new BorderLayout();
-
- JLabel jLabel1 = new JLabel();
-
- JPanel jPanel2 = new JPanel();
-
- BorderLayout borderLayout2 = new BorderLayout();
- JScrollPane jScrollPane1 = new JScrollPane();
-
- public LabelAccessory() {
- try {
- this.setLayout(borderLayout1);
- jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
- jPanel2.setLayout(borderLayout2);
- this.add(jPanel2, java.awt.BorderLayout.CENTER);
- jScrollPane1.setPreferredSize(new Dimension(200, 200));
- jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);
- jScrollPane1.setViewportView(jLabel1);
- }
- catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- public void createTextFromPDF(File file) {
- if (file.exists()) {
- int page = 1;
- PdfReader reader = null;
-
- try {
- reader = new PdfReader(file.getAbsolutePath());
- HashMap pdfinfo = reader.getInfo();
-
- StringBuffer sb = new StringBuffer();
- sb.append("<html>=== Document Information ===<p>");
- sb.append(reader.getCropBox(page).height() + "*"
- + reader.getCropBox(page).width() + "<p>");
- sb.append("PDF Version: " + reader.getPdfVersion() + "<p>");
- sb.append("Number of pages: " + reader.getNumberOfPages()
- + "<p>");
- sb.append("Number of PDF objects: " + reader.getXrefSize()
- + "<p>");
- sb.append("File length: " + reader.getFileLength() + "<p>");
- sb.append("Encrypted= " + reader.isEncrypted() + "<p>");
- if (pdfinfo.get("Title") != null) {
- sb.append("Title= " + pdfinfo.get("Title") + "<p>");
- }
- if (pdfinfo.get("Author") != null) {
- sb.append("Author= " + pdfinfo.get("Author") + "<p>");
- }
- if (pdfinfo.get("Subject") != null) {
- sb.append("Subject= " + pdfinfo.get("Subject") + "<p>");
- }
- if (pdfinfo.get("Producer") != null) {
- sb.append("Producer= " + pdfinfo.get("Producer") + "<p>");
- }
- if (pdfinfo.get("ModDate") != null) {
- sb.append("ModDate= " +
- PdfDate.decode(pdfinfo.get("ModDate").toString()).getTime() +
- "<p>");
- }
- if (pdfinfo.get("CreationDate") != null) {
- sb.append("CreationDate= " +
- PdfDate.decode(pdfinfo.get("CreationDate").toString()).getTime() +
- "<p>");
- }
- sb.append("</html>");
- jLabel1.setText(sb.toString());
- }
- catch (IOException ex) {
- jLabel1.setText("");
- }
- }
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- filename = evt.getPropertyName();
- if (filename.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
- File file = (File) evt.getNewValue();
- if (file != null) {
- this.createTextFromPDF(file);
- this.repaint();
- }
- }
- }
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/OptionArgument.java b/src/main/java/com/lowagie/tools/arguments/OptionArgument.java
deleted file mode 100644
index 28d4eda..0000000
--- a/src/main/java/com/lowagie/tools/arguments/OptionArgument.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * $Id: OptionArgument.java,v 1.8 2006/05/30 09:13:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.awt.event.ActionEvent;
-import java.util.Iterator;
-import java.util.TreeMap;
-
-import javax.swing.JComboBox;
-import javax.swing.JOptionPane;
-
-import com.lowagie.tools.plugins.AbstractTool;
-
-/**
- * Argument that can be one of several options.
- */
-public class OptionArgument extends ToolArgument {
-
- /**
- * An Entry that can be chosen as option.
- */
- public class Entry {
- /** Describes the option. */
- private Object description;
- /** Holds the actual value of the option. */
- private Object value;
- /**
- * Constructs an entry.
- * @param value the value of the entry (that wil be identical to the description)
- */
- public Entry(Object value) {
- this.value = value;
- this.description = value;
- }
- /**
- * Constructs an entry.
- * @param description the description of the entry
- * @param value the value of the entry
- */
- public Entry(Object description, Object value) {
- this.description = description;
- this.value = value;
- }
- /**
- * String representation of the Entry.
- * @return a description of the entry
- */
- public String toString() {
- return description.toString();
- }
- /**
- * Gets the value of the String.
- * @return the toString of the value
- */
- public String getValueToString() {
- return value.toString();
- }
- /**
- * @return Returns the description.
- */
- public Object getDescription() {
- return description;
- }
- /**
- * @param description The description to set.
- */
- public void setDescription(Object description) {
- this.description = description;
- }
- /**
- * @return Returns the value.
- */
- public Object getValue() {
- return value;
- }
- /**
- * @param value The value to set.
- */
- public void setValue(Object value) {
- this.value = value;
- }
- }
-
- private TreeMap options = new TreeMap();
-
- /**
- * Constructs an OptionArgument.
- * @param tool the tool that needs this argument
- * @param name the name of the argument
- * @param description the description of the argument
- */
- public OptionArgument(AbstractTool tool, String name, String description) {
- super(tool, name, description, Entry.class.getName());
- }
-
- /**
- * Adds an Option.
- * @param description the description of the option
- * @param value the value of the option
- */
- public void addOption(Object description, Object value) {
- options.put(value.toString(), new Entry(description, value));
- }
-
- /**
- * Gets the argument as an object.
- * @return an object
- * @throws InstantiationException
- */
- public Object getArgument() throws InstantiationException {
- if (value == null) return null;
- try {
- return ((Entry)options.get(value)).getValue();
- } catch (Exception e) {
- throw new InstantiationException(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.arguments.ToolArgument#getUsage()
- */
- public String getUsage() {
- StringBuffer buf = new StringBuffer(super.getUsage());
- buf.append(" possible options:\n");
- Entry entry;
- for (Iterator i = options.values().iterator(); i.hasNext(); ) {
- entry = (Entry)i.next();
- buf.append(" - ");
- buf.append(entry.getValueToString());
- buf.append(": ");
- buf.append(entry.toString());
- buf.append("\n");
- }
- return buf.toString();
- }
-
- /**
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent evt) {
- Object[] message = new Object[2];
- message[0] = "Choose one of the following options:";
- JComboBox cb = new JComboBox();
- for(Iterator i = options.values().iterator(); i.hasNext(); ) {
- cb.addItem(i.next());
- }
- message[1] = cb;
- int result = JOptionPane.showOptionDialog(
- tool.getInternalFrame(),
- message,
- description,
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null,
- null,
- null
- );
- if (result == 0) {
- Entry entry = (Entry)cb.getSelectedItem();
- setValue(entry.getValueToString());
- }
- }
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/PageSelectionTableDialog.java b/src/main/java/com/lowagie/tools/arguments/PageSelectionTableDialog.java
deleted file mode 100644
index cf14442..0000000
--- a/src/main/java/com/lowagie/tools/arguments/PageSelectionTableDialog.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package com.lowagie.tools.arguments;
-
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.table.*;
-import java.awt.BorderLayout;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-/**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2005</p>
- *
- * <p>Company: </p>
- *
- * @author not attributable
- * @version 1.0
- */
-public class PageSelectionTableDialog
- extends JDialog {
- JPanel panel1 = new JPanel();
- BorderLayout borderLayout1 = new BorderLayout();
- ListSelectionModel listSelectionModel1;
- JTable jTable1 = new JTable();
- JScrollPane jScrollPane1 = new JScrollPane();
- String selectionstring = "";
- JLabel jLabel1 = new JLabel();
- BorderLayout borderLayout2 = new BorderLayout();
- JPanel jPanel1 = new JPanel();
- JButton alljButton1 = new JButton();
- JButton oddjButton2 = new JButton();
- JButton evenjButton3 = new JButton();
- JToggleButton jToggleButton1 = new JToggleButton();
- JButton none = new JButton();
-
- public PageSelectionTableDialog(JInternalFrame owner, String title, boolean modal) {
- super(new Frame(), title, modal);
-// super( title);
- try {
- setDefaultCloseOperation(DISPOSE_ON_CLOSE);
- jbInit();
- pack();
- }
- catch (Exception exception) {
- exception.printStackTrace();
- }
- }
-
- public PageSelectionTableDialog(JInternalFrame jinternalframe) {
- this(jinternalframe, "", false);
- }
-
- private void jbInit() throws Exception {
- panel1.setLayout(borderLayout1);
- this.getContentPane().setLayout(borderLayout2);
- alljButton1.setText("all");
- alljButton1.addActionListener(new
- PageSelectionTableDialog_jButton1_actionAdapter(this));
- oddjButton2.setText("odd");
- oddjButton2.addActionListener(new
- PageSelectionTableDialog_jButton2_actionAdapter(this));
- evenjButton3.setText("even");
- evenjButton3.addActionListener(new
- PageSelectionTableDialog_jButton3_actionAdapter(this));
- jToggleButton1.setText("swap");
- jToggleButton1.addActionListener(new
- PageSelectionTableDialog_jToggleButton1_actionAdapter(this));
- none.setText("none");
- none.addActionListener(new PageSelectionTableDialog_none_actionAdapter(this));
-
- panel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);
- panel1.add(jLabel1, java.awt.BorderLayout.SOUTH);
- this.getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);
- jPanel1.add(none);
- jPanel1.add(jToggleButton1);
- jPanel1.add(evenjButton3);
- jPanel1.add(oddjButton2);
- jPanel1.add(alljButton1);
- this.getContentPane().add(panel1, java.awt.BorderLayout.CENTER);
- jScrollPane1.setViewportView(jTable1);
- listSelectionModel1 = jTable1.getSelectionModel();
- listSelectionModel1.addListSelectionListener(new
- PageSelectionTableDialog_listSelectionModel1_listSelectionAdapter(this));
- }
-
- public void setDataModel(TableModel dataModel) {
- TableSorter sorter = new TableSorter(dataModel);
- jTable1.setModel(sorter);
- sorter.addMouseListenerToHeaderInTable(jTable1);
- this.repaint();
- }
-
- public void listSelectionModel1_valueChanged(ListSelectionEvent e) {
- if (!e.getValueIsAdjusting()) {
- pulllistselectionmodel();
- }
- }
-
- private void pulllistselectionmodel() {
- TableSorter mysorter = (TableSorter) jTable1.getModel();
- int[] values = jTable1.getSelectedRows();
- int max = jTable1.getSelectedRowCount();
- int[] swappedvalues = new int[max];
-
- if (jToggleButton1.getModel().isSelected()) {
- for (int i = 0; i < max; i+=2) {
- int second=(i+1)<max?i+1:i;
- swappedvalues[i] = mysorter.getModelrow(values[second]) + 1;
- swappedvalues[second] = mysorter.getModelrow(values[i]) + 1;
- }
- }
- else {
- for (int i = 0; i < max; i++) {
- swappedvalues[i] = mysorter.getModelrow(values[i]) + 1;
- }
-
- }
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < max; i++) {
- sb.append(swappedvalues[i]);
- if ( (i + 1) < max) {
- sb.append(",");
- }
- }
-
- jLabel1.setText(sb.toString());
- this.firePropertyChange(PageSelectorToolArgument.
- PROPERTYPAGESELECTIONSTRING, selectionstring,
- sb.toString());
- selectionstring = sb.toString();
- }
-
- public void jButton1_actionPerformed(ActionEvent e) {
- listSelectionModel1.addSelectionInterval(0, jTable1.getRowCount() - 1);
- jTable1.repaint();
- }
-
- public void jButton3_actionPerformed(ActionEvent e) {
- for (int i = 0; i < jTable1.getRowCount(); i += 2) {
- listSelectionModel1.addSelectionInterval(i, i);
- }
- jTable1.repaint();
- }
-
- public void jButton2_actionPerformed(ActionEvent e) {
- for (int i = 1; i < jTable1.getRowCount(); i += 2) {
- listSelectionModel1.addSelectionInterval(i, i);
- }
- jTable1.repaint();
- }
-
- public void jToggleButton1_actionPerformed(ActionEvent e) {
- pulllistselectionmodel();
- }
-
- public void none_actionPerformed(ActionEvent e) {
- listSelectionModel1.clearSelection();
- jTable1.repaint();
- }
-}
-
-class PageSelectionTableDialog_none_actionAdapter
- implements ActionListener {
- private PageSelectionTableDialog adaptee;
- PageSelectionTableDialog_none_actionAdapter(PageSelectionTableDialog adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.none_actionPerformed(e);
- }
-}
-
-class PageSelectionTableDialog_jToggleButton1_actionAdapter
- implements ActionListener {
- private PageSelectionTableDialog adaptee;
- PageSelectionTableDialog_jToggleButton1_actionAdapter(
- PageSelectionTableDialog adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.jToggleButton1_actionPerformed(e);
- }
-}
-
-class PageSelectionTableDialog_jButton2_actionAdapter
- implements ActionListener {
- private PageSelectionTableDialog adaptee;
- PageSelectionTableDialog_jButton2_actionAdapter(PageSelectionTableDialog
- adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.jButton2_actionPerformed(e);
- }
-}
-
-class PageSelectionTableDialog_jButton3_actionAdapter
- implements ActionListener {
- private PageSelectionTableDialog adaptee;
- PageSelectionTableDialog_jButton3_actionAdapter(PageSelectionTableDialog
- adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- adaptee.jButton3_actionPerformed(e);
- }
-}
-
-class PageSelectionTableDialog_jButton1_actionAdapter
- implements ActionListener {
- private PageSelectionTableDialog adaptee;
- PageSelectionTableDialog_jButton1_actionAdapter(PageSelectionTableDialog
- adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.jButton1_actionPerformed(e);
- }
-}
-
-class PageSelectionTableDialog_listSelectionModel1_listSelectionAdapter
- implements ListSelectionListener {
- private PageSelectionTableDialog adaptee;
- PageSelectionTableDialog_listSelectionModel1_listSelectionAdapter(
- PageSelectionTableDialog adaptee) {
- this.adaptee = adaptee;
- }
-
- public void valueChanged(ListSelectionEvent e) {
- adaptee.listSelectionModel1_valueChanged(e);
- }
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/PageSelectorToolArgument.java b/src/main/java/com/lowagie/tools/arguments/PageSelectorToolArgument.java
deleted file mode 100644
index 6911468..0000000
--- a/src/main/java/com/lowagie/tools/arguments/PageSelectorToolArgument.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * $Id: PageSelectorToolArgument.java,v 1.3 2006/05/30 09:13:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Anonymous known by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.awt.event.ActionEvent;
-import java.beans.PropertyChangeEvent;
-
-import com.lowagie.tools.plugins.AbstractTool;
-
-/**
- * Argument that allows you to select a (set of) page(s).
- */
-public class PageSelectorToolArgument
- extends ToolArgument {
-// public final static String PROPERTYFILENAME = "inputfilename";
- public final static String PROPERTYPAGESELECTIONSTRING =
- "pageselectionstring";
-
- public PageSelectorToolArgument(AbstractTool tool, String name,
- String description,
- String classname) {
- super(tool, name, description, classname);
-
- }
-
- public void actionPerformed(ActionEvent e) {
- if (jDialog1 != null) {
- jDialog1.show();
- }
- }
-
- public Object getArgument() throws InstantiationException {
- if (value == null) {
- return null;
- }
- return value;
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- String propertyname = evt.getPropertyName();
- if (jDialog1 == null) {
- actionPerformed(null);
- }
- if (propertyname == null) {
- return;
- }
- else if (propertyname.equals(name)) {
- String filename = (String) evt.getNewValue();
- if(jDialog1!=null)jDialog1.hide();
- jDialog1 = new PageSelectionTableDialog(tool.getInternalFrame());
- jDialog1.show();
- jDialog1.addPropertyChangeListener(this);
- jDialog1.setDataModel(new PageTableModel(filename));
- jDialog1.setTitle(filename);
- }
- else if (propertyname.equals(PROPERTYPAGESELECTIONSTRING)) {
- String pageselectionstring = (String) evt.getNewValue();
- System.out.print(" Oldvalue:" + evt.getOldValue());
- System.out.println(" Newvalue:" + pageselectionstring);
- setValue(pageselectionstring, PROPERTYPAGESELECTIONSTRING);
- }
- }
-
- PageSelectionTableDialog jDialog1 = null;
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/PageSizeArgument.java b/src/main/java/com/lowagie/tools/arguments/PageSizeArgument.java
deleted file mode 100644
index c8cdb0c..0000000
--- a/src/main/java/com/lowagie/tools/arguments/PageSizeArgument.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * $Id: PageSizeArgument.java,v 1.3 2006/05/30 09:13:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.awt.event.ActionEvent;
-import java.lang.reflect.Field;
-import java.util.Iterator;
-import java.util.TreeMap;
-
-import javax.swing.JComboBox;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.PageSize;
-import com.lowagie.text.Rectangle;
-import com.lowagie.tools.plugins.AbstractTool;
-
-/**
- * Argument that can be one of several options.
- */
-public class PageSizeArgument extends OptionArgument {
-
- private TreeMap options = new TreeMap();
-
- /**
- * Constructs an OptionArgument.
- *
- * @param tool
- * the tool that needs this argument
- * @param name
- * the name of the argument
- * @param description
- * the description of the argument
- */
- public PageSizeArgument(AbstractTool tool, String name, String description) {
- super(tool, name, description);
- Class ps = PageSize.class;
- Field[] sizes = ps.getDeclaredFields();
- try {
- for (int i = 0; i < sizes.length; i++) {
- addOption(sizes[i].getName(), sizes[i].get(null));
- }
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Adds an Option.
- * @param description the description of the option
- * @param value the value of the option
- */
- public void addOption(Object description, Object value) {
- options.put(description, value);
- }
-
- /**
- * Gets the options.
- * @return Returns the options.
- */
- public TreeMap getOptions() {
- return options;
- }
-
- /**
- * Gets the argument as an object.
- * @return an object
- * @throws InstantiationException
- */
- public Object getArgument() throws InstantiationException {
- if (value == null) return null;
- try {
- return ((Rectangle)options.get(value));
- } catch (Exception e) {
- throw new InstantiationException(e.getMessage());
- }
- }
-
- /**
- * @see com.lowagie.tools.arguments.ToolArgument#getUsage()
- */
- public String getUsage() {
- StringBuffer buf = new StringBuffer(" ");
- buf.append(name);
- buf.append(" - ");
- buf.append(description);
- buf.append("\n");
- buf.append(" possible options:\n");
- String s;
- for (Iterator i = options.keySet().iterator(); i.hasNext(); ) {
- s = (String)i.next();
- buf.append(" - ");
- buf.append(s);
- buf.append("\n");
- }
- return buf.toString();
- }
-
- /**
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent evt) {
- Object[] message = new Object[2];
- message[0] = "Choose one of the following pagesizes:";
- JComboBox cb = new JComboBox();
- for(Iterator i = options.keySet().iterator(); i.hasNext(); ) {
- cb.addItem(i.next());
- }
- message[1] = cb;
- int result = JOptionPane.showOptionDialog(
- tool.getInternalFrame(),
- message,
- description,
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null,
- null,
- null
- );
- if (result == 0) {
- setValue((String)cb.getSelectedItem());
- }
- }
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/PageTableModel.java b/src/main/java/com/lowagie/tools/arguments/PageTableModel.java
deleted file mode 100644
index 0e44123..0000000
--- a/src/main/java/com/lowagie/tools/arguments/PageTableModel.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * $Id: PageTableModel.java,v 1.2 2005/10/23 09:35:48 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by anonymous contributor known by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import javax.swing.table.*;
-import com.lowagie.text.pdf.PdfReader;
-import java.io.*;
-import com.lowagie.text.Rectangle;
-import java.util.ArrayList;
-import java.text.DecimalFormat;
-
-/**
- * A table that shows info about the pages in a PDF document.
- */
-public class PageTableModel
- extends AbstractTableModel {
- int seitenzahl;
- PdfReader reader;
- ArrayList auftragarray = new ArrayList();
- DecimalFormat myFormatter = new DecimalFormat("00000");
- public PageTableModel(String filename) {
- super();
- try {
- reader = new PdfReader(filename);
- seitenzahl = reader.getNumberOfPages();
- }
- catch (IOException ex) {
- throw new RuntimeException("Datei " + filename +
- " lässt sich nicht lesen!");
- }
- }
-
- /**
- * Returns the number of columns in the model.
- *
- * @return the number of columns in the model
- * @todo Implement this javax.swing.table.TableModel method
- */
- public int getColumnCount() {
- return 4;
- }
-
- /**
- * Returns the number of rows in the model.
- *
- * @return the number of rows in the model
- * @todo Implement this javax.swing.table.TableModel method
- */
- public int getRowCount() {
- return seitenzahl;
- }
-
- /**
- * Returns the value for the cell at <code>columnIndex</code> and <code>rowIndex</code>.
- *
- * @param rowIndex the row whose value is to be queried
- * @param columnIndex the column whose value is to be queried
- * @return the value Object at the specified cell
- * @todo Implement this javax.swing.table.TableModel method
- */
- public Object getValueAt(int rowIndex, int columnIndex) {
- Rectangle rec = reader.getPageSizeWithRotation(rowIndex + 1);
- switch (columnIndex) {
- case 0:
- return myFormatter.format(rowIndex + 1);
- case 1:
- return new Float(rec.width());
- case 2:
- return new Float(rec.height());
- case 3:
- return new Float(rec.getRotation());
- }
- return null;
- }
-
- public String getColumnName(int column) {
- String name = new Integer(column + 1).toString();
- switch (column) {
- case 0:
- name = "<html>Pagenr<p>" + name + "</html>";
- break;
- case 1:
- name = "<html>Weidth<p>" + name + "</html>";
- break;
- case 2:
- name = "<html>Height<p>" + name + "</html>";
- break;
- case 3:
- name = "<html>Rotation<p>" + name + "</html>";
- break;
-
- default:
- name = "<html>-<p>" + name + "</html>";
- break;
- }
- return name;
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/PdfFilter.java b/src/main/java/com/lowagie/tools/arguments/PdfFilter.java
deleted file mode 100644
index 5b0b8b4..0000000
--- a/src/main/java/com/lowagie/tools/arguments/PdfFilter.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * $Id: PdfFilter.java,v 1.2 2005/10/24 06:33:31 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.io.File;
-
-import javax.swing.filechooser.FileFilter;
-
-/**
- * Filters PDF files in a JFileChooser.
- */
-public class PdfFilter extends FileFilter {
-
- /**
- * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
- */
- public boolean accept(File f) {
- if (f.isDirectory()) return true;
- if (f.getName().toLowerCase().endsWith(".pdf")) return true;
- return false;
- }
-
- /**
- * @see javax.swing.filechooser.FileFilter#getDescription()
- */
- public String getDescription() {
- return "*.pdf PDF files";
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/TableMap.java b/src/main/java/com/lowagie/tools/arguments/TableMap.java
deleted file mode 100644
index 58308ee..0000000
--- a/src/main/java/com/lowagie/tools/arguments/TableMap.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package com.lowagie.tools.arguments;
-/*
- * @(#)TableMap.java 1.4 97/12/17
- *
- * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
- *
- * This software is the confidential and proprietary information of Sun
- * Microsystems, Inc. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Sun.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
- * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
- * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
- * THIS SOFTWARE OR ITS DERIVATIVES.
- *
- */
-
-/**
- * In a chain of data manipulators some behaviour is common. TableMap
- * provides most of this behavour and can be subclassed by filters
- * that only need to override a handful of specific methods. TableMap
- * implements TableModel by routing all requests to its model, and
- * TableModelListener by routing all events to its listeners. Inserting
- * a TableMap which has not been subclassed into a chain of table filters
- * should have no effect.
- *
- * @version 1.4 12/17/97
- * @author Philip Milne */
-
-import javax.swing.table.*;
-import javax.swing.event.TableModelListener;
-import javax.swing.event.TableModelEvent;
-
-public class TableMap extends AbstractTableModel implements TableModelListener
-{
- protected TableModel model;
-
- public TableModel getModel() {
- return model;
- }
-
- public void setModel(TableModel model) {
- this.model = model;
- model.addTableModelListener(this);
- }
-
- // By default, Implement TableModel by forwarding all messages
- // to the model.
-
- public Object getValueAt(int aRow, int aColumn) {
- return model.getValueAt(aRow, aColumn);
- }
-
- public void setValueAt(Object aValue, int aRow, int aColumn) {
- model.setValueAt(aValue, aRow, aColumn);
- }
-
- public int getRowCount() {
- return (model == null) ? 0 : model.getRowCount();
- }
-
- public int getColumnCount() {
- return (model == null) ? 0 : model.getColumnCount();
- }
-
- public String getColumnName(int aColumn) {
- return model.getColumnName(aColumn);
- }
-
- public Class getColumnClass(int aColumn) {
- return model.getColumnClass(aColumn);
- }
-
- public boolean isCellEditable(int row, int column) {
- return model.isCellEditable(row, column);
- }
-//
-// Implementation of the TableModelListener interface,
-//
-
- // By default forward all events to all the listeners.
- public void tableChanged(TableModelEvent e) {
- fireTableChanged(e);
- }
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/TableSorter.java b/src/main/java/com/lowagie/tools/arguments/TableSorter.java
deleted file mode 100644
index a921516..0000000
--- a/src/main/java/com/lowagie/tools/arguments/TableSorter.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/** Code contributed by Anonymous; looks like code that was reused from another application. */
-package com.lowagie.tools.arguments;
-
-import java.awt.event.InputEvent;
-
-// Imports for picking up mouse events from the JTable.
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-/*
- * @(#)TableSorter.java 1.5 97/12/17
- *
- * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
- *
- * This software is the confidential and proprietary information of Sun
- * Microsystems, Inc. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Sun.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
- * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
- * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
- * THIS SOFTWARE OR ITS DERIVATIVES.
- *
- */
-
-/**
- * A sorter for TableModels. The sorter has a model (conforming to TableModel)
- * and itself implements TableModel. TableSorter does not store or copy
- * the data in the TableModel, instead it maintains an array of
- * integers which it keeps the same size as the number of rows in its
- * model. When the model changes it notifies the sorter that something
- * has changed eg. "rowsAdded" so that its internal array of integers
- * can be reallocated. As requests are made of the sorter (like
- * getValueAt(row, col) it redirects them to its model via the mapping
- * array. That way the TableSorter appears to hold another copy of the table
- * with the rows in a different order. The sorting algorthm used is stable
- * which means that it does not move around rows when its comparison
- * function returns 0 to denote that they are equivalent.
- *
- * @version 1.5 12/17/97
- * @author Philip Milne
- */
-import java.util.*;
-
-import javax.swing.JTable;
-import javax.swing.event.TableModelEvent;
-import javax.swing.table.JTableHeader;
-import javax.swing.table.TableColumnModel;
-import javax.swing.table.TableModel;
-
-public class TableSorter
- extends TableMap {
- int[] indexes;
- Vector sortingColumns = new Vector();
- boolean ascending = true;
- int compares;
-
- public TableSorter() {
- indexes = new int[0]; // For consistency.
- }
-
- public TableSorter(TableModel model) {
- setModel(model);
- }
-
- public void setModel(TableModel model) {
- super.setModel(model);
- reallocateIndexes();
- }
-
- public int compareRowsByColumn(int row1, int row2, int column) {
- Class type = model.getColumnClass(column);
- TableModel data = model;
-
- // Check for nulls
- Object o1 = data.getValueAt(row1, column);
- Object o2 = data.getValueAt(row2, column);
-
- // If both values are null return 0
- if ( (o1 == null) && (o2 == null)) {
- return 0;
- }
- else if (o1 == null) { // Define null less than everything.
-
- return -1;
- }
- else if (o2 == null) {
- return 1;
- }
-
- /* We copy all returned values from the getValue call in case
- an optimised model is reusing one object to return many values.
- The Number subclasses in the JDK are immutable and so will not be used in
- this way but other subclasses of Number might want to do this to save
- space and avoid unnecessary heap allocation.
- */
- if (type.getSuperclass() == java.lang.Number.class) {
- Number n1 = (Number) data.getValueAt(row1, column);
- double d1 = n1.doubleValue();
- Number n2 = (Number) data.getValueAt(row2, column);
- double d2 = n2.doubleValue();
-
- if (d1 < d2) {
- return -1;
- }
- else if (d1 > d2) {
- return 1;
- }
- else {
- return 0;
- }
- }
- else if (type == java.util.Date.class) {
- Date d1 = (Date) data.getValueAt(row1, column);
- long n1 = d1.getTime();
- Date d2 = (Date) data.getValueAt(row2, column);
- long n2 = d2.getTime();
-
- if (n1 < n2) {
- return -1;
- }
- else if (n1 > n2) {
- return 1;
- }
- else {
- return 0;
- }
- }
- else if (type == String.class) {
- String s1 = (String) data.getValueAt(row1, column);
- String s2 = (String) data.getValueAt(row2, column);
- int result = s1.compareTo(s2);
-
- if (result < 0) {
- return -1;
- }
- else if (result > 0) {
- return 1;
- }
- else {
- return 0;
- }
- }
- else if (type == Boolean.class) {
- Boolean bool1 = (Boolean) data.getValueAt(row1, column);
- boolean b1 = bool1.booleanValue();
- Boolean bool2 = (Boolean) data.getValueAt(row2, column);
- boolean b2 = bool2.booleanValue();
-
- if (b1 == b2) {
- return 0;
- }
- else if (b1) { // Define false < true
-
- return 1;
- }
- else {
- return -1;
- }
- }
- else {
- Object v1 = data.getValueAt(row1, column);
- String s1 = v1.toString();
- Object v2 = data.getValueAt(row2, column);
- String s2 = v2.toString();
- int result = s1.compareTo(s2);
-
- if (result < 0) {
- return -1;
- }
- else if (result > 0) {
- return 1;
- }
- else {
- return 0;
- }
- }
- }
-
- public int compare(int row1, int row2) {
- compares++;
-
- for (int level = 0; level < sortingColumns.size(); level++) {
- Integer column = (Integer) sortingColumns.elementAt(level);
- int result = compareRowsByColumn(row1, row2, column.intValue());
-
- if (result != 0) {
- return ascending ? result : ( -result);
- }
- }
-
- return 0;
- }
-
- public void reallocateIndexes() {
- int rowCount = model.getRowCount();
-
- // Set up a new array of indexes with the right number of elements
- // for the new data model.
- indexes = new int[rowCount];
-
- // Initialise with the identity mapping.
- for (int row = 0; row < rowCount; row++) {
- indexes[row] = row;
- }
- }
-
- public void tableChanged(TableModelEvent e) {
- //System.out.println("Sorter: tableChanged");
- reallocateIndexes();
- super.tableChanged(e);
- }
-
- public void checkModel() {
- if (indexes.length != model.getRowCount()) {
- System.err.println("Sorter not informed of a change in model.");
- }
- }
-
- public void sort(Object sender) {
- checkModel();
- compares = 0;
-
- // n2sort();
- // qsort(0, indexes.length-1);
- shuttlesort( (int[]) indexes.clone(), indexes, 0, indexes.length);
-
- //System.out.println("Compares: "+compares);
- }
-
- public void n2sort() {
- for (int i = 0; i < getRowCount(); i++) {
- for (int j = i + 1; j < getRowCount(); j++) {
- if (compare(indexes[i], indexes[j]) == -1) {
- swap(i, j);
- }
- }
- }
- }
-
- // This is a home-grown implementation which we have not had time
- // to research - it may perform poorly in some circumstances. It
- // requires twice the space of an in-place algorithm and makes
- // NlogN assigments shuttling the values between the two
- // arrays. The number of compares appears to vary between N-1 and
- // NlogN depending on the initial order but the main reason for
- // using it here is that, unlike qsort, it is stable.
- public void shuttlesort(int[] from, int[] to, int low, int high) {
- if ( (high - low) < 2) {
- return;
- }
-
- int middle = (low + high) / 2;
- shuttlesort(to, from, low, middle);
- shuttlesort(to, from, middle, high);
-
- int p = low;
- int q = middle;
-
- /* This is an optional short-cut; at each recursive call,
- check to see if the elements in this subset are already
- ordered. If so, no further comparisons are needed; the
- sub-array can just be copied. The array must be copied rather
- than assigned otherwise sister calls in the recursion might
- get out of sinc. When the number of elements is three they
- are partitioned so that the first set, [low, mid), has one
- element and and the second, [mid, high), has two. We skip the
- optimisation when the number of elements is three or less as
- the first compare in the normal merge will produce the same
- sequence of steps. This optimisation seems to be worthwhile
- for partially ordered lists but some analysis is needed to
- find out how the performance drops to Nlog(N) as the initial
- order diminishes - it may drop very quickly. */
- if ( ( (high - low) >= 4) && (compare(from[middle - 1], from[middle]) <= 0)) {
- for (int i = low; i < high; i++) {
- to[i] = from[i];
- }
-
- return;
- }
-
- // A normal merge.
- for (int i = low; i < high; i++) {
- if ( (q >= high) || ( (p < middle) && (compare(from[p], from[q]) <= 0))) {
- to[i] = from[p++];
- }
- else {
- to[i] = from[q++];
- }
- }
- }
-
- public void swap(int i, int j) {
- int tmp = indexes[i];
- indexes[i] = indexes[j];
- indexes[j] = tmp;
- }
-
- // The mapping only affects the contents of the data rows.
- // Pass all requests to these rows through the mapping array: "indexes".
- public Object getValueAt(int aRow, int aColumn) {
- checkModel();
-
- return model.getValueAt(indexes[aRow], aColumn);
- }
-
- public void setValueAt(Object aValue, int aRow, int aColumn) {
- checkModel();
- model.setValueAt(aValue, indexes[aRow], aColumn);
- }
-
- public void sortByColumn(int column) {
- sortByColumn(column, true);
- }
-
- public void sortByColumn(int column, boolean ascending) {
- this.ascending = ascending;
- sortingColumns.removeAllElements();
- sortingColumns.addElement(new Integer(column));
- sort(this);
- super.tableChanged(new TableModelEvent(this));
- }
-
- // There is no-where else to put this.
- // Add a mouse listener to the Table to trigger a table sort
- // when a column heading is clicked in the JTable.
- public void addMouseListenerToHeaderInTable(JTable table) {
- final TableSorter sorter = this;
- final JTable tableView = table;
- tableView.setColumnSelectionAllowed(false);
-
- MouseAdapter listMouseListener = new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- TableColumnModel columnModel = tableView.getColumnModel();
- int viewColumn = columnModel.getColumnIndexAtX(e.getX());
- int column = tableView.convertColumnIndexToModel(viewColumn);
-
- if ( (e.getClickCount() == 1) && (column != -1)) {
- //System.out.println("Sorting ...");
- int shiftPressed = e.getModifiers() & InputEvent.SHIFT_MASK;
- boolean ascending = (shiftPressed == 0);
- sorter.sortByColumn(column, ascending);
- }
- }
- };
-
- JTableHeader th = tableView.getTableHeader();
- th.addMouseListener(listMouseListener);
- }
-
- public int getModelrow(int viewrow) {
- return indexes[viewrow];
- }
-
- public int getjTablerow(int modelrow) {
- int i = 0;
- while (indexes[i] != modelrow) {
- i++;
- }
- return i;
- }
-
-}
diff --git a/src/main/java/com/lowagie/tools/arguments/ToolArgument.java b/src/main/java/com/lowagie/tools/arguments/ToolArgument.java
deleted file mode 100644
index 203c298..0000000
--- a/src/main/java/com/lowagie/tools/arguments/ToolArgument.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * $Id: ToolArgument.java,v 1.6 2006/05/30 09:13:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 2005 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.tools.arguments;
-
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.util.Vector;
-
-import javax.swing.JColorChooser;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-
-import com.lowagie.text.Image;
-import com.lowagie.tools.plugins.AbstractTool;
-
-/**
- * This is an argument of one of the tools in the toolbox.
- */
-public class ToolArgument
- implements ActionListener, PropertyChangeListener {
- /** reference to the internal frame */
- protected AbstractTool tool;
- /** describes the argument. */
- protected String description;
- /** short name for the argument. */
- protected String name;
- /** type of the argument. */
- protected String classname;
- /** value of the argument. */
- protected String value = null;
-
- /** Constructs a ToolArgument. */
- public ToolArgument() {}
-
- /**
- * Constructs a ToolArgument.
- * @param tool the tool that needs this argument
- * @param name the name of the argument
- * @param description the description of the argument
- * @param classname the type of the argument
- */
- public ToolArgument(AbstractTool tool, String name, String description,
- String classname) {
- this.tool = tool;
- this.name = name;
- this.description = description;
- this.classname = classname;
- }
-
- /**
- * Gets the argument as an object.
- * @return an object
- * @throws InstantiationException
- */
- public Object getArgument() throws InstantiationException {
- if (value == null) {
- return null;
- }
- try {
- if (String.class.getName().equals(classname)) {
- return value;
- }
- if (Image.class.getName().equals(classname)) {
- return Image.getInstance(value);
- }
- if (File.class.getName().equals(classname)) {
- return new File(value);
- }
- if (Color.class.getName().equals(classname)) {
- return Color.decode(value);
- }
- }
- catch (Exception e) {
- throw new InstantiationException(e.getMessage());
- }
- return value;
- }
-
- /**
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e) {
- if (String.class.getName().equals(classname)) {
- setValue(JOptionPane.showInputDialog(tool.getInternalFrame(),
- "Enter a value for " + name + ":"));
- }
- if (Image.class.getName().equals(classname)) {
- JFileChooser fc = new JFileChooser();
- fc.showOpenDialog(tool.getInternalFrame());
- setValue(fc.getSelectedFile().getAbsolutePath());
- }
- if (File.class.getName().equals(classname)) {
- JFileChooser fc = new JFileChooser();
- fc.showOpenDialog(tool.getInternalFrame());
- setValue(fc.getSelectedFile().getAbsolutePath());
- }
- if (Color.class.getName().equals(classname)) {
- Color initialColor = new Color(0xFF, 0xFF, 0xFF);
- if (value != null) {
- initialColor = Color.decode(value);
- }
- Color newColor = JColorChooser.showDialog(tool.getInternalFrame(),
- "Choose Color", initialColor);
- setValue("0x" +
- Integer.toHexString( (newColor.getRed() << 16) |
- (newColor.getGreen() << 8) |
- (newColor.getBlue() << 0)).toUpperCase());
- }
- }
-
- /**
- * Give you a String that can be used in a usage description.
- * @return a String
- */
- public String getUsage() {
- StringBuffer buf = new StringBuffer(" ");
- buf.append(name);
- buf.append(" - ");
- buf.append(description);
- buf.append("\n");
- return buf.toString();
- }
-
- /**
- * @return Returns the classname.
- */
- public String getClassname() {
- return classname;
- }
-
- /**
- * @param classname The classname to set.
- */
- public void setClassname(String classname) {
- this.classname = classname;
- }
-
- /**
- * @return Returns the description.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description The description to set.
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return Returns the name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name The name to set.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return Returns the value.
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value The value to set.
- */
- public void setValue(String value) {
- Object oldvalue = this.value;
- this.value = value;
- tool.valueHasChanged(this);
- this.firePropertyChange(new PropertyChangeEvent(this, name,
- oldvalue, this.value));
- }
- public void setValue(String value, String propertyname) {
- Object oldvalue = this.value;
- this.value = value;
- tool.valueHasChanged(this);
- this.firePropertyChange(new PropertyChangeEvent(this, propertyname,
- oldvalue, this.value));
- }
- transient Vector propertyChangeListeners;
- public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
-
- Vector v = propertyChangeListeners == null ? new Vector(2) :
- (Vector) propertyChangeListeners.clone();
- if (!v.contains(l)) {
- v.addElement(l);
- propertyChangeListeners = v;
- }
- }
-
- public synchronized void removePropertyChangeListener(PropertyChangeListener
- l) {
- if (propertyChangeListeners != null && propertyChangeListeners.contains(l)) {
- Vector v = (Vector) propertyChangeListeners.clone();
- v.removeElement(l);
- propertyChangeListeners = v;
- }
-
- }
-
- protected void firePropertyChange(PropertyChangeEvent evt) {
- if (propertyChangeListeners != null) {
- Vector listeners = propertyChangeListeners;
- int count = listeners.size();
- for (int i = 0; i < count; i++) {
- ( (PropertyChangeListener) listeners.elementAt(i)).propertyChange(evt);
- }
- }
- }
-
- /**
- * This method gets called when a bound property is changed.
- *
- * @param evt A PropertyChangeEvent object describing the event source and the property that has
- * changed.
- * @todo Implement this java.beans.PropertyChangeListener method
- */
- public void propertyChange(PropertyChangeEvent evt) {
- }
-}