public Window getWindow() { if ( parent != null ) { return LibSwingUtil.getWindowAncestor( parent ); } return null; }
public boolean showData( final TableModel rawTableModel ) { if ( rawTableModel == null ) { // User must have hit cancel return true; } LibSwingUtil.centerDialogInParent( this ); table.setModel( rawTableModel ); setVisible( true ); return false; } }
/** * Positions the specified dialog within its parent. * * @param dialog the dialog to be positioned on the screen. */ public static void centerDialogInParent( final Dialog dialog ) { positionDialogRelativeToParent( dialog, 0.5, 0.5 ); }
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { if ( fieldSelectorDialog == null ) { final Window w = LibSwingUtil.getWindowAncestor( parent ); if ( w instanceof Frame ) { this.fieldSelectorDialog = new FieldSelectorDialog( (Frame) w ); LibSwingUtil.positionDialogRelativeToParent( this.fieldSelectorDialog, 0.5, 0.5 ); } else if ( w instanceof Dialog ) { this.fieldSelectorDialog = new FieldSelectorDialog( (Dialog) w ); LibSwingUtil.positionDialogRelativeToParent( this.fieldSelectorDialog, 0.5, 0.5 ); } else { this.fieldSelectorDialog = new FieldSelectorDialog(); LibSwingUtil.positionDialogRelativeToParent( this.fieldSelectorDialog, 0.5, 0.5 ); } } final FieldDefinition[] fields = fieldDefinitionSource.getFields(); if ( fields != null ) { this.fieldSelectorDialog.setFields( fields ); } fieldSelectorDialog.setFocusReturn( focusReturn ); fieldSelectorDialog.removePropertyChangeListener ( FieldSelectorDialog.SELECTED_DEFINITION_PROPERTY, selectorUpdateHandler ); fieldSelectorDialog.setSelectedDefinition( null ); fieldSelectorDialog.addPropertyChangeListener( FieldSelectorDialog.SELECTED_DEFINITION_PROPERTY, selectorUpdateHandler ); fieldSelectorDialog.setVisible( true ); }
public boolean configure( final PreviewPane reportPane ) { if ( aboutFrame == null ) { final String title = getDisplayName(); // look where we have been added ... final Window w = LibSwingUtil.getWindowAncestor( reportPane ); if ( w instanceof Frame ) { aboutFrame = new AboutDialog( (Frame) w, title, ClassicEngineInfo.getInstance() ); } else if ( w instanceof Dialog ) { aboutFrame = new AboutDialog( (Dialog) w, title, ClassicEngineInfo.getInstance() ); } else { aboutFrame = new AboutDialog( title, ClassicEngineInfo.getInstance() ); } aboutFrame.pack(); LibSwingUtil.centerFrameOnScreen( aboutFrame ); } aboutFrame.setVisible( true ); aboutFrame.requestFocus(); return true; }
final Window window = LibSwingUtil.getWindowAncestor( parent ); final ExceptionDialog defaultDialog; if ( window instanceof Frame ) { defaultDialog.adjustSize(); defaultDialog.setModal( true ); LibSwingUtil.centerDialogInParent( defaultDialog ); defaultDialog.setVisible( true );
public static void showDialog( final MasterReport report ) { if ( GraphicsEnvironment.isHeadless() ) { return; } final PreviewDialog dialog = new PreviewDialog( report ); dialog.setModal( true ); dialog.pack(); LibSwingUtil.centerFrameOnScreen( dialog ); dialog.setVisible( true ); }
/** * Creates the progress dialog that monitors the export process. * * @return the progress monitor dialog. */ protected ReportProgressDialog createProgressDialog() { final ReportProgressDialog progressDialog = super.createProgressDialog(); progressDialog.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); progressDialog.setMessage( resources.getString( "html-export.progressdialog.message" ) ); //$NON-NLS-1$ progressDialog.pack(); LibSwingUtil.positionFrameRandomly( progressDialog ); return progressDialog; }
/** * Positions the specified frame in the middle of the screen. * * @param frame the frame to be centered on the screen. */ public static void centerFrameOnScreen( final Window frame ) { positionFrameOnScreen( frame, 0.5, 0.5 ); }
public Rectangle get( final String key ) { final String value = properties.get( key, null ); if ( value == null ) { return null; } return LibSwingUtil.parseRectangle( value ); }
public void put( final String key, final Rectangle value ) { if ( key == null ) { throw new IllegalArgumentException( "key must not be null" ); } if ( value == null ) { properties.remove( key ); } else { properties.put( key, LibSwingUtil.rectangleToString( value ) ); } }
protected void resizeDialog() { final Rectangle rectangle = dialogSizeSettings.get( getDialogId() ); if ( rectangle != null ) { if ( LibSwingUtil.safeRestoreWindow( this, rectangle ) ) { // paranoid safety net to ensure that we have sensible sizes if ( getWidth() > 50 && getHeight() > 50 ) { return; } } } performInitialResize(); }
protected void showCrosstabDialog() { MasterReport crosstabReport = createCrosstabReport( createTableModel() ); if ( crosstabReport == null ) { return; } PreviewDialog dialog = new PreviewDialog( configureReport( crosstabReport, false ) ); dialog.setModal( true ); dialog.pack(); LibSwingUtil.centerFrameOnScreen( dialog ); dialog.setVisible( true ); } }
/** * Creates the progress dialog that monitors the export process. * * @return the progress monitor dialog. */ protected ReportProgressDialog createProgressDialog() { final ReportProgressDialog progressDialog = super.createProgressDialog(); progressDialog.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); progressDialog.setMessage( resources.getString( "rtf-export.progressdialog.message" ) ); //$NON-NLS-1$ progressDialog.pack(); LibSwingUtil.positionFrameRandomly( progressDialog ); return progressDialog; }
/** * Positions the specified frame at a random location on the screen while ensuring that the entire frame is visible * (provided that the frame is smaller than the screen). * * @param frame the frame. */ public static void positionFrameRandomly( final Window frame ) { //noinspection UnsecureRandomNumberGeneration positionFrameOnScreen( frame, Math.random(), Math.random() ); }
public Window getWindow() { return LibSwingUtil.getWindowAncestor( PreviewPane.this ); }
protected void performInitialResize() { pack(); LibSwingUtil.centerDialogInParent( this ); }
protected void showRelationalGeneratorDialog() { MasterReport relationalReport = createRelationalReport( createTableModel(), "cell", "row-b", "row-a", "column-a", "column-b" ); PreviewDialog dialog = new PreviewDialog( configureReport( relationalReport, false ) ); dialog.setModal( true ); dialog.pack(); LibSwingUtil.centerFrameOnScreen( dialog ); dialog.setVisible( true ); }
/** * Creates the progress dialog that monitors the export process. * * @return the progress monitor dialog. */ protected ReportProgressDialog createProgressDialog() { final ReportProgressDialog progressDialog = super.createProgressDialog(); progressDialog.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); progressDialog.setMessage( resources.getString( "plaintext-export.progressdialog.message" ) ); //$NON-NLS-1$ progressDialog.pack(); LibSwingUtil.positionFrameRandomly( progressDialog ); return progressDialog; }
final Container parent = dialog.getParent(); if ( parent == null || ( parent.isVisible() == false ) ) { positionFrameOnScreen( dialog, horizontalPercent, verticalPercent ); return;