Search in sources :

Example 6 with LightScrollPane

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

the class Menubar method initializeItemPreferences.

private JMenuItem initializeItemPreferences() {
    JMenuItem itemPreferences = new JMenuItemWithMargin(I18nUtil.valueByKey(KEY_MENU_PREFERENCES), 'P');
    I18nViewUtil.addComponentForKey(KEY_MENU_PREFERENCES, itemPreferences);
    // Render the Preferences dialog behind scene
    var titleTabPreferences = "Preferences";
    // Single rendering
    var panelPreferences = new PanelPreferences();
    itemPreferences.addActionListener(actionEvent -> {
        for (var i = 0; i < MediatorHelper.tabResults().getTabCount(); i++) {
            if (titleTabPreferences.equals(MediatorHelper.tabResults().getTitleAt(i))) {
                MediatorHelper.tabResults().setSelectedIndex(i);
                return;
            }
        }
        CreateTabHelper.initializeSplitOrientation();
        AdjustmentListener singleItemScroll = adjustmentEvent -> {
            // The user scrolled the List (using the bar, mouse wheel or something else):
            if (adjustmentEvent.getAdjustmentType() == AdjustmentEvent.TRACK) {
                // Jump to the next "block" (which is a row".
                adjustmentEvent.getAdjustable().setBlockIncrement(100);
                adjustmentEvent.getAdjustable().setUnitIncrement(100);
            }
        };
        var scroller = new LightScrollPane(1, 0, 0, 0, panelPreferences);
        scroller.scrollPane.getVerticalScrollBar().addAdjustmentListener(singleItemScroll);
        MediatorHelper.tabResults().addTab(titleTabPreferences, scroller);
        // Focus on the new tab
        MediatorHelper.tabResults().setSelectedComponent(scroller);
        // Create a custom tab header with close button
        var header = new TabHeader(I18nViewUtil.valueByKey(KEY_MENU_PREFERENCES), UiUtil.ICON_COG, panelPreferences.getPanelTampering());
        I18nViewUtil.addComponentForKey(KEY_MENU_PREFERENCES, header.getTabTitleLabel());
        // Apply the custom header to the tab
        MediatorHelper.tabResults().setTabComponentAt(MediatorHelper.tabResults().indexOfComponent(scroller), header);
    });
    return itemPreferences;
}
Also used : UIManager(javax.swing.UIManager) I18nViewUtil(com.jsql.view.swing.util.I18nViewUtil) TabHeader(com.jsql.view.swing.tab.TabHeader) CreateTabHelper(com.jsql.view.swing.interaction.CreateTabHelper) JTableHeader(javax.swing.table.JTableHeader) StringUtils(org.apache.commons.lang3.StringUtils) SqlEngine(com.jsql.view.swing.sql.SqlEngine) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) UiUtil(com.jsql.view.swing.util.UiUtil) Locale(java.util.Locale) MouseAdapter(java.awt.event.MouseAdapter) I18nUtil(com.jsql.util.I18nUtil) MediatorHelper(com.jsql.view.swing.util.MediatorHelper) JToolTipI18n(com.jsql.view.swing.text.JToolTipI18n) BorderLayout(java.awt.BorderLayout) InjectionModel(com.jsql.model.InjectionModel) JMenuBar(javax.swing.JMenuBar) KeyStroke(javax.swing.KeyStroke) Font(java.awt.Font) JMenu(javax.swing.JMenu) KeyEvent(java.awt.event.KeyEvent) Collectors(java.util.stream.Collectors) PanelPreferences(com.jsql.view.swing.panel.PanelPreferences) Dimension(java.awt.Dimension) Stream(java.util.stream.Stream) Logger(org.apache.logging.log4j.Logger) NodeModelEmpty(com.jsql.view.swing.tree.model.NodeModelEmpty) BasicCheckBoxMenuItemUI(javax.swing.plaf.basic.BasicCheckBoxMenuItemUI) JSeparator(javax.swing.JSeparator) LogLevel(com.jsql.util.LogLevel) ShowOnConsole(com.jsql.util.GitUtil.ShowOnConsole) JPanel(javax.swing.JPanel) ActionListener(java.awt.event.ActionListener) JSplitPane(javax.swing.JSplitPane) TableColumnModel(javax.swing.table.TableColumnModel) Language(com.jsql.view.swing.dialog.translate.Language) StyleConstants(javax.swing.text.StyleConstants) MenuSelectionManager(javax.swing.MenuSelectionManager) ArrayUtils(org.apache.commons.lang3.ArrayUtils) AdjustmentListener(java.awt.event.AdjustmentListener) DialogAbout(com.jsql.view.swing.dialog.DialogAbout) PanelTable(com.jsql.view.swing.table.PanelTable) ResourceBundle(java.util.ResourceBundle) JMenuItem(javax.swing.JMenuItem) JTextFieldPlaceholder(com.jsql.view.swing.text.JTextFieldPlaceholder) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane) SimpleEntry(java.util.AbstractMap.SimpleEntry) AdjustmentEvent(java.awt.event.AdjustmentEvent) JPopupTextArea(com.jsql.view.swing.text.JPopupTextArea) ButtonGroup(javax.swing.ButtonGroup) DialogTranslate(com.jsql.view.swing.dialog.DialogTranslate) ActionSaveTab(com.jsql.view.swing.action.ActionSaveTab) HotkeyUtil(com.jsql.view.swing.action.HotkeyUtil) JOptionPane(javax.swing.JOptionPane) ActionEvent(java.awt.event.ActionEvent) JTextComponent(javax.swing.text.JTextComponent) MouseEvent(java.awt.event.MouseEvent) ActionNewWindow(com.jsql.view.swing.action.ActionNewWindow) ComponentOrientation(java.awt.ComponentOrientation) Preferences(java.util.prefs.Preferences) JScrollPane(javax.swing.JScrollPane) JLabel(javax.swing.JLabel) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JTextArea(javax.swing.JTextArea) JButtonStateful(com.jsql.view.swing.manager.util.JButtonStateful) LogManager(org.apache.logging.log4j.LogManager) JTextPaneAppender(com.jsql.view.swing.console.JTextPaneAppender) TabHeader(com.jsql.view.swing.tab.TabHeader) AdjustmentListener(java.awt.event.AdjustmentListener) PanelPreferences(com.jsql.view.swing.panel.PanelPreferences) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane) JMenuItem(javax.swing.JMenuItem)

Example 7 with LightScrollPane

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

the class SqlEngine method getPanelConfiguration.

private JPanel getPanelConfiguration() {
    JTabbedPane tabsConfiguration = new TabbedPaneWheeled(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    tabsConfiguration.addTab(I18nUtil.valueByKey("SQLENGINE_CHARACTERS_SLIDINGWINDOW"), new LightScrollPane(1, 0, 1, 0, TextareaWithColor.SLIDING_WINDOW.getText()));
    tabsConfiguration.addTab(I18nUtil.valueByKey("SQLENGINE_ROWS_SLIDINGWINDOW"), new LightScrollPane(1, 0, 1, 0, TextareaWithColor.LIMIT.getText()));
    tabsConfiguration.addTab("Limit start index", new LightScrollPane(1, 0, 1, 0, TextareaWithColor.LIMIT_BOUNDARY.getText()));
    tabsConfiguration.addTab(I18nUtil.valueByKey("SQLENGINE_CAPACITY"), new LightScrollPane(1, 0, 1, 0, TextareaWithColor.CAPACITY.getText()));
    tabsConfiguration.addTab(I18nUtil.valueByKey("SQLENGINE_CALIBRATOR"), new LightScrollPane(1, 0, 1, 0, TextareaWithColor.CALIBRATOR.getText()));
    tabsConfiguration.addTab(I18nUtil.valueByKey("SQLENGINE_TRAPCANCELLER"), new LightScrollPane(1, 0, 1, 0, TextareaWithColor.FAILSAFE.getText()));
    tabsConfiguration.addTab("End comment", new LightScrollPane(1, 0, 1, 0, TextareaWithColor.ENDING_COMMENT.getText()));
    Stream.of("SQLENGINE_CHARACTERS_SLIDINGWINDOW", "SQLENGINE_ROWS_SLIDINGWINDOW", "SQLENGINE_CAPACITY", "SQLENGINE_CALIBRATOR", "SQLENGINE_TRAPCANCELLER").forEach(keyI18n -> {
        var label = new JLabel(I18nUtil.valueByKey(keyI18n));
        tabsConfiguration.setTabComponentAt(tabsConfiguration.indexOfTab(I18nUtil.valueByKey(keyI18n)), label);
        I18nViewUtil.addComponentForKey(keyI18n, label);
    });
    var panelConfiguration = new JPanel(new BorderLayout());
    panelConfiguration.add(tabsConfiguration, BorderLayout.CENTER);
    panelConfiguration.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UiUtil.COLOR_COMPONENT_BORDER));
    return panelConfiguration;
}
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 8 with LightScrollPane

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

the class SqlEngine method getPanelStrategy.

private JPanel getPanelStrategy() {
    JTabbedPane tabsStrategy = new TabbedPaneWheeled(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    tabsStrategy.addTab(I18nUtil.valueByKey("SQLENGINE_NORMAL"), new LightScrollPane(1, 0, 1, 0, TextareaWithColor.INDICES.getText()));
    var panelStrategy = new JPanel(new BorderLayout());
    panelStrategy.add(tabsStrategy, BorderLayout.CENTER);
    panelStrategy.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UiUtil.COLOR_COMPONENT_BORDER));
    /* Error */
    var panelError = new JPanel(new BorderLayout());
    panelError.add(SqlEngine.tabbedPaneError, BorderLayout.CENTER);
    tabsStrategy.addTab(I18nUtil.valueByKey("SQLENGINE_ERROR"), panelError);
    /* Boolean */
    JTabbedPane tabsBoolean = new TabbedPaneWheeled(SwingConstants.RIGHT, JTabbedPane.SCROLL_TAB_LAYOUT);
    Stream.of(new SimpleEntry<>("AND mode", TextareaWithColor.MODE_AND.getText()), new SimpleEntry<>("OR mode", TextareaWithColor.MODE_OR.getText()), new SimpleEntry<>("Blind", TextareaWithColor.BLIND.getText()), new SimpleEntry<>("Time", TextareaWithColor.TIME.getText()), new SimpleEntry<>("Bit Test", TextareaWithColor.BIT_TEST.getText()), new SimpleEntry<>("Length Test", TextareaWithColor.LENGTH_TEST.getText())).forEach(entry -> tabsBoolean.addTab(entry.getKey(), new LightScrollPane(1, 0, 1, 0, entry.getValue())));
    var panelBoolean = new JPanel(new BorderLayout());
    panelBoolean.add(tabsBoolean, BorderLayout.CENTER);
    tabsStrategy.addTab(I18nUtil.valueByKey("SQLENGINE_BOOLEAN"), panelBoolean);
    /* Strategy */
    Stream.of("SQLENGINE_NORMAL", "SQLENGINE_ERROR", "SQLENGINE_BOOLEAN").forEach(keyI18n -> {
        var label = new JLabel(I18nUtil.valueByKey(keyI18n));
        tabsStrategy.setTabComponentAt(tabsStrategy.indexOfTab(I18nUtil.valueByKey(keyI18n)), label);
        I18nViewUtil.addComponentForKey(keyI18n, label);
    });
    return panelStrategy;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) SimpleEntry(java.util.AbstractMap.SimpleEntry) JTabbedPane(javax.swing.JTabbedPane) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane) JLabel(javax.swing.JLabel) TabbedPaneWheeled(com.jsql.view.swing.tab.TabbedPaneWheeled)

Example 9 with LightScrollPane

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

the class SqlEngine method getPanelStructure.

private JPanel getPanelStructure() {
    final var keyDatabases = "SQLENGINE_DATABASES";
    final var keyTables = "SQLENGINE_TABLES";
    final var keyColumns = "SQLENGINE_COLUMNS";
    final var keyRows = "SQLENGINE_ROWS";
    final var keyField = "SQLENGINE_FIELD";
    final var keyFieldSeparator = "SQLENGINE_FIELDS_SEPARATOR";
    JTabbedPane tabsStandard = new TabbedPaneWheeled(SwingConstants.RIGHT, JTabbedPane.SCROLL_TAB_LAYOUT);
    JTabbedPane tabsSchema = new TabbedPaneWheeled(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    Stream.of(new SimpleEntry<>(keyDatabases, TextareaWithColor.DATABASE_DEFAULT.getText()), new SimpleEntry<>(keyTables, TextareaWithColor.TABLE_DEFAULT.getText()), new SimpleEntry<>(keyColumns, TextareaWithColor.COLUMN_DEFAULT.getText()), new SimpleEntry<>(keyRows, TextareaWithColor.QUERY_DEFAULT.getText()), new SimpleEntry<>(keyField, TextareaWithColor.FIELD_DEFAULT.getText()), new SimpleEntry<>(keyFieldSeparator, TextareaWithColor.CONCAT_DEFAULT.getText()), new SimpleEntry<>("SQLENGINE_METADATA", TextareaWithColor.INFO.getText())).forEach(entry -> {
        tabsSchema.addTab(I18nUtil.valueByKey(entry.getKey()), new LightScrollPane(1, 0, 1, 0, entry.getValue()));
        var label = new JLabel(I18nUtil.valueByKey(entry.getKey()));
        tabsSchema.setTabComponentAt(tabsSchema.indexOfTab(I18nUtil.valueByKey(entry.getKey())), label);
        I18nViewUtil.addComponentForKey(entry.getKey(), label);
    });
    JTabbedPane tabsZip = new TabbedPaneWheeled(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    Stream.of(new SimpleEntry<>(keyDatabases, TextareaWithColor.DATABASE_ZIP.getText()), new SimpleEntry<>(keyTables, TextareaWithColor.TABLE_ZIP.getText()), new SimpleEntry<>(keyColumns, TextareaWithColor.COLUMN_ZIP.getText()), new SimpleEntry<>(keyRows, TextareaWithColor.QUERY_ZIP.getText()), new SimpleEntry<>(keyField, TextareaWithColor.FIELD_ZIP.getText()), new SimpleEntry<>(keyFieldSeparator, TextareaWithColor.CONCAT_ZIP.getText())).forEach(entry -> {
        tabsZip.addTab(I18nUtil.valueByKey(entry.getKey()), new LightScrollPane(1, 0, 1, 0, entry.getValue()));
        var label = new JLabel(I18nUtil.valueByKey(entry.getKey()));
        tabsZip.setTabComponentAt(tabsZip.indexOfTab(I18nUtil.valueByKey(entry.getKey())), label);
        I18nViewUtil.addComponentForKey(entry.getKey(), label);
    });
    JTabbedPane tabsDios = new TabbedPaneWheeled(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    Stream.of(new SimpleEntry<>(keyDatabases, TextareaWithColor.DATABASE_DIOS.getText()), new SimpleEntry<>(keyTables, TextareaWithColor.TABLE_DIOS.getText()), new SimpleEntry<>(keyColumns, TextareaWithColor.COLUMN_DIOS.getText()), new SimpleEntry<>(keyRows, TextareaWithColor.QUERY_DIOS.getText()), new SimpleEntry<>(keyField, TextareaWithColor.FIELD_DIOS.getText()), new SimpleEntry<>(keyFieldSeparator, TextareaWithColor.CONCAT_DIOS.getText())).forEach(entry -> {
        tabsDios.addTab(I18nUtil.valueByKey(entry.getKey()), new LightScrollPane(1, 0, 1, 0, entry.getValue()));
        var label = new JLabel(I18nUtil.valueByKey(entry.getKey()));
        tabsDios.setTabComponentAt(tabsDios.indexOfTab(I18nUtil.valueByKey(entry.getKey())), label);
        I18nViewUtil.addComponentForKey(entry.getKey(), label);
    });
    Stream.of(new SimpleEntry<>("SQLENGINE_STANDARD", tabsSchema), new SimpleEntry<>("SQLENGINE_ZIP", tabsZip), new SimpleEntry<>("SQLENGINE_DIOS", tabsDios)).forEach(entry -> {
        tabsStandard.addTab(I18nUtil.valueByKey(entry.getKey()), entry.getValue());
        var label = new JLabel(I18nUtil.valueByKey(entry.getKey()));
        tabsStandard.setTabComponentAt(tabsStandard.indexOfTab(I18nUtil.valueByKey(entry.getKey())), label);
        I18nViewUtil.addComponentForKey(entry.getKey(), label);
    });
    var panelStructure = new JPanel(new BorderLayout());
    panelStructure.add(tabsStandard, BorderLayout.CENTER);
    panelStructure.setBorder(BorderFactory.createEmptyBorder());
    return panelStructure;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) SimpleEntry(java.util.AbstractMap.SimpleEntry) JTabbedPane(javax.swing.JTabbedPane) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane) JLabel(javax.swing.JLabel) TabbedPaneWheeled(com.jsql.view.swing.tab.TabbedPaneWheeled)

Example 10 with LightScrollPane

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

the class CreateFileTab method execute.

@Override
public void execute() {
    if (MediatorGui.tabResults() == null) {
        LOGGER.error("Unexpected unregistered MediatorGui.tabResults() in " + this.getClass());
    }
    JTextArea fileText = new JPopupTextArea().getProxy();
    fileText.setText(this.content);
    fileText.setFont(new Font(HelperUi.FONT_NAME_UBUNTU_MONO, Font.PLAIN, 14));
    LightScrollPane scroller = new LightScrollPane(1, 0, 0, 0, fileText);
    fileText.setCaretPosition(0);
    MediatorGui.tabResults().addTab(this.name + " ", scroller);
    // Focus on the new tab
    MediatorGui.tabResults().setSelectedComponent(scroller);
    // Create a custom tab header with close button
    TabHeader header = new TabHeader(this.name, HelperUi.ICON_FILE_SERVER);
    MediatorGui.tabResults().setToolTipTextAt(MediatorGui.tabResults().indexOfComponent(scroller), this.path);
    // Apply the custom header to the tab
    MediatorGui.tabResults().setTabComponentAt(MediatorGui.tabResults().indexOfComponent(scroller), header);
    // Add the path String to the list of files only if there is no same StringObject value already
    MediatorGui.managerWebshell().addToList(this.path.replace(this.name, ""));
    MediatorGui.managerUpload().addToList(this.path.replace(this.name, ""));
    MediatorGui.managerSqlshell().addToList(this.path.replace(this.name, ""));
}
Also used : TabHeader(com.jsql.view.swing.tab.TabHeader) JTextArea(javax.swing.JTextArea) JPopupTextArea(com.jsql.view.swing.text.JPopupTextArea) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane) Font(java.awt.Font)

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