Перенос.
This commit is contained in:
24
src/Common/UI/Windows/Dialog/DBObjectDialog.java
Normal file
24
src/Common/UI/Windows/Dialog/DBObjectDialog.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import Common.Database.DBObject;
|
||||
public abstract class DBObjectDialog<T extends DBObject, F extends DialogFields> extends Dialog<T, F> {
|
||||
public boolean edit = false;
|
||||
public DBObjectDialog(Class<F> f) {
|
||||
super(f);
|
||||
}
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
//тут входной параметр всегда объект. он же и есть Result
|
||||
//считаем что он всегда создан.
|
||||
Result = (T) params[0];
|
||||
fillFields();
|
||||
}
|
||||
public void SetEditLimits() {
|
||||
//установить ограничения если объект в режиме редактирования( например нельзя менять тип машины, или почту адресата)
|
||||
}
|
||||
public void fillFields() {
|
||||
//отобразить объект
|
||||
}
|
||||
public void SetReadonly(){
|
||||
//заблокировать окно для редактирования
|
||||
}
|
||||
}
|
||||
160
src/Common/UI/Windows/Dialog/Dialog.java
Normal file
160
src/Common/UI/Windows/Dialog/Dialog.java
Normal file
@@ -0,0 +1,160 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.Themes.ThemeElement;
|
||||
import Common.UI.Themes.VisualiserFonts;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
//T Тип объекта
|
||||
//F Тип полей.
|
||||
public class Dialog<T, F extends DialogFields> extends JDialog implements ThemeElement {
|
||||
public F fields; //рабочая область диалога.
|
||||
public String title_text;
|
||||
public JLabel lTitle = new JLabel();
|
||||
public boolean OK = false;
|
||||
//--------------------------------------
|
||||
public T Result = null;
|
||||
public Class<F> f = null;
|
||||
public TextLog Log = new TextLog(); //журнал валидации.
|
||||
protected JScrollPane scroll = null;
|
||||
protected JPanel buttonsPane = null;
|
||||
protected JButton btnOK = null;
|
||||
protected JButton btnCancel = null;
|
||||
protected JCheckBox showNoMore = null;
|
||||
public String getIconPath() {
|
||||
return "";
|
||||
}
|
||||
protected Component content;
|
||||
//--------------------------------------
|
||||
public Dialog(Class<F> f_in) {
|
||||
f = f_in;
|
||||
setModal(true);
|
||||
toFront();
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
lTitle.setFont(Current.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
if (!getIconPath().isEmpty()) {
|
||||
setIconImage(Utils.getIcon(getIconPath()).getImage());
|
||||
}
|
||||
//делаем титульную надпись в самом окне чтобы не зависеть от языковой политики ОС
|
||||
getContentPane().add(lTitle, BorderLayout.NORTH);
|
||||
//сюда добавляется содержимое.
|
||||
content = null;
|
||||
CreateContent();
|
||||
InitFields(); //дополнительная инициализация полей..
|
||||
getContentPane().add(NeedsScroll() ? (scroll = new JScrollPane(content)) : content, BorderLayout.CENTER);
|
||||
CreateButtons();
|
||||
// call onCancel() when cross is clicked
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
UI.windowsStack.pop();
|
||||
System.out.println("Previous Front Window");
|
||||
onCancel();
|
||||
onClose();
|
||||
}
|
||||
});
|
||||
// pack(); //авторазмер окна.
|
||||
setLocationRelativeTo(null);
|
||||
LoadSize();
|
||||
}
|
||||
public void CreateContent() {
|
||||
try {
|
||||
content = (fields = f.newInstance()).getContent();
|
||||
//--?
|
||||
} catch (Exception e) {
|
||||
Global.Log.PrintException(e);
|
||||
}
|
||||
}
|
||||
public void onClose() {
|
||||
|
||||
}
|
||||
public void LoadSize() {
|
||||
setMinimumSize(new Dimension(getDefaultWidth(), getDefaultHeight()));
|
||||
setPreferredSize(new Dimension(getDefaultWidth(), getDefaultHeight()));
|
||||
}
|
||||
//бывает что у полей собственные скроллы
|
||||
public boolean NeedsScroll() {
|
||||
return true;
|
||||
}
|
||||
public boolean NeedsShowNoMore() {
|
||||
return false;
|
||||
}
|
||||
public int getDefaultWidth() {
|
||||
return 800;
|
||||
}
|
||||
public int getDefaultHeight() {
|
||||
return 450;
|
||||
}
|
||||
//создание полей формы( без заполнения)
|
||||
public void InitFields() {
|
||||
}
|
||||
public void CreateButtons() {
|
||||
btnOK = new JButton(" OK ");
|
||||
btnCancel = new JButton("Отмена");
|
||||
buttonsPane = new JPanel();
|
||||
buttonsPane.setOpaque(true);
|
||||
buttonsPane.setBackground(Color.WHITE);
|
||||
btnOK.addActionListener(e -> onOK());
|
||||
btnCancel.addActionListener(e -> onCancel());
|
||||
buttonsPane.add(btnOK);
|
||||
buttonsPane.add(btnCancel);
|
||||
if (NeedsShowNoMore()) {
|
||||
buttonsPane.add(showNoMore = new JCheckBox("больше не показывать"));
|
||||
showNoMore.setOpaque(true);
|
||||
showNoMore.setBackground(Color.WHITE);
|
||||
}
|
||||
getContentPane().add(buttonsPane, BorderLayout.SOUTH);
|
||||
}
|
||||
public boolean isOnTop() {
|
||||
return true;
|
||||
}
|
||||
public boolean ShowDialog(String title, Object... params) {
|
||||
OK = false;
|
||||
title_text = title;
|
||||
Init(params);
|
||||
ShowTitle();
|
||||
setAlwaysOnTop(isOnTop());
|
||||
UI.windowsStack.push(this);
|
||||
System.out.println("New Front Window");
|
||||
setVisible(true);
|
||||
return OK;
|
||||
}
|
||||
public void ShowTitle() {
|
||||
lTitle.setText(getTitleText());
|
||||
}
|
||||
public String getTitleText() {
|
||||
return title_text;
|
||||
}
|
||||
public void Init(Object... params) {
|
||||
}
|
||||
public void onOK() {
|
||||
Log.Clear();
|
||||
validateFields();
|
||||
if (Log.isEmpty()) {
|
||||
ProcessResult();
|
||||
OK = true;
|
||||
CloseAction();
|
||||
} else
|
||||
UI.Error("Валидация не пройдена:\n" + Log.toString());
|
||||
}
|
||||
protected void onCancel() {
|
||||
CloseAction();
|
||||
}
|
||||
public void CloseAction() {
|
||||
dispose();
|
||||
}
|
||||
public void validateFields() {
|
||||
}
|
||||
public void ProcessResult() {
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
//todo -> Применение темы
|
||||
}
|
||||
}
|
||||
5
src/Common/UI/Windows/Dialog/DialogFields.java
Normal file
5
src/Common/UI/Windows/Dialog/DialogFields.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import java.awt.*;
|
||||
public interface DialogFields {
|
||||
Component getContent();
|
||||
}
|
||||
9
src/Common/UI/Windows/Dialog/DialogSlider.java
Normal file
9
src/Common/UI/Windows/Dialog/DialogSlider.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class DialogSlider extends JSlider implements DialogFields {
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
9
src/Common/UI/Windows/Dialog/DialogSpinner.java
Normal file
9
src/Common/UI/Windows/Dialog/DialogSpinner.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class DialogSpinner extends JSpinner implements DialogFields {
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
16
src/Common/UI/Windows/Dialog/DialogTextComboBox.java
Normal file
16
src/Common/UI/Windows/Dialog/DialogTextComboBox.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import Common.Current;
|
||||
import Common.UI.Themes.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class DialogTextComboBox extends JComboBox<String> implements DialogFields {
|
||||
public DialogTextComboBox() {
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setEditable(false);
|
||||
}
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
10
src/Common/UI/Windows/Dialog/DialogTextField.java
Normal file
10
src/Common/UI/Windows/Dialog/DialogTextField.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import Common.UI.TextField.StyledTextField;
|
||||
|
||||
import java.awt.*;
|
||||
public class DialogTextField extends StyledTextField implements DialogFields {
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
42
src/Common/UI/Windows/Dialog/DialogWrapText.java
Normal file
42
src/Common/UI/Windows/Dialog/DialogWrapText.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import Common.Current;
|
||||
import Common.UI.Themes.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class DialogWrapText extends JTextPane implements DialogFields {
|
||||
public DialogWrapText(){
|
||||
setOpaque(true);
|
||||
setBackground(Color.WHITE);
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeBold));
|
||||
setEditable(false);
|
||||
}
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
/*
|
||||
public void setTextW(String text_in){
|
||||
String[] lines = text_in.split("\n");
|
||||
String labelText = "";
|
||||
if (lines.length == 1) {
|
||||
labelText = text_in;
|
||||
} else {
|
||||
int i = 0;
|
||||
for (String line : lines) {
|
||||
String fline = "";
|
||||
if (i == 0) {
|
||||
fline = "<html><body>" + line + "<br>";
|
||||
} else if (i == lines.length - 1) {
|
||||
fline = line + "</body></html>";
|
||||
} else {
|
||||
fline = line + "<br>";
|
||||
}
|
||||
++i;
|
||||
labelText += fline;
|
||||
}
|
||||
}
|
||||
setText(labelText);
|
||||
}
|
||||
*/
|
||||
}
|
||||
11
src/Common/UI/Windows/Dialog/NumberDialog.java
Normal file
11
src/Common/UI/Windows/Dialog/NumberDialog.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
public abstract class NumberDialog<F extends DialogFields> extends Dialog<Integer, F> {
|
||||
public NumberDialog(Class<F> f) {
|
||||
super(f);
|
||||
}
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
if (params.length > 0) setNumber((int) params[0]);
|
||||
}
|
||||
public abstract void setNumber(int num_in);
|
||||
}
|
||||
22
src/Common/UI/Windows/Dialog/PercentsForm.java
Normal file
22
src/Common/UI/Windows/Dialog/PercentsForm.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
public class PercentsForm extends SliderNumberForm {
|
||||
public PercentsForm() {
|
||||
}
|
||||
@Override
|
||||
public String getTitleText() {
|
||||
return super.getTitleText() + "%";
|
||||
}
|
||||
@Override
|
||||
public void InitFields() {
|
||||
fields.setPaintLabels(true);
|
||||
fields.setPaintTicks(true);
|
||||
fields.setPaintTrack(true);
|
||||
fields.setSnapToTicks(true);
|
||||
fields.setMinorTickSpacing(1);
|
||||
fields.setMajorTickSpacing(25);
|
||||
}
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
super.Init(params[0], 0, 100);
|
||||
}
|
||||
}
|
||||
10
src/Common/UI/Windows/Dialog/SessionMaxtimeDialog.java
Normal file
10
src/Common/UI/Windows/Dialog/SessionMaxtimeDialog.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import javax.swing.*;
|
||||
public class SessionMaxtimeDialog extends SpinnerNumberForm {
|
||||
public SessionMaxtimeDialog() {
|
||||
}
|
||||
@Override
|
||||
public void InitFields() {
|
||||
fields.setModel(new SpinnerNumberModel(10, 5, 65535, 1));
|
||||
}
|
||||
}
|
||||
53
src/Common/UI/Windows/Dialog/SliderNumberForm.java
Normal file
53
src/Common/UI/Windows/Dialog/SliderNumberForm.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
public class SliderNumberForm extends NumberDialog<DialogSlider> {
|
||||
public SliderNumberForm() {
|
||||
super(DialogSlider.class);
|
||||
setResizable(false);
|
||||
}
|
||||
@Override
|
||||
public void setNumber(int num_in) {
|
||||
fields.setValue(num_in);
|
||||
}
|
||||
//тут всегда должно быть три параметра
|
||||
//минимум нет смысла задавать меньше 1
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
if (params.length == 3) {
|
||||
setNumber((Integer) params[0]);
|
||||
fields.setMinimum((Integer) params[1]);
|
||||
fields.setMaximum((Integer) params[2]);
|
||||
}
|
||||
fields.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
ShowTitle();
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void InitFields() {
|
||||
fields.setPaintLabels(true);
|
||||
fields.setPaintTicks(true);
|
||||
fields.setPaintTrack(true);
|
||||
fields.setSnapToTicks(false);
|
||||
fields.setMinorTickSpacing(1);
|
||||
fields.setMajorTickSpacing(1);
|
||||
}
|
||||
@Override
|
||||
public int getDefaultWidth() {
|
||||
return 600;
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 200;
|
||||
}
|
||||
@Override
|
||||
public String getTitleText() {
|
||||
return title_text + " : " + fields.getValue();
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result = fields.getValue();
|
||||
}
|
||||
}
|
||||
22
src/Common/UI/Windows/Dialog/SpinnerNumberForm.java
Normal file
22
src/Common/UI/Windows/Dialog/SpinnerNumberForm.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package Common.UI.Windows.Dialog;
|
||||
public abstract class SpinnerNumberForm extends NumberDialog<DialogSpinner> {
|
||||
public SpinnerNumberForm() {
|
||||
super(DialogSpinner.class);
|
||||
}
|
||||
@Override
|
||||
public void setNumber(int num_in) {
|
||||
fields.setValue(num_in);
|
||||
}
|
||||
@Override
|
||||
public int getDefaultWidth() {
|
||||
return 400;
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 130;
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result = (Integer) fields.getValue();
|
||||
}
|
||||
}
|
||||
35
src/Common/UI/Windows/Dialog/Text/ComboTextDialog.java
Normal file
35
src/Common/UI/Windows/Dialog/Text/ComboTextDialog.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package Common.UI.Windows.Dialog.Text;
|
||||
import Common.UI.Windows.Dialog.Dialog;
|
||||
import Common.UI.Windows.Dialog.DialogTextComboBox;
|
||||
|
||||
import java.util.Vector;
|
||||
public class ComboTextDialog extends Dialog<String, DialogTextComboBox> {
|
||||
public ComboTextDialog() {
|
||||
super(DialogTextComboBox.class);
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result = (String) fields.getSelectedItem();
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
if (fields.getSelectedItem() == null)
|
||||
Log.Writeln("Элемент не выбран");
|
||||
}
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
Vector<String> sp = (Vector<String>) params[0];
|
||||
if (!sp.isEmpty()) {
|
||||
for (Object p : sp)
|
||||
fields.addItem(p.toString());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getDefaultWidth() {
|
||||
return 450;
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 135;
|
||||
}
|
||||
}
|
||||
10
src/Common/UI/Windows/Dialog/Text/FileNameForm.java
Normal file
10
src/Common/UI/Windows/Dialog/Text/FileNameForm.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package Common.UI.Windows.Dialog.Text;
|
||||
import Common.Utils.Utils;
|
||||
public class FileNameForm extends TextFieldDialog {
|
||||
public FileNameForm() {
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
Utils.validateFileShortNewName(fields.getText(), Log);
|
||||
}
|
||||
}
|
||||
25
src/Common/UI/Windows/Dialog/Text/MultilineTextForm.java
Normal file
25
src/Common/UI/Windows/Dialog/Text/MultilineTextForm.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package Common.UI.Windows.Dialog.Text;
|
||||
import Common.UI.Editor.BaseEditor;
|
||||
public class MultilineTextForm extends TextDialog<BaseEditor> {
|
||||
public MultilineTextForm() {
|
||||
super(BaseEditor.class);
|
||||
}
|
||||
//при наследовании по умолчанию поля не присваивать!
|
||||
//инициализация полей работает после конструктора предка!!
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result = fields.getText();
|
||||
}
|
||||
@Override
|
||||
public void InitFields() {
|
||||
fields.setSearchEnabled(false);
|
||||
fields.setLineWrap(true);
|
||||
fields.setWrapStyleWord(true);
|
||||
fields.setHighlightCurrentLine(false);
|
||||
}
|
||||
@Override
|
||||
public void setText(String text_in) {
|
||||
fields.setText(text_in);
|
||||
fields.setCaretPosition(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package Common.UI.Windows.Dialog.Text;
|
||||
public class ReadOnlyMultilineTextForm extends MultilineTextForm {
|
||||
public ReadOnlyMultilineTextForm() {
|
||||
}
|
||||
@Override
|
||||
public void InitFields() {
|
||||
fields.setEditable(false);
|
||||
}
|
||||
@Override
|
||||
public void CreateButtons() {
|
||||
}
|
||||
}
|
||||
15
src/Common/UI/Windows/Dialog/Text/TextDialog.java
Normal file
15
src/Common/UI/Windows/Dialog/Text/TextDialog.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package Common.UI.Windows.Dialog.Text;
|
||||
import Common.UI.Windows.Dialog.Dialog;
|
||||
import Common.UI.Windows.Dialog.DialogFields;
|
||||
//текстовый диалог. возвращает текст. может иметь параметром исходный текст.
|
||||
public abstract class TextDialog<F extends DialogFields> extends Dialog<String, F> {
|
||||
public TextDialog(Class<F> f) {
|
||||
super(f);
|
||||
}
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
if (params.length > 0) setText((String) params[0]);
|
||||
}
|
||||
public abstract void setText(String text_in);
|
||||
}
|
||||
|
||||
35
src/Common/UI/Windows/Dialog/Text/TextFieldDialog.java
Normal file
35
src/Common/UI/Windows/Dialog/Text/TextFieldDialog.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package Common.UI.Windows.Dialog.Text;
|
||||
import Common.UI.Windows.Dialog.DialogTextField;
|
||||
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
public class TextFieldDialog extends TextDialog<DialogTextField> {
|
||||
public TextFieldDialog() {
|
||||
super(DialogTextField.class);
|
||||
setResizable(false);
|
||||
fields.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
onOK();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public int getDefaultWidth() {
|
||||
return 450;
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 135;
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result = fields.getText();
|
||||
}
|
||||
@Override
|
||||
public void setText(String text_in) {
|
||||
fields.setText(text_in);
|
||||
}
|
||||
}
|
||||
98
src/Common/UI/Windows/Form.java
Normal file
98
src/Common/UI/Windows/Form.java
Normal file
@@ -0,0 +1,98 @@
|
||||
package Common.UI.Windows;
|
||||
import Common.Global;
|
||||
import Common.UI.Themes.ThemeElement;
|
||||
import GlobalData.FormsParams.DBForm;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.sql.SQLException;
|
||||
public abstract class Form extends JFrame implements ThemeElement {
|
||||
private DBForm info = null;
|
||||
public Form() {
|
||||
if (getIconName().length() > 0) setIconImage(new ImageIcon(Form.class.getResource(getIconName())).getImage());
|
||||
SetListener();
|
||||
this.setTitle(Global.isWindows ? getWTitleText() : getUTitleText());
|
||||
pack();
|
||||
setMinimumSize(new Dimension(getDefaultWidth(), getDefaultHeight()));
|
||||
}
|
||||
abstract protected JPanel getMainPanel();
|
||||
public String getIconName() {
|
||||
return "";
|
||||
}
|
||||
public String getWTitleText() {
|
||||
return "";
|
||||
}
|
||||
public String getUTitleText() {
|
||||
return "";
|
||||
}
|
||||
protected FormType getFormType() {
|
||||
return FormType.Undefined;
|
||||
}
|
||||
protected void SetListener() {
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
Close();
|
||||
}
|
||||
});
|
||||
}
|
||||
public int getDefaultWidth() {
|
||||
return 800;
|
||||
}
|
||||
public int getDefaultHeight() {
|
||||
return 450;
|
||||
}
|
||||
/*
|
||||
*вызывать после перегрузки, чтобы отобразить окно.
|
||||
*/
|
||||
public Component getRelative() {
|
||||
return null;
|
||||
}
|
||||
public void Show() {
|
||||
try {
|
||||
LoadWindowParameters();
|
||||
} catch (Exception e) {
|
||||
Global.Log.PrintException(e);
|
||||
}
|
||||
setContentPane(getMainPanel());
|
||||
setVisible(true);
|
||||
}
|
||||
public void Close() {
|
||||
try {
|
||||
SaveWindowParameters();
|
||||
} catch (Exception e) {
|
||||
Global.Log.PrintException(e);
|
||||
}
|
||||
setVisible(false);
|
||||
dispose();
|
||||
AfterClose();
|
||||
}
|
||||
public void AfterClose() {
|
||||
}
|
||||
public void LoadWindowParameters() throws SQLException, InstantiationException, IllegalAccessException, NoSuchFieldException {
|
||||
if (!getFormType().equals(FormType.Undefined))
|
||||
if (Global.db.forms.Data.containsKey(getFormType())) {
|
||||
info = Global.db.forms.Data.get(getFormType());
|
||||
info.Apply(this);
|
||||
return;
|
||||
}
|
||||
setSize(getDefaultWidth(), getDefaultHeight());
|
||||
setLocationRelativeTo(getRelative());
|
||||
}
|
||||
public void SaveWindowParameters() throws Exception {
|
||||
if (!getFormType().equals(FormType.Undefined)) {
|
||||
if (info != null) {
|
||||
info.Init(this);
|
||||
Global.db.Update(info);
|
||||
} else
|
||||
Global.db.Insert(new DBForm(getFormType(), this));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
//todo -> применение темы.
|
||||
}
|
||||
}
|
||||
10
src/Common/UI/Windows/FormType.java
Normal file
10
src/Common/UI/Windows/FormType.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package Common.UI.Windows;
|
||||
public enum FormType {
|
||||
Undefined,
|
||||
|
||||
Main,
|
||||
SearchReplace,
|
||||
Components,
|
||||
RemoteFileChooser,
|
||||
Profiles
|
||||
}
|
||||
BIN
src/Common/UI/Windows/Sapfor.png
Normal file
BIN
src/Common/UI/Windows/Sapfor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
213
src/Common/UI/Windows/SearchReplaceForm.form
Normal file
213
src/Common/UI/Windows/SearchReplaceForm.form
Normal file
@@ -0,0 +1,213 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="Common.UI.Windows.SearchReplaceForm">
|
||||
<grid id="cbd77" binding="MainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="48" y="54" width="723" height="433"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="7e504" layout-manager="GridLayoutManager" row-count="11" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="8f101" class="javax.swing.JTextField" binding="tfFind" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="1e6aa" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="90" height="20"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<horizontalAlignment value="0"/>
|
||||
<text value="поиск"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="20f14" class="javax.swing.JCheckBox" binding="replaceOn">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="90" height="27"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="замена"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="7a05a" class="javax.swing.JTextField" binding="tfReplace" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="false"/>
|
||||
<font name="Times New Roman" size="16"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ab9" class="javax.swing.JCheckBox" binding="registerOn">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="Учитывать регистр"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="71774" class="javax.swing.JCheckBox" binding="wholeWordOn">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="Слово целиком"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="6e6a7" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="5" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16"/>
|
||||
<text value="Направление поиска"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ceb1a" class="javax.swing.JRadioButton" binding="rbUp">
|
||||
<constraints>
|
||||
<grid row="6" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<selected value="false"/>
|
||||
<text value="Вверх"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a5775" class="javax.swing.JRadioButton" binding="rbDown">
|
||||
<constraints>
|
||||
<grid row="7" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<selected value="true"/>
|
||||
<text value="Вниз"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="7c480" class="javax.swing.JButton" binding="bNext">
|
||||
<constraints>
|
||||
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="144" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="3"/>
|
||||
<text value="Найти далее"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="6eff3" class="javax.swing.JCheckBox" binding="loopOn">
|
||||
<constraints>
|
||||
<grid row="4" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="Зациклить поиск"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="dd8e2" class="javax.swing.JButton" binding="bAll">
|
||||
<constraints>
|
||||
<grid row="10" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="127" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="3"/>
|
||||
<text value="Найти всё"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="905c1" class="javax.swing.JButton" binding="bSearchInFiles">
|
||||
<constraints>
|
||||
<grid row="10" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="127" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="3"/>
|
||||
<text value="Найти в файлах"/>
|
||||
<visible value="true"/>
|
||||
</properties>
|
||||
</component>
|
||||
<scrollpane id="3dd41">
|
||||
<constraints>
|
||||
<grid row="0" column="3" row-span="9" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="4e002" binding="filesTreePanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<hspacer id="a2529">
|
||||
<constraints>
|
||||
<grid row="10" column="4" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="8e0e8" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="9" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16"/>
|
||||
<text value="Всего совпадений в файлах:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="bc3e5" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16"/>
|
||||
<text value="Найдено совпадений:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="3e591" class="javax.swing.JLabel" binding="lCount">
|
||||
<constraints>
|
||||
<grid row="9" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16"/>
|
||||
<text value="0"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="fde6a" class="javax.swing.JLabel" binding="lFilesMatchesCount">
|
||||
<constraints>
|
||||
<grid row="9" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16"/>
|
||||
<text value="0"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
253
src/Common/UI/Windows/SearchReplaceForm.java
Normal file
253
src/Common/UI/Windows/SearchReplaceForm.java
Normal file
@@ -0,0 +1,253 @@
|
||||
package Common.UI.Windows;
|
||||
import Common.Current;
|
||||
import Common.UI.TextField.StyledTextField;
|
||||
import Common.UI.Trees.StyledTree;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import javafx.util.Pair;
|
||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||
import org.fife.ui.rtextarea.SearchContext;
|
||||
import org.fife.ui.rtextarea.SearchEngine;
|
||||
import org.fife.ui.rtextarea.SearchResult;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.LinkedHashMap;
|
||||
public class SearchReplaceForm extends Form {
|
||||
public JPanel MainPanel;
|
||||
public boolean forward = true;
|
||||
SearchContext context = null;
|
||||
RSyntaxTextArea editor = null;
|
||||
boolean replace_mode = false;
|
||||
private JTextField tfFind;
|
||||
private JTextField tfReplace;
|
||||
private JCheckBox replaceOn;
|
||||
private JCheckBox registerOn;
|
||||
private JCheckBox wholeWordOn;
|
||||
private JRadioButton rbUp;
|
||||
private JRadioButton rbDown;
|
||||
private JButton bAll;
|
||||
private JButton bNext;
|
||||
private JCheckBox loopOn;
|
||||
private JLabel lCount;
|
||||
private SearchResult result = null;
|
||||
//https://techarks.ru/qa/java/kak-uznat-kakoj-iz-jlist-s-Y4/
|
||||
public void ClearMarkers() {
|
||||
//сброс выделения. решается подсовыванием пустой строки
|
||||
context.setSearchFor("");
|
||||
SearchEngine.find(editor, context);
|
||||
DropMatchCount();
|
||||
}
|
||||
public void DropMatchCount() {
|
||||
lCount.setText("0");
|
||||
}
|
||||
public void setEditor(RSyntaxTextArea editor_in) {
|
||||
editor = editor_in;
|
||||
}
|
||||
@Override
|
||||
protected JPanel getMainPanel() {
|
||||
return MainPanel;
|
||||
}
|
||||
@Override
|
||||
public void Close() {
|
||||
ClearMarkers();
|
||||
super.Close();
|
||||
}
|
||||
public void setMode(boolean replace) {
|
||||
replace_mode = replace;
|
||||
System.out.println("MODE CHANGED");
|
||||
tfReplace.setEnabled(replace_mode);
|
||||
String prefix = replace_mode ? "Заменить" : "Найти";
|
||||
bNext.setText(prefix + " далее");
|
||||
bAll.setText(prefix + " всё");
|
||||
}
|
||||
public void ShowMode() {
|
||||
replaceOn.setSelected(replace_mode);
|
||||
}
|
||||
@Override
|
||||
public Component getRelative() {
|
||||
return (Component) UI.getMainWindow();
|
||||
}
|
||||
@Override
|
||||
public int getDefaultWidth() {
|
||||
return 650;
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 400;
|
||||
}
|
||||
public void Refresh() {
|
||||
String text = editor.getSelectedText();
|
||||
if ((text != null) && !text.isEmpty())
|
||||
tfFind.setText(text);
|
||||
tfFind.requestFocus();
|
||||
}
|
||||
//-------------------------------
|
||||
public void SwitchDirection(boolean direction_in) {
|
||||
forward = direction_in;
|
||||
if (forward) {
|
||||
rbUp.setSelected(false);
|
||||
rbDown.setSelected(true);
|
||||
} else {
|
||||
rbDown.setSelected(false);
|
||||
rbUp.setSelected(true);
|
||||
}
|
||||
}
|
||||
public void applyParams() {
|
||||
String toFind = Utils.hideRegularMetasymbols(tfFind.getText());
|
||||
String toReplace = Utils.hideRegularMetasymbols(tfReplace.getText());
|
||||
System.out.println("toFind=" + toFind);
|
||||
System.out.println("toReplace" + toReplace);
|
||||
System.out.println("============");
|
||||
context.setSearchFor(toFind);
|
||||
context.setMatchCase(registerOn.isSelected());
|
||||
context.setWholeWord(wholeWordOn.isSelected());
|
||||
if (replace_mode)
|
||||
context.setReplaceWith(toReplace);
|
||||
DropMatchCount();
|
||||
}
|
||||
public void onAll() {
|
||||
applyParams();
|
||||
result = replace_mode ?
|
||||
SearchEngine.replaceAll(editor, context) : SearchEngine.markAll(editor, context);
|
||||
lCount.setText(String.valueOf(
|
||||
replace_mode ? result.getCount() : result.getMarkedCount()));
|
||||
}
|
||||
public void onNext() {
|
||||
applyParams();
|
||||
context.setSearchForward(forward);
|
||||
result = replace_mode ? SearchEngine.replace(editor, context) : SearchEngine.find(editor, context);
|
||||
if (loopOn.isSelected() && !result.wasFound()) SwitchDirection(!forward);
|
||||
lCount.setText(String.valueOf(result.getMarkedCount()));
|
||||
}
|
||||
@Override
|
||||
protected FormType getFormType() {
|
||||
return FormType.SearchReplace;
|
||||
}
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
tfFind = new StyledTextField();
|
||||
tfReplace = new StyledTextField();
|
||||
}
|
||||
//------------------
|
||||
//-
|
||||
private JButton bSearchInFiles;
|
||||
private JPanel filesTreePanel;
|
||||
private JLabel lFilesMatchesCount;
|
||||
public static String lastProjectPath = "";
|
||||
public static LinkedHashMap<String, Long> matches = new LinkedHashMap<>();
|
||||
public void dropFilesMatches() {
|
||||
matches = new LinkedHashMap<>();
|
||||
}
|
||||
public void showNoFilesMatches() {
|
||||
lFilesMatchesCount.setText("—");
|
||||
UI.Clear(filesTreePanel);
|
||||
}
|
||||
public void showFilesMatches() {
|
||||
long total = 0;
|
||||
DefaultMutableTreeNode res = new DefaultMutableTreeNode("файлов " + matches.size());
|
||||
for (String fileName : matches.keySet()) {
|
||||
DefaultMutableTreeNode fileNode = new DefaultMutableTreeNode(new Pair(fileName, matches.get(fileName)) {
|
||||
@Override
|
||||
public String toString() {
|
||||
return getKey() + ":" + getValue();
|
||||
}
|
||||
});
|
||||
res.add(fileNode);
|
||||
total += matches.get(fileName);
|
||||
}
|
||||
StyledTree matchesTree = new StyledTree(res) {
|
||||
{
|
||||
setRootVisible(false);
|
||||
}
|
||||
@Override
|
||||
public void LeftMouseAction2() {
|
||||
DefaultMutableTreeNode selectedFile = (DefaultMutableTreeNode) getLastSelectedPathComponent();
|
||||
if (selectedFile != null) {
|
||||
Pair<String, Long> info = (Pair<String, Long>) selectedFile.getUserObject();
|
||||
if (Current.getProject().db.files.containsKey(info.getKey())) {
|
||||
Pass_2021.passes.get(PassCode_2021.OpenCurrentFile).Do(Current.getProject().db.files.get(info.getKey()));
|
||||
//--->>>
|
||||
replaceOn.setSelected(false);
|
||||
setMode(false);
|
||||
SwitchDirection(true);
|
||||
//-
|
||||
bNext.requestFocus();
|
||||
bNext.doClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
filesTreePanel.add(matchesTree);
|
||||
filesTreePanel.revalidate();
|
||||
filesTreePanel.repaint();
|
||||
lFilesMatchesCount.setText(String.valueOf(total));
|
||||
}
|
||||
@Override
|
||||
public void Show() {
|
||||
super.Show();
|
||||
//------->>
|
||||
showNoFilesMatches();
|
||||
if (lastProjectPath.equals(Current.getProject().Home.getAbsolutePath()))
|
||||
showFilesMatches();
|
||||
else
|
||||
dropFilesMatches();
|
||||
//------->>
|
||||
Refresh();
|
||||
// setAlwaysOnTop(true);
|
||||
}
|
||||
public SearchReplaceForm() {
|
||||
context = new SearchContext();
|
||||
//-
|
||||
context.setRegularExpression(true);
|
||||
//-
|
||||
rbDown.addActionListener(e -> SwitchDirection(!forward));
|
||||
rbUp.addActionListener(e -> SwitchDirection(!forward));
|
||||
bAll.addActionListener(e -> onAll());
|
||||
bNext.addActionListener(e -> onNext());
|
||||
replaceOn.addActionListener(e -> {
|
||||
setMode(replaceOn.isSelected());
|
||||
});
|
||||
bNext.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER)
|
||||
bNext.doClick();
|
||||
}
|
||||
});
|
||||
tfFind.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
switch (e.getKeyCode()) {
|
||||
case KeyEvent.VK_ENTER:
|
||||
bNext.requestFocus();
|
||||
bNext.doClick();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
bSearchInFiles.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
showNoFilesMatches();
|
||||
lastProjectPath = Current.getProject().Home.getAbsolutePath();
|
||||
matches = Current.getProject().getMatches(
|
||||
tfFind.getText(),
|
||||
registerOn.isSelected(),
|
||||
wholeWordOn.isSelected());
|
||||
showFilesMatches();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user