Search in sources :

Example 16 with LightScrollPane

use of com.jsql.view.swing.scrollpane.LightScrollPane in project jsql-injection by ron190.

the class ManagerCoder method initializeTopPanel.

private JPanel initializeTopPanel() {
    var topMixed = new JPanel(new BorderLayout());
    final var middleLine = new JPanel();
    middleLine.setLayout(new BorderLayout());
    middleLine.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 1));
    var comboMenubar = this.initializeMenuBarCoder();
    this.menuMethod.setText("Encode to Base64");
    middleLine.add(comboMenubar);
    topMixed.add(new LightScrollPane(0, 0, 1, 0, this.textInput), BorderLayout.CENTER);
    topMixed.add(middleLine, BorderLayout.SOUTH);
    return topMixed;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane)

Example 17 with LightScrollPane

use of com.jsql.view.swing.scrollpane.LightScrollPane in project jsql-injection by ron190.

the class SqlEngine method populateTabError.

/**
 * Dynamically add textPanes to Error tab for current vendor.
 */
private static void populateTabError() {
    SqlEngine.tabbedPaneError.removeAll();
    if (SqlEngine.modelYaml.getStrategy().getError() == null) {
        return;
    }
    for (Method methodError : SqlEngine.modelYaml.getStrategy().getError().getMethod()) {
        var panelError = new JPanel(new BorderLayout());
        final var refMethodError = new Method[] { methodError };
        var textPaneError = new JTextPaneLexer(refMethodError[0]::setQuery, refMethodError[0]::getQuery);
        SqlEngine.resetLexer(textPaneError);
        textPaneError.switchSetterToVendor();
        textPaneError.setText(methodError.getQuery().trim());
        textPaneError.setBorder(SqlEngine.borderRight);
        panelError.add(new LightScrollPane(1, 0, 1, 0, textPaneError), BorderLayout.CENTER);
        var 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())));
        // TODO Integrate Error limit
        panelError.add(panelLimit, BorderLayout.SOUTH);
        SqlEngine.tabbedPaneError.addTab(methodError.getName(), panelError);
        SqlEngine.tabbedPaneError.setTitleAt(SqlEngine.tabbedPaneError.getTabCount() - 1, String.format("<html><div style=\"text-align:left;width:100px;\">%s</div></html>", methodError.getName()));
        SqlEngine.textPanesError.add(textPaneError);
    }
}
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) JTextPaneObjectMethod(com.jsql.view.swing.sql.text.JTextPaneObjectMethod) Method(com.jsql.model.injection.vendor.model.yaml.Method) JTextPaneLexer(com.jsql.view.swing.sql.text.JTextPaneLexer) JTextField(javax.swing.JTextField)

Example 18 with LightScrollPane

use of com.jsql.view.swing.scrollpane.LightScrollPane in project jsql-injection by ron190.

the class SqlEngine method getPanelFingerprinting.

private JPanel getPanelFingerprinting() {
    JTabbedPane tabs = new TabbedPaneWheeled(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    tabs.addTab(I18nUtil.valueByKey("SQLENGINE_ORDER_BY"), new LightScrollPane(1, 0, 1, 0, TextareaWithColor.ORDER_BY.getText()));
    tabs.addTab("Order by error", new LightScrollPane(1, 0, 1, 0, TextareaWithColor.ORDER_BY_ERROR_MESSAGE.getText()));
    tabs.addTab("String error", new LightScrollPane(1, 0, 1, 0, TextareaWithColor.INCORRECT_STRING_ERROR_MESSAGE.getText()));
    tabs.addTab("Truthy", new LightScrollPane(1, 0, 1, 0, TextareaWithColor.TRUTHY.getText()));
    tabs.addTab("Falsy", new LightScrollPane(1, 0, 1, 0, TextareaWithColor.FALSY.getText()));
    Stream.of("SQLENGINE_ORDER_BY").forEach(keyI18n -> {
        var label = new JLabel(I18nUtil.valueByKey(keyI18n));
        tabs.setTabComponentAt(tabs.indexOfTab(I18nUtil.valueByKey(keyI18n)), label);
        I18nViewUtil.addComponentForKey(keyI18n, label);
    });
    var panel = new JPanel(new BorderLayout());
    panel.add(tabs, BorderLayout.CENTER);
    panel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UiUtil.COLOR_COMPONENT_BORDER));
    return panel;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTabbedPane(javax.swing.JTabbedPane) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane) JLabel(javax.swing.JLabel) TabbedPaneWheeled(com.jsql.view.swing.tab.TabbedPaneWheeled)

Example 19 with LightScrollPane

use of com.jsql.view.swing.scrollpane.LightScrollPane in project jsql-injection by ron190.

the class ActionSaveTab method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    this.filechooser.setDialogTitle("Save Tab As");
    var componentResult = MediatorHelper.tabResults().getSelectedComponent();
    if (componentResult instanceof PanelTable) {
        JTable table = ((PanelTable) componentResult).getTableValues();
        this.saveToFile(table);
    } else if (componentResult instanceof LightScrollPane && ((LightScrollPane) componentResult).scrollPane.getViewport().getView() instanceof JTextComponent) {
        JTextComponent textarea = (JTextComponent) ((LightScrollPane) componentResult).scrollPane.getViewport().getView();
        this.saveToFile(textarea);
    }
}
Also used : JTable(javax.swing.JTable) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane) PanelTable(com.jsql.view.swing.table.PanelTable) JTextComponent(javax.swing.text.JTextComponent)

Aggregations

LightScrollPane (com.jsql.view.swing.scrollpane.LightScrollPane)19 BorderLayout (java.awt.BorderLayout)10 JPanel (javax.swing.JPanel)10 JLabel (javax.swing.JLabel)9 JPopupTextArea (com.jsql.view.swing.text.JPopupTextArea)6 TabHeader (com.jsql.view.swing.tab.TabHeader)5 JTabbedPane (javax.swing.JTabbedPane)5 JTextArea (javax.swing.JTextArea)5 LightScrollPaneShell (com.jsql.view.swing.scrollpane.LightScrollPaneShell)4 TabbedPaneWheeled (com.jsql.view.swing.tab.TabbedPaneWheeled)4 Font (java.awt.Font)4 MouseAdapter (java.awt.event.MouseAdapter)4 MouseEvent (java.awt.event.MouseEvent)4 MalformedURLException (java.net.MalformedURLException)4 Dimension (java.awt.Dimension)3 SimpleEntry (java.util.AbstractMap.SimpleEntry)3 JMenuItem (javax.swing.JMenuItem)3 InjectionModel (com.jsql.model.InjectionModel)2 ShellSql (com.jsql.view.swing.shell.ShellSql)2 ShellWeb (com.jsql.view.swing.shell.ShellWeb)2