no message

This commit is contained in:
2024-10-14 15:19:13 +03:00
parent 8eef367bd4
commit 5e09fb44ea
634 changed files with 3751 additions and 3263 deletions

View File

@@ -1,18 +1,17 @@
package _VisualDVM.Visual.Windows;
import Common.CommonConstants;
import Common.Current_;
import Common.Database.Objects.DBObject;
import Common.Passes.Pass;
import Common.Utils.TextLog;
import Common.Utils.Utils_;
import Common.Visual.Controls.ShortLabel;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.Visual.Editor.BaseEditor;
import _VisualDVM.Visual.Controls.ShortLabel;
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
import _VisualDVM.Visual.UI;
import Common.Utils.TextLog;
import _VisualDVM.Utils;
import Common.Passes.Pass;
import javafx.util.Pair;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaHighlighter;
import org.fife.ui.rtextarea.RTextScrollPane;
@@ -23,37 +22,106 @@ import java.util.Vector;
public abstract class ComparisonForm<T> {
public Class<T> t; //класс объектов.
//-->>
private JPanel content;
public JPanel getContent() {
return content;
}
protected JToolBar tools;
private JPanel editorPanel;
protected JLabel lObjectName;
protected JButton bApplyObject;
private JButton bPrevious;
private JButton bNext;
private JButton bCompare;
protected JButton bClose;
//-->>
ComparisonForm<T> this_ = null; //?
ComparisonForm<T> slave = null;
ComparisonForm<T> master = null;
//-->>
protected T object = null;
//-->>
protected BaseEditor Body;
private RTextScrollPane Scroll;
//-->>
public Vector<String> lines = new Vector<>(); //строки с учетом/неучетом пробелов. для сравнения
public Vector<String> visible_lines = new Vector<>(); //строки с нетронутыми пробелами. для отображения
//подсветка.
public LinkedHashMap<Integer, Pair<Integer, Boolean>> colors = new LinkedHashMap<>();
public RSyntaxTextAreaHighlighter slave_highlighter = null; //погонщик рабов
protected JToolBar tools;
protected JLabel lObjectName;
protected JButton bApplyObject;
protected JButton bClose;
//-->>
protected T object = null;
//-->>
protected BaseEditor Body;
//-->>
ComparisonForm<T> this_ = null; //?
ComparisonForm<T> slave = null;
ComparisonForm<T> master = null;
//-->>
private JPanel content;
private JPanel editorPanel;
private JButton bPrevious;
private JButton bNext;
private JButton bCompare;
private RTextScrollPane Scroll;
//-----
private boolean events_on = false;//относится только к мастеру, отвечает за скроллы.
private int current_diff_line = -1;
//--->>
// protected Object ownScrollModel = null;
//---<<
public ComparisonForm(Class<T> t_in, ComparisonForm<T> slave_in) {
//-
Body = new BaseEditor();
Scroll = new RTextScrollPane(Body);
editorPanel.add(Scroll);
// ownScrollModel = Scroll.getVerticalScrollBar().getModel();
//-
t = t_in;
this_ = this;
slave = slave_in;
bPrevious.setVisible(isMaster());
bNext.setVisible(isMaster());
Scroll.setLineNumbersEnabled(true);
bApplyObject.addActionListener(e -> {
ApplyObject();
});
//--->>>
Body.setWhitespaceVisible(true);
Body.setEditable(false);
if (isMaster()) {
//<editor-fold desc="синхронизация скроллов">
slave.Scroll.getVerticalScrollBar().setModel(Scroll.getVerticalScrollBar().getModel());
slave_highlighter = (RSyntaxTextAreaHighlighter) slave.Body.getHighlighter();
//бяк быть не должно при условии что строк одинаковое количество. а это должно выполняться.
Body.addCaretListener(e -> {
if (events_on && isReady() && slave.isReady()) {
try {
int master_lineNum = Body.getCaretLineNumber();
slave.Body.setCaretPosition(slave.Body.getLineStartOffset(master_lineNum));
} catch (Exception ex) {
Utils_.MainLog.PrintException(ex);
}
}
});
//</editor-fold>
slave.master = this;
bPrevious.addActionListener(e -> {
if (current_diff_line != CommonConstants.Nan) {
if (current_diff_line > 0)
current_diff_line--;
else
current_diff_line = colors.size() - 1;
ShowCurrentDiff();
}
});
bNext.addActionListener(e -> {
if (current_diff_line != CommonConstants.Nan) {
if (current_diff_line < colors.size() - 1)
current_diff_line++;
else
current_diff_line = 0;
ShowCurrentDiff();
}
});
bCompare.addActionListener(e -> {
DoComparePass(isReady() && slave.isReady());
});
} else {
//рабу сравнивать не положено.
bCompare.setVisible(false);
}
//--->>>
bClose.addActionListener(e -> {
onClose();
});
}
public JPanel getContent() {
return content;
}
//--->>
public boolean isMaster() {
return slave != null;
}
@@ -84,9 +152,9 @@ public abstract class ComparisonForm<T> {
} else
UI_.Info(log.toString());
}
public void ApplyObject(DBObject object_in){
public void ApplyObject(DBObject object_in) {
RemoveObject();
object = (T)object_in;
object = (T) object_in;
applyObject();
showObject();
}
@@ -222,75 +290,6 @@ public abstract class ComparisonForm<T> {
protected boolean fortranWrapsOn() {
return false;
}
//--->>
// protected Object ownScrollModel = null;
//---<<
public ComparisonForm(Class<T> t_in, ComparisonForm<T> slave_in) {
//-
Body = new BaseEditor();
Scroll = new RTextScrollPane(Body);
editorPanel.add(Scroll);
// ownScrollModel = Scroll.getVerticalScrollBar().getModel();
//-
t = t_in;
this_ = this;
slave = slave_in;
bPrevious.setVisible(isMaster());
bNext.setVisible(isMaster());
Scroll.setLineNumbersEnabled(true);
bApplyObject.addActionListener(e -> {
ApplyObject();
});
//--->>>
Body.setWhitespaceVisible(true);
Body.setEditable(false);
if (isMaster()) {
//<editor-fold desc="синхронизация скроллов">
slave.Scroll.getVerticalScrollBar().setModel(Scroll.getVerticalScrollBar().getModel());
slave_highlighter = (RSyntaxTextAreaHighlighter) slave.Body.getHighlighter();
//бяк быть не должно при условии что строк одинаковое количество. а это должно выполняться.
Body.addCaretListener(e -> {
if (events_on && isReady() && slave.isReady()) {
try {
int master_lineNum = Body.getCaretLineNumber();
slave.Body.setCaretPosition(slave.Body.getLineStartOffset(master_lineNum));
} catch (Exception ex) {
Utils_.MainLog.PrintException(ex);
}
}
});
//</editor-fold>
slave.master = this;
bPrevious.addActionListener(e -> {
if (current_diff_line != CommonConstants.Nan) {
if (current_diff_line > 0)
current_diff_line--;
else
current_diff_line = colors.size() - 1;
ShowCurrentDiff();
}
});
bNext.addActionListener(e -> {
if (current_diff_line != CommonConstants.Nan) {
if (current_diff_line < colors.size() - 1)
current_diff_line++;
else
current_diff_line = 0;
ShowCurrentDiff();
}
});
bCompare.addActionListener(e -> {
DoComparePass(isReady() && slave.isReady());
});
} else {
//рабу сравнивать не положено.
bCompare.setVisible(false);
}
//--->>>
bClose.addActionListener(e -> {
onClose();
});
}
//-->>
private void createUIComponents() {
// TODO: place custom component creation code here