?? printertablemodel.java
字號:
package jp.co.ntl.swing.ext.printer.printer;
import java.util.Vector;
import jp.co.ntl.printer.PrinterInfo2;
import jp.co.ntl.swing.ext.AbstractInfoTableModel;
public class PrinterTableModel extends AbstractInfoTableModel {
/**
*
*/
private static final long serialVersionUID = 1L;
private final String columnPrinter;
private final String columnPlace;
private final String columnDevice;
private final String columnOutput;
private final String columnMethod;
private final String columnColor;
private final String columnPrinterGroup;
private final String columnGroup;
public PrinterTableModel(Vector vcPrinterInfo) {
super(vcPrinterInfo);
this.columnPrinter = Resource.getString(Resource.LIST_PRINTER);
this.columnPlace = Resource.getString(Resource.LIST_PLACE);
this.columnDevice = Resource.getString(Resource.LIST_DEVICE);
this.columnOutput = Resource.getString(Resource.LIST_OUTPUT);
this.columnMethod = Resource.getString(Resource.LIST_METHOD);
this.columnColor = Resource.getString(Resource.LIST_COLOR);
this.columnPrinterGroup = Resource.getString(Resource.LIST_PRINTERGROUP);
this.columnGroup = Resource.getString(Resource.LIST_GROUP);
this.columnNames = new String[] {
columnPrinter,
columnPlace,
columnDevice,
columnOutput,
columnMethod,
columnColor,
columnPrinterGroup,
columnGroup
};
}
public Object getValueAt(int row, int column) {
if (vcInfo == null) {
return null;
}
if (row >= vcInfo.size()) {
return null;
}
if (column >= columnNames.length) {
return null;
}
PrinterInfo2 prnInfo = (PrinterInfo2)vcInfo.get(row);
String name = columnNames[column];
if (name.equals(columnPrinter)) {
return prnInfo.getName();
} else if (name.equals(columnPlace)) {
return prnInfo.getPlaceInfo().getPlace();
} else if (name.equals(columnDevice)) {
return prnInfo.getDeviceName();
} else if (name.equals(columnOutput)) {
switch (prnInfo.getOutputKind()) {
case PrinterInfo2.OUTPUT_KIND_OS:
return Resource.getString(Resource.OUTPUT_STANDARD);
case PrinterInfo2.OUTPUT_KIND_LPR:
return Resource.getString(Resource.OUTPUT_LPR);
case PrinterInfo2.OUTPUT_KIND_FTP:
return Resource.getString(Resource.OUTPUT_FTP);
}
} else if (name.equals(columnMethod)) {
switch (prnInfo.getMethod()) {
case PrinterInfo2.PRINT_CONTROL_DIRECT:
return Resource.getString(Resource.METHOD_DIRECT);
case PrinterInfo2.PRINT_CONTROL_ONDEMAND:
return Resource.getString(Resource.METHOD_ONDEMAND);
}
} else if (name.equals(columnColor)) {
switch (prnInfo.getColorModel()) {
case PrinterInfo2.MONO:
return Resource.getString(Resource.COLOR_MONO);
case PrinterInfo2.COLOR:
return Resource.getString(Resource.COLOR_COLOR);
/* case PrinterInfo2.FULLCOLOR:
return Resource.getString(Resource.COLOR_FULLCOLOR);*/
}
} else if (name.equals(columnPrinterGroup)) {
return prnInfo.getPrinterGInfo().getPrinterGName();
} else if (name.equals(columnGroup)) {
return prnInfo.getGroupInfo().getName();
}
return "";
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -