public static int showValidatingConfirmDialog(Component parent, String title, JComponent component, int messageType, int optionType, final JComponent defaultFocusedComponent) { if (component instanceof VerifiedInputEditor) { final VerifyingOptionPane optionPane = new VerifyingOptionPane(component, messageType, optionType) { public void selectInitialValue() { // This is overridden so that the option pane dialog default // button doesn't get the focus. if (defaultFocusedComponent != null) { defaultFocusedComponent.requestFocusInWindow(); } } }; final InputVerificationStatusChangedListener verificationListener = optionPane::setOKEnabled; ((VerifiedInputEditor) component).addStatusChangedListener(verificationListener); final JDialog dlg = createDialog(parent, title, optionPane, defaultFocusedComponent); dlg.setModal(true); dlg.setVisible(true); return getReturnValueAsInteger(optionPane); } else { logger.warn("Component should implement VerifiedInputEditor for validating dialog to work. " + "Using normal dialog with no validating"); return showConfirmDialog(parent, title, component, messageType, optionType, null); } }
public void componentHidden(ComponentEvent e) { Object retVal = optionPane.getValue(); editorComponent.setPreferredSize(editorComponent.getSize()); if (retVal != null && retVal.equals(JOptionPane.OK_OPTION)) { handler.handleEditFinished(editor); } setSelectedValue(frameObject, true); if (editor instanceof VerifiedInputEditor) { ((VerifiedInputEditor) editor).removeStatusChangedListener(verificationListener); } // editor.dispose(); if (isRowEditor) { editor.dispose(); } } });
((VerifiedInputEditor) component).addStatusChangedListener(verificationListener);
public void componentHidden(ComponentEvent e) { Object retVal = optionPane.getValue(); editorComponent.setPreferredSize(editorComponent.getSize()); if (retVal != null && retVal.equals(JOptionPane.OK_OPTION)) { handler.handleEditFinished(editor); } setSelectedValue(frameObject, true); if (editor instanceof VerifiedInputEditor) { ((VerifiedInputEditor) editor).removeStatusChangedListener(verificationListener); } // editor.dispose(); if (isRowEditor) { editor.dispose(); } } });
public static int showValidatingConfirmDialog(Component parent, String title, JComponent component, int messageType, int optionType, final JComponent defaultFocusedComponent) { if (component instanceof VerifiedInputEditor){ final VerifyingOptionPane optionPane = new VerifyingOptionPane(component, messageType, optionType) { /** * */ private static final long serialVersionUID = 7128847118051849761L; public void selectInitialValue() { // This is overridden so that the option pane dialog default // button doesn't get the focus. } }; final InputVerificationStatusChangedListener verificationListener = new InputVerificationStatusChangedListener() { public void verifiedStatusChanged(boolean verified) { optionPane.setOKEnabled(verified); } }; ((VerifiedInputEditor) component).addStatusChangedListener(verificationListener); final JDialog dlg = createDialog(parent, title, optionPane, defaultFocusedComponent); dlg.setModal(true); dlg.setVisible(true); return getReturnValue(optionPane); } else{ logger.warn("Component should implement VerifiedInputEditor for validating dialog to work. " + "Using normal dialog with no validating"); return showConfirmDialog(parent, title, component, messageType, optionType, null); } }
public void componentHidden(ComponentEvent e) { Object retVal = optionPane.getValue(); editorComponent.setPreferredSize(editorComponent.getSize()); if (retVal != null && retVal.equals(JOptionPane.OK_OPTION)) { handler.handleEditFinished(editor); } setSelectedValue(frameObject, true); if (editor instanceof VerifiedInputEditor) { ((VerifiedInputEditor) editor).removeStatusChangedListener(verificationListener); } // editor.dispose(); if (isRowEditor) { editor.dispose(); } } });
((VerifiedInputEditor) editor).addStatusChangedListener(verificationListener);
public void componentHidden(ComponentEvent e) { Object retVal = optionPane.getValue(); editorComponent.setPreferredSize(editorComponent.getSize()); if (retVal != null && retVal.equals(JOptionPane.OK_OPTION)) { handler.handleEditFinished(editor); } setSelectedValue(frameObject, true); if (editor instanceof VerifiedInputEditor) { ((VerifiedInputEditor) editor) .removeStatusChangedListener(verificationListener); } // editor.dispose(); if (isRowEditor) { editor.dispose(); } } });
.addStatusChangedListener(verificationListener);
((VerifiedInputEditor) editor).addStatusChangedListener(verificationListener);
((VerifiedInputEditor) editor).addStatusChangedListener(verificationListener);