no message
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package Common_old.UI.Editor;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.UI.Menus.StyledPopupMenu;
|
||||
import Common_old.UI.Menus.TextEditorMenu;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import Common_old.UI.UI;
|
||||
import Common_old.UI.Windows.Dialog.DialogFields;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Syntax.SPFEditorTheme;
|
||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
@@ -45,7 +45,7 @@ public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogF
|
||||
//todo переход в нужную строку по ctrl+g?
|
||||
case KeyEvent.VK_Z:
|
||||
if (getText().equals(startText)) {
|
||||
UI.Info("Начальная версия текста достигнута.");
|
||||
CommonUI.Info("Начальная версия текста достигнута.");
|
||||
e.consume();
|
||||
}
|
||||
break;
|
||||
@@ -129,7 +129,7 @@ public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogF
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
float font_size = (float) getFont().getSize();
|
||||
Current.getTheme().getEditorTheme().apply(this);
|
||||
((SPFEditorTheme)CommonUI.getTheme()).getEditorTheme().apply(this);
|
||||
setFont(getFont().deriveFont(font_size));
|
||||
menu.applyTheme();
|
||||
//меню связано с редактором. поэтому тема меняется только вместе с ним.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package Common_old.UI.List;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
public class HyperlinksStyledList extends StyledList {
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
super.applyTheme();
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package Common_old.UI.List;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
public class StyledList extends JList implements ThemeElement {
|
||||
public StyledList() {
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
applyTheme();
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackground(Current.getTheme().table_background);
|
||||
setForeground(Current.getTheme().foreground);
|
||||
setBackground(CommonUI.getTheme().table_background);
|
||||
setForeground(CommonUI.getTheme().foreground);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common_old.UI.Menus;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
@@ -10,7 +10,7 @@ public class PassesSubMenu extends JMenu {
|
||||
public PassesSubMenu(String title, String icon, PassCode_2021... passes) {
|
||||
super(title);
|
||||
setIcon(CommonUtils.getIcon(icon));
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
for (PassCode_2021 code : passes) {
|
||||
add(Pass_2021.passes.get(code).createMenuItem());
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package Common_old.UI.Menus;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import Common.Visual.CommonUI;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
public class PropertiesSubmenu extends JMenu {
|
||||
@@ -10,7 +10,7 @@ public class PropertiesSubmenu extends JMenu {
|
||||
super(title);
|
||||
if (icon != null)
|
||||
setIcon(CommonUtils.getIcon(icon));
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
for (String name : settings) {
|
||||
Global.properties.addFlagMenuItem(this, name);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common_old.UI.Menus;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
@@ -21,15 +21,15 @@ public class StyledPopupMenu extends JPopupMenu implements ThemeElement {
|
||||
});
|
||||
}
|
||||
private void refreshTheme_r(MenuElement element) {
|
||||
element.getComponent().setBackground(Current.getTheme().background);
|
||||
element.getComponent().setForeground(Current.getTheme().foreground);
|
||||
element.getComponent().setBackground(CommonUI.getTheme().background);
|
||||
element.getComponent().setForeground(CommonUI.getTheme().foreground);
|
||||
for (MenuElement se : element.getSubElements())
|
||||
refreshTheme_r(se);
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackground(Current.getTheme().background);
|
||||
setForeground(Current.getTheme().foreground);
|
||||
setBackground(CommonUI.getTheme().background);
|
||||
setForeground(CommonUI.getTheme().foreground);
|
||||
refreshTheme_r(this);
|
||||
}
|
||||
public void CheckElementsVisibility() {
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
package Common_old.UI.Menus;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
public class VisualiserMenuItem extends JMenuItem {
|
||||
public VisualiserMenuItem(String text) {
|
||||
super(text, null);
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
}
|
||||
public VisualiserMenuItem(String text, String icon_path) {
|
||||
super(text);
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
if (icon_path != null)
|
||||
setIcon(CommonUtils.getIcon(icon_path));
|
||||
}
|
||||
public VisualiserMenuItem(){
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package Common_old.UI.Menus_2023.CredentialsBar;
|
||||
import Common_old.Current;
|
||||
import Common_old.UI.Menus_2023.MenuBarButton;
|
||||
import Common_old.UI.Menus_2023.VisualiserMenuBar;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package Common_old.UI.Menus_2023.MainMenuBar;
|
||||
import Common.Visual.CommonUI;
|
||||
import _VisualDVM.Global;
|
||||
import Common_old.UI.Menus_2023.MenuBarButton;
|
||||
import Common_old.UI.Menus_2023.VisualiserMenuBar;
|
||||
@@ -29,7 +30,7 @@ public class MainMenuBar extends VisualiserMenuBar {
|
||||
setIcon("/icons/ComponentsActual.png");
|
||||
addActionListener(e -> {
|
||||
if (PerformanceAnalyzer.isActive) {
|
||||
UI.Info("Перед работой с компонентами закройте анализатор производительности!");
|
||||
CommonUI.Info("Перед работой с компонентами закройте анализатор производительности!");
|
||||
} else {
|
||||
Pass_2021.passes.get(PassCode_2021.GetComponentsActualVersions).Do();
|
||||
Global.RefreshUpdatesStatus();
|
||||
|
||||
@@ -15,7 +15,7 @@ public class VisualiserSettingsMenu extends VisualiserMenu {
|
||||
"FocusPassesResult"
|
||||
));
|
||||
add(new CompactnessSettingsMenu());
|
||||
if (CommonUtils.isWindows) {
|
||||
if (CommonUtils.isWindows()) {
|
||||
add(new SettingsSubmenu("Компиляция на локальной машине", null,
|
||||
SettingName.LocalMakePathWindows,
|
||||
SettingName.Kernels
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common_old.UI.Menus_2023;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -9,7 +9,7 @@ import java.awt.*;
|
||||
public class MenuBarButton extends JButton {
|
||||
public MenuBarButton() {
|
||||
super();
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
//
|
||||
setBorderPainted(false);
|
||||
setContentAreaFilled(false);
|
||||
@@ -30,6 +30,6 @@ public class MenuBarButton extends JButton {
|
||||
setIcon(CommonUtils.getIcon(icon_path));
|
||||
}
|
||||
public void setFont(VisualiserFonts font_in){
|
||||
setFont(Current.getTheme().Fonts.get(font_in));
|
||||
setFont(CommonUI.getTheme().Fonts.get(font_in));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package Common_old.UI.Menus_2023.ProjectMenuBar;
|
||||
import Common.CurrentAnchestor;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.Current;
|
||||
import Common_old.UI.Menus_2023.VisualiserMenu;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common_old.UI.UI;
|
||||
import ProjectData.ProjectView;
|
||||
|
||||
@@ -18,7 +19,7 @@ public class ProjectViewMenu extends VisualiserMenu {
|
||||
JMenuItem m = new JMenuItem(view.getDescription()) {
|
||||
{
|
||||
setIcon(CommonUtils.getIcon(view.getIcon()));
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
addActionListener(e -> {
|
||||
CurrentAnchestor.set(Current.ProjectView, view);
|
||||
UI.getMainWindow().getProjectWindow().ShowProjectView();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package Common_old.UI.Menus_2023;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import Common.Visual.CommonUI;
|
||||
import GlobalData.GlobalDatabase;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import GlobalData.Settings.SettingName;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -11,7 +11,7 @@ public class SettingsSubmenu extends JMenu {
|
||||
super(title);
|
||||
if (icon != null)
|
||||
setIcon(CommonUtils.getIcon(icon));
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
for (SettingName c : settings) {
|
||||
add(((GlobalDatabase)CommonUtils.db).settings.get(c).getMenuItem());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common_old.UI.Menus_2023;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class VisualiserMenu extends JMenu {
|
||||
setToolTipText(text);
|
||||
if (textVisible)
|
||||
setText(text);
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
if (!iconPath.isEmpty())
|
||||
setIcon(CommonUtils.getIcon(iconPath));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common_old.UI.Menus_2023;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class VisualiserMenuBar extends JToolBar {
|
||||
public JLabel addLabel(String text_in, String icon_path_in) {
|
||||
JLabel res = new JLabel(text_in) {
|
||||
{
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
if (icon_path_in != null) {
|
||||
setIcon(CommonUtils.getIcon(icon_path_in));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common_old.UI.ProgressBar;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
|
||||
import javax.swing.*;
|
||||
public class StyledProgressBar extends JProgressBar implements ThemeElement {
|
||||
@@ -10,7 +10,7 @@ public class StyledProgressBar extends JProgressBar implements ThemeElement {
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackground(Current.getTheme().bar_background);
|
||||
setForeground(Current.getTheme().bar_foreground);
|
||||
setBackground(CommonUI.getTheme().bar_background);
|
||||
setForeground(CommonUI.getTheme().bar_foreground);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common_old.UI.Tables;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Vector;
|
||||
@@ -12,6 +12,6 @@ public class HiddenListRenderer extends RendererCell<Vector<String>> {
|
||||
@Override
|
||||
public void Display() {
|
||||
setText(String.join(";", value));
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreePlain).deriveFont(12.0f));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain).deriveFont(12.0f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package Common_old.UI.Tables;
|
||||
import Common_old.Current;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.StatusEnum;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -12,7 +12,7 @@ public class StatusEnumRenderer extends RendererCell<StatusEnum> {
|
||||
public void Display() {
|
||||
if (value != null) {
|
||||
setText(value.getDescription());
|
||||
setFont(Current.getTheme().Fonts.get(value.getFont()));
|
||||
setFont(CommonUI.getTheme().Fonts.get(value.getFont()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package Common_old.UI.Tables;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
//наиболее распространенный случай. переотображение текста и/или изображения в ячейке таблицы.
|
||||
public class StyledCellLabel extends JLabel implements ThemeElement {
|
||||
public StyledCellLabel() {
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
setHorizontalAlignment(SwingConstants.LEFT);
|
||||
setVerticalAlignment(SwingConstants.CENTER);
|
||||
setOpaque(true);
|
||||
@@ -15,7 +15,7 @@ public class StyledCellLabel extends JLabel implements ThemeElement {
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackground(Current.getTheme().table_background);
|
||||
setForeground(Current.getTheme().foreground);
|
||||
setBackground(CommonUI.getTheme().table_background);
|
||||
setForeground(CommonUI.getTheme().foreground);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package Common_old.UI.Tables;
|
||||
import Common_old.Current;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.UI.Menus.TableMenu;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
@@ -16,9 +16,9 @@ public abstract class StyledTable extends JTable implements ThemeElement {
|
||||
setFillsViewportHeight(true);
|
||||
setAutoCreateRowSorter(dataModel.getRowCount() > 0);
|
||||
Init();
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
JTableHeader header = getTableHeader();
|
||||
header.setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
header.setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
|
||||
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
//текущий объет может определяться по первому столбцу. могут быть баги если не запретить
|
||||
@@ -77,10 +77,10 @@ public abstract class StyledTable extends JTable implements ThemeElement {
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackground(Current.getTheme().table_background);
|
||||
setForeground(Current.getTheme().foreground);
|
||||
setSelectionBackground(Current.getTheme().selection_background);
|
||||
setSelectionForeground(Current.getTheme().foreground);
|
||||
setBackground(CommonUI.getTheme().table_background);
|
||||
setForeground(CommonUI.getTheme().foreground);
|
||||
setSelectionBackground(CommonUI.getTheme().selection_background);
|
||||
setSelectionForeground(CommonUI.getTheme().foreground);
|
||||
}
|
||||
public void SelectRow(int r) {
|
||||
getSelectionModel().setSelectionInterval(r, r);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common_old.UI.Tables;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
@@ -10,7 +10,7 @@ public class WrapTextRenderer extends JTextArea implements TableCellRenderer {
|
||||
setLineWrap(true);
|
||||
setWrapStyleWord(true);
|
||||
// setOpaque(false);
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.Distribution).deriveFont(14.0f));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Distribution).deriveFont(14.0f));
|
||||
}
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common_old.UI.Trees;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import ProjectData.SapforData.FileObjectWithMessages;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -16,10 +16,10 @@ public class GraphTreeCellRenderer extends StyledTreeCellRenderer {
|
||||
if (o instanceof FileObjectWithMessages) {
|
||||
FileObjectWithMessages target = (FileObjectWithMessages) o;
|
||||
setIcon(CommonUtils.getIcon(target.ImageKey()));
|
||||
setFont(Current.getTheme().Fonts.get(target.getFont()));
|
||||
setFont(CommonUI.getTheme().Fonts.get(target.getFont()));
|
||||
} else {
|
||||
setIcon(null);
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
}
|
||||
setForeground(tree.getForeground());
|
||||
return this;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common_old.UI.Trees;
|
||||
import Common_old.Current;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Selectable;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
@@ -17,7 +17,7 @@ public class SelectionTreeCellRenderer extends StyledTreeCellRenderer {
|
||||
setText(selectable.getSelectionText());
|
||||
setIcon(selectable.GetSelectionIcon());
|
||||
} else {
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
setIcon(null);
|
||||
}
|
||||
setForeground(tree.getForeground());
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package Common_old.UI.Trees;
|
||||
import Common_old.Current;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.UI.Menus.GraphMenu;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common_old.UI.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -22,7 +22,7 @@ public class StyledTree extends JTree implements ThemeElement {
|
||||
super(root_in);
|
||||
root = root_in;
|
||||
setOpaque(true);
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
setToggleClickCount(0); //отключение сворачивание разворачивания по двойному клику
|
||||
//--
|
||||
if (!getRenderer().equals(TreeRenderers.RendererUndefined))
|
||||
@@ -86,8 +86,8 @@ public class StyledTree extends JTree implements ThemeElement {
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackground(Current.getTheme().trees_background);
|
||||
setForeground(Current.getTheme().foreground);
|
||||
setBackground(CommonUI.getTheme().trees_background);
|
||||
setForeground(CommonUI.getTheme().foreground);
|
||||
menu.applyTheme();
|
||||
}
|
||||
protected GraphMenu createMenu() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common_old.UI.Trees;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
public class StyledTreeCellRenderer extends DefaultTreeCellRenderer implements ThemeElement {
|
||||
@@ -9,7 +9,7 @@ public class StyledTreeCellRenderer extends DefaultTreeCellRenderer implements T
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackgroundNonSelectionColor(Current.getTheme().trees_background);
|
||||
setBackgroundSelectionColor(Current.getTheme().selection_background);
|
||||
setBackgroundNonSelectionColor(CommonUI.getTheme().trees_background);
|
||||
setBackgroundSelectionColor(CommonUI.getTheme().selection_background);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common_old.UI;
|
||||
import Common.CurrentAnchestor;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common_old.Current;
|
||||
import Common_old.UI.Menus_2023.CredentialsBar.CredentialsBar;
|
||||
import Common.Visual.DataMenuBar;
|
||||
@@ -93,14 +93,10 @@ import Visual_DVM_2021.UI.Main.DebugForm;
|
||||
import Visual_DVM_2021.UI.Main.MainForm;
|
||||
import Visual_DVM_2021.UI.Main.ProfilesForm;
|
||||
import Visual_DVM_2021.UI.Main.VersionsForm;
|
||||
import _VisualDVM.Syntax.*;
|
||||
import _VisualDVM.Syntax.VisualiserTheme;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.text.DefaultFormatter;
|
||||
import javax.swing.text.DefaultHighlighter;
|
||||
import javax.swing.text.Highlighter;
|
||||
import javax.swing.tree.TreeCellRenderer;
|
||||
@@ -128,7 +124,6 @@ public class UI {
|
||||
public static LinkedHashMap<Common_old.UI.Tables.TableRenderers, TableCellRenderer> TableRenderers = new LinkedHashMap<>();
|
||||
public static LinkedHashMap<Common_old.UI.Tables.TableEditors, TableCellEditor> TableEditors = new LinkedHashMap<>();
|
||||
public static LinkedHashMap<Common_old.UI.Trees.TreeRenderers, TreeCellRenderer> TreeRenderers = new LinkedHashMap<>();
|
||||
public static LinkedHashMap<VisualiserThemeName, VisualiserTheme> themes = new LinkedHashMap<>();
|
||||
public static LinkedHashMap<FormType, ThemeElement> windows = new LinkedHashMap<>();
|
||||
public static RemoteFileChooser getRemoteFileChooser() {
|
||||
return (RemoteFileChooser) windows.get(FormType.RemoteFileChooser);
|
||||
@@ -239,10 +234,6 @@ public class UI {
|
||||
UIManager.put("OptionPane.cancelButtonText", "Отмена");
|
||||
UIManager.put("OptionPane.okButtonText", "Готово");
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="Темы(всегда создавать первыми)">
|
||||
themes.put(VisualiserThemeName.Light, new LightVisualiserTheme());
|
||||
//по умолчанию поставить светлую тему. потому что до загрузки бд работаем с таблицей компонент.
|
||||
CurrentAnchestor.set(Current.Theme, themes.get(VisualiserThemeName.Light));
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="Объекты отрисовки и редактирования деревьев и таблиц">
|
||||
TableRenderers.put(RendererDate, new DateRenderer_());
|
||||
@@ -285,15 +276,6 @@ public class UI {
|
||||
public static ProfilesForm getProfilesWindow() {
|
||||
return (ProfilesForm) windows.get(FormType.Profiles);
|
||||
}
|
||||
public static Component getFrontWindow() {
|
||||
Component res = null;
|
||||
try {
|
||||
res = CommonUI.windowsStack.peek();
|
||||
} catch (Exception ignored){
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//-----
|
||||
public static void ShowTabsNames(JTabbedPane tabs) {
|
||||
ShowTabsNames(tabs, 0);
|
||||
@@ -309,43 +291,6 @@ public class UI {
|
||||
if (list.get(i).equals(line)) last_index = i;
|
||||
return (last_index >= max_index);
|
||||
}
|
||||
public static void MakeSpinnerRapid(JSpinner spinner, ChangeListener listener) {
|
||||
JComponent comp = spinner.getEditor();
|
||||
JFormattedTextField field = (JFormattedTextField) comp.getComponent(0);
|
||||
DefaultFormatter formatter = (DefaultFormatter) field.getFormatter();
|
||||
formatter.setCommitsOnValidEdit(true);
|
||||
formatter.setAllowsInvalid(true);
|
||||
spinner.addChangeListener(listener);
|
||||
}
|
||||
//---------------
|
||||
public static boolean Question(Component parent, String text) {
|
||||
return !CommonUtils.hasUI() || (JOptionPane.showConfirmDialog(parent,
|
||||
text + "?",
|
||||
"Подтверждение",
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE) == 0);
|
||||
}
|
||||
public static boolean Question(String text) {
|
||||
return Question(getFrontWindow(), text);
|
||||
}
|
||||
public static void Info(String message) {
|
||||
CommonUtils.CopyToClipboard(message);
|
||||
if (CommonUtils.hasUI())
|
||||
JOptionPane.showMessageDialog(getFrontWindow(), message, "", 1);
|
||||
}
|
||||
public static void Error(String message) {
|
||||
CommonUtils.CopyToClipboard(message);
|
||||
if (CommonUtils.hasUI())
|
||||
JOptionPane.showMessageDialog(getFrontWindow(), message, "", 0);
|
||||
}
|
||||
public static boolean Warning(String text) {
|
||||
return !CommonUtils.hasUI() ||
|
||||
JOptionPane.showConfirmDialog(getFrontWindow(),
|
||||
text + "\nВы уверены?",
|
||||
"Подтверждение",
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.WARNING_MESSAGE) == 0;
|
||||
}
|
||||
//--
|
||||
public static VersionsWindow getVersionsWindow() {
|
||||
return versionsWindow;
|
||||
@@ -380,5 +325,4 @@ public class UI {
|
||||
public static void ShowProfilesWindow() {
|
||||
getProfilesWindow().ShowDialog("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog;
|
||||
import Common.Database.Objects.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(){
|
||||
//заблокировать окно для редактирования
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
import Common_old.UI.UI;
|
||||
import Common.Utils.TextLog;
|
||||
|
||||
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(CommonUtils.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) {
|
||||
CommonUI.windowsStack.pop();
|
||||
onCancel();
|
||||
onClose();
|
||||
}
|
||||
});
|
||||
// pack(); //авторазмер окна.
|
||||
setLocationRelativeTo(null);
|
||||
LoadSize();
|
||||
}
|
||||
public void CreateContent() {
|
||||
try {
|
||||
content = (fields = f.newInstance()).getContent();
|
||||
//--?
|
||||
} catch (Exception e) {
|
||||
CommonUtils.MainLog.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());
|
||||
CommonUI.windowsStack.push(this);
|
||||
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 -> Применение темы
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog;
|
||||
import java.awt.*;
|
||||
public interface DialogFields {
|
||||
Component getContent();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class DialogSlider extends JSlider implements DialogFields {
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class DialogSpinner extends JSpinner implements DialogFields {
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.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;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog;
|
||||
import Common_old.UI.TextField.StyledTextField;
|
||||
|
||||
import java.awt.*;
|
||||
public class DialogTextField extends StyledTextField implements DialogFields {
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog;
|
||||
import Common_old.Current;
|
||||
import _VisualDVM.Syntax.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);
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package Common_old.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);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package Common_old.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);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package Common_old.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));
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package Common_old.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();
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package Common_old.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();
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog.Text;
|
||||
import Common_old.UI.Windows.Dialog.Dialog;
|
||||
import Common_old.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;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog.Text;
|
||||
import Common_old.Utils.Utils;
|
||||
public class FileNameForm extends TextFieldDialog {
|
||||
public FileNameForm() {
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
Utils.validateFileShortNewName(fields.getText(), Log);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog.Text;
|
||||
import Common_old.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);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog.Text;
|
||||
public class ReadOnlyMultilineTextForm extends MultilineTextForm {
|
||||
public ReadOnlyMultilineTextForm() {
|
||||
}
|
||||
@Override
|
||||
public void InitFields() {
|
||||
fields.setEditable(false);
|
||||
}
|
||||
@Override
|
||||
public void CreateButtons() {
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog.Text;
|
||||
import Common_old.UI.Windows.Dialog.Dialog;
|
||||
import Common_old.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);
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package Common_old.UI.Windows.Dialog.Text;
|
||||
import Common_old.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);
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package Common_old.UI.Windows;
|
||||
import Common.Utils.CommonUtils;
|
||||
import GlobalData.GlobalDatabase;
|
||||
import _VisualDVM.Syntax.ThemeElement;
|
||||
import Common.Database.Objects.DBForm.DBForm;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
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(CommonUtils.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 String getFormType() {
|
||||
return null;
|
||||
}
|
||||
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) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
}
|
||||
setContentPane(getMainPanel());
|
||||
setVisible(true);
|
||||
}
|
||||
public void Close() {
|
||||
try {
|
||||
SaveWindowParameters();
|
||||
} catch (Exception e) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
}
|
||||
setVisible(false);
|
||||
dispose();
|
||||
AfterClose();
|
||||
}
|
||||
public void AfterClose() {
|
||||
}
|
||||
//todo поменять на json? вместе с окном компонент
|
||||
public void LoadWindowParameters() throws Exception {
|
||||
if (getFormType()!=null)
|
||||
if (((GlobalDatabase)CommonUtils.db).forms.Data.containsKey(getFormType())) {
|
||||
info = ((GlobalDatabase)CommonUtils.db).forms.Data.get(getFormType());
|
||||
info.Apply(this);
|
||||
return;
|
||||
}
|
||||
setSize(getDefaultWidth(), getDefaultHeight());
|
||||
setLocationRelativeTo(getRelative());
|
||||
}
|
||||
public void SaveWindowParameters() throws Exception {
|
||||
if (getFormType()!=null) {
|
||||
if (info != null) {
|
||||
info.Init(this);
|
||||
CommonUtils.db.Update(info);
|
||||
} else
|
||||
CommonUtils.db.Insert(new DBForm(getFormType(), this));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
//todo -> применение темы.
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package Common_old.UI.Windows;
|
||||
public enum FormType {
|
||||
Undefined,
|
||||
|
||||
Main,
|
||||
SearchReplace,
|
||||
Components,
|
||||
RemoteFileChooser, Profiles
|
||||
RemoteFileChooser,
|
||||
Profiles
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
@@ -1,6 +1,7 @@
|
||||
package Common_old.UI.Windows;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Windows.Form;
|
||||
import Common_old.Current;
|
||||
import Common_old.UI.TextField.StyledTextField;
|
||||
import Common_old.UI.Trees.StyledTree;
|
||||
@@ -125,7 +126,7 @@ public class SearchReplaceForm extends Form {
|
||||
lCount.setText(String.valueOf(result.getMarkedCount()));
|
||||
}
|
||||
@Override
|
||||
protected String getFormType() {
|
||||
protected String getFormKey() {
|
||||
return FormType.SearchReplace.toString();
|
||||
}
|
||||
private void createUIComponents() {
|
||||
|
||||
Reference in New Issue
Block a user