Search in sources :

Example 1 with UndoableEditListener

use of javax.swing.event.UndoableEditListener in project jadx by skylot.

the class TextStandardActions method registerListeners.

private void registerListeners() {
    textComponent.addMouseListener(new MouseAdapter() {

        public void mouseReleased(MouseEvent e) {
            if (e.getModifiers() == InputEvent.BUTTON3_MASK && e.getSource() == textComponent) {
                process(e);
            }
        }
    });
    textComponent.getDocument().addUndoableEditListener(new UndoableEditListener() {

        public void undoableEditHappened(UndoableEditEvent event) {
            undoManager.addEdit(event.getEdit());
        }
    });
}
Also used : UndoableEditListener(javax.swing.event.UndoableEditListener) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) UndoableEditEvent(javax.swing.event.UndoableEditEvent)

Example 2 with UndoableEditListener

use of javax.swing.event.UndoableEditListener in project enclojure by EricThorsen.

the class ReplPanel method createReplEditorPane.

public void createReplEditorPane() {
    try {
        Var createReplEditorPaneFn = RT.var("org.enclojure.ide.repl.repl-panel", "create-repl-editor-pane");
        _replEditorPane = (JEditorPane) createReplEditorPaneFn.invoke(this);
    } catch (Exception ex) {
        Logger.getLogger(ReplPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
    // ??_replEditorPane.setInheritsPopupMenu(true);
    jScrollPaneRepl.setViewportView(_replEditorPane);
    _replEditorPane.getDocument().addUndoableEditListener(new UndoableEditListener() {

        public void undoableEditHappened(UndoableEditEvent e) {
            _undoManager.addEdit(e.getEdit());
        }
    });
    _replEditorPane.addKeyListener(new java.awt.event.KeyAdapter() {

        public void keyTyped(java.awt.event.KeyEvent evt) {
            processCharInput(evt);
        }

        public void keyPressed(java.awt.event.KeyEvent evt) {
            processKeyInput(evt);
        }
    });
}
Also used : UndoableEditListener(javax.swing.event.UndoableEditListener) Var(clojure.lang.Var) UndoableEditEvent(javax.swing.event.UndoableEditEvent) KeyEvent(java.awt.event.KeyEvent) BadLocationException(javax.swing.text.BadLocationException)

Example 3 with UndoableEditListener

use of javax.swing.event.UndoableEditListener in project vcell by virtualcell.

the class VirtualFrapMainFrame method initiateComponents.

/**
 * Initiation of the UI components that is shown in the main window
 */
protected void initiateComponents(DocumentWindowManager documentWindowManager) {
    toolBar = new ToolBar();
    toolBar.setNewAndRunButtonVisible(false);
    ToolBarHandler th = new ToolBarHandler();
    toolBar.addToolBarHandler(th);
    mb = new JMenuBar();
    frapStudyPanel = new FRAPStudyPanel();
    frapStudyPanel.addUndoableEditListener(new UndoableEditListener() {

        public void undoableEditHappened(UndoableEditEvent e) {
            if (e.getEdit().canUndo()) {
                lastUndoableEdit = e.getEdit();
                mUndo.setText(UNDO_ACTION_COMMAND + " " + e.getEdit().getUndoPresentationName());
                mUndo.setEnabled(true);
            } else {
                lastUndoableEdit = null;
                mUndo.setText(UNDO_ACTION_COMMAND);
                mUndo.setEnabled(false);
            }
        }
    });
    // System.setProperty(PropertyLoader.primarySimDataDirProperty, localWorkspace.getDefaultWorkspaceDirectory());
    // System.setProperty(PropertyLoader.secondarySimDataDirProperty, localWorkspace.getDefaultWorkspaceDirectory());
    System.setProperty(PropertyLoader.exportBaseDirInternalProperty, localWorkspace.getDefaultSimDataDirectory());
    System.setProperty(PropertyLoader.exportBaseURLProperty, "file://" + localWorkspace.getDefaultSimDataDirectory());
    frapStudyPanel.setLocalWorkspace(localWorkspace);
    frapStudyPanel.setFRAPWorkspace(frapWorkspace);
    frapStudyPanel.setDocumentWindowManager(documentWindowManager);
    // add components to the main frame
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(toolBar, BorderLayout.NORTH);
    getContentPane().add(statusBarNew, BorderLayout.SOUTH);
    getContentPane().add(frapStudyPanel);
}
Also used : UndoableEditListener(javax.swing.event.UndoableEditListener) BorderLayout(java.awt.BorderLayout) UndoableEditEvent(javax.swing.event.UndoableEditEvent) JMenuBar(javax.swing.JMenuBar)

Example 4 with UndoableEditListener

use of javax.swing.event.UndoableEditListener in project vcell by virtualcell.

the class AddShapeJPanel method init.

private void init() {
    cylAxisButtonGroup.add(cylXRadioButton);
    cylAxisButtonGroup.add(cylYRadioButton);
    cylAxisButtonGroup.add(cylZRadioButton);
    cylXRadioButton.addActionListener(shapeTypeComboBoxActionListener);
    cylYRadioButton.addActionListener(shapeTypeComboBoxActionListener);
    cylZRadioButton.addActionListener(shapeTypeComboBoxActionListener);
    comboBox.addActionListener(shapeTypeComboBoxActionListener);
    copyExpressionTextButton.setEnabled(false);
    populateShapeTypeComboBox(1);
    UndoableEditListener undoableEditListener = new UndoableEditListener() {

        public void undoableEditHappened(UndoableEditEvent e) {
            setAnalyticExprLabel();
        }
    };
    circleCenterTextField.getDocument().addUndoableEditListener(undoableEditListener);
    circleRadiusTextField.getDocument().addUndoableEditListener(undoableEditListener);
    boxLCTextField.getDocument().addUndoableEditListener(undoableEditListener);
    boxUCTextField.getDocument().addUndoableEditListener(undoableEditListener);
    ellipseCenterTextField.getDocument().addUndoableEditListener(undoableEditListener);
    axisRadiiTextField.getDocument().addUndoableEditListener(undoableEditListener);
    cylStartPointTextField.getDocument().addUndoableEditListener(undoableEditListener);
    cylRadiusTextField.getDocument().addUndoableEditListener(undoableEditListener);
    cylLengthTextField.getDocument().addUndoableEditListener(undoableEditListener);
    manualTextField.getDocument().addUndoableEditListener(undoableEditListener);
    setAnalyticExprLabel();
}
Also used : UndoableEditListener(javax.swing.event.UndoableEditListener) UndoableEditEvent(javax.swing.event.UndoableEditEvent)

Example 5 with UndoableEditListener

use of javax.swing.event.UndoableEditListener in project vcell by virtualcell.

the class EventPanel method getDelayTextField.

// private InputVerifier delayInputVerifier = new InputVerifier() {
// @Override
// public boolean verify(JComponent input) {
// boolean bValid = true;
// Exception delayException = null;
// boolean bTextNotEmpty = getDelayTextField().getText() != null && getDelayTextField().getText().trim().length() > 0;
// try{
// if (bTextNotEmpty) {
// //Use createDelay to check validity
// createDelay(getBioEvent(),getDelayTextField().getText(),getSimulationContext(),getRdbtnTrigTime().isSelected());
// }
// }catch(Exception e){
// bValid = false;
// delayException = e;
// //					e.printStackTrace();
// }
// if (bValid) {
// getDelayTextField().setBorder(UIManager.getBorder("TextField.border"));
// getDelayTextField().setToolTipText(null);
// enableTriggerRadioButtons(bTextNotEmpty);
// } else {
// getDelayTextField().setBorder(GuiConstants.ProblematicTextFieldBorder);
// getDelayTextField().setToolTipText("Error parse 'delay': "+delayException.getMessage());
// enableTriggerRadioButtons(false);
// //					SwingUtilities.invokeLater(new Runnable() {
// //					    public void run() {
// //					    	getDelayTextField().requestFocus();
// //					    }
// //					});
// }
// return bValid;
// }
// };
// ActionListener editTimerActionListener = new ActionListener() {
// private String lastEdit = null;
// @Override
// public void actionPerformed(ActionEvent e) {
// if(!delayTextField.isPopupVisible()){
// 
// }
// }
// };
// Timer editTimer;
private TextFieldAutoCompletion getDelayTextField() {
    if (delayTextField == null) {
        try {
            delayTextField = new TextFieldAutoCompletion();
            delayTextField.setName("DelayTextField");
            KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(new PropertyChangeListener() {

                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    // System.out.println(evt);
                    if (evt.getPropertyName().equals("focusOwner") && evt.getNewValue() == delayTextField) {
                    // System.out.println("-----I got Focus "+delayTextField.hashCode()+" "+(getBioEvent()==null?null:getBioEvent().hashCode()));
                    } else if (evt.getPropertyName().equals("focusOwner") && evt.getOldValue() == delayTextField && evt.getNewValue() != delayTextField) {
                        // System.out.println("-----I lost Focus "+bErrorDialog+" "+delayTextField.hashCode()+" autolist visible="+delayTextField.isPopupVisible()+" "+(getBioEvent()==null?null:getBioEvent().hashCode()));
                        if (!delayTextField.isPopupVisible()) {
                            try {
                                setNewDelay(getBioEvent(), getDelayTextField().getText(), getSimulationContext(), getRdbtnTrigTime().isSelected());
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        // System.out.println("set new delay="+(getBioEvent()==null?null:getBioEvent().getDelay()));
                        }
                    }
                // System.out.println(EventPanel.this.hashCode()+" "+evt);
                }
            });
            delayTextField.getDocument().addUndoableEditListener(new UndoableEditListener() {

                @Override
                public void undoableEditHappened(UndoableEditEvent e) {
                    if (delayTextField.getText() != null && delayTextField.getText().length() > 0) {
                        enableTriggerRadioButtons(true);
                    } else {
                        enableTriggerRadioButtons(false);
                    }
                // delayInputVerifier.verify(delayTextField);
                }
            });
            // delayTextField.addMouseListener(new MouseAdapter() {
            // @Override
            // public void mouseExited(MouseEvent e) {
            // super.mouseExited(e);
            // if(!delayTextField.isPopupVisible()){
            // delayInputVerifier.verify(delayTextField);
            // }else{
            // System.out.println("-----MouseExit");
            // }
            // }
            // });
            delayTextField.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    updateDelay();
                }
            });
        // 
        // delayTextField.setInputVerifier(delayInputVerifier);
        } catch (java.lang.Throwable e) {
            e.printStackTrace(System.out);
        }
    }
    return delayTextField;
}
Also used : UndoableEditListener(javax.swing.event.UndoableEditListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) TextFieldAutoCompletion(cbit.gui.TextFieldAutoCompletion) PropertyChangeListener(java.beans.PropertyChangeListener) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) UndoableEditEvent(javax.swing.event.UndoableEditEvent) PropertyVetoException(java.beans.PropertyVetoException) ExpressionBindingException(cbit.vcell.parser.ExpressionBindingException) ExpressionException(cbit.vcell.parser.ExpressionException)

Aggregations

UndoableEditEvent (javax.swing.event.UndoableEditEvent)5 UndoableEditListener (javax.swing.event.UndoableEditListener)5 TextFieldAutoCompletion (cbit.gui.TextFieldAutoCompletion)1 ExpressionBindingException (cbit.vcell.parser.ExpressionBindingException)1 ExpressionException (cbit.vcell.parser.ExpressionException)1 Var (clojure.lang.Var)1 BorderLayout (java.awt.BorderLayout)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 KeyEvent (java.awt.event.KeyEvent)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 PropertyVetoException (java.beans.PropertyVetoException)1 JMenuBar (javax.swing.JMenuBar)1 BadLocationException (javax.swing.text.BadLocationException)1