本文整理汇总了Java中javax.print.attribute.PrintServiceAttributeSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java PrintServiceAttributeSet.add方法的具体用法?Java PrintServiceAttributeSet.add怎么用?Java PrintServiceAttributeSet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.print.attribute.PrintServiceAttributeSet
的用法示例。
在下文中一共展示了PrintServiceAttributeSet.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUpdatedAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
public PrintServiceAttributeSet getUpdatedAttributes() {
PrintServiceAttributeSet currSet = getDynamicAttributes();
if (lastSet == null) {
lastSet = currSet;
return AttributeSetUtilities.unmodifiableView(currSet);
} else {
PrintServiceAttributeSet updates =
new HashPrintServiceAttributeSet();
Attribute []attrs = currSet.toArray();
for (int i=0; i<attrs.length; i++) {
Attribute attr = attrs[i];
if (!lastSet.containsValue(attr)) {
updates.add(attr);
}
}
lastSet = currSet;
return AttributeSetUtilities.unmodifiableView(updates);
}
}
示例2: getAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
public PrintServiceAttributeSet getAttributes() {
PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
attrs.add(getPrinterName());
attrs.add(getPrinterIsAcceptingJobs());
PrinterState prnState = getPrinterState();
if (prnState != null) {
attrs.add(prnState);
}
PrinterStateReasons prnStateReasons = getPrinterStateReasons();
if (prnStateReasons != null) {
attrs.add(prnStateReasons);
}
attrs.add(getQueuedJobCount());
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_COLOR) != 0) {
attrs.add(ColorSupported.SUPPORTED);
} else {
attrs.add(ColorSupported.NOT_SUPPORTED);
}
return AttributeSetUtilities.unmodifiableView(attrs);
}
示例3: getUpdatedAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
public PrintServiceAttributeSet getUpdatedAttributes() {
PrintServiceAttributeSet currSet = getDynamicAttributes();
if (lastSet == null) {
lastSet = currSet;
return AttributeSetUtilities.unmodifiableView(currSet);
} else {
PrintServiceAttributeSet updates =
new HashPrintServiceAttributeSet();
Attribute []attrs = currSet.toArray();
Attribute attr;
for (int i=0; i<attrs.length; i++) {
attr = attrs[i];
if (!lastSet.containsValue(attr)) {
updates.add(attr);
}
}
lastSet = currSet;
return AttributeSetUtilities.unmodifiableView(updates);
}
}
示例4: getAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
/**
* @see javax.print.PrintService#getAttributes()
*/
public PrintServiceAttributeSet getAttributes()
{
PrintServiceAttributeSet set = new HashPrintServiceAttributeSet();
for (Set<Attribute> attrSet : printerAttr.values())
{
for (Attribute attr : attrSet)
{
if (attr instanceof PrintServiceAttribute)
set.add(attr);
}
}
return AttributeSetUtilities.unmodifiableView(set);
}
示例5: getAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
/**
* @see javax.print.PrintService#getAttributes()
*/
public PrintServiceAttributeSet getAttributes()
{
PrintServiceAttributeSet set = new HashPrintServiceAttributeSet();
Iterator it = printerAttr.values().iterator();
while (it.hasNext())
{
Iterator it2 = ((Set) it.next()).iterator();
while (it2.hasNext())
{
Attribute attr = (Attribute) it2.next();
if (attr instanceof PrintServiceAttribute)
set.add(attr);
}
}
return AttributeSetUtilities.unmodifiableView(set);
}
示例6: getAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
public PrintServiceAttributeSet getAttributes() {
PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
attrs.add(getPrinterName());
attrs.add(getPrinterIsAcceptingJobs());
PrinterState prnState = getPrinterState();
if (prnState != null) {
attrs.add(prnState);
}
PrinterStateReasons prnStateReasons = getPrinterStateReasons();
if (prnStateReasons != null) {
attrs.add(prnStateReasons);
}
attrs.add(getQueuedJobCount());
return AttributeSetUtilities.unmodifiableView(attrs);
}
示例7: getAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
@Override
public PrintServiceAttributeSet getAttributes(){
PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
attrs.add(getPrinterName());
PrinterIsAcceptingJobs acptJobs = getAttribute(PrinterIsAcceptingJobs.class);
if(acptJobs != null){
attrs.add(acptJobs);
}
PrinterState prnState = getAttribute(PrinterState.class);
if(prnState != null){
attrs.add(prnState);
}
PrinterStateReasons prnStateReasons = getAttribute(PrinterStateReasons.class);
if(prnStateReasons != null){
attrs.add(prnStateReasons);
}
QueuedJobCount jobCount = getAttribute(QueuedJobCount.class);
if(jobCount != null){
attrs.add(jobCount);
}
// TODO: Seems to be more accurate than settings.get_SupportsColor(), which doesn't work for CutePDF
if(settings.get_DefaultPageSettings().get_Color()){
attrs.add(ColorSupported.SUPPORTED);
}else{
attrs.add(ColorSupported.NOT_SUPPORTED);
}
return AttributeSetUtilities.unmodifiableView(attrs);
}
示例8: testHashPrintServiceAttributeSet
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
public void testHashPrintServiceAttributeSet() {
startTest("HashPrintJobAttributeSet class testing...");
PrintServiceAttributeSet set1 = new HashPrintServiceAttributeSet();
PrintServiceAttributeSet set2 = new HashPrintServiceAttributeSet(
ColorSupported.SUPPORTED);
PrintServiceAttributeSet set3 = new HashPrintServiceAttributeSet(set2);
PrinterLocation location = new PrinterLocation("room 222", Locale.ENGLISH);
PrintServiceAttribute [] arr = { location,
ColorSupported.SUPPORTED };
PrintServiceAttributeSet set4 = new HashPrintServiceAttributeSet(arr);
assertTrue(set1.isEmpty());
assertFalse(set2.isEmpty());
assertTrue(set3.equals(set2));
assertFalse(set3.equals(set1));
set3.clear();
assertEquals(set3, set1);
set3.add(ColorSupported.SUPPORTED);
set3.add(location);
assertTrue(set3.containsKey(location.getClass()));
assertFalse(set2.containsKey(MediaName.NA_LETTER_WHITE.getClass()));
assertTrue(set4.equals(set3));
assertEquals(set3.get(location.getClass()), location);
set1.addAll(set3);
assertEquals(set3, set1);
set1.remove(location.getClass());
assertEquals(set1.size(), 1);
}
示例9: getUpdatedAttributeSet
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
private PrintServiceAttributeSet getUpdatedAttributeSet(
PrintServiceAttributeSet oldSet, PrintServiceAttributeSet newSet) {
Attribute[] newAttributes = newSet.toArray();
PrintServiceAttributeSet updated = new HashPrintServiceAttributeSet();
for (int i = 0; i < newAttributes.length; i++) {
if (!oldSet.containsValue(newAttributes[i])) {
updated.add(newAttributes[i]);
}
}
return updated;
}
示例10: getAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
public PrintServiceAttributeSet getAttributes() {
PrintServiceAttributeSet attributes =
new HashPrintServiceAttributeSet();
attributes.add(new PrinterName(serviceName, Locale.getDefault()));
if (getColorSupported(serviceName)) {
attributes.add(ColorSupported.SUPPORTED);
int colorPPM = getPagesPerMinuteColor(serviceName);
if (colorPPM > 0) {
attributes.add(new PagesPerMinuteColor(colorPPM));
}
} else {
attributes.add(ColorSupported.NOT_SUPPORTED);
}
int pagesPerMinute = getPagesPerMinute(serviceName);
if (pagesPerMinute > 0) {
attributes.add(new PagesPerMinute(pagesPerMinute));
}
String printerLocation = getPrinterLocation(serviceName);
if (printerLocation != null) {
attributes.add(new PrinterLocation(printerLocation,
Locale.getDefault()));
}
int acceptingJobs = getPrinterIsAcceptingJobs(serviceName);
if (acceptingJobs == 0) {
attributes.add(PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS);
} else if (acceptingJobs == 1) {
attributes.add(PrinterIsAcceptingJobs.ACCEPTING_JOBS);
}
int jobCount = getQueuedJobCount(serviceName);
if (jobCount >= 0) {
attributes.add(new QueuedJobCount(jobCount));
}
return attributes;
}
示例11: getAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
public PrintServiceAttributeSet getAttributes() {
final PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
attrs.add(new PrinterName(printerName, null));
try {
attrs.add(WinPrinterFactory.getPrinterState(getPrinterHandle()));
attrs.add(WinPrinterFactory.getQueuedJobCount(getPrinterHandle()));
} catch (final PrintException ex) {
throw new RuntimeException(ex);
}
return AttributeSetUtilities.unmodifiableView(attrs);
}
示例12: getDynamicAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
private PrintServiceAttributeSet getDynamicAttributes() {
PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
attrs.add(getPrinterIsAcceptingJobs());
attrs.add(getQueuedJobCount());
return attrs;
}
示例13: getSysVServiceAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
private PrintServiceAttributeSet getSysVServiceAttributes() {
PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
attrs.add(getQueuedJobCountSysV());
attrs.add(getPrinterIsAcceptingJobsSysV());
return attrs;
}
示例14: getBSDServiceAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
private PrintServiceAttributeSet getBSDServiceAttributes() {
PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
attrs.add(getQueuedJobCountBSD());
attrs.add(getPrinterIsAcceptingJobsBSD());
return attrs;
}
示例15: getAIXServiceAttributes
import javax.print.attribute.PrintServiceAttributeSet; //导入方法依赖的package包/类
private PrintServiceAttributeSet getAIXServiceAttributes() {
PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
attrs.add(getQueuedJobCountAIX());
attrs.add(getPrinterIsAcceptingJobsAIX());
return attrs;
}