use of com.jsql.view.swing.tree.model.AbstractNodeModel in project jsql-injection by ron190.
the class UpdateProgress method execute.
@Override
public void execute() {
if (MediatorGui.frame() == null) {
LOGGER.error("Unexpected unregistered MediatorGui.frame() in " + this.getClass());
}
DefaultMutableTreeNode node = MediatorGui.frame().getTreeNodeModels().get(this.dataElementDatabase);
// Fix Report #1368: ignore if no element database
if (node != null) {
// Get the node
AbstractNodeModel progressingTreeNodeModel = (AbstractNodeModel) node.getUserObject();
// Update the progress value of the model
progressingTreeNodeModel.setIndexProgress(this.dataCount);
// Tree model, update the tree (refresh, add node, etc)
DefaultTreeModel treeModel = (DefaultTreeModel) MediatorGui.treeDatabase().getModel();
// Update the node
treeModel.nodeChanged(node);
}
}
use of com.jsql.view.swing.tree.model.AbstractNodeModel in project jsql-injection by ron190.
the class EndIndeterminateProgress method execute.
@Override
public void execute() {
if (MediatorGui.treeDatabase() == null) {
LOGGER.error("Unexpected unregistered MediatorGui.treeDatabase() in " + this.getClass());
}
// Tree model, update the tree (refresh, add node, etc)
DefaultTreeModel treeModel = (DefaultTreeModel) MediatorGui.treeDatabase().getModel();
DefaultMutableTreeNode nodeModel = MediatorGui.frame().getTreeNodeModels().get(this.dataElementDatabase);
// Fix #1806 : NullPointerException on ...odels().get(dataElementDatabase).getUserObject()
if (nodeModel != null) {
// Get the node
AbstractNodeModel progressingTreeNodeModel = (AbstractNodeModel) nodeModel.getUserObject();
// Mark the node model as 'no loading bar'
progressingTreeNodeModel.setProgressing(false);
// Mark the node model as 'no stop/pause/resume button'
progressingTreeNodeModel.setRunning(false);
// Update the node
treeModel.nodeChanged(nodeModel);
}
}
use of com.jsql.view.swing.tree.model.AbstractNodeModel in project jsql-injection by ron190.
the class EndProgress method execute.
@Override
public void execute() {
if (MediatorGui.treeDatabase() == null) {
LOGGER.error("Unexpected unregistered MediatorGui.treeDatabase() in " + this.getClass());
}
// Tree model, update the tree (refresh, add node, etc)
DefaultTreeModel treeModel = (DefaultTreeModel) MediatorGui.treeDatabase().getModel();
// Report NullPointerException #1671
DefaultMutableTreeNode node = MediatorGui.frame().getTreeNodeModels().get(this.dataElementDatabase);
if (node != null) {
// Get the node
AbstractNodeModel progressingTreeNodeModel = (AbstractNodeModel) node.getUserObject();
// Mark the node model as 'no progress bar'
progressingTreeNodeModel.setLoading(false);
// Mark the node model as 'no stop/pause/resume button'
progressingTreeNodeModel.setRunning(false);
// Reset the progress value of the model
progressingTreeNodeModel.setIndexProgress(0);
// Update the node and progressbar
treeModel.nodeChanged(node);
}
}
use of com.jsql.view.swing.tree.model.AbstractNodeModel in project jsql-injection by ron190.
the class StartIndeterminateProgress method execute.
@Override
public void execute() {
if (MediatorGui.treeDatabase() == null) {
LOGGER.error("Unexpected unregistered MediatorGui.treeDatabase() in " + this.getClass());
}
// Tree model, update the tree (refresh, add node, etc)
DefaultTreeModel treeModel = (DefaultTreeModel) MediatorGui.treeDatabase().getModel();
DefaultMutableTreeNode node = MediatorGui.frame().getTreeNodeModels().get(this.dataElementDatabase);
// Fix #45540: NullPointerException on node.getUserObject()
if (node != null) {
// Get the node
AbstractNodeModel progressingTreeNodeModel = (AbstractNodeModel) node.getUserObject();
// Mark the node model as 'loading'
progressingTreeNodeModel.setProgressing(true);
// Update the node
treeModel.nodeChanged(node);
}
}
use of com.jsql.view.swing.tree.model.AbstractNodeModel in project jsql-injection by ron190.
the class CreateValuesTab method execute.
@Override
public void execute() {
if (MediatorGui.frame() == null) {
LOGGER.error("Unexpected unregistered MediatorGui.frame() in " + this.getClass());
}
// Report NullPointerException #1683
DefaultMutableTreeNode node = MediatorGui.frame().getTreeNodeModels().get(this.table);
if (node != null) {
// Get the node
AbstractNodeModel progressingTreeNodeModel = (AbstractNodeModel) node.getUserObject();
// Update the progress value of the model, end the progress
progressingTreeNodeModel.setIndexProgress(this.table.getChildCount());
// Mark the node model as 'no stop/pause/resume button'
progressingTreeNodeModel.setRunning(false);
// Create a new table to display the values
PanelTable newTableJPanel = new PanelTable(this.data, this.columnNames);
// Create a new tab: add header and table
MediatorGui.tabResults().addTab(StringUtil.detectUtf8(this.table.toString()), newTableJPanel);
newTableJPanel.setComponentOrientation(ComponentOrientation.getOrientation(I18n.getLocaleDefault()));
// Focus on the new tab
MediatorGui.tabResults().setSelectedComponent(newTableJPanel);
// Create a custom tab header with close button
TabHeader header = new TabHeader(StringUtil.detectUtf8Html(this.table.toString()));
MediatorGui.tabResults().setToolTipTextAt(MediatorGui.tabResults().indexOfComponent(newTableJPanel), "<html>" + "<b>" + this.table.getParent() + "." + this.table + "</b><br>" + "<i>" + String.join("<br>", Arrays.copyOfRange(this.columnNames, 2, this.columnNames.length)) + "</i>" + "</html>");
// Apply the custom header to the tab
MediatorGui.tabResults().setTabComponentAt(MediatorGui.tabResults().indexOfComponent(newTableJPanel), header);
}
}
Aggregations