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;
}
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;
}
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;
}
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;
}
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, ""));
}
Aggregations