harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r469038 - in /incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common: javax/print/ org/apache/harmony/x/print/util/
Date Mon, 30 Oct 2006 00:53:25 GMT
Author: ndbeyer
Date: Sun Oct 29 16:53:24 2006
New Revision: 469038

URL: http://svn.apache.org/viewvc?view=rev&rev=469038
Log:
Cleanup for 'javax.print'
* add missing annotations
* add missing type variables
* format source
* add missing modifiers

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/AttributeException.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/CancelablePrintJob.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/Doc.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocFlavor.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocPrintJob.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/FlavorException.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDoc.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintJob.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintService.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/PrintService.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUI.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUIFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/SimpleDoc.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintService.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintServiceFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/URIException.java
    incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/util/FactoryLocator.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/AttributeException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/AttributeException.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/AttributeException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/AttributeException.java
Sun Oct 29 16:53:24 2006
@@ -14,19 +14,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.4 $ 
- */ 
 
 package javax.print;
 
 import javax.print.attribute.Attribute;
 
 public interface AttributeException {
-
     Class[] getUnsupportedAttributes();
 
     Attribute[] getUnsupportedValues();
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/CancelablePrintJob.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/CancelablePrintJob.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/CancelablePrintJob.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/CancelablePrintJob.java
Sun Oct 29 16:53:24 2006
@@ -14,15 +14,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.3 $ 
- */ 
 
 package javax.print;
 
 public interface CancelablePrintJob extends DocPrintJob {
-    
     void cancel() throws PrintException;
-    
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/Doc.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/Doc.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/Doc.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/Doc.java
Sun Oct 29 16:53:24 2006
@@ -14,21 +14,15 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.3 $ 
- */ 
 
 package javax.print;
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
-
 import javax.print.attribute.DocAttributeSet;
 
 public interface Doc {
-    
     DocAttributeSet getAttributes();
 
     DocFlavor getDocFlavor();
@@ -38,5 +32,4 @@
     Reader getReaderForText() throws IOException;
 
     InputStream getStreamForBytes() throws IOException;
-
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocFlavor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocFlavor.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocFlavor.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocFlavor.java
Sun Oct 29 16:53:24 2006
@@ -49,7 +49,7 @@
     // Document media type (as defined in RFC 2045,2046, 822)
     private transient MimeType aType;
 
-    private String aClass; // Representation class name
+    private final String aClass; // Representation class name
 
     public DocFlavor(String mimeType, String className) {
         if ((mimeType == null) || (className == null)) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocPrintJob.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocPrintJob.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocPrintJob.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/DocPrintJob.java
Sun Oct 29 16:53:24 2006
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.4 $ 
- */ 
 
 package javax.print;
 
@@ -28,7 +24,6 @@
 import javax.print.PrintException;
 
 public interface DocPrintJob {
-
     PrintService getPrintService();
 
     PrintJobAttributeSet getAttributes();
@@ -37,12 +32,10 @@
 
     void removePrintJobListener(PrintJobListener listener);
 
-    void addPrintJobAttributeListener(PrintJobAttributeListener listener, 
+    void addPrintJobAttributeListener(PrintJobAttributeListener listener,
             PrintJobAttributeSet attributes);
 
     void removePrintJobAttributeListener(PrintJobAttributeListener listener);
 
-    void print(Doc doc, PrintRequestAttributeSet attributes) 
-            throws PrintException;
-
-}
\ No newline at end of file
+    void print(Doc doc, PrintRequestAttributeSet attributes) throws PrintException;
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/FlavorException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/FlavorException.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/FlavorException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/FlavorException.java
Sun Oct 29 16:53:24 2006
@@ -14,15 +14,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.4 $ 
- */ 
 
 package javax.print;
 
 public interface FlavorException {
-
     DocFlavor[] getUnsupportedFlavors();
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDoc.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDoc.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDoc.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDoc.java
Sun Oct 29 16:53:24 2006
@@ -14,19 +14,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.3 $ 
- */ 
 
 package javax.print;
 
 import java.io.IOException;
 
 public interface MultiDoc {
-    
     Doc getDoc() throws IOException;
 
     MultiDoc next() throws IOException;
-    
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintJob.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintJob.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintJob.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintJob.java
Sun Oct 29 16:53:24 2006
@@ -14,18 +14,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.3 $ 
- */ 
 
 package javax.print;
 
 import javax.print.attribute.PrintRequestAttributeSet;
 
 public interface MultiDocPrintJob extends DocPrintJob {
-
-    void print(MultiDoc multiDoc, PrintRequestAttributeSet attributes)
-            throws PrintException;
-
-}
\ No newline at end of file
+    void print(MultiDoc multiDoc, PrintRequestAttributeSet attributes) throws PrintException;
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintService.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintService.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintService.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/MultiDocPrintService.java
Sun Oct 29 16:53:24 2006
@@ -14,15 +14,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.3 $ 
- */ 
 
 package javax.print;
 
 public interface MultiDocPrintService extends PrintService {
-
     MultiDocPrintJob createMultiDocPrintJob();
-
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/PrintService.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/PrintService.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/PrintService.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/PrintService.java
Sun Oct 29 16:53:24 2006
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.3 $ 
- */ 
 
 package javax.print;
 
@@ -28,7 +24,6 @@
 import javax.print.event.PrintServiceAttributeListener;
 
 public interface PrintService {
-    
     void addPrintServiceAttributeListener(PrintServiceAttributeListener listener);
 
     DocPrintJob createPrintJob();
@@ -52,19 +47,16 @@
 
     DocFlavor[] getSupportedDocFlavors();
 
-   AttributeSet getUnsupportedAttributes(DocFlavor flavor,
-            AttributeSet attributes);
+    AttributeSet getUnsupportedAttributes(DocFlavor flavor, AttributeSet attributes);
 
     int hashCode();
 
     boolean isAttributeCategorySupported(Class<? extends Attribute> category);
 
-    boolean isAttributeValueSupported(Attribute attrval, DocFlavor flavor, 
+    boolean isAttributeValueSupported(Attribute attrval, DocFlavor flavor,
             AttributeSet attributes);
 
     boolean isDocFlavorSupported(DocFlavor flavor);
 
-    void removePrintServiceAttributeListener(
-            PrintServiceAttributeListener listener);
-
-}
\ No newline at end of file
+    void removePrintServiceAttributeListener(PrintServiceAttributeListener listener);
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUI.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUI.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUI.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUI.java
Sun Oct 29 16:53:24 2006
@@ -14,14 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Irina A. Arkhipets 
- * @version $Revision: 1.4 $ 
- */ 
-
-/*
- * ServiceUI.java
- */
 
 package javax.print;
 
@@ -32,106 +24,78 @@
 import java.awt.HeadlessException;
 import java.awt.KeyboardFocusManager;
 import java.awt.Window;
-
 import javax.print.attribute.PrintRequestAttributeSet;
-
 import org.apache.harmony.x.print.ServiceUIDialog;
 
-
 public class ServiceUI {
-    
-public static PrintService printDialog(GraphicsConfiguration gc, 
-                                       int x,
-                                       int y,
-                                       PrintService [] services,
-                                       PrintService defaultService,
-                                       DocFlavor flavor,
-                                       PrintRequestAttributeSet attributes)
-        throws HeadlessException
-{
-
-    if (GraphicsEnvironment.isHeadless()) { 
-        throw new HeadlessException();
-    }
-
-    int initialIndex = checkServices(services, defaultService, attributes);
-
-    Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager()
-            .getActiveWindow();
-    Window dialogOwner = getDialogOwner(activeWindow);
-
-    ServiceUIDialog dialog = new ServiceUIDialog(gc, x, y, services,
-            initialIndex, flavor, attributes, dialogOwner);
-
-    dialog.show();
-
-    if (dialogOwner != activeWindow) {
-        dialogOwner.dispose();
-    }
-
-    if (dialog.getResult() == ServiceUIDialog.APPROVE_PRINT) {
-        attributes.clear();
-        attributes.addAll(dialog.getAttributes());
-        return dialog.getPrintService();
-    } 
-
-    return null;
-}
-
-//------------------------------------------------------------------------
-
-/*
- * This function checks services, defaultService and attributes input
- * parameters for printDialog(...) method. 
- * 
- * Returns defaultService index in services array 
- * or 0 if defaultService is null.
- * 
- * Throws IllegalArgumentException if services is null or empty, 
- * or attributes is null, or the initial PrintService is not
- * in the list of browsable services
- */
-static int checkServices(PrintService [] services, 
-                         PrintService defaultService,
-                         PrintRequestAttributeSet attributes)
-{
-    if (services == null) {
-        throw new IllegalArgumentException("Services list is null!");
-    } else if (services.length == 0) {
-        throw new IllegalArgumentException("Services list is empty!");
-    } else if (attributes == null) {
-        throw new IllegalArgumentException("Attribute set is null!");
+    public static PrintService printDialog(GraphicsConfiguration gc, int x, int y,
+            PrintService[] services, PrintService defaultService, DocFlavor flavor,
+            PrintRequestAttributeSet attributes) throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()) {
+            throw new HeadlessException();
+        }
+        int initialIndex = checkServices(services, defaultService, attributes);
+        Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager()
+                .getActiveWindow();
+        Window dialogOwner = getDialogOwner(activeWindow);
+        ServiceUIDialog dialog = new ServiceUIDialog(gc, x, y, services, initialIndex, flavor,
+                attributes, dialogOwner);
+        dialog.show();
+        if (dialogOwner != activeWindow) {
+            dialogOwner.dispose();
+        }
+        if (dialog.getResult() == ServiceUIDialog.APPROVE_PRINT) {
+            attributes.clear();
+            attributes.addAll(dialog.getAttributes());
+            return dialog.getPrintService();
+        }
+        return null;
     }
 
-    int serviceIndex = 0;
-    boolean defaultServiceFound = (defaultService == null);
-    
-    for (int i = 0; i < services.length; i++) {
-        if (services[i].equals(defaultService)) {
-            serviceIndex = i;
-            defaultServiceFound = true;
-            break;
+    /**
+     * This function checks services, defaultService and attributes input
+     * parameters for printDialog(...) method.
+     * 
+     * @return defaultService index in services array or 0 if defaultService is
+     *         null.
+     * 
+     * @throws IllegalArgumentException if services is null or empty, or
+     *         attributes is null, or the initial PrintService is not in the
+     *         list of browseable services
+     */
+    static int checkServices(PrintService[] services, PrintService defaultService,
+            PrintRequestAttributeSet attributes) {
+        if (services == null) {
+            throw new IllegalArgumentException("Services list is null!");
+        } else if (services.length == 0) {
+            throw new IllegalArgumentException("Services list is empty!");
+        } else if (attributes == null) {
+            throw new IllegalArgumentException("Attribute set is null!");
         }
-    }
-    
-    if (!defaultServiceFound) {
-        throw new IllegalArgumentException(
-                "Default service is absent in the services list!");
+        int serviceIndex = 0;
+        boolean defaultServiceFound = (defaultService == null);
+        for (int i = 0; i < services.length; i++) {
+            if (services[i].equals(defaultService)) {
+                serviceIndex = i;
+                defaultServiceFound = true;
+                break;
+            }
+        }
+        if (!defaultServiceFound) {
+            throw new IllegalArgumentException(
+                    "Default service is absent in the services list!");
+        }
+        return serviceIndex;
     }
 
-    return serviceIndex;
-}
-
-/*
- * This functions checks if current activeWindow can be parent for
- * ServiceUIDialog window.
- * 
- * Returns window if the given window is Dialog or Frame, 
- * overwise returns new Frame object.
- */
-private static Window getDialogOwner(Window window) {
-    return ((window instanceof Dialog) || (window instanceof Frame)) ? 
-            window : new Frame();
-}
-
+    /**
+     * This functions checks if current activeWindow can be parent for
+     * ServiceUIDialog window.
+     * 
+     * @return window if the given window is Dialog or Frame, otherwise returns
+     *         new Frame object.
+     */
+    private static Window getDialogOwner(Window window) {
+        return ((window instanceof Dialog) || (window instanceof Frame)) ? window : new Frame();
+    }
 } /* End of ServiceUI class */

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUIFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUIFactory.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUIFactory.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/ServiceUIFactory.java
Sun Oct 29 16:53:24 2006
@@ -14,38 +14,27 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Irina A. Arkhipets 
- * @version $Revision: 1.3 $ 
- */ 
-
-/*
- * ServiceUIFactory.java
- * 
- */
 
 package javax.print;
 
 public abstract class ServiceUIFactory {
+    public static final int ABOUT_UIROLE = 1;
 
-public static final int ABOUT_UIROLE = 1;
+    public static final int ADMIN_UIROLE = 2;
 
-public static final int ADMIN_UIROLE = 2;
+    public static final int MAIN_UIROLE = 3;
 
-public static final int MAIN_UIROLE = 3;
+    public static final int RESERVED_UIROLE = 99;
 
-public static final int RESERVED_UIROLE = 99;
+    public static final String DIALOG_UI = "java.awt.Dialog";
 
-public static final String DIALOG_UI = "java.awt.Dialog";
+    public static final String JCOMPONENT_UI = "javax.swing.JComponent";
 
-public static final String JCOMPONENT_UI = "javax.swing.JComponent";
+    public static final String JDIALOG_UI = "javax.swing.JDialog";
 
-public static final String JDIALOG_UI = "javax.swing.JDialog";
+    public static final String PANEL_UI = "java.awt.Panel";
 
-public static final String PANEL_UI = "java.awt.Panel";
+    public abstract Object getUI(int role, String ui);
 
-public abstract Object getUI(int role, String ui);
-
-public abstract String[] getUIClassNamesForRole(int role);
-
-}
\ No newline at end of file
+    public abstract String[] getUIClassNamesForRole(int role);
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/SimpleDoc.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/SimpleDoc.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/SimpleDoc.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/SimpleDoc.java
Sun Oct 29 16:53:24 2006
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.3 $ 
- */ 
 
 package javax.print;
 
@@ -27,37 +23,37 @@
 import java.io.InputStream;
 import java.io.Reader;
 import java.io.StringReader;
-
 import javax.print.attribute.DocAttributeSet;
 
 public final class SimpleDoc implements Doc {
-    
-    Object printdata;
-    DocFlavor flavor;
-    DocAttributeSet attributes;
-    Reader reader;
-    InputStream instream;
-
-    public SimpleDoc(Object printData, DocFlavor docflavor,
-            DocAttributeSet docattributes) {
-        // IllegalArgumentException - if flavor or printData is null, or the
-        // printData does not correspond to the specified doc flavor--for
-        // example, the data is not of the type specified as the representation
-        // in the DocFlavor.
+    private Object printdata;
+
+    private DocFlavor flavor;
+
+    private DocAttributeSet attributes;
+
+    private Reader reader;
+
+    private InputStream instream;
+
+    public SimpleDoc(Object printData, DocFlavor docflavor, DocAttributeSet docattributes)
{
+        /*
+         * IllegalArgumentException - if flavor or printData is null, or the
+         * printData does not correspond to the specified doc flavor--for
+         * example, the data is not of the type specified as the representation
+         * in the DocFlavor.
+         */
         if (docflavor == null || printData == null) {
             throw new IllegalArgumentException("Argument is null");
         }
         try {
-            Class claz = null;
-            claz = Class.forName(docflavor.getRepresentationClassName());
-
-            if (!claz.isInstance(printData)) {
+            Class<?> clazz = Class.forName(docflavor.getRepresentationClassName());
+            if (!clazz.isInstance(printData)) {
                 throw new IllegalArgumentException("");
             }
         } catch (Exception e) {
             throw new IllegalArgumentException("Wrong type of print data");
         }
-
         this.printdata = printData;
         this.flavor = docflavor;
         this.attributes = docattributes;
@@ -82,7 +78,6 @@
             if (reader != null) {
                 return reader;
             }
-
             if (printdata instanceof Reader) {
                 reader = (Reader) printdata;
             } else if (printdata instanceof char[]) {
@@ -99,7 +94,6 @@
             if (instream != null) {
                 return instream;
             }
-
             if (printdata instanceof InputStream) {
                 instream = (InputStream) printdata;
             } else if (printdata instanceof byte[]) {
@@ -108,4 +102,4 @@
         }
         return instream;
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintService.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintService.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintService.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintService.java
Sun Oct 29 16:53:24 2006
@@ -14,43 +14,39 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.3 $ 
- */ 
 
 package javax.print;
 
 import java.io.IOException;
 import java.io.OutputStream;
 
-public abstract class StreamPrintService implements PrintService {  
-    private OutputStream outputStream;
-    private boolean disposed ;
-    
-    protected StreamPrintService(OutputStream out){
+public abstract class StreamPrintService implements PrintService {
+    private final OutputStream outputStream;
+
+    private boolean disposed;
+
+    protected StreamPrintService(OutputStream out) {
+        super();
         outputStream = out;
         disposed = false;
-    }  
-    
-    public abstract String getOutputFormat();     
-    
-    public OutputStream getOutputStream(){
+    }
+
+    public abstract String getOutputFormat();
+
+    public OutputStream getOutputStream() {
         return outputStream;
     }
-    
-    public void dispose() {     
+
+    public void dispose() {
         try {
             outputStream.flush();
         } catch (IOException e) {
-            e.printStackTrace();            
+            e.printStackTrace();
         }
         disposed = true;
     }
-    
+
     public boolean isDisposed() {
         return disposed;
     }
 }
-
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintServiceFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintServiceFactory.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintServiceFactory.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/StreamPrintServiceFactory.java
Sun Oct 29 16:53:24 2006
@@ -14,18 +14,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Igor A. Pyankov 
- * @version $Revision: 1.3 $ 
- */ 
+
 package javax.print;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
-import java.io.IOException;
-import javax.print.DocFlavor;
-import javax.print.StreamPrintService;
-
+import java.util.List;
 import org.apache.harmony.x.print.PSStreamPrintServiceFactory;
 import org.apache.harmony.x.print.util.FactoryLocator;
 
@@ -33,7 +28,7 @@
 public abstract class StreamPrintServiceFactory {
 
     //  static part of the class
-    private static ArrayList listOfSPSFactories = new ArrayList();      
+    private static List listOfSPSFactories = new ArrayList();      
        
     
     public static StreamPrintServiceFactory[] 
@@ -41,7 +36,7 @@
                     DocFlavor flavor, String outputMimeType) {
         
         int l;
-        ArrayList selectedSPSFactories = new ArrayList();
+        ArrayList<StreamPrintServiceFactory> selectedSPSFactories = new ArrayList<StreamPrintServiceFactory>();
         StreamPrintServiceFactory factory;        
         StreamPrintServiceFactory[] a = {}; 
         
@@ -49,7 +44,7 @@
         try {
             fl.lookupAllFactories();
         } catch (IOException io) {            
-            return (StreamPrintServiceFactory[]) selectedSPSFactories.toArray(a);       
    
+            return selectedSPSFactories.toArray(a);            
         }
         listOfSPSFactories = fl.getFactoryClasses();
 
@@ -71,7 +66,7 @@
                    selectedSPSFactories.add(factory);
                }
         }
-        return (StreamPrintServiceFactory[]) selectedSPSFactories.toArray(a);
+        return selectedSPSFactories.toArray(a);
     }
     
     /*

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/URIException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/URIException.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/URIException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/URIException.java
Sun Oct 29 16:53:24 2006
@@ -14,26 +14,19 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.3 $ 
- */ 
 
 package javax.print;
 
 import java.net.URI;
 
-
 public interface URIException {
+    int URIInaccessible = 1;
 
-    static final int URIInaccessible = 1;
-
-    static final int URISchemeNotSupported = 2;
+    int URISchemeNotSupported = 2;
 
-    static final int URIOtherProblem = -1;
+    int URIOtherProblem = -1;
 
     int getReason();
 
     URI getUnsupportedURI();
-
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/util/FactoryLocator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/util/FactoryLocator.java?view=diff&rev=469038&r1=469037&r2=469038
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/util/FactoryLocator.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/util/FactoryLocator.java
Sun Oct 29 16:53:24 2006
@@ -31,13 +31,14 @@
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.List;
 
 /*
  *  auxilary class FactoryLocator 
  *  for abstract class javax.print.StreamPrintServiceFactory
  */
 public class FactoryLocator {    
-    ArrayList factoryClasses; /* List of accessible Factories */  
+    List factoryClasses; /* List of accessible Factories */  
              
     /*
      * Constructor for FactoryLocator
@@ -47,7 +48,7 @@
         factoryClasses = new ArrayList();
     }
     
-    public ArrayList getFactoryClasses(){
+    public List getFactoryClasses(){
         return  factoryClasses;
     }
     



Mime
View raw message