use of com.jsql.view.swing.sql.text.JTextPaneLexer 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);
}
}
Aggregations