home *** CD-ROM | disk | FTP | other *** search
Wrap
package sun.awt.print; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; import java.awt.Dialog; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; import java.awt.JobAttributes; import java.awt.PageAttributes; import java.awt.PrintJob; import java.awt.Toolkit; import java.awt.Window; import java.awt.JobAttributes.DefaultSelectionType; import java.awt.JobAttributes.DestinationType; import java.awt.JobAttributes.SidesType; import java.awt.PageAttributes.ColorType; import java.awt.PageAttributes.OrientationRequestedType; import java.awt.PageAttributes.PrintQualityType; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.net.URL; import java.security.AccessController; import java.util.EventObject; import java.util.MissingResourceException; import java.util.ResourceBundle; import javax.swing.ButtonGroup; import javax.swing.DefaultComboBoxModel; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTabbedPane; import javax.swing.JTextField; public class PrintDialog extends JDialog implements PrinterListUpdatable, ItemListener, ActionListener { private static String[] sortedPrinterList = null; private Frame parent; private PrintControl printControl; private PrintJob printJob; private String fileName = ""; private int minPage = 0; private int maxPage = Integer.MAX_VALUE; private JTabbedPane tabs; private JPanel printPanel; private JLabel pagesLabel; private ButtonGroup selectionGroup; private JRadioButton selectionAllRB; private JRadioButton selectionRangeRB; private JPanel panelSelection; private NumericField selectionFromText; private JLabel selectionToLabel; private NumericField selectionToText; private JRadioButton selectionSelectionRB; private JLabel copiesLabel; private NumericField copiesText; private JCheckBox collateCB; private JLabel optionsLabel; private JCheckBox titleSheetCB; private JTextField titleSheetText; private JLabel commandsLabel; private JTextField commandsText; private JLabel printToLabel; private ButtonGroup printDestGroup; private JRadioButton printerRB; private JComboBox printerCmB; private JRadioButton fileRB; private JPanel spacingPanel1; private JPanel spacingPanel2; private JPanel propertiesPanel; private JLabel orientationLabel; private ButtonGroup orientationGroup; private JPanel portraitPanel; private JRadioButton portraitRB; private OrientationLabel portraitLabel; private JPanel landscapePanel; private JRadioButton landscapeRB; private OrientationLabel landscapeLabel; private JLabel colorLabel; private ButtonGroup colorGroup; private JRadioButton colorRB; private JRadioButton monochromeRB; private JLabel paperLabel; private JComboBox paperCmB; private JCheckBox duplexCB; private JCheckBox tumbleCB; private JLabel qualityLabel; private ButtonGroup qualityGroup; private JRadioButton highQualityRB; private JRadioButton normalQualityRB; private JRadioButton draftQualityRB; private JPanel spacingPanel3; private JPanel buttonPanel; private JPanel buttonLeftPanel; private JPanel buttonRightPanel; private JButton printButton; private JButton cancelButton; private JButton helpButton; private ImageIcon landscapeIcon; private ImageIcon portraitIcon; private static ResourceBundle messageRB; private static final MediaString[] ALL_SIZES; private static final DefaultComboBoxModel ALL_SIZES_MODEL; // $FF: synthetic field static Class class$sun$awt$print$PrintDialog; static void initResource() { AccessController.doPrivileged(new 1()); } static String getMsg(String var0) { try { return messageRB.getString(var0); } catch (MissingResourceException var2) { throw new Error("Fatal: Resource for PrintDialog is broken, There is no " + var0 + " key in resource"); } } static char getMnemonic(String var0) { String var1 = getMsg(var0 + ".mnemonic"); return var1 != null && var1.length() > 0 ? var1.charAt(0) : '\u0000'; } static URL getImageResource(String var0) { try { return (class$sun$awt$print$PrintDialog == null ? (class$sun$awt$print$PrintDialog = class$("sun.awt.print.PrintDialog")) : class$sun$awt$print$PrintDialog).getResource("resources/" + var0); } catch (MissingResourceException var2) { throw new Error("Fatal: Resource for PrintDialog is broken, There is no " + var0 + " key in resource"); } } public PrintDialog(Frame var1, PrintControl var2) { super(var1, getMsg("dialog.title"), true); this.parent = var1; this.printControl = var2; ((JDialog)this).setDefaultCloseOperation(1); ((JDialog)this).getContentPane().setLayout(new BorderLayout(6, 6)); this.tabs = new JTabbedPane(); ((JDialog)this).getContentPane().add("Center", this.tabs); this.printPanel = new JPanel(new GridBagLayout()); this.initPrintPanel(); this.tabs.add(this.printPanel); this.propertiesPanel = new JPanel(new GridBagLayout()); this.initPropertiesPanel(); this.tabs.add(this.propertiesPanel); this.tabs.setSelectedIndex(0); this.tabs.setSelectedComponent(this.printPanel); this.tabs.setTitleAt(0, getMsg("tab.print")); this.tabs.setTitleAt(1, getMsg("tab.properties")); this.buttonPanel = new JPanel(new GridLayout(1, 1, 6, 6)); ((JDialog)this).getContentPane().add("South", this.buttonPanel); this.buttonLeftPanel = new JPanel(new FlowLayout(1, 5, 5)); this.buttonPanel.add(this.buttonLeftPanel); this.buttonRightPanel = new JPanel(new GridLayout(1, 3, 6, 6)); this.buttonPanel.add(this.buttonRightPanel); this.buttonRightPanel.add(new JPanel()); this.printButton = new JButton(getMsg("button.print")); this.printButton.setMnemonic(getMnemonic("button.print")); this.printButton.addActionListener(this); this.buttonRightPanel.add(this.printButton); this.cancelButton = new JButton(getMsg("button.cancel")); this.cancelButton.addActionListener(this); this.buttonRightPanel.add(this.cancelButton); this.helpButton = new JButton(getMsg("button.help")); this.helpButton.addActionListener(this); this.paperCmB.setPreferredSize(new Dimension(370, 20)); this.printerCmB.setPreferredSize(new Dimension(100, 20)); ((Dialog)this).setResizable(false); ((JDialog)this).getRootPane().setDefaultButton(this.printButton); this.setDefaultPrinter(); ((Window)this).pack(); ((JDialog)this).setLocationRelativeTo(var1); } private void addComponent(JComponent var1, Container var2, int var3, int var4, int var5, int var6, int var7, int var8, int var9, int var10, Insets var11) { GridBagConstraints var12 = new GridBagConstraints(); var12.gridx = var3; var12.gridy = var4; var12.gridwidth = var5; var12.gridheight = var6; var12.anchor = var9; var12.fill = var10; var12.insets = var11; var12.weightx = (double)var7; var12.weighty = (double)var8; var2.add(var1, var12); } private void initPrintPanel() { this.pagesLabel = new JLabel(getMsg("label.pages")); this.addComponent(this.pagesLabel, this.printPanel, 0, 0, 1, 1, 1, 1, 10, 2, new Insets(3, 6, 0, 0)); this.selectionGroup = new ButtonGroup(); this.selectionAllRB = new JRadioButton(getMsg("radiobutton.all")); this.selectionAllRB.setMnemonic(getMnemonic("radiobutton.all")); this.addComponent(this.selectionAllRB, this.printPanel, 1, 0, 1, 1, 1, 1, 10, 2, new Insets(3, 6, 0, 0)); this.selectionGroup.add(this.selectionAllRB); this.selectionRangeRB = new JRadioButton(getMsg("radiobutton.range")); this.selectionRangeRB.setMnemonic(getMnemonic("radiobutton.range")); this.selectionRangeRB.addItemListener(this); this.addComponent(this.selectionRangeRB, this.printPanel, 1, 1, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 0, 0)); this.selectionGroup.add(this.selectionRangeRB); this.selectionSelectionRB = new JRadioButton(getMsg("radiobutton.selection")); this.selectionSelectionRB.setMnemonic(getMnemonic("radiobutton.selection")); this.addComponent(this.selectionSelectionRB, this.printPanel, 1, 2, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 5, 0)); this.selectionGroup.add(this.selectionSelectionRB); this.panelSelection = new JPanel(new GridLayout(1, 1, 0, 0)); this.addComponent(this.panelSelection, this.printPanel, 2, 1, 1, 1, 0, 1, 10, 2, new Insets(0, 0, 0, 0)); this.selectionFromText = new NumericField(); this.selectionFromText.setEnabled(false); this.panelSelection.add(this.selectionFromText); this.selectionToLabel = new JLabel(getMsg("label.selection"), 0); this.selectionToLabel.setForeground(this.selectionSelectionRB.getForeground()); this.panelSelection.add(this.selectionToLabel); this.selectionToText = new NumericField(); this.selectionToText.setEnabled(false); this.panelSelection.add(this.selectionToText); this.copiesText = new NumericField(); this.addComponent(this.copiesText, this.printPanel, 1, 3, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 5, 5)); this.copiesLabel = new JLabel(getMsg("label.copies")); this.copiesLabel.setDisplayedMnemonic(getMnemonic("label.copies")); this.copiesLabel.setLabelFor(this.copiesText); this.addComponent(this.copiesLabel, this.printPanel, 0, 3, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 6, 0)); this.collateCB = new JCheckBox(getMsg("checkbox.collate")); this.collateCB.setMnemonic(getMnemonic("checkbox.collate")); this.addComponent(this.collateCB, this.printPanel, 2, 3, 1, 1, 1, 1, 10, 2, new Insets(0, 0, 6, 0)); this.optionsLabel = new JLabel(getMsg("label.options")); this.addComponent(this.optionsLabel, this.printPanel, 0, 4, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 0, 0)); this.titleSheetCB = new JCheckBox(getMsg("checkbox.titlesheet")); this.titleSheetCB.setMnemonic(getMnemonic("checkbox.titlesheet")); this.titleSheetCB.addItemListener(this); this.addComponent(this.titleSheetCB, this.printPanel, 1, 4, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 0, 0)); this.titleSheetText = new JTextField(); this.addComponent(this.titleSheetText, this.printPanel, 2, 4, 3, 1, 3, 1, 10, 2, new Insets(0, 0, 0, 6)); this.commandsText = new JTextField(); this.addComponent(this.commandsText, this.printPanel, 2, 5, 3, 1, 3, 1, 10, 2, new Insets(0, 0, 5, 6)); this.commandsLabel = new JLabel(getMsg("label.commands")); this.commandsLabel.setDisplayedMnemonic(getMnemonic("label.commands")); this.commandsLabel.setLabelFor(this.commandsText); this.addComponent(this.commandsLabel, this.printPanel, 1, 5, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 5, 0)); this.printToLabel = new JLabel(getMsg("label.printdest")); this.addComponent(this.printToLabel, this.printPanel, 0, 6, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 0, 0)); this.printDestGroup = new ButtonGroup(); this.printerRB = new JRadioButton(getMsg("radiobutton.printer")); this.printerRB.setMnemonic(getMnemonic("radiobutton.printer")); this.printerRB.addItemListener(this); this.addComponent(this.printerRB, this.printPanel, 1, 6, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 0, 0)); this.printDestGroup.add(this.printerRB); this.printerCmB = new JComboBox(); this.printerCmB.setEditable(true); this.printerCmB.addItemListener(this); this.printerCmB.setModel(new LoadingPrintersCBModel(this)); this.addComponent(this.printerCmB, this.printPanel, 2, 6, 3, 1, 1, 1, 10, 2, new Insets(0, 0, 0, 6)); this.fileRB = new JRadioButton(getMsg("radiobutton.file")); this.fileRB.setMnemonic(getMnemonic("radiobutton.file")); this.fileRB.addItemListener(this); this.addComponent(this.fileRB, this.printPanel, 1, 7, 1, 1, 1, 1, 10, 2, new Insets(0, 6, 5, 0)); this.printDestGroup.add(this.fileRB); this.spacingPanel1 = new JPanel(); this.addComponent(this.spacingPanel1, this.printPanel, 3, 1, 0, 1, 50, 1, 10, 0, new Insets(0, 0, 0, 0)); this.spacingPanel2 = new JPanel(); this.addComponent(this.spacingPanel2, this.printPanel, 0, 8, 1, 2, 0, 80, 10, 0, new Insets(0, 0, 0, 0)); } private void initPropertiesPanel() { this.orientationLabel = new JLabel(getMsg("label.orientation")); this.addComponent(this.orientationLabel, this.propertiesPanel, 0, 0, 1, 1, 1, 0, 10, 2, new Insets(6, 6, 0, 0)); this.orientationGroup = new ButtonGroup(); this.portraitPanel = new JPanel(new FlowLayout(0, 0, 0)); this.addComponent(this.portraitPanel, this.propertiesPanel, 1, 0, 1, 1, 1, 0, 10, 2, new Insets(6, 1, 0, 0)); this.portraitRB = new JRadioButton(); this.portraitRB.setHorizontalAlignment(0); this.portraitPanel.add(this.portraitRB); this.orientationGroup.add(this.portraitRB); this.portraitLabel = new OrientationLabel(this, "label.portrait", this.portraitRB); this.portraitLabel.setForeground(this.portraitRB.getForeground()); this.portraitIcon = new ImageIcon(getImageResource("orientPortrait.gif")); this.portraitLabel.setIcon(this.portraitIcon); this.portraitPanel.add(this.portraitLabel); this.landscapePanel = new JPanel(new FlowLayout(0, 0, 0)); this.addComponent(this.landscapePanel, this.propertiesPanel, 1, 1, 1, 1, 0, 0, 10, 2, new Insets(0, 1, 0, 0)); this.landscapeRB = new JRadioButton(); this.landscapeRB.setHorizontalAlignment(0); this.landscapePanel.add(this.landscapeRB); this.orientationGroup.add(this.landscapeRB); this.landscapeLabel = new OrientationLabel(this, "label.landscape", this.landscapeRB); this.landscapeLabel.setForeground(this.landscapeRB.getForeground()); this.landscapeIcon = new ImageIcon(getImageResource("orientLandscape.gif")); this.landscapeLabel.setIcon(this.landscapeIcon); this.landscapePanel.add(this.landscapeLabel); this.colorLabel = new JLabel(getMsg("label.color")); this.addComponent(this.colorLabel, this.propertiesPanel, 0, 2, 1, 1, 1, 0, 10, 2, new Insets(0, 6, 0, 0)); this.colorGroup = new ButtonGroup(); this.colorRB = new JRadioButton(getMsg("radiobutton.color")); this.colorRB.setMnemonic(getMnemonic("radiobutton.color")); this.addComponent(this.colorRB, this.propertiesPanel, 1, 2, 1, 1, 1, 0, 10, 2, new Insets(6, 6, 0, 0)); this.colorGroup.add(this.colorRB); this.monochromeRB = new JRadioButton(getMsg("radiobutton.monochrome")); this.monochromeRB.setMnemonic(getMnemonic("radiobutton.monochrome")); this.addComponent(this.monochromeRB, this.propertiesPanel, 1, 3, 1, 1, 1, 0, 10, 2, new Insets(0, 6, 5, 0)); this.colorGroup.add(this.monochromeRB); this.paperCmB = new JComboBox(); this.paperCmB.setModel(ALL_SIZES_MODEL); this.addComponent(this.paperCmB, this.propertiesPanel, 1, 4, 2, 1, 60, 0, 10, 2, new Insets(0, 6, 0, 0)); this.paperLabel = new JLabel(getMsg("label.paper")); this.paperLabel.setDisplayedMnemonic(getMnemonic("label.paper")); this.paperLabel.setLabelFor(this.paperCmB); this.addComponent(this.paperLabel, this.propertiesPanel, 0, 4, 1, 1, 1, 0, 10, 2, new Insets(0, 6, 0, 0)); this.duplexCB = new JCheckBox(getMsg("checkbox.duplex")); this.duplexCB.setMnemonic(getMnemonic("checkbox.duplex")); this.duplexCB.addItemListener(this); this.addComponent(this.duplexCB, this.propertiesPanel, 1, 5, 1, 1, 0, 0, 10, 2, new Insets(0, 6, 0, 0)); this.tumbleCB = new JCheckBox(getMsg("checkbox.tumble")); this.tumbleCB.setMnemonic(getMnemonic("checkbox.tumble")); this.addComponent(this.tumbleCB, this.propertiesPanel, 1, 6, 1, 1, 0, 0, 10, 2, new Insets(0, 22, 5, 0)); this.qualityLabel = new JLabel(getMsg("label.quality")); this.addComponent(this.qualityLabel, this.propertiesPanel, 0, 7, 1, 1, 1, 0, 10, 2, new Insets(0, 6, 0, 0)); this.qualityGroup = new ButtonGroup(); this.highQualityRB = new JRadioButton(getMsg("radiobutton.highq")); this.highQualityRB.setMnemonic(getMnemonic("radiobutton.highq")); this.addComponent(this.highQualityRB, this.propertiesPanel, 1, 7, 1, 1, 1, 0, 10, 2, new Insets(0, 6, 0, 0)); this.qualityGroup.add(this.highQualityRB); this.normalQualityRB = new JRadioButton(getMsg("radiobutton.normalq")); this.normalQualityRB.setMnemonic(getMnemonic("radiobutton.normalq")); this.addComponent(this.normalQualityRB, this.propertiesPanel, 1, 8, 1, 1, 1, 0, 10, 2, new Insets(0, 6, 0, 0)); this.qualityGroup.add(this.normalQualityRB); this.draftQualityRB = new JRadioButton(getMsg("radiobutton.draftq")); this.draftQualityRB.setMnemonic(getMnemonic("radiobutton.draftq")); this.addComponent(this.draftQualityRB, this.propertiesPanel, 1, 9, 1, 1, 0, 0, 10, 2, new Insets(0, 6, 0, 0)); this.qualityGroup.add(this.draftQualityRB); this.spacingPanel3 = new JPanel(); this.addComponent(this.spacingPanel3, this.propertiesPanel, 3, 0, 1, 1, 100, 0, 10, 0, new Insets(0, 0, 0, 0)); } private void setDefaultPrinter() { String var1 = this.printControl.getDefaultPrinterName(); if (sortedPrinterList == null) { if (var1 != null) { this.printerCmB.insertItemAt(var1, 0); } } else { this.printerCmB.setModel(new DefaultComboBoxModel(sortedPrinterList)); if (var1 != null) { this.printerCmB.setSelectedItem(var1); } } if (var1 != null) { PrinterCapabilities var2 = new PrinterCapabilities(var1); this.updatePrinterCaps(this.printControl.getCapabilities(var2) ? var2 : null); } else { this.updatePrinterCaps((PrinterCapabilities)null); } this.printControl.getPrinterList(this); } public PrintJob getPrintJob() { ((Component)this).setVisible(true); PrintJob var1 = this.printJob; this.printJob = null; return var1; } public JobAttributes.SidesType getSides() { if (this.duplexCB.isSelected()) { return this.tumbleCB.isSelected() ? SidesType.TWO_SIDED_SHORT_EDGE : SidesType.TWO_SIDED_LONG_EDGE; } else { return SidesType.ONE_SIDED; } } public void setSides(JobAttributes.SidesType var1) { boolean var2 = var1 != SidesType.ONE_SIDED; this.duplexCB.setSelected(var2); if (var2) { this.tumbleCB.setSelected(var1 == SidesType.TWO_SIDED_SHORT_EDGE); } } public String getDocumentTitle() { return this.titleSheetCB.isSelected() ? this.titleSheetText.getText() : null; } public void setDocumentTitle(String var1) { boolean var2 = var1 != null; this.titleSheetCB.setSelected(var2); if (var2) { this.titleSheetText.setText(var1); } else { this.titleSheetText.setText(""); } } public JobAttributes.DestinationType getDestType() { return this.printerRB.isSelected() ? DestinationType.PRINTER : DestinationType.FILE; } public void setDestType(JobAttributes.DestinationType var1) { if (var1 == DestinationType.PRINTER) { this.printerRB.setSelected(true); } else { this.fileRB.setSelected(true); } } public String getDestString(JobAttributes.DestinationType var1) { return var1 == DestinationType.PRINTER ? this.printerCmB.getSelectedItem().toString() : this.fileName; } public void setDestString(JobAttributes.DestinationType var1, String var2) { if (var1 == DestinationType.PRINTER) { this.printerCmB.setSelectedItem(var2); } else { this.fileName = var2 == null ? "" : var2; } } public String getOptionsString() { return this.commandsText.getText(); } public void setOptionsString(String var1) { this.commandsText.setText(var1); } public JobAttributes.DefaultSelectionType getPrintRange() { if (this.selectionAllRB.isSelected()) { return DefaultSelectionType.ALL; } else { return this.selectionRangeRB.isSelected() ? DefaultSelectionType.RANGE : DefaultSelectionType.SELECTION; } } public void setPrintRange(JobAttributes.DefaultSelectionType var1) { if (var1 == DefaultSelectionType.ALL) { this.selectionAllRB.setSelected(true); } else if (var1 == DefaultSelectionType.RANGE) { this.selectionRangeRB.setSelected(true); } else { this.selectionSelectionRB.setSelected(true); } } public void setMinMaxPage(int var1, int var2) { if (this.minPage != var1 || this.maxPage != var2) { this.minPage = var1; this.maxPage = var2; if (this.getFromPage() < var1) { this.setFromPage(var1); } if (this.getToPage() > var2) { this.setToPage(var2); } } } public int getFromPage() { try { return this.selectionFromText.getValue(); } catch (NumberFormatException var2) { return 0; } } public void setFromPage(int var1) { this.selectionFromText.setValue(var1); } public int getToPage() { try { return this.selectionToText.getValue(); } catch (NumberFormatException var2) { return 0; } } public void setToPage(int var1) { this.selectionToText.setValue(var1); } public int getCopies() { try { return this.copiesText.getValue(); } catch (NumberFormatException var2) { return 0; } } public void setCopies(int var1) { this.copiesText.setValue(var1); } public boolean getCollate() { return this.collateCB.isSelected(); } public void setCollate(boolean var1) { this.collateCB.setSelected(var1); } public PageAttributes.MediaType getMedia() { return ((MediaString)this.paperCmB.getSelectedItem()).media; } public void setMedia(PageAttributes.MediaType var1) { this.paperCmB.setSelectedItem(new MediaString(var1)); } public PageAttributes.OrientationRequestedType getOrientation() { return this.portraitRB.isSelected() ? OrientationRequestedType.PORTRAIT : OrientationRequestedType.LANDSCAPE; } public void setOrientation(PageAttributes.OrientationRequestedType var1) { if (var1 == OrientationRequestedType.PORTRAIT) { this.portraitRB.setSelected(true); } else { this.landscapeRB.setSelected(true); } } public PageAttributes.ColorType getColor() { return this.colorRB.isSelected() ? ColorType.COLOR : ColorType.MONOCHROME; } public void setColor(PageAttributes.ColorType var1) { if (var1 == ColorType.COLOR) { this.colorRB.setSelected(true); } else { this.monochromeRB.setSelected(true); } } public PageAttributes.PrintQualityType getQuality() { if (this.highQualityRB.isSelected()) { return PrintQualityType.HIGH; } else { return this.normalQualityRB.isSelected() ? PrintQualityType.NORMAL : PrintQualityType.DRAFT; } } public void setQuality(PageAttributes.PrintQualityType var1) { if (var1 == PrintQualityType.HIGH) { this.highQualityRB.setSelected(true); } else if (var1 == PrintQualityType.NORMAL) { this.normalQualityRB.setSelected(true); } else { this.draftQualityRB.setSelected(true); } } private void updatePrinterCaps(PrinterCapabilities var1) { if (var1 != null) { long var2 = var1.getCapabilities(); if ((var2 & 1L) != 0L) { this.colorRB.setEnabled(true); this.monochromeRB.setEnabled(true); } else { this.monochromeRB.setSelected(true); this.colorRB.setEnabled(false); this.monochromeRB.setEnabled(false); } if ((var2 & 2L) != 0L) { this.duplexCB.setEnabled(true); this.tumbleCB.setEnabled(this.duplexCB.isSelected()); } else { this.tumbleCB.setSelected(false); this.duplexCB.setSelected(false); this.tumbleCB.setEnabled(false); this.duplexCB.setEnabled(false); } if ((var2 & 4L) == 0L) { this.paperCmB.setModel(ALL_SIZES_MODEL); } else { DefaultComboBoxModel var4 = (DefaultComboBoxModel)var1.getUserData(); if (var4 == null) { int[] var5 = var1.getSizes(); MediaString[] var6 = new MediaString[var5.length]; for(int var7 = 0; var7 < var5.length; ++var7) { var6[var7] = new MediaString(PrintControl.SIZES[var5[var7]]); } var4 = new DefaultComboBoxModel(var6); var1.setUserData(var4); } this.paperCmB.setModel(var4); } this.setMedia(PrintControl.SIZES[this.printControl.getMediaAttrib()]); } else { this.colorRB.setEnabled(true); this.monochromeRB.setEnabled(true); this.paperCmB.setModel(ALL_SIZES_MODEL); this.duplexCB.setEnabled(true); this.tumbleCB.setEnabled(this.duplexCB.isSelected()); } this.duplexCB.repaint(); this.tumbleCB.repaint(); this.colorRB.repaint(); this.monochromeRB.repaint(); this.paperCmB.repaint(); } public void updatePrinterList(String[] var1) { if (var1 == null || var1 != sortedPrinterList) { sortedPrinterList = var1; EventQueue.invokeLater(new 2(this)); } } public void itemStateChanged(ItemEvent var1) { Object var2 = ((EventObject)var1).getSource(); if (var2 == this.selectionRangeRB) { boolean var3 = this.selectionRangeRB.isSelected(); this.selectionFromText.setEnabled(var3); this.selectionToText.setEnabled(var3); } else if (var2 == this.titleSheetCB) { this.titleSheetText.setEnabled(this.titleSheetCB.isSelected()); } else if (var2 != this.printerRB && var2 != this.fileRB) { if (var2 == this.duplexCB) { this.tumbleCB.setEnabled(this.duplexCB.isSelected()); } else { String var6 = (String)this.printerCmB.getEditor().getItem(); if (var6 != null) { PrinterCapabilities var7 = new PrinterCapabilities(var6); this.updatePrinterCaps(this.printControl.getCapabilities(var7) ? var7 : null); } else { this.updatePrinterCaps((PrinterCapabilities)null); } } } else { boolean var5 = this.printerRB.isSelected(); this.printerCmB.setEnabled(var5); String var4 = var5 ? "button.print" : "button.save"; this.printButton.setText(getMsg(var4)); this.printButton.setMnemonic(getMnemonic(var4)); } } public void actionPerformed(ActionEvent var1) { Object var2 = ((EventObject)var1).getSource(); if (var2 == this.printButton) { if (this.printerRB.isSelected()) { this.actionPrint(); } else { this.actionSave(); } } else if (var2 == this.cancelButton) { ((Component)this).setVisible(false); } } private void actionPrint() { if (this.getPrintRange() == DefaultSelectionType.RANGE) { int var1 = this.getFromPage(); if (var1 < this.minPage || var1 > this.maxPage) { this.selectionFromText.selectAll(); this.selectionFromText.requestFocus(); Toolkit.getDefaultToolkit().beep(); return; } int var2 = this.getToPage(); if (var2 < this.minPage || var2 > this.maxPage || var2 < var1) { this.selectionToText.selectAll(); this.selectionToText.requestFocus(); Toolkit.getDefaultToolkit().beep(); return; } } if (this.getCopies() < 1) { this.copiesText.selectAll(); this.copiesText.requestFocus(); Toolkit.getDefaultToolkit().beep(); } else { try { this.printJob = this.printControl.createPrintJob(this); } catch (IllegalArgumentException var4) { PrintStatusDialog var6 = new PrintStatusDialog(this, getMsg("printstatus.error"), getMsg("printstatus.notfound"), getMsg("button.ok")); ((JDialog)var6).setLocationRelativeTo(this); ((Component)var6).setVisible(true); this.printJob = null; } catch (InternalError var5) { if (!((Throwable)var5).getMessage().equals("No default printer installed")) { throw var5; } PrintStatusDialog var3 = new PrintStatusDialog(this, getMsg("printstatus.error"), getMsg("printstatus.noprinters"), getMsg("button.ok")); ((JDialog)var3).setLocationRelativeTo(this); ((Component)var3).setVisible(true); this.printJob = null; } if (this.printJob != null) { ((Component)this).setVisible(false); } } } public void setPrintToFileEnabled(boolean var1) { this.fileRB.setEnabled(var1); } private void actionSave() { SaveFileChooser var1 = (SaveFileChooser)AccessController.doPrivileged(new 3(this)); if (((JFileChooser)var1).showSaveDialog(this.parent) == 0) { this.fileName = var1.getFileName(); this.actionPrint(); } } public static void main(String[] var0) { JFrame var1 = new JFrame(); PrintDialog var2 = new PrintDialog(var1, (PrintControl)null); ((Window)var2).addWindowListener(new 4()); ((Component)var2).setVisible(true); } // $FF: synthetic method static ResourceBundle access$002(ResourceBundle var0) { messageRB = var0; return var0; } // $FF: synthetic method static Class class$(String var0) { try { return Class.forName(var0); } catch (ClassNotFoundException var2) { throw new NoClassDefFoundError(((Throwable)var2).getMessage()); } } // $FF: synthetic method static JComboBox access$100(PrintDialog var0) { return var0.printerCmB; } // $FF: synthetic method static String[] access$200() { return sortedPrinterList; } // $FF: synthetic method static String access$300(PrintDialog var0) { return var0.fileName; } static { ALL_SIZES = new MediaString[PrintControl.SIZES.length]; initResource(); for(int var0 = 0; var0 < ALL_SIZES.length; ++var0) { ALL_SIZES[var0] = new MediaString(PrintControl.SIZES[var0]); } ALL_SIZES_MODEL = new DefaultComboBoxModel(ALL_SIZES); } }