Search in sources :

Example 1 with JPopupTextField

use of com.jsql.view.swing.text.JPopupTextField in project jsql-injection by ron190.

the class NodeModelTable method buildMenu.

@Override
protected void buildMenu(JPopupMenu2 tablePopupMenu, final TreePath path) {
    JMenuItem menuItemCheckAll = new JMenuItem(I18nView.valueByKey("COLUMNS_CHECK_ALL"), 'C');
    I18nView.addComponentForKey("COLUMNS_CHECK_ALL", menuItemCheckAll);
    JMenuItem menuItemUncheckAll = new JMenuItem(I18nView.valueByKey("COLUMNS_UNCHECK_ALL"), 'U');
    I18nView.addComponentForKey("COLUMNS_UNCHECK_ALL", menuItemUncheckAll);
    menuItemCheckAll.setIcon(HelperUi.ICON_EMPTY);
    menuItemUncheckAll.setIcon(HelperUi.ICON_EMPTY);
    if (!this.isLoaded()) {
        menuItemCheckAll.setEnabled(false);
        menuItemUncheckAll.setEnabled(false);
    }
    class ActionCheckbox implements ActionListener {

        private boolean isCheckboxesSelected;

        ActionCheckbox(boolean isCheckboxesSelected) {
            this.isCheckboxesSelected = isCheckboxesSelected;
        }

        @Override
        public void actionPerformed(ActionEvent arg0) {
            final DefaultMutableTreeNode currentTableNode = (DefaultMutableTreeNode) path.getLastPathComponent();
            final AbstractNodeModel currentTableModel = (AbstractNodeModel) currentTableNode.getUserObject();
            DefaultTreeModel treeModel = (DefaultTreeModel) MediatorGui.treeDatabase().getModel();
            int tableChildCount = treeModel.getChildCount(currentTableNode);
            for (int i = 0; i < tableChildCount; i++) {
                DefaultMutableTreeNode currentChild = (DefaultMutableTreeNode) treeModel.getChild(currentTableNode, i);
                if (currentChild.getUserObject() instanceof AbstractNodeModel) {
                    AbstractNodeModel columnTreeNodeModel = (AbstractNodeModel) currentChild.getUserObject();
                    columnTreeNodeModel.setSelected(this.isCheckboxesSelected);
                    currentTableModel.setContainingSelection(this.isCheckboxesSelected);
                }
            }
            treeModel.nodeChanged(currentTableNode);
        }
    }
    class ActionCheckAll extends ActionCheckbox {

        ActionCheckAll() {
            super(true);
        }
    }
    class ActionUncheckAll extends ActionCheckbox {

        ActionUncheckAll() {
            super(false);
        }
    }
    menuItemCheckAll.addActionListener(new ActionCheckAll());
    menuItemUncheckAll.addActionListener(new ActionUncheckAll());
    menuItemCheckAll.setIcon(HelperUi.ICON_EMPTY);
    menuItemUncheckAll.setIcon(HelperUi.ICON_EMPTY);
    tablePopupMenu.add(new JSeparator());
    tablePopupMenu.add(menuItemCheckAll);
    tablePopupMenu.add(menuItemUncheckAll);
    JMenu menuCustomLoad = new JMenu("Custom load");
    ButtonGroup buttonGroupLoadRows = new ButtonGroup();
    JMenuItem menuItemLoadAllRows = new JRadioButtonMenuItem("Load all rows (default)", true);
    JMenuItem menuItemLoadOneRow = new JRadioButtonMenuItem("Load first row only");
    JMenuItem menuItemDump = new JCheckBoxMenuItem("Dump to a file");
    JPanel panelCustomFromRow = new JPanel(new BorderLayout());
    final JTextField inputCustomFromRow = new JPopupTextField("no.", "1").getProxy();
    inputCustomFromRow.setHorizontalAlignment(JTextField.TRAILING);
    Dimension d = new Dimension((int) inputCustomFromRow.getPreferredSize().getWidth() + 50, (int) inputCustomFromRow.getPreferredSize().getHeight());
    inputCustomFromRow.setPreferredSize(d);
    final JCheckBox radioCustomFromRow = new JCheckBox("<html><pre style=\"font-family:'Segoe UI';padding-left: 1px;\">Load from row no.&#9;</pre></html>");
    radioCustomFromRow.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    radioCustomFromRow.setIcon(new CheckBoxMenuItemIconCustom());
    radioCustomFromRow.setFocusPainted(false);
    panelCustomFromRow.add(radioCustomFromRow, BorderLayout.LINE_START);
    panelCustomFromRow.add(inputCustomFromRow, BorderLayout.CENTER);
    JPanel panelCustomToRow = new JPanel(new BorderLayout());
    final JTextField inputCustomToRow = new JPopupTextField("no.", "65565").getProxy();
    inputCustomToRow.setHorizontalAlignment(JTextField.TRAILING);
    inputCustomToRow.setPreferredSize(d);
    final JCheckBox radioCustomToRow = new JCheckBox("<html><pre style=\"font-family:'Segoe UI';padding-left: 1px;\">Load to row no.&#9;&#9;&#9;&#9;&#9;&#9;</pre></html>");
    radioCustomToRow.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    radioCustomToRow.setIcon(new CheckBoxMenuItemIconCustom());
    radioCustomToRow.setFocusPainted(false);
    panelCustomToRow.add(radioCustomToRow, BorderLayout.LINE_START);
    panelCustomToRow.add(inputCustomToRow, BorderLayout.CENTER);
    JPanel panelCustomFromChar = new JPanel(new BorderLayout());
    final JTextField inputCustomFromChar = new JPopupTextField("no.", "1").getProxy();
    inputCustomFromChar.setHorizontalAlignment(JTextField.TRAILING);
    inputCustomFromChar.setPreferredSize(d);
    final JCheckBox radioCustomFromChar = new JCheckBox("<html><pre style=\"font-family:'Segoe UI';padding-left: 1px;\">Load from char no.</pre></html>");
    radioCustomFromChar.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    radioCustomFromChar.setIcon(new CheckBoxMenuItemIconCustom());
    radioCustomFromChar.setFocusPainted(false);
    panelCustomFromChar.add(radioCustomFromChar, BorderLayout.LINE_START);
    panelCustomFromChar.add(inputCustomFromChar, BorderLayout.CENTER);
    JPanel panelCustomToChar = new JPanel(new BorderLayout());
    final JTextField inputCustomToChar = new JPopupTextField("no.", "65565").getProxy();
    inputCustomToChar.setHorizontalAlignment(JTextField.TRAILING);
    inputCustomToChar.setPreferredSize(d);
    final JCheckBox radioCustomToChar = new JCheckBox("<html><pre style=\"font-family:'Segoe UI';padding-left: 1px;\">Load to char no.&#9;&#9;&#9;&#9;&#9;</pre></html>");
    radioCustomToChar.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    radioCustomToChar.setIcon(new CheckBoxMenuItemIconCustom());
    radioCustomToChar.setFocusPainted(false);
    panelCustomToChar.add(radioCustomToChar, BorderLayout.LINE_START);
    panelCustomToChar.add(inputCustomToChar, BorderLayout.CENTER);
    buttonGroupLoadRows.add(menuItemLoadAllRows);
    buttonGroupLoadRows.add(menuItemLoadOneRow);
    menuCustomLoad.add(menuItemLoadAllRows);
    menuCustomLoad.add(menuItemLoadOneRow);
    menuCustomLoad.add(new JSeparator());
    menuCustomLoad.add(panelCustomFromRow);
    menuCustomLoad.add(panelCustomToRow);
    menuCustomLoad.add(panelCustomFromChar);
    menuCustomLoad.add(panelCustomToChar);
    menuCustomLoad.add(new JSeparator());
    menuCustomLoad.add(menuItemDump);
    for (JMenuItem menuItem : new JMenuItem[] { menuItemLoadAllRows, menuItemLoadOneRow }) {
        menuItem.setUI(new BasicRadioButtonMenuItemUI() {

            @Override
            protected void doClick(MenuSelectionManager msm) {
                this.menuItem.doClick(0);
            }
        });
    }
    menuItemDump.setUI(new BasicCheckBoxMenuItemUI() {

        @Override
        protected void doClick(MenuSelectionManager msm) {
            this.menuItem.doClick(0);
        }
    });
    // tablePopupMenu.add(new JSeparator());
    // tablePopupMenu.add(menuCustomLoad);
    tablePopupMenu.setButtonGroupLoadRows(buttonGroupLoadRows);
    tablePopupMenu.setRadioCustomFromChar(radioCustomFromChar);
    tablePopupMenu.setRadioCustomToChar(radioCustomToChar);
    tablePopupMenu.setRadioCustomFromRow(radioCustomFromRow);
    tablePopupMenu.setRadioCustomToRow(radioCustomToRow);
}
Also used : JPanel(javax.swing.JPanel) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ActionEvent(java.awt.event.ActionEvent) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) BasicRadioButtonMenuItemUI(javax.swing.plaf.basic.BasicRadioButtonMenuItemUI) BorderLayout(java.awt.BorderLayout) CheckBoxMenuItemIconCustom(com.jsql.view.swing.panel.util.CheckBoxMenuItemIconCustom) MenuSelectionManager(javax.swing.MenuSelectionManager) JMenuItem(javax.swing.JMenuItem) BasicCheckBoxMenuItemUI(javax.swing.plaf.basic.BasicCheckBoxMenuItemUI) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Dimension(java.awt.Dimension) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) JPopupTextField(com.jsql.view.swing.text.JPopupTextField) ButtonGroup(javax.swing.ButtonGroup) JMenu(javax.swing.JMenu)

Example 2 with JPopupTextField

use of com.jsql.view.swing.text.JPopupTextField in project jsql-injection by ron190.

the class ManagerBruteForce method initializeThirdLine.

private JPanel initializeThirdLine() {
    var thirdLine = new JPanel();
    thirdLine.setLayout(new BoxLayout(thirdLine, BoxLayout.X_AXIS));
    thirdLine.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, UiUtil.COLOR_DEFAULT_BACKGROUND));
    this.exclude = new JPopupTextField(I18nUtil.valueByKey("BRUTEFORCE_EXCLUDE_LABEL")).getProxy();
    this.exclude.setToolTipText(I18nUtil.valueByKey("BRUTEFORCE_EXCLUDE_TOOLTIP"));
    this.exclude.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, UiUtil.COLOR_DEFAULT_BACKGROUND), UiUtil.BORDER_BLU));
    thirdLine.add(this.exclude);
    this.minimumLength = new JSpinner();
    this.minimumLength.setModel(new SpinnerNumberModel(1, 1, 10000, 1));
    this.maximumLength = new JSpinner();
    this.maximumLength.setModel(new SpinnerNumberModel(5, 1, 10000, 1));
    this.minimumLength.setToolTipText(I18nUtil.valueByKey("BRUTEFORCE_MIN_TOOLTIP"));
    this.maximumLength.setToolTipText(I18nUtil.valueByKey("BRUTEFORCE_MAX_TOOLTIP"));
    this.minimumLength.setPreferredSize(new Dimension(38, (int) this.minimumLength.getPreferredSize().getHeight()));
    this.maximumLength.setPreferredSize(new Dimension(38, (int) this.maximumLength.getPreferredSize().getHeight()));
    this.minimumLength.setMaximumSize(new Dimension(38, (int) this.minimumLength.getPreferredSize().getHeight()));
    this.maximumLength.setMaximumSize(new Dimension(38, (int) this.maximumLength.getPreferredSize().getHeight()));
    this.minimumLength.setMinimumSize(new Dimension(38, (int) this.minimumLength.getPreferredSize().getHeight()));
    this.maximumLength.setMinimumSize(new Dimension(38, (int) this.maximumLength.getPreferredSize().getHeight()));
    var labelMin = new JLabel(StringUtils.SPACE + I18nUtil.valueByKey("BRUTEFORCE_MIN_LABEL"), SwingConstants.RIGHT);
    thirdLine.add(labelMin);
    I18nViewUtil.addComponentForKey("BRUTEFORCE_MIN_LABEL", labelMin);
    thirdLine.add(this.minimumLength);
    var labelMax = new JLabel(StringUtils.SPACE + I18nUtil.valueByKey("BRUTEFORCE_MAX_LABEL"), SwingConstants.RIGHT);
    thirdLine.add(labelMax);
    I18nViewUtil.addComponentForKey("BRUTEFORCE_MAX_LABEL", labelMax);
    thirdLine.add(this.maximumLength);
    return thirdLine;
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) JPanel(javax.swing.JPanel) JPopupTextField(com.jsql.view.swing.text.JPopupTextField) BoxLayout(javax.swing.BoxLayout) JSpinner(javax.swing.JSpinner) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 3 with JPopupTextField

use of com.jsql.view.swing.text.JPopupTextField in project jsql-injection by ron190.

the class ManagerBruteForce method initializeFirstLine.

private JPanel initializeFirstLine() {
    var firstLine = new JPanel(new BorderLayout());
    this.hash = new JPopupTextField(I18nUtil.valueByKey("BRUTEFORCE_HASH_LABEL")).getProxy();
    this.hash.setName("managerBruterHash");
    this.hash.setToolTipText(I18nUtil.valueByKey("BRUTEFORCE_HASH_TOOLTIP"));
    firstLine.add(this.hash, BorderLayout.CENTER);
    this.hash.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UiUtil.COLOR_DEFAULT_BACKGROUND), UiUtil.BORDER_BLU));
    return firstLine;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JPopupTextField(com.jsql.view.swing.text.JPopupTextField)

Example 4 with JPopupTextField

use of com.jsql.view.swing.text.JPopupTextField in project jsql-injection by ron190.

the class NodeModelTable method addCustomLoadItems.

private void addCustomLoadItems(JPopupMenuCustomExtract tablePopupMenu) {
    var menuCustomLoad = new JMenu("Custom load");
    var buttonGroupLoadRows = new ButtonGroup();
    JMenuItem menuItemLoadAllRows = new JRadioButtonMenuItem("Load all rows (default)", true);
    JMenuItem menuItemLoadOneRow = new JRadioButtonMenuItem("Load first row only");
    JMenuItem menuItemDump = new JCheckBoxMenuItem("Dump to a file");
    var panelCustomFromRow = new JPanel(new BorderLayout());
    final JTextField inputCustomFromRow = new JPopupTextField("no.", "1").getProxy();
    inputCustomFromRow.setHorizontalAlignment(SwingConstants.TRAILING);
    var d = new Dimension((int) inputCustomFromRow.getPreferredSize().getWidth() + 50, (int) inputCustomFromRow.getPreferredSize().getHeight());
    inputCustomFromRow.setPreferredSize(d);
    final var radioCustomFromRow = new JCheckBox("<html><pre style=\"font-family:'Segoe UI';padding-left: 1px;\">Load from row no.&#9;</pre></html>");
    radioCustomFromRow.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    radioCustomFromRow.setIcon(new CheckBoxMenuItemIconCustom());
    radioCustomFromRow.setFocusPainted(false);
    panelCustomFromRow.add(radioCustomFromRow, BorderLayout.LINE_START);
    panelCustomFromRow.add(inputCustomFromRow, BorderLayout.CENTER);
    var panelCustomToRow = new JPanel(new BorderLayout());
    final JTextField inputCustomToRow = new JPopupTextField("no.", "65565").getProxy();
    inputCustomToRow.setHorizontalAlignment(SwingConstants.TRAILING);
    inputCustomToRow.setPreferredSize(d);
    final var radioCustomToRow = new JCheckBox("<html><pre style=\"font-family:'Segoe UI';padding-left: 1px;\">Load to row no.&#9;&#9;&#9;&#9;&#9;&#9;</pre></html>");
    radioCustomToRow.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    radioCustomToRow.setIcon(new CheckBoxMenuItemIconCustom());
    radioCustomToRow.setFocusPainted(false);
    panelCustomToRow.add(radioCustomToRow, BorderLayout.LINE_START);
    panelCustomToRow.add(inputCustomToRow, BorderLayout.CENTER);
    var panelCustomFromChar = new JPanel(new BorderLayout());
    final JTextField inputCustomFromChar = new JPopupTextField("no.", "1").getProxy();
    inputCustomFromChar.setHorizontalAlignment(SwingConstants.TRAILING);
    inputCustomFromChar.setPreferredSize(d);
    final var radioCustomFromChar = new JCheckBox("<html><pre style=\"font-family:'Segoe UI';padding-left: 1px;\">Load from char no.</pre></html>");
    radioCustomFromChar.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    radioCustomFromChar.setIcon(new CheckBoxMenuItemIconCustom());
    radioCustomFromChar.setFocusPainted(false);
    panelCustomFromChar.add(radioCustomFromChar, BorderLayout.LINE_START);
    panelCustomFromChar.add(inputCustomFromChar, BorderLayout.CENTER);
    var panelCustomToChar = new JPanel(new BorderLayout());
    final JTextField inputCustomToChar = new JPopupTextField("no.", "65565").getProxy();
    inputCustomToChar.setHorizontalAlignment(SwingConstants.TRAILING);
    inputCustomToChar.setPreferredSize(d);
    final var radioCustomToChar = new JCheckBox("<html><pre style=\"font-family:'Segoe UI';padding-left: 1px;\">Load to char no.&#9;&#9;&#9;&#9;&#9;</pre></html>");
    radioCustomToChar.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    radioCustomToChar.setIcon(new CheckBoxMenuItemIconCustom());
    radioCustomToChar.setFocusPainted(false);
    panelCustomToChar.add(radioCustomToChar, BorderLayout.LINE_START);
    panelCustomToChar.add(inputCustomToChar, BorderLayout.CENTER);
    buttonGroupLoadRows.add(menuItemLoadAllRows);
    buttonGroupLoadRows.add(menuItemLoadOneRow);
    menuCustomLoad.add(menuItemLoadAllRows);
    menuCustomLoad.add(menuItemLoadOneRow);
    menuCustomLoad.add(new JSeparator());
    menuCustomLoad.add(panelCustomFromRow);
    menuCustomLoad.add(panelCustomToRow);
    menuCustomLoad.add(panelCustomFromChar);
    menuCustomLoad.add(panelCustomToChar);
    menuCustomLoad.add(new JSeparator());
    menuCustomLoad.add(menuItemDump);
    for (JMenuItem menuItem : new JMenuItem[] { menuItemLoadAllRows, menuItemLoadOneRow }) {
        menuItem.setUI(new BasicRadioButtonMenuItemUI() {

            @Override
            protected void doClick(MenuSelectionManager msm) {
                this.menuItem.doClick(0);
            }
        });
    }
    menuItemDump.setUI(new BasicCheckBoxMenuItemUI() {

        @Override
        protected void doClick(MenuSelectionManager msm) {
            this.menuItem.doClick(0);
        }
    });
    tablePopupMenu.add(new JSeparator());
    tablePopupMenu.add(menuCustomLoad);
    tablePopupMenu.setButtonGroupLoadRows(buttonGroupLoadRows);
    tablePopupMenu.setRadioCustomFromChar(radioCustomFromChar);
    tablePopupMenu.setRadioCustomToChar(radioCustomToChar);
    tablePopupMenu.setRadioCustomFromRow(radioCustomFromRow);
    tablePopupMenu.setRadioCustomToRow(radioCustomToRow);
}
Also used : JPanel(javax.swing.JPanel) BasicCheckBoxMenuItemUI(javax.swing.plaf.basic.BasicCheckBoxMenuItemUI) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JSeparator(javax.swing.JSeparator) JCheckBox(javax.swing.JCheckBox) BasicRadioButtonMenuItemUI(javax.swing.plaf.basic.BasicRadioButtonMenuItemUI) BorderLayout(java.awt.BorderLayout) JPopupTextField(com.jsql.view.swing.text.JPopupTextField) CheckBoxMenuItemIconCustom(com.jsql.view.swing.tree.CheckBoxMenuItemIconCustom) ButtonGroup(javax.swing.ButtonGroup) MenuSelectionManager(javax.swing.MenuSelectionManager) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu)

Aggregations

JPopupTextField (com.jsql.view.swing.text.JPopupTextField)4 JPanel (javax.swing.JPanel)4 BorderLayout (java.awt.BorderLayout)3 Dimension (java.awt.Dimension)3 ButtonGroup (javax.swing.ButtonGroup)2 JCheckBox (javax.swing.JCheckBox)2 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)2 JMenu (javax.swing.JMenu)2 JMenuItem (javax.swing.JMenuItem)2 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)2 JSeparator (javax.swing.JSeparator)2 JTextField (javax.swing.JTextField)2 MenuSelectionManager (javax.swing.MenuSelectionManager)2 BasicCheckBoxMenuItemUI (javax.swing.plaf.basic.BasicCheckBoxMenuItemUI)2 BasicRadioButtonMenuItemUI (javax.swing.plaf.basic.BasicRadioButtonMenuItemUI)2 CheckBoxMenuItemIconCustom (com.jsql.view.swing.panel.util.CheckBoxMenuItemIconCustom)1 CheckBoxMenuItemIconCustom (com.jsql.view.swing.tree.CheckBoxMenuItemIconCustom)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 BoxLayout (javax.swing.BoxLayout)1