no message
This commit is contained in:
@@ -6,9 +6,9 @@ import java.awt.*;
|
||||
//класс, представляющий собой прокручиваемую панель, на которой лежит нечто.
|
||||
public class ControlForm<C extends Component> {
|
||||
public C control = null;
|
||||
public JScrollPane scroll = null;
|
||||
protected Class<C> control_class;
|
||||
protected JPanel content; //задник.
|
||||
public JScrollPane scroll = null;
|
||||
public ControlForm(Class<C> class_in) {
|
||||
control_class = class_in;
|
||||
setContent(new JPanel(new BorderLayout()));
|
||||
@@ -18,7 +18,6 @@ public class ControlForm<C extends Component> {
|
||||
return content;
|
||||
}
|
||||
public void setContent(JPanel content_in) {
|
||||
|
||||
content = content_in;
|
||||
}
|
||||
//-
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
public class HyperlinksStyledList extends StyledList {
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -29,7 +29,7 @@ public class MenuBarButton extends JButton {
|
||||
public void setIcon(String icon_path) {
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
public void setFont(VisualiserFonts font_in){
|
||||
public void setFont(VisualiserFonts font_in) {
|
||||
setFont(UI_.getTheme().Fonts.get(font_in));
|
||||
}
|
||||
}
|
||||
|
||||
24
src/Common/Visual/Controls/PassButton.java
Normal file
24
src/Common/Visual/Controls/PassButton.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.awt.*;
|
||||
public class PassButton extends MenuBarButton implements PassControl {
|
||||
public PassButton(Pass pass, boolean tab) {
|
||||
setText(pass.getButtonText());
|
||||
setToolTipText(pass.getDescription());
|
||||
if (pass.getIconPath() != null) {
|
||||
if (tab) {
|
||||
setIcon(pass.getTabIcon());
|
||||
setPreferredSize(new Dimension(18, 18));
|
||||
setMaximumSize(new Dimension(18, 18));
|
||||
setMinimumSize(new Dimension(18, 18));
|
||||
} else
|
||||
setIcon(pass.getIconPath());
|
||||
}
|
||||
addActionListener(pass.getControlAction());
|
||||
pass.controls.add(this);
|
||||
}
|
||||
public PassButton(Pass pass) {
|
||||
this(pass, false);
|
||||
}
|
||||
}
|
||||
8
src/Common/Visual/Controls/PassControl.java
Normal file
8
src/Common/Visual/Controls/PassControl.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package Common.Visual.Controls;
|
||||
public interface PassControl {
|
||||
void setIcon(String icon_path);
|
||||
void setEnabled(boolean flag);
|
||||
void setVisible(boolean flag);
|
||||
void setToolTipText(String text);
|
||||
void setText(String text);
|
||||
}
|
||||
17
src/Common/Visual/Controls/PassMenuItem.java
Normal file
17
src/Common/Visual/Controls/PassMenuItem.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Menus.VisualiserMenuItem;
|
||||
public class PassMenuItem extends VisualiserMenuItem implements PassControl {
|
||||
public PassMenuItem(Pass pass) {
|
||||
setText(pass.getDescription());
|
||||
setToolTipText(pass.getDescription());
|
||||
if (pass.getIconPath() != null) setIcon(pass.getIconPath());
|
||||
addActionListener(pass.getControlAction());
|
||||
pass.controls.add(this);
|
||||
}
|
||||
@Override
|
||||
public void setIcon(String icon_path) {
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
}
|
||||
15
src/Common/Visual/Controls/ShortLabel.java
Normal file
15
src/Common/Visual/Controls/ShortLabel.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package Common.Visual.Controls;
|
||||
import javax.swing.*;
|
||||
public class ShortLabel extends JLabel {
|
||||
int max = 0;
|
||||
public ShortLabel(int max_in) {
|
||||
max = max_in;
|
||||
}
|
||||
@Override
|
||||
public void setText(String text_in) {
|
||||
if ((max > 0) && (text_in.length() > max)) {
|
||||
super.setText(text_in.substring(0, max - 1) + "...");
|
||||
} else super.setText(text_in);
|
||||
setToolTipText(text_in);
|
||||
}
|
||||
}
|
||||
41
src/Common/Visual/Controls/StableMenuItem.java
Normal file
41
src/Common/Visual/Controls/StableMenuItem.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Menus.VisualiserMenuItem;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicMenuItemUI;
|
||||
//неичезающий меню итем. нужен для настроек
|
||||
//https://translated.turbopages.org/proxy_u/en-ru.ru.64537f6c-6460c460-8e74a1ab-74722d776562/https/tips4java.wordpress.com/2010/09/12/keeping-menus-open/
|
||||
class StableItemUI extends BasicMenuItemUI {
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new StableItemUI();
|
||||
}
|
||||
@Override
|
||||
protected void doClick(MenuSelectionManager msm) {
|
||||
menuItem.doClick(0);
|
||||
if (UI_.last_menu_path != null)
|
||||
MenuSelectionManager.defaultManager().setSelectedPath(UI_.last_menu_path);
|
||||
}
|
||||
}
|
||||
public class StableMenuItem extends VisualiserMenuItem {
|
||||
{
|
||||
getModel().addChangeListener(e -> {
|
||||
if (getModel().isArmed() && isShowing())
|
||||
UI_.last_menu_path = MenuSelectionManager.defaultManager().getSelectedPath();
|
||||
});
|
||||
}
|
||||
public StableMenuItem(String text) {
|
||||
super(text);
|
||||
setUI(new StableItemUI());
|
||||
}
|
||||
public StableMenuItem(String text, String icon_path) {
|
||||
super(text);
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
setUI(new StableItemUI());
|
||||
}
|
||||
public StableMenuItem() {
|
||||
setUI(new StableItemUI());
|
||||
}
|
||||
}
|
||||
16
src/Common/Visual/Controls/StablePassMenuItem.java
Normal file
16
src/Common/Visual/Controls/StablePassMenuItem.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Utils.Utils_;
|
||||
public class StablePassMenuItem extends StableMenuItem implements PassControl {
|
||||
public StablePassMenuItem(Pass pass) {
|
||||
setText(pass.getDescription());
|
||||
setToolTipText(pass.getDescription());
|
||||
if (pass.getIconPath() != null) setIcon(pass.getIconPath());
|
||||
addActionListener(pass.getControlAction());
|
||||
pass.controls.add(this);
|
||||
}
|
||||
@Override
|
||||
public void setIcon(String icon_path) {
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
public class StyledList extends JList implements ThemeElement {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
public class StyledProgressBar extends JProgressBar implements ThemeElement {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package Common.Visual;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Visual.Menus.StableMenuItem;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Controls.StableMenuItem;
|
||||
|
||||
import javax.swing.*;
|
||||
//одиночный фильтр, пункт фильтрационного меню.
|
||||
@@ -12,6 +12,19 @@ public abstract class DBObjectFilter<D extends DBObject> {
|
||||
String description;
|
||||
boolean active = true; //включен ли фильтр
|
||||
int count = 0;
|
||||
public DBObjectFilter(DataSet dataSet, String description_in, boolean active_in) {
|
||||
menuItem = new StableMenuItem((description = description_in) + " (0)");
|
||||
active = active_in;
|
||||
menuItem.addActionListener(e -> {
|
||||
active = !active;
|
||||
Mark();
|
||||
dataSet.ShowUI();
|
||||
});
|
||||
Mark();
|
||||
}
|
||||
public DBObjectFilter(DataSet dataSet, String description_in) {
|
||||
this(dataSet, description_in, true);
|
||||
}
|
||||
//--
|
||||
static String getNotActiveIconPath() {
|
||||
return "/Common/icons/NotPick.png";
|
||||
@@ -29,23 +42,6 @@ public abstract class DBObjectFilter<D extends DBObject> {
|
||||
count++;
|
||||
return valid & active;
|
||||
}
|
||||
public DBObjectFilter(DataSet dataSet, String description_in, boolean active_in) {
|
||||
menuItem = new StableMenuItem((description = description_in) + " (0)");
|
||||
active = active_in;
|
||||
menuItem.addActionListener(e -> {
|
||||
active = !active;
|
||||
Mark();
|
||||
dataSet.ShowUI();
|
||||
});
|
||||
Mark();
|
||||
}
|
||||
public DBObjectFilter(DataSet dataSet, String description_in) {
|
||||
this(dataSet, description_in, true);
|
||||
}
|
||||
public void setActive(boolean flag) {
|
||||
active = flag;
|
||||
Mark();
|
||||
}
|
||||
//--
|
||||
protected abstract boolean validate(D object);
|
||||
//--
|
||||
@@ -58,5 +54,9 @@ public abstract class DBObjectFilter<D extends DBObject> {
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
public void setActive(boolean flag) {
|
||||
active = flag;
|
||||
Mark();
|
||||
}
|
||||
//--
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package Common.Visual;
|
||||
import Common.CommonConstants;
|
||||
import Common.Current_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Menus.TableMenu;
|
||||
import Common.Visual.Tables.ColumnInfo;
|
||||
import Common.Visual.Tables.DataTable;
|
||||
import Common.Visual.Tables.Grid.GridAnchestor;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Grid.TableVisualData;
|
||||
import _VisualDVM.Visual.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableColumn;
|
||||
@@ -29,9 +29,6 @@ import static Common.Visual.Tables.TableRenderers.RendererSelect;
|
||||
public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
protected JPanel dataPanel;
|
||||
protected DataSet dataSource;
|
||||
public JPanel getDataPanel() {
|
||||
return dataPanel;
|
||||
}
|
||||
protected int current_row_i;
|
||||
protected boolean events_on = true;
|
||||
protected String colNamesAndSizes = "";
|
||||
@@ -46,6 +43,9 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
dataPanel = new JPanel(new BorderLayout());
|
||||
content.add(dataPanel, BorderLayout.CENTER);
|
||||
}
|
||||
public JPanel getDataPanel() {
|
||||
return dataPanel;
|
||||
}
|
||||
@Override
|
||||
public void Show() {
|
||||
super.Show();
|
||||
@@ -68,7 +68,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
if (Global.mainModule.getDb() != null) {
|
||||
try {
|
||||
if ((CurrentName() != null)) {
|
||||
String tableName= CurrentName().toString();
|
||||
String tableName = CurrentName().toString();
|
||||
Vector<String> widths = IntStream.range(0, columns.size()).mapToObj(i -> String.valueOf(control.getColumnModel().getColumn(i).getWidth())).collect(Collectors.toCollection(Vector::new));
|
||||
String packed = String.join("|", widths);
|
||||
TableVisualData tableVisualData;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package Common.Visual;
|
||||
import _VisualDVM.Visual.Menus.StableMenuItem;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenu;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.Controls.StableMenuItem;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenu;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package Common.Visual.Menus;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.Controls.MenuBarButton;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionListener;
|
||||
public class DataMenuBar extends VisualiserMenuBar {
|
||||
public JLabel countLabel = null;
|
||||
JButton selectAllButton = null;
|
||||
JButton unselectAllButton = null;
|
||||
//-
|
||||
public ActionListener selectAllListener = null;
|
||||
public ActionListener unselectAllListener = null;
|
||||
JButton selectAllButton = null;
|
||||
JButton unselectAllButton = null;
|
||||
//-
|
||||
public DataMenuBar(String dataName, PassCode... passes) {
|
||||
// Font font = Current.getTheme().Fonts.get(VisualiserFonts.TreeBoldItalic).deriveFont(12.0F);
|
||||
@@ -46,7 +46,8 @@ public class DataMenuBar extends VisualiserMenuBar {
|
||||
}, 1);
|
||||
}
|
||||
if (selectAllListener != null) {
|
||||
selectAllButton.removeActionListener(selectAllListener); }
|
||||
selectAllButton.removeActionListener(selectAllListener);
|
||||
}
|
||||
selectAllButton.addActionListener(selectAllListener = e -> dataSet.CheckAll(true));
|
||||
if (unselectAllListener != null) {
|
||||
unselectAllButton.removeActionListener(unselectAllListener);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Menus;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
|
||||
@@ -8,12 +8,12 @@ import java.util.Vector;
|
||||
public class TextEditorMenu extends StyledPopupMenu {
|
||||
protected JTextComponent editor;
|
||||
protected String selectedText = null;
|
||||
protected JMenuItem m_strike;
|
||||
protected JMenuItem m_unstrike;
|
||||
//-------------------------------------------------
|
||||
JMenuItem m_cut;
|
||||
JMenuItem m_copy;
|
||||
JMenuItem m_paste;
|
||||
protected JMenuItem m_strike;
|
||||
protected JMenuItem m_unstrike;
|
||||
//-------------------------------------------------
|
||||
public TextEditorMenu(JTextComponent editor_in) {
|
||||
editor = editor_in;
|
||||
@@ -44,28 +44,28 @@ public class TextEditorMenu extends StyledPopupMenu {
|
||||
});
|
||||
add(m_paste);
|
||||
//--
|
||||
m_strike = new VisualiserMenuItem("Вычеркнуть","/icons/Editor/Strikethrough.png");
|
||||
m_strike = new VisualiserMenuItem("Вычеркнуть", "/icons/Editor/Strikethrough.png");
|
||||
m_strike.addActionListener(
|
||||
new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String[] data = selectedText.split("\n");
|
||||
Vector<String> new_data = new Vector<>();
|
||||
for (String line: data){
|
||||
for (String line : data) {
|
||||
new_data.add(Utils_.strikeThrough(line));
|
||||
}
|
||||
editor.replaceSelection(String.join("\n", new_data));
|
||||
}
|
||||
});
|
||||
add(m_strike);
|
||||
m_unstrike = new VisualiserMenuItem("Отменить вычёркивание","/icons/Editor/NoStrike.png");
|
||||
m_unstrike = new VisualiserMenuItem("Отменить вычёркивание", "/icons/Editor/NoStrike.png");
|
||||
m_unstrike.addActionListener(
|
||||
new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String[] data = selectedText.split("\n");
|
||||
Vector<String> new_data = new Vector<>();
|
||||
for (String line: data){
|
||||
for (String line : data) {
|
||||
new_data.add(Utils_.noStrikeThrough(line));
|
||||
}
|
||||
editor.replaceSelection(String.join("\n", new_data));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common.Visual.Menus;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
public class VisualiserMenuItem extends JMenuItem {
|
||||
@@ -15,7 +15,7 @@ public class VisualiserMenuItem extends JMenuItem {
|
||||
if (icon_path != null)
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
public VisualiserMenuItem(){
|
||||
public VisualiserMenuItem() {
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,7 @@ public interface StatusEnum {
|
||||
default String getDescription() {
|
||||
return toString();
|
||||
}
|
||||
default VisualiserFonts getFont() {return VisualiserFonts.UnknownState;}
|
||||
default VisualiserFonts getFont() {
|
||||
return VisualiserFonts.UnknownState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ColumnFilter {
|
||||
setBackground(dataSet.getUi().control.getTableHeader().getBackground());
|
||||
setFont(dataSet.getUi().control.getTableHeader().getFont());
|
||||
setBorder(new MatteBorder(0, 0, 1, 1, Color.DARK_GRAY));
|
||||
setText("текст : "+dataSet.getColumnFilterValue(columnIndex));
|
||||
setText("текст : " + dataSet.getColumnFilterValue(columnIndex));
|
||||
}
|
||||
});
|
||||
//--
|
||||
@@ -63,7 +63,7 @@ public class ColumnFilter {
|
||||
int columnIndex = dataSet.getUi().control.getTableHeader().columnAtPoint(event.getPoint());
|
||||
if (dataSet.columnsFilters.containsKey(columnIndex)) {
|
||||
Rectangle columnRectangle = dataSet.getUi().control.getTableHeader().getHeaderRect(columnIndex);
|
||||
Dimension d = new Dimension(columnRectangle.width - 72, columnRectangle.height - 1);
|
||||
Dimension d = new Dimension(columnRectangle.width - 72, columnRectangle.height - 1);
|
||||
popup.setPreferredSize(d);
|
||||
popup.setMaximumSize(d);
|
||||
popup.show(dataSet.getUi().control.getTableHeader(), columnRectangle.x + 72, 0);
|
||||
|
||||
@@ -4,7 +4,7 @@ public class ConfigurationAutoRenderer extends DBObjectRenderer {
|
||||
@Override
|
||||
public void Display() {
|
||||
if (value != null) {
|
||||
setIcon(((Configuration)value).GetAutoIcon());
|
||||
setIcon(((Configuration) value).GetAutoIcon());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.Passes.Pass;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.Server.EditServerObject;
|
||||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||||
import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import Common.Passes.Pass;
|
||||
import _VisualDVM.Passes.Server.EditServerObject;
|
||||
public class ConfigurationAutoSwitcher extends DBObjectEditor<Configuration> {
|
||||
@Override
|
||||
public void Action() {
|
||||
value.SwitchAuto();
|
||||
setIcon(value.GetAutoIcon());
|
||||
///-
|
||||
Pass pass = new EditServerObject<TestingServer,Configuration> (Global.testingServer, Configuration.class){
|
||||
Pass pass = new EditServerObject<TestingServer, Configuration>(Global.testingServer, Configuration.class) {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (Configuration) args[0];
|
||||
|
||||
@@ -10,8 +10,8 @@ public abstract class DataTable extends StyledTable implements DataControl {
|
||||
@Override
|
||||
public void SelectRowByPK(Object pk) {
|
||||
for (int i = 0; i < getRowCount(); ++i) {
|
||||
DBObject o = getRowObject(i);
|
||||
if (o!=null) {
|
||||
DBObject o = getRowObject(i);
|
||||
if (o != null) {
|
||||
if (o.getPK()
|
||||
.equals(pk)) {
|
||||
SelectRow(i);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.StatusEnum;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
public class StatusEnumRenderer extends RendererCell<StatusEnum> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
//наиболее распространенный случай. переотображение текста и/или изображения в ячейке таблицы.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.Menus.TableMenu;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Themes;
|
||||
import java.awt.*;
|
||||
public class DefaultTheme extends VisualiserTheme{
|
||||
public class DefaultTheme extends VisualiserTheme {
|
||||
@Override
|
||||
protected String getForegroundHex() {
|
||||
return "#000000";
|
||||
|
||||
@@ -18,6 +18,24 @@ public abstract class VisualiserTheme {
|
||||
public Color bar_background;
|
||||
public Color table_background;
|
||||
//--
|
||||
public LinkedHashMap<VisualiserFonts, Font> Fonts = new LinkedHashMap<>();
|
||||
public LinkedHashMap<VisualiserColor, Color> Colors = new LinkedHashMap<>();
|
||||
public VisualiserTheme() {
|
||||
try {
|
||||
//-----------------------------------------------
|
||||
foreground = Color.decode(getForegroundHex());
|
||||
background = Color.decode(getBackgroundHex());
|
||||
selection_background = Color.decode(getSelectionBackgroundHex());
|
||||
trees_background = Color.decode(getTreeBackgroundHex());
|
||||
bar_foreground = Color.decode(getBarForegroundHex());
|
||||
bar_background = Color.decode(getBarBackgroundHex());
|
||||
table_background = Color.decode(getTableBackgroundHex());
|
||||
createFonts();
|
||||
} catch (Exception ex) {
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
}
|
||||
//--
|
||||
protected abstract String getForegroundHex();
|
||||
protected abstract String getBackgroundHex();
|
||||
protected abstract String getSelectionBackgroundHex();
|
||||
@@ -32,10 +50,7 @@ public abstract class VisualiserTheme {
|
||||
protected abstract Color getFatalFontColor();
|
||||
protected abstract Color getUnknownFontColor();
|
||||
protected abstract Color getHyperlinkFontColor();
|
||||
//--
|
||||
public LinkedHashMap<VisualiserFonts, Font> Fonts = new LinkedHashMap<>();
|
||||
public LinkedHashMap<VisualiserColor, Color> Colors = new LinkedHashMap<>();
|
||||
protected void createFonts(){
|
||||
protected void createFonts() {
|
||||
Fonts.put(VisualiserFonts.GoodState,
|
||||
new Font(
|
||||
new HashMap<TextAttribute, Object>() {
|
||||
@@ -142,7 +157,7 @@ public abstract class VisualiserTheme {
|
||||
Fonts.put(VisualiserFonts.TreePlain, new Font("Times New Roman", Font.PLAIN, 16));
|
||||
Fonts.put(VisualiserFonts.TreeItalic, new Font("Times New Roman", Font.ITALIC, 16));
|
||||
Fonts.put(VisualiserFonts.TreeBold, new Font("Times New Roman", Font.BOLD, 16));
|
||||
Fonts.put(VisualiserFonts.TreeBoldItalic, new Font("Times New Roman", Font.BOLD|Font.ITALIC, 16));
|
||||
Fonts.put(VisualiserFonts.TreeBoldItalic, new Font("Times New Roman", Font.BOLD | Font.ITALIC, 16));
|
||||
Fonts.put(VisualiserFonts.Menu, new Font("Times New Roman", Font.ITALIC, 16));
|
||||
Fonts.put(VisualiserFonts.NewVersion, new Font(
|
||||
new HashMap<TextAttribute, Object>() {
|
||||
@@ -153,22 +168,6 @@ public abstract class VisualiserTheme {
|
||||
put(TextAttribute.SIZE, 16);
|
||||
}
|
||||
}
|
||||
|
||||
));
|
||||
}
|
||||
public VisualiserTheme() {
|
||||
try {
|
||||
//-----------------------------------------------
|
||||
foreground = Color.decode(getForegroundHex());
|
||||
background = Color.decode(getBackgroundHex());
|
||||
selection_background = Color.decode(getSelectionBackgroundHex());
|
||||
trees_background = Color.decode(getTreeBackgroundHex());
|
||||
bar_foreground = Color.decode(getBarForegroundHex());
|
||||
bar_background = Color.decode(getBarBackgroundHex());
|
||||
table_background = Color.decode(getTableBackgroundHex());
|
||||
createFonts();
|
||||
} catch (Exception ex) {
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package Common.Visual.Trees;
|
||||
import Common.Current_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.DataControl_OLD;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common.Visual.Trees;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package Common.Visual.Trees;
|
||||
import Common.Current_;
|
||||
import Common.Visual.Selectable;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common.Visual.Trees;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Selectable;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.Selectable;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package Common.Visual.Trees;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Visual.Menus.GraphMenu;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import _VisualDVM.Visual.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -144,8 +144,8 @@ public class StyledTree extends JTree implements ThemeElement {
|
||||
public void SelectNode(DefaultMutableTreeNode node) {
|
||||
setSelectionPath(new TreePath(((DefaultTreeModel) getModel()).getPathToRoot(node)));
|
||||
}
|
||||
//https://stackoverflow.com/questions/7928839/adding-and-removing-nodes-from-a-jtree !!!
|
||||
public void AddNode(DefaultMutableTreeNode parent, DefaultMutableTreeNode node){
|
||||
//https://stackoverflow.com/questions/7928839/adding-and-removing-nodes-from-a-jtree !!!
|
||||
public void AddNode(DefaultMutableTreeNode parent, DefaultMutableTreeNode node) {
|
||||
parent.add(node);
|
||||
DefaultTreeModel model = (DefaultTreeModel) getModel();
|
||||
model.reload(parent);
|
||||
@@ -154,13 +154,13 @@ public class StyledTree extends JTree implements ThemeElement {
|
||||
setSelectionPath(path);
|
||||
//scrollPathToVisible(path);
|
||||
}
|
||||
public void RemoveNode(DefaultMutableTreeNode node){
|
||||
if (node.getParent()!=null) {
|
||||
public void RemoveNode(DefaultMutableTreeNode node) {
|
||||
if (node.getParent() != null) {
|
||||
DefaultTreeModel model = (DefaultTreeModel) getModel();
|
||||
model.removeNodeFromParent(node);
|
||||
}
|
||||
}
|
||||
public void RefreshNode(DefaultMutableTreeNode node){
|
||||
public void RefreshNode(DefaultMutableTreeNode node) {
|
||||
DefaultTreeModel model = (DefaultTreeModel) getModel();
|
||||
model.reload(node);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Trees;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
public class StyledTreeCellRenderer extends DefaultTreeCellRenderer implements ThemeElement {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Trees;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.ControlForm;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import java.awt.*;
|
||||
public class TreeForm<C extends StyledTree> extends ControlForm<C> {
|
||||
|
||||
@@ -12,27 +12,26 @@ import java.awt.*;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Stack;
|
||||
public class UI_ {
|
||||
public static boolean active=false; //есть ли интерфейс. в консольных версиях не нужен.
|
||||
public static boolean active = false; //есть ли интерфейс. в консольных версиях не нужен.
|
||||
public static MenuElement[] last_menu_path; //для меню
|
||||
public static boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
//---
|
||||
public static LinkedHashMap<Class<? extends DataSet>, DataMenuBar> menuBars = new LinkedHashMap<>();
|
||||
public static Stack<Component> windowsStack = new Stack<>();
|
||||
static VisualiserTheme theme = new DefaultTheme();
|
||||
public static boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
public static VisualiserTheme getTheme() {
|
||||
return theme;
|
||||
}
|
||||
public static void setTheme(VisualiserTheme theme_in){
|
||||
theme= theme_in;
|
||||
public static void setTheme(VisualiserTheme theme_in) {
|
||||
theme = theme_in;
|
||||
}
|
||||
public static Component getFrontWindow() {
|
||||
Component res = null;
|
||||
try {
|
||||
res = windowsStack.peek();
|
||||
} catch (Exception ignored){
|
||||
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public abstract class DBObjectDialog<T extends DBObject, F extends DialogFields>
|
||||
public void fillFields() {
|
||||
//отобразить объект
|
||||
}
|
||||
public void SetReadonly(){
|
||||
public void SetReadonly() {
|
||||
//заблокировать окно для редактирования
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package Common.Visual.Windows.Dialog;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -25,9 +25,6 @@ public class Dialog<T, F extends DialogFields> extends JDialog implements ThemeE
|
||||
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) {
|
||||
@@ -60,6 +57,9 @@ public class Dialog<T, F extends DialogFields> extends JDialog implements ThemeE
|
||||
setLocationRelativeTo(null);
|
||||
LoadSize();
|
||||
}
|
||||
public String getIconPath() {
|
||||
return "";
|
||||
}
|
||||
public void CreateContent() {
|
||||
try {
|
||||
content = (fields = f.newInstance()).getContent();
|
||||
@@ -69,7 +69,6 @@ public class Dialog<T, F extends DialogFields> extends JDialog implements ThemeE
|
||||
}
|
||||
}
|
||||
public void onClose() {
|
||||
|
||||
}
|
||||
public void LoadSize() {
|
||||
setMinimumSize(new Dimension(getDefaultWidth(), getDefaultHeight()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Windows.Dialog;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package Common.Visual.Windows.Dialog;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class DialogWrapText extends JTextPane implements DialogFields {
|
||||
public DialogWrapText(){
|
||||
public DialogWrapText() {
|
||||
setOpaque(true);
|
||||
setBackground(Color.WHITE);
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreeBold));
|
||||
|
||||
@@ -14,14 +14,14 @@ public class VFileChooser_ {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
public File getCurrentDirectory(){
|
||||
return fileChooser.getCurrentDirectory();
|
||||
}
|
||||
public VFileChooser_(String title, FileFilter filter) {
|
||||
fileChooser.setDialogTitle(title);
|
||||
fileChooser.setAcceptAllFileFilterUsed(false);
|
||||
fileChooser.setFileFilter(filter);
|
||||
}
|
||||
public File getCurrentDirectory() {
|
||||
return fileChooser.getCurrentDirectory();
|
||||
}
|
||||
public void setTitle(String title_in) {
|
||||
fileChooser.setDialogTitle(title_in);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common.Visual.Windows;
|
||||
import Common.Database.Objects.DBForm.DBForm;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Database.Objects.DBForm.DBForm;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -11,7 +11,7 @@ import java.awt.event.WindowEvent;
|
||||
public abstract class Form extends JFrame implements ThemeElement {
|
||||
private DBForm dbInfo = null;
|
||||
public Form() {
|
||||
if (getIconPath()!=null) setIconImage(Utils_.getIcon(getIconPath()).getImage());
|
||||
if (getIconPath() != null) setIconImage(Utils_.getIcon(getIconPath()).getImage());
|
||||
SetListener();
|
||||
this.setTitle(Utils_.isWindows() ? getWTitleText() : getUTitleText());
|
||||
pack();
|
||||
@@ -73,7 +73,7 @@ public abstract class Form extends JFrame implements ThemeElement {
|
||||
public void AfterClose() {
|
||||
}
|
||||
public void LoadWindowParameters() throws Exception {
|
||||
if (getFormKey()!=null)
|
||||
if (getFormKey() != null)
|
||||
if (Global.mainModule.getDb().forms.Data.containsKey(getFormKey())) {
|
||||
dbInfo = Global.mainModule.getDb().forms.Data.get(getFormKey());
|
||||
dbInfo.Apply(this);
|
||||
@@ -83,7 +83,7 @@ public abstract class Form extends JFrame implements ThemeElement {
|
||||
setLocationRelativeTo(getRelative());
|
||||
}
|
||||
public void SaveWindowParameters() throws Exception {
|
||||
if (getFormKey()!=null) {
|
||||
if (getFormKey() != null) {
|
||||
if (dbInfo != null) {
|
||||
dbInfo.Init(this);
|
||||
Global.mainModule.getDb().Update(dbInfo);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common.Visual.Windows;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Windows.Dialog.Dialog;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
Reference in New Issue
Block a user