/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4910388 4871089 4998624
* @summary Confirm that
* 1. After choosing Reverse Landscape in the system default print
* Print Service (2nd in the list), it
* will reset to portrait in "Test Printer"
* 2. Print To File button is not cleared when switching between the
* 2nd service (system default printer) and Test Printer.
* 3. Make sure "Postscript" printer is the default and make sure the
* "print to file" button is disabled. File Dialog should not be
* shown after pressing print button.
*
*/
public class ServiceDialogTest {
/**
* Constructor
*/
public ServiceDialogTest() {
super();
}
/**
* Starts the application.
*/
try {
f = new File("streamexample.ps");
fos = new FileOutputStream(f);
StreamPrintServiceFactory[] factories = StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor, mType);
} else {
}
//System.out.println("is "+flavor+" supported? "+services[0].isDocFlavorSupported(flavor));
//System.out.println("is Orientation supported? "+services[0].isAttributeCategorySupported(OrientationRequested.class));
//System.out.println("is REVERSE PORTRAIT supported ? "+services[0].isAttributeValueSupported(OrientationRequested.REVERSE_PORTRAIT, flavor, null));
PrintService selService = ServiceUI.printDialog(null, 200, 200, services, services[0], flavor, prSet);
}
//DocPrintJob pj = service.createPrintJob();
//PrintDocument prDoc = new PrintDocument();
//pj.print(prDoc, null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
{
});
});
});
public TestPrintService() {
}
if (printerName == null) {
throw new IllegalArgumentException("null printer name");
} else {
}
}
{
return printer;
}
{
return null;
}
{
return null;
}
public void addPrintServiceAttributeListener(PrintServiceAttributeListener printserviceattributelistener)
{
}
public void removePrintServiceAttributeListener(PrintServiceAttributeListener printserviceattributelistener)
{
}
{
return null;
}
{
return aSet;
}
{
int i = supportedDocFlavors.length;
return adocflavor;
}
{
return true;
}
}
return false;
}
{
int i = otherAttrCats.length;
return aclass;
}
{
throw new NullPointerException("null category");
}
if (category == otherAttrCats[i]) {
return true;
}
}
return false;
}
public boolean isAttributeValueSupported(Attribute attrval, DocFlavor flavor, AttributeSet attributes) {
return true;
return true;
else
return false;
}
{
throw new NullPointerException("null category");
}
return new Copies(1);
return OrientationRequested.PORTRAIT;
return null;
}
public Object getSupportedAttributeValues(Class category, DocFlavor docflavor, AttributeSet attributeset)
{
throw new NullPointerException("null category");
}
if (!isDocFlavorSupported(docflavor)) {
}
}
if (!isAttributeCategorySupported(category)) {
return null;
}
}
return req;
}
return null;
}
}
if (attributeset == null) {
return null;
}
try {
} else {
}
}
}
catch (ClassCastException classcastexception) {
}
}
if (hashattributeset.isEmpty()) {
return null;
}
return hashattributeset;
}
return null;
}
return "Printer : " + getName();
}
return obj == this || (obj instanceof TestPrintService) && ((TestPrintService)obj).getName().equals(getName());
}
public int hashCode() {
}
}