/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { if ( validateInputs( true ) ) { setConfirmed( true ); dispose(); } } }
protected void init() { dialogSizeSettings = new DialogSizeSettings(); buttonPaneVisible = true; confirmAction = new OKAction(); cancelAction = new CancelAction(); setDefaultCloseOperation( DISPOSE_ON_CLOSE ); final JPanel contentPane = new JPanel(); contentPane.setLayout( new BorderLayout() ); buttonPanel = createButtonsPane(); contentPane.add( createContentPane(), BorderLayout.CENTER ); contentPane.add( buttonPanel, BorderLayout.SOUTH ); setContentPane( contentPane ); final InputMap inputMap = contentPane.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW ); final ActionMap actionMap = contentPane.getActionMap(); inputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, 0 ), "confirm" ); // NON-NLS inputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0 ), "cancel" ); // NON-NLS actionMap.put( "confirm", getConfirmAction() ); // NON-NLS actionMap.put( "cancel", getCancelAction() ); // NON-NLS resizeDialog(); }
public void setVisible( final boolean b ) { if ( b == false ) { dialogSizeSettings.put( getDialogId(), getBounds() ); } super.setVisible( b ); }
protected void init() { validationHandler = new ValidationHandler(); contentPane = new JPanel( new BorderLayout() ); setDefaultCloseOperation( DISPOSE_ON_CLOSE ); setTitle( Messages.getInstance().getString( "CustomPropertyEditorDialog.Title" ) ); setPreferredSize( new Dimension( 500, 550 ) ); super.init(); }
protected JPanel createButtonsPane() { final JButton button = new JButton( getConfirmAction() ); button.setDefaultCapable( true ); final JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout( new FlowLayout( FlowLayout.RIGHT, 5, 5 ) ); if ( !MacOSXIntegration.MAC_OS_X ) { buttonsPanel.add( button ); } if ( hasCancelButton() ) { buttonsPanel.add( new JButton( getCancelAction() ) ); } if ( MacOSXIntegration.MAC_OS_X ) { buttonsPanel.add( button ); } final JPanel extraPanel = new JPanel(); extraPanel.setLayout( new FlowLayout( FlowLayout.LEFT, 5, 5 ) ); final Action[] extraActions = getExtraActions(); for ( int i = 0; i < extraActions.length; i++ ) { final Action action = extraActions[ i ]; extraPanel.add( new JButton( action ) ); } final JPanel buttonsCarrierPanel = new JPanel(); buttonsCarrierPanel.setLayout( new BorderLayout( 5, 5 ) ); buttonsCarrierPanel.add( buttonsPanel, BorderLayout.EAST ); buttonsCarrierPanel.add( extraPanel, BorderLayout.WEST ); return buttonsCarrierPanel; }
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { dispose(); } }
public boolean performEdit( final PropertyEditor editor ) { if ( editor == null ) { throw new NullPointerException(); } final Object originalValue = editor.getValue(); final Component view = editor.getCustomEditor(); if ( view instanceof ValidatingPropertyEditorComponent ) { validatingView = (ValidatingPropertyEditorComponent) view; validatingView.addPropertyChangeListener( validationHandler ); } else { validatingView = null; } contentPane.removeAll(); contentPane.add( new JScrollPane( view ), BorderLayout.CENTER ); if ( super.performEdit() == false ) { try { editor.setValue( originalValue ); } catch ( Exception ex ) { // ignore .. } } if ( validatingView != null ) { validatingView.removePropertyChangeListener( validationHandler ); } return isConfirmed(); } }
public void setButtonPaneVisible( final boolean buttonPaneVisible ) { this.buttonPaneVisible = buttonPaneVisible; if ( buttonPaneVisible ) { getContentPane().add( buttonPanel, BorderLayout.SOUTH ); } else { getContentPane().remove( buttonPanel ); } }
@Override public void dispose() { close(); super.dispose(); }
public String editFormula( final String formula, final FieldDefinition[] fields ) { if ( fields == null ) { throw new NullPointerException(); } panel.setFields( fields ); if ( StringUtils.isEmpty( formula, true ) ) { panel.setFormulaText( "=" ); } else { panel.setFormulaText( formula ); } if ( !super.performEdit() ) { return null; } final String formulaText = panel.getFormulaText(); if ( StringUtils.isEmpty( formulaText, true ) || formulaText.trim().equals( "=" ) ) { return ""; } return formulaText; }
protected void init() { // focus logic currently depends on this setDefaultCloseOperation( JDialog.DISPOSE_ON_CLOSE ); fieldList = new JList( new FieldListModel() ); fieldList.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); fieldList.setCellRenderer( new FieldDefinitionCellRenderer() ); fieldList.addMouseListener( new MouseHandler() ); setTitle( Messages.getInstance().getString( "FieldSelectorDialog.Title" ) ); super.init(); }
@SuppressWarnings( "deprecation" ) public void hide() { // called from dispose() ... dialogSizeSettings.put( getDialogId(), getBounds() ); super.hide(); }
protected void init() { setTitle( ColorChooserMessages.getInstance().getString( "ColorChooserDialog.Title" ) ); colorChooserPane = new ColorChooserPane(); super.init(); }
protected void init() { setModal( true ); setTitle( Messages.getInstance().getString( "TextAreaPropertyEditorDialog.Title" ) ); textArea = createTextArea(); super.init(); }
protected void init() { setDefaultCloseOperation( JDialog.DISPOSE_ON_CLOSE ); setTitle( Messages.getInstance().getString( "FormulaEditorDialog.Title" ) ); setModal( true ); setResizable( true ); panel = new FormulaEditorPanel(); super.init(); }
protected void init() { setTitle( Messages.getInstance().getString( "ArrayCellEditorDialog.Title" ) ); tableModel = new ArrayTableModel(); table = new PropertyTable(); table.setModel( tableModel ); paletteListModel = new ArrayTableModel(); paletteListModel.setEditable( false ); paletteList = new PropertyTable(); paletteList.setModel( paletteListModel ); paletteList.setDragEnabled( true ); paletteList.setTransferHandler( new ListTransferHandler() ); paletteList.setDropMode( DropMode.ON ); paletteList.addMouseListener( new DoubleClickHandler( paletteList.getSelectionModel() ) ); contentPane = new JPanel(); contentPane.setLayout( new BorderLayout() ); super.init(); }