< prev index next >

src/java.desktop/share/classes/javax/print/ServiceUI.java

Print this page




 194             getDefaultConfiguration().getBounds() : gc.getBounds();
 195 
 196         ServiceDialog dialog;
 197         if (owner instanceof Frame) {
 198             dialog = new ServiceDialog(gc,
 199                                        x + gcBounds.x,
 200                                        y + gcBounds.y,
 201                                        services, defaultIndex,
 202                                        flavor, attributes,
 203                                        (Frame)owner);
 204         } else {
 205             dialog = new ServiceDialog(gc,
 206                                        x + gcBounds.x,
 207                                        y + gcBounds.y,
 208                                        services, defaultIndex,
 209                                        flavor, attributes,
 210                                        (Dialog)owner);
 211         }
 212         Rectangle dlgBounds = dialog.getBounds();
 213 
 214         // get union of all GC bounds
 215         GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
 216         GraphicsDevice[] gs = ge.getScreenDevices();
 217         for (int j=0; j<gs.length; j++) {
 218             gcBounds =
 219                 gcBounds.union(gs[j].getDefaultConfiguration().getBounds());
 220         }
 221 
 222         // if portion of dialog is not within the gc boundary
 223         if (!gcBounds.contains(dlgBounds)) {
 224             // put in the center relative to parent frame/dialog
 225             dialog.setLocationRelativeTo(owner);














 226         }
 227         dialog.show();
 228 
 229         if (dialog.getStatus() == ServiceDialog.APPROVE) {
 230             PrintRequestAttributeSet newas = dialog.getAttributes();
 231             Class<?> dstCategory = Destination.class;
 232             Class<?> amCategory = SunAlternateMedia.class;
 233             Class<?> fdCategory = Fidelity.class;
 234 
 235             if (attributes.containsKey(dstCategory) &&
 236                 !newas.containsKey(dstCategory))
 237             {
 238                 attributes.remove(dstCategory);
 239             }
 240 
 241             if (attributes.containsKey(amCategory) &&
 242                 !newas.containsKey(amCategory))
 243             {
 244                 attributes.remove(amCategory);
 245             }




 194             getDefaultConfiguration().getBounds() : gc.getBounds();
 195 
 196         ServiceDialog dialog;
 197         if (owner instanceof Frame) {
 198             dialog = new ServiceDialog(gc,
 199                                        x + gcBounds.x,
 200                                        y + gcBounds.y,
 201                                        services, defaultIndex,
 202                                        flavor, attributes,
 203                                        (Frame)owner);
 204         } else {
 205             dialog = new ServiceDialog(gc,
 206                                        x + gcBounds.x,
 207                                        y + gcBounds.y,
 208                                        services, defaultIndex,
 209                                        flavor, attributes,
 210                                        (Dialog)owner);
 211         }
 212         Rectangle dlgBounds = dialog.getBounds();
 213 








 214         // if portion of dialog is not within the gc boundary
 215         if (!gcBounds.contains(dlgBounds)) {
 216             
 217             // if dialog bounds exceed window bounds, positioning the dialog 
 218             // by moving it (bounds.x + bounds.width) - dlgBound.width 
 219             // If it results in dialog moving beyond the window bounds at top-left, 
 220             // then position it at window top-left
 221             if ((gcBounds.x + gcBounds.width - dlgBounds.width) > gcBounds.x) {
 222                 x = (gcBounds.x + gcBounds.width) - dlgBounds.width;                
 223             } else {
 224                 x = gcBounds.x;                
 225             }
 226             if ((gcBounds.y + gcBounds.height - dlgBounds.height) > gcBounds.y) {
 227                 y = (gcBounds.y + gcBounds.height) - dlgBounds.height;                
 228             } else {
 229                 y = gcBounds.y;                
 230             }            
 231             dialog.setBounds(x, y, dlgBounds.width, dlgBounds.height);
 232         }
 233         dialog.show();
 234 
 235         if (dialog.getStatus() == ServiceDialog.APPROVE) {
 236             PrintRequestAttributeSet newas = dialog.getAttributes();
 237             Class<?> dstCategory = Destination.class;
 238             Class<?> amCategory = SunAlternateMedia.class;
 239             Class<?> fdCategory = Fidelity.class;
 240 
 241             if (attributes.containsKey(dstCategory) &&
 242                 !newas.containsKey(dstCategory))
 243             {
 244                 attributes.remove(dstCategory);
 245             }
 246 
 247             if (attributes.containsKey(amCategory) &&
 248                 !newas.containsKey(amCategory))
 249             {
 250                 attributes.remove(amCategory);
 251             }


< prev index next >