Search in sources :

Example 1 with Method

use of com.jsql.model.injection.vendor.model.Model.Strategy.Error.Method 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)

Example 2 with Method

use of com.jsql.model.injection.vendor.model.Model.Strategy.Error.Method in project jsql-injection by ron190.

the class SqlEngine method initErrorTabs.

private void initErrorTabs() {
    SqlEngine.TAB_ERROR.removeAll();
    if (xmlModel.getStrategy().getError() != null) {
        for (Method methodError : xmlModel.getStrategy().getError().getMethod()) {
            JPanel panelError = new JPanel(new BorderLayout());
            final Method[] m = new Method[] { methodError };
            JTextPaneLexer textPane = new JTextPaneLexer(false) {

                @Override
                public void switchSetterToVendor() {
                    this.attributeSetter = new AttributeSetterForVendor(m[0], "setQuery");
                }
            };
            SqlEngine.resetLexer(textPane);
            textPane.switchSetterToVendor();
            textPane.setText(methodError.getQuery().trim());
            textPane.setBorder(SqlEngine.BORDER_RIGHT);
            panelError.add(new LightScrollPane(1, 0, 1, 0, textPane), BorderLayout.CENTER);
            JPanel panelLimit = new JPanel();
            panelLimit.setLayout(new BoxLayout(panelLimit, BoxLayout.LINE_AXIS));
            panelLimit.add(new JLabel(" Overflow limit: "));
            panelLimit.add(new JTextField(Integer.toString(methodError.getCapacity())));
            panelError.add(panelLimit, BorderLayout.SOUTH);
            SqlEngine.TAB_ERROR.addTab(methodError.getName(), panelError);
            SqlEngine.TAB_ERROR.setTitleAt(SqlEngine.TAB_ERROR.getTabCount() - 1, "<html><div style=\"text-align:left;width:150px;\">" + methodError.getName() + "</div></html>");
        }
    }
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) BoxLayout(javax.swing.BoxLayout) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane) JLabel(javax.swing.JLabel) Method(com.jsql.model.injection.vendor.model.Model.Strategy.Error.Method) JTextField(javax.swing.JTextField)

Aggregations

Method (com.jsql.model.injection.vendor.model.Model.Strategy.Error.Method)2 StrategyInjectionError (com.jsql.model.injection.strategy.StrategyInjectionError)1 LightScrollPane (com.jsql.view.swing.scrollpane.LightScrollPane)1 BorderLayout (java.awt.BorderLayout)1 BoxLayout (javax.swing.BoxLayout)1 JLabel (javax.swing.JLabel)1 JMenuItem (javax.swing.JMenuItem)1 JPanel (javax.swing.JPanel)1 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)1 JTextField (javax.swing.JTextField)1