Search in sources :

Example 1 with BaseDialog

use of com.ramussoft.gui.common.BaseDialog in project ramus by Vitaliy-Yakovchuk.

the class QualifierPreferencesPanel method showDialog.

public void showDialog() {
    dialog = new BaseDialog(framework.getMainFrame(), true) {

        /**
         */
        private static final long serialVersionUID = -8447199076378835917L;

        @Override
        protected void onOk() {
            if (QualifierPreferencesPanel.this.ok())
                super.onOk();
        }
    };
    dialog.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/ramussoft/gui/table/qualifier.png")));
    dialog.setTitle(GlobalResourcesManager.getString("QialifierPreferenciesDialog.Title"));
    dialog.setMainPane(this);
    dialog.pack();
    dialog.setLocationRelativeTo(null);
    Options.loadOptions("QualifierPreferencesDialog", dialog);
    dialog.getOKButton().setEnabled(rules.canUpdateQualifier(qualifier.getId()));
    dialog.setVisible(true);
    Options.saveOptions("QualifierPreferencesDialog", dialog);
    attributeEditor.close();
}
Also used : BaseDialog(com.ramussoft.gui.common.BaseDialog)

Example 2 with BaseDialog

use of com.ramussoft.gui.common.BaseDialog in project ramus by Vitaliy-Yakovchuk.

the class QualifierSelectComponent method showDialog.

public List<Qualifier> showDialog(JFrame frame, JPanel jPanel, Object constraints) {
    final List<Qualifier> result = new ArrayList<Qualifier>();
    BaseDialog dialog = new BaseDialog(frame, true) {

        /**
         */
        private static final long serialVersionUID = -2166014042175217388L;

        @Override
        protected void onOk() {
            result.addAll(getSelected());
            super.onOk();
        }
    };
    dialog.setTitle(GlobalResourcesManager.getString("QualifierView"));
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(this, BorderLayout.CENTER);
    if (jPanel != null) {
        panel.add(jPanel, constraints);
    }
    dialog.setMainPane(panel);
    dialog.pack();
    dialog.setLocationRelativeTo(frame);
    dialog.setMinimumSize(dialog.getSize());
    Options.loadOptions(dialog);
    dialog.setVisible(true);
    Options.saveOptions(dialog);
    return result;
}
Also used : BaseDialog(com.ramussoft.gui.common.BaseDialog) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier)

Example 3 with BaseDialog

use of com.ramussoft.gui.common.BaseDialog in project ramus by Vitaliy-Yakovchuk.

the class IconPreviewPanel method select.

public IconPersistent select(JFrame frame) {
    BaseDialog dialog = new BaseDialog(frame, true) {

        /**
         */
        private static final long serialVersionUID = 1L;

        @Override
        protected void onOk() {
            super.onOk();
            res = getSelectedValue();
        }
    };
    dialog.setTitle(GlobalResourcesManager.getString("IconPreviewDialog.Title"));
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setMainPane(this);
    dialog.pack();
    dialog.setLocationRelativeTo(null);
    Options.loadOptions(dialog);
    dialog.setVisible(true);
    Options.saveOptions(dialog);
    return res;
}
Also used : BaseDialog(com.ramussoft.gui.common.BaseDialog)

Example 4 with BaseDialog

use of com.ramussoft.gui.common.BaseDialog in project ramus by Vitaliy-Yakovchuk.

the class ClientPlugin method getActionDescriptors.

@Override
public ActionDescriptor[] getActionDescriptors() {
    ActionDescriptor changePassword = new ActionDescriptor();
    changePassword.setAction(new AbstractAction() {

        /**
         */
        private static final long serialVersionUID = 1388478861191637977L;

        {
            putValue(ACTION_COMMAND_KEY, "Action.ChangePassword");
        }

        public void actionPerformed(ActionEvent e) {
            final JPasswordField oldPassword = new JPasswordField();
            final JPasswordField newPassword = new JPasswordField();
            final JPasswordField conformNewPassword = new JPasswordField();
            double[][] size = { { 5, TableLayout.FILL, 5 }, { 5, TableLayout.FILL, 5, TableLayout.FILL, 5, TableLayout.FILL, 5, TableLayout.FILL, 5, TableLayout.FILL, 5, TableLayout.FILL, 5 } };
            final JPanel panel = new JPanel(new TableLayout(size));
            panel.add(new JLabel(getString("Message.OldPassword")), "1,1");
            panel.add(oldPassword, "1,3");
            panel.add(new JLabel(getString("Message.NewPassword")), "1,5");
            panel.add(newPassword, "1,7");
            panel.add(new JLabel(getString("Message.ConformNewPassword")), "1,9");
            panel.add(conformNewPassword, "1,11");
            BaseDialog dialog = new BaseDialog(framework.getMainFrame(), true) {

                {
                    setTitle(getString("ChangePasswordDialog.Title"));
                    setMainPane(panel);
                }

                /**
                 */
                private static final long serialVersionUID = 1L;

                @Override
                protected void onOk() {
                    if (!Arrays.equals(newPassword.getPassword(), conformNewPassword.getPassword())) {
                        JOptionPane.showMessageDialog(framework.getMainFrame(), getString("Message.ConforPasswordsFailded"));
                        return;
                    }
                    User user = provider.me();
                    if (Arrays.equals(user.getPassword().toCharArray(), oldPassword.getPassword())) {
                        provider.changePassword(new String(newPassword.getPassword()));
                        super.onOk();
                    } else {
                        JOptionPane.showMessageDialog(framework.getMainFrame(), getString("Message.OldPasswordWrong"));
                    }
                }
            };
            dialog.pack();
            dialog.setResizable(false);
            dialog.setLocationRelativeTo(null);
            dialog.setVisible(true);
        }
    });
    changePassword.setMenu("Net");
    ActionDescriptor refresh = new ActionDescriptor();
    refreshAction.putValue(Action.ACTION_COMMAND_KEY, "Refresh");
    refreshAction.putValue(Action.SMALL_ICON, getIcon("/com/ramussoft/gui/refresh.png"));
    // refreshAction.putValue(Action.LARGE_ICON_KEY,
    // getIcon("/com/ramussoft/gui/22x22/refresh.png"));
    refresh.setAction(refreshAction);
    refresh.setMenu("Edit");
    refresh.setToolBar("Edit");
    if (refreshSupport)
        return new ActionDescriptor[] { changePassword, refresh };
    else
        return new ActionDescriptor[] { changePassword };
}
Also used : JPanel(javax.swing.JPanel) BaseDialog(com.ramussoft.gui.common.BaseDialog) User(com.ramussoft.net.common.User) JPasswordField(javax.swing.JPasswordField) ActionEvent(java.awt.event.ActionEvent) ActionDescriptor(com.ramussoft.gui.common.ActionDescriptor) JLabel(javax.swing.JLabel) AbstractAction(javax.swing.AbstractAction) TableLayout(info.clearthought.layout.TableLayout)

Example 5 with BaseDialog

use of com.ramussoft.gui.common.BaseDialog in project ramus by Vitaliy-Yakovchuk.

the class ChartSourceSelectPanel method showDialog.

public boolean showDialog() {
    res = false;
    BaseDialog dialog = new BaseDialog(framework.getMainFrame(), true) {

        /**
         */
        private static final long serialVersionUID = 8037833645038528124L;

        @Override
        protected void onOk() {
            if (qualifierSelectPanel != null)
                saveSelectedElements();
            close();
            res = true;
            super.onOk();
        }
    };
    dialog.setMainPane(this);
    dialog.pack();
    dialog.setLocationRelativeTo(null);
    Options.loadOptions(dialog);
    dialog.setVisible(true);
    return res;
}
Also used : BaseDialog(com.ramussoft.gui.common.BaseDialog)

Aggregations

BaseDialog (com.ramussoft.gui.common.BaseDialog)8 JPanel (javax.swing.JPanel)4 BorderLayout (java.awt.BorderLayout)3 ArrayList (java.util.ArrayList)3 Qualifier (com.ramussoft.common.Qualifier)2 Row (com.ramussoft.database.common.Row)2 ActionEvent (java.awt.event.ActionEvent)2 AbstractAction (javax.swing.AbstractAction)2 JComponent (javax.swing.JComponent)2 Attribute (com.ramussoft.common.Attribute)1 RowSet (com.ramussoft.database.common.RowSet)1 OtherElementTableCellEditor (com.ramussoft.gui.attribute.OtherElementTableCellEditor)1 PopupRowWrapper (com.ramussoft.gui.attribute.OtherElementTableCellEditor.PopupRowWrapper)1 ActionDescriptor (com.ramussoft.gui.common.ActionDescriptor)1 RowTreeTableComponent (com.ramussoft.gui.qualifier.table.RowTreeTableComponent)1 SelectableTableView (com.ramussoft.gui.qualifier.table.SelectableTableView)1 User (com.ramussoft.net.common.User)1 TableLayout (info.clearthought.layout.TableLayout)1 Component (java.awt.Component)1 Dimension (java.awt.Dimension)1