home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / print / ServiceDialog$OrientationPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  4.2 KB  |  137 lines

  1. package sun.print;
  2.  
  3. import java.awt.GridBagConstraints;
  4. import java.awt.GridBagLayout;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7. import javax.print.attribute.standard.OrientationRequested;
  8. import javax.swing.BorderFactory;
  9. import javax.swing.ButtonGroup;
  10. import javax.swing.JPanel;
  11.  
  12. class ServiceDialog$OrientationPanel extends JPanel implements ActionListener {
  13.    private final String strTitle;
  14.    private ServiceDialog.IconRadioButton rbPortrait;
  15.    private ServiceDialog.IconRadioButton rbLandscape;
  16.    private ServiceDialog.IconRadioButton rbRevPortrait;
  17.    private ServiceDialog.IconRadioButton rbRevLandscape;
  18.    private ServiceDialog.MarginsPanel pnlMargins;
  19.    // $FF: synthetic field
  20.    final ServiceDialog this$0;
  21.  
  22.    public ServiceDialog$OrientationPanel(ServiceDialog var1) {
  23.       this.this$0 = var1;
  24.       this.strTitle = ServiceDialog.getMsg("border.orientation");
  25.       this.pnlMargins = null;
  26.       GridBagLayout var2 = new GridBagLayout();
  27.       GridBagConstraints var3 = new GridBagConstraints();
  28.       this.setLayout(var2);
  29.       this.setBorder(BorderFactory.createTitledBorder(this.strTitle));
  30.       var3.fill = 1;
  31.       var3.insets = ServiceDialog.access$700();
  32.       var3.weighty = (double)1.0F;
  33.       var3.gridwidth = 0;
  34.       ButtonGroup var4 = new ButtonGroup();
  35.       this.rbPortrait = new ServiceDialog.IconRadioButton(var1, "radiobutton.portrait", "orientPortrait.png", true, var4, this);
  36.       this.rbPortrait.addActionListener(this);
  37.       ServiceDialog.access$300(this.rbPortrait, this, var2, var3);
  38.       this.rbLandscape = new ServiceDialog.IconRadioButton(var1, "radiobutton.landscape", "orientLandscape.png", false, var4, this);
  39.       this.rbLandscape.addActionListener(this);
  40.       ServiceDialog.access$300(this.rbLandscape, this, var2, var3);
  41.       this.rbRevPortrait = new ServiceDialog.IconRadioButton(var1, "radiobutton.revportrait", "orientRevPortrait.png", false, var4, this);
  42.       this.rbRevPortrait.addActionListener(this);
  43.       ServiceDialog.access$300(this.rbRevPortrait, this, var2, var3);
  44.       this.rbRevLandscape = new ServiceDialog.IconRadioButton(var1, "radiobutton.revlandscape", "orientRevLandscape.png", false, var4, this);
  45.       this.rbRevLandscape.addActionListener(this);
  46.       ServiceDialog.access$300(this.rbRevLandscape, this, var2, var3);
  47.    }
  48.  
  49.    public void actionPerformed(ActionEvent var1) {
  50.       Object var2 = var1.getSource();
  51.       if (this.rbPortrait.isSameAs(var2)) {
  52.          ServiceDialog.access$1200(this.this$0).add(OrientationRequested.PORTRAIT);
  53.       } else if (this.rbLandscape.isSameAs(var2)) {
  54.          ServiceDialog.access$1200(this.this$0).add(OrientationRequested.LANDSCAPE);
  55.       } else if (this.rbRevPortrait.isSameAs(var2)) {
  56.          ServiceDialog.access$1200(this.this$0).add(OrientationRequested.REVERSE_PORTRAIT);
  57.       } else if (this.rbRevLandscape.isSameAs(var2)) {
  58.          ServiceDialog.access$1200(this.this$0).add(OrientationRequested.REVERSE_LANDSCAPE);
  59.       }
  60.  
  61.       if (this.pnlMargins != null) {
  62.          this.pnlMargins.updateInfo();
  63.       }
  64.  
  65.    }
  66.  
  67.    void addOrientationListener(ServiceDialog.MarginsPanel var1) {
  68.       this.pnlMargins = var1;
  69.    }
  70.  
  71.    public void updateInfo() {
  72.       Class var1 = OrientationRequested.class;
  73.       boolean var2 = false;
  74.       boolean var3 = false;
  75.       boolean var4 = false;
  76.       boolean var5 = false;
  77.       if (ServiceDialog.access$1500(this.this$0)) {
  78.          var2 = true;
  79.          var3 = true;
  80.       } else if (ServiceDialog.access$400(this.this$0).isAttributeCategorySupported(var1)) {
  81.          Object var6 = ServiceDialog.access$400(this.this$0).getSupportedAttributeValues(var1, ServiceDialog.access$1600(this.this$0), ServiceDialog.access$1200(this.this$0));
  82.          if (var6 instanceof OrientationRequested[]) {
  83.             OrientationRequested[] var7 = (OrientationRequested[])var6;
  84.  
  85.             for(int var8 = 0; var8 < var7.length; ++var8) {
  86.                OrientationRequested var9 = var7[var8];
  87.                if (var9 == OrientationRequested.PORTRAIT) {
  88.                   var2 = true;
  89.                } else if (var9 == OrientationRequested.LANDSCAPE) {
  90.                   var3 = true;
  91.                } else if (var9 == OrientationRequested.REVERSE_PORTRAIT) {
  92.                   var4 = true;
  93.                } else if (var9 == OrientationRequested.REVERSE_LANDSCAPE) {
  94.                   var5 = true;
  95.                }
  96.             }
  97.          }
  98.       }
  99.  
  100.       this.rbPortrait.setEnabled(var2);
  101.       this.rbLandscape.setEnabled(var3);
  102.       this.rbRevPortrait.setEnabled(var4);
  103.       this.rbRevLandscape.setEnabled(var5);
  104.       OrientationRequested var10 = (OrientationRequested)ServiceDialog.access$1200(this.this$0).get(var1);
  105.       if (var10 == null || !ServiceDialog.access$400(this.this$0).isAttributeValueSupported(var10, ServiceDialog.access$1600(this.this$0), ServiceDialog.access$1200(this.this$0))) {
  106.          var10 = (OrientationRequested)ServiceDialog.access$400(this.this$0).getDefaultAttributeValue(var1);
  107.          if (!ServiceDialog.access$400(this.this$0).isAttributeValueSupported(var10, ServiceDialog.access$1600(this.this$0), ServiceDialog.access$1200(this.this$0))) {
  108.             var10 = null;
  109.             Object var11 = ServiceDialog.access$400(this.this$0).getSupportedAttributeValues(var1, ServiceDialog.access$1600(this.this$0), ServiceDialog.access$1200(this.this$0));
  110.             if (var11 instanceof OrientationRequested[]) {
  111.                OrientationRequested[] var12 = (OrientationRequested[])var11;
  112.                if (var12.length > 1) {
  113.                   var10 = var12[0];
  114.                }
  115.             }
  116.          }
  117.  
  118.          if (var10 == null) {
  119.             var10 = OrientationRequested.PORTRAIT;
  120.          }
  121.  
  122.          ServiceDialog.access$1200(this.this$0).add(var10);
  123.       }
  124.  
  125.       if (var10 == OrientationRequested.PORTRAIT) {
  126.          this.rbPortrait.setSelected(true);
  127.       } else if (var10 == OrientationRequested.LANDSCAPE) {
  128.          this.rbLandscape.setSelected(true);
  129.       } else if (var10 == OrientationRequested.REVERSE_PORTRAIT) {
  130.          this.rbRevPortrait.setSelected(true);
  131.       } else {
  132.          this.rbRevLandscape.setSelected(true);
  133.       }
  134.  
  135.    }
  136. }
  137.