Search in sources :

Example 76 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem in project binnavi by google.

the class CModuleContainerNodeMenuBuilder method createMenu.

@Override
protected void createMenu(final JComponent menu) {
    if (m_containerNode == null) {
        m_containerNode = getModuleContainerNode(CNodeExpander.findNode(getProjectTree(), m_database));
    }
    menu.add(new JMenuItem(CActionProxy.proxy(new CImportModuleAction(getParent(), m_database))));
    menu.add(new JMenuItem(CActionProxy.proxy(new CRefreshRawModulesAction(getParent(), m_database))));
    menu.add(new JMenuItem(CActionProxy.proxy(new CResolveAllFunctionsAction(menu, m_database))));
    menu.add(new JSeparator());
    final JMenu sortMenu = new JMenu("Sort");
    final JRadioButtonMenuItem idMenu = new JRadioButtonMenuItem(new CActionSortModulesById(m_containerNode));
    idMenu.setSelected(!m_containerNode.isSorted());
    sortMenu.add(idMenu);
    final JRadioButtonMenuItem nameMenu = new JRadioButtonMenuItem(new CActionSortModulesByName(m_containerNode));
    nameMenu.setSelected(m_containerNode.isSorted());
    sortMenu.add(nameMenu);
    menu.add(sortMenu);
}
Also used : CResolveAllFunctionsAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CResolveAllFunctionsAction) CActionSortModulesByName(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CActionSortModulesByName) CActionSortModulesById(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CActionSortModulesById) CImportModuleAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CImportModuleAction) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) CRefreshRawModulesAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CRefreshRawModulesAction) JMenuItem(javax.swing.JMenuItem) JSeparator(javax.swing.JSeparator) JMenu(javax.swing.JMenu)

Example 77 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem in project binnavi by google.

the class HexViewOptionsMenu method createHexViewOptionsMenu.

public static JMenu createHexViewOptionsMenu(final JHexView hexView) {
    final JMenu menu = new JMenu("Options");
    final JMenu groupingMenu = new JMenu("Byte Grouping");
    final ButtonGroup group = new ButtonGroup();
    final JRadioButtonMenuItem groupingByteMenu = new JRadioButtonMenuItem(CActionProxy.proxy(new CSelectGroupingAction(hexView, "Byte", 1)));
    group.add(groupingByteMenu);
    final JRadioButtonMenuItem groupingWordMenu = new JRadioButtonMenuItem(CActionProxy.proxy(new CSelectGroupingAction(hexView, "Word", 2)));
    group.add(groupingWordMenu);
    final JRadioButtonMenuItem groupingDwordMenu = new JRadioButtonMenuItem(CActionProxy.proxy(new CSelectGroupingAction(hexView, "Double Word", 4)));
    group.add(groupingDwordMenu);
    final int grouping = hexView.getBytesPerColumn();
    switch(grouping) {
        case 1:
            groupingByteMenu.setSelected(true);
            break;
        case 2:
            groupingWordMenu.setSelected(true);
            break;
        case 4:
            groupingDwordMenu.setSelected(true);
            break;
        default:
            throw new IllegalStateException("IE01123: Unknown grouping value: " + grouping);
    }
    groupingMenu.add(groupingByteMenu);
    groupingMenu.add(groupingWordMenu);
    groupingMenu.add(groupingDwordMenu);
    menu.add(groupingMenu);
    final JMenu endiannessMenu = new JMenu("Endianness");
    final ButtonGroup endiannessGroup = new ButtonGroup();
    final JRadioButtonMenuItem littleEndiannessMenu = new JRadioButtonMenuItem(CActionProxy.proxy(new CLittleEndiannessAction(hexView)));
    endiannessGroup.add(littleEndiannessMenu);
    final JRadioButtonMenuItem bigEndiannessMenu = new JRadioButtonMenuItem(CActionProxy.proxy(new CBigEndiannessAction(hexView)));
    endiannessGroup.add(bigEndiannessMenu);
    final boolean flip = hexView.doFlipBytes();
    if (flip) {
        littleEndiannessMenu.setSelected(true);
    } else {
        bigEndiannessMenu.setSelected(true);
    }
    endiannessMenu.add(bigEndiannessMenu);
    endiannessMenu.add(littleEndiannessMenu);
    menu.add(endiannessMenu);
    return menu;
}
Also used : ButtonGroup(javax.swing.ButtonGroup) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) CSelectGroupingAction(com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CSelectGroupingAction) CLittleEndiannessAction(com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CLittleEndiannessAction) JMenu(javax.swing.JMenu) CBigEndiannessAction(com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Actions.CBigEndiannessAction)

Example 78 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem in project freeplane by freeplane.

the class UserInputListenerFactory method updateMapList.

private void updateMapList(final String mapsMenuPosition) {
    if (!getMenuBuilder(MenuBuilder.class).contains(mapsMenuPosition))
        return;
    getMenuBuilder(MenuBuilder.class).removeChildElements(mapsMenuPosition);
    final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
    final List<? extends Component> mapViewVector = mapViewManager.getMapViewVector();
    if (mapViewVector == null) {
        return;
    }
    final ButtonGroup group = new ButtonGroup();
    int i = 0;
    for (final Component mapView : mapViewVector) {
        final String displayName = mapView.getName();
        final JRadioButtonMenuItem newItem = new JRadioButtonMenuItem(displayName);
        newItem.setSelected(false);
        group.add(newItem);
        newItem.addActionListener(mapsMenuActionListener);
        if (displayName.length() > 0) {
            newItem.setMnemonic(displayName.charAt(0));
        }
        final MapView currentMapView = (MapView) mapViewManager.getMapViewComponent();
        if (currentMapView != null) {
            if (mapView == currentMapView) {
                newItem.setSelected(true);
            }
        }
        getMenuBuilder(MenuBuilder.class).addMenuItem(mapsMenuPosition, newItem, mapsMenuPosition + '-' + i++, UIBuilder.AS_CHILD);
    }
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) ButtonGroup(javax.swing.ButtonGroup) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) MapView(org.freeplane.view.swing.map.MapView) JComponent(javax.swing.JComponent) Component(java.awt.Component) MenuBuilder(org.freeplane.core.ui.MenuBuilder)

Example 79 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem 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 80 with JRadioButtonMenuItem

use of javax.swing.JRadioButtonMenuItem in project jsql-injection by ron190.

the class ManagerDatabase method initErrorMethods.

public void initErrorMethods(Vendor vendor) {
    this.itemRadioStrategyError[0].removeAll();
    Integer[] i = { 0 };
    if (vendor != Vendor.AUTO && vendor.instance().getXmlModel().getStrategy().getError() != null) {
        for (Method methodError : vendor.instance().getXmlModel().getStrategy().getError().getMethod()) {
            JMenuItem itemRadioVendor = new JRadioButtonMenuItem(methodError.getName());
            itemRadioVendor.setEnabled(false);
            this.itemRadioStrategyError[0].add(itemRadioVendor);
            this.groupStrategy.add(itemRadioVendor);
            final int indexError = i[0];
            itemRadioVendor.addActionListener(actionEvent -> {
                ManagerDatabase.this.menuStrategy.setText(methodError.getName());
                MediatorModel.model().setStrategy(StrategyInjection.ERROR);
                ((StrategyInjectionError) StrategyInjection.ERROR.instance()).setIndexMethod(indexError);
            });
            i[0]++;
        }
    }
}
Also used : StrategyInjectionError(com.jsql.model.injection.strategy.StrategyInjectionError) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) Method(com.jsql.model.injection.vendor.model.Model.Strategy.Error.Method) JMenuItem(javax.swing.JMenuItem)

Aggregations

JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)246 ButtonGroup (javax.swing.ButtonGroup)123 JMenu (javax.swing.JMenu)110 JMenuItem (javax.swing.JMenuItem)85 ActionEvent (java.awt.event.ActionEvent)81 ActionListener (java.awt.event.ActionListener)69 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)38 JPopupMenu (javax.swing.JPopupMenu)31 JMenuBar (javax.swing.JMenuBar)21 ItemEvent (java.awt.event.ItemEvent)19 ItemListener (java.awt.event.ItemListener)19 JPanel (javax.swing.JPanel)19 AbstractAction (javax.swing.AbstractAction)18 JSeparator (javax.swing.JSeparator)15 JButton (javax.swing.JButton)12 JLabel (javax.swing.JLabel)12 BorderLayout (java.awt.BorderLayout)11 Component (java.awt.Component)11 Dimension (java.awt.Dimension)11 ArrayList (java.util.ArrayList)11