no message
This commit is contained in:
@@ -1,8 +1,40 @@
|
||||
package Common.Visual;
|
||||
import Common_old.UI.Menus_2023.DataMenuBar;
|
||||
import Common.Database.Tables.DataSet;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Stack;
|
||||
public class CommonUI {
|
||||
public static LinkedHashMap<Class<? extends DataSet>, DataMenuBar> menuBars = new LinkedHashMap<>();
|
||||
public static Stack<Component> windowsStack = new Stack<>();
|
||||
//-----
|
||||
public static void Clear(Container container) {
|
||||
container.removeAll();
|
||||
container.repaint();
|
||||
container.revalidate();
|
||||
}
|
||||
// http://java-online.ru/swing-joptionpane.xhtml
|
||||
public static <T> void TrySelect(JComboBox box, T value_in) {
|
||||
if (value_in != null) {
|
||||
for (int i = 0; i < box.getItemCount(); ++i) {
|
||||
T value = (T) box.getItemAt(i);
|
||||
if (value.equals(value_in)) {
|
||||
box.setSelectedIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
box.addItem(value_in);
|
||||
box.setSelectedIndex(box.getItemCount() - 1);
|
||||
}
|
||||
}
|
||||
public static void TrySelect_s(JComboBox box, String value_string_in) {
|
||||
for (int i = 0; i < box.getItemCount(); ++i) {
|
||||
Object value = box.getItemAt(i);
|
||||
if (value.toString().equals(value_string_in)) {
|
||||
box.setSelectedIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
56
src/Common/Visual/DataMenuBar.java
Normal file
56
src/Common/Visual/DataMenuBar.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package Common.Visual;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common_old.UI.Menus_2023.MenuBarButton;
|
||||
import Common_old.UI.Menus_2023.VisualiserMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
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;
|
||||
//-
|
||||
public DataMenuBar(String dataName, PassCode_2021... passes) {
|
||||
// Font font = Current.getTheme().Fonts.get(VisualiserFonts.TreeBoldItalic).deriveFont(12.0F);
|
||||
add(new JLabel(dataName + " : "));
|
||||
add(countLabel = new JLabel("?"));
|
||||
addPasses(passes);
|
||||
}
|
||||
public void createSelectionButtons(DataSet dataSet) {
|
||||
java.awt.Dimension d = new Dimension(25, 25);
|
||||
if (selectAllButton == null) {
|
||||
add(selectAllButton = new MenuBarButton() {
|
||||
{
|
||||
setIcon("/Common/icons/SelectAll.png");
|
||||
setToolTipText("Выбрать всё");
|
||||
setPreferredSize(d);
|
||||
setMinimumSize(d);
|
||||
setMaximumSize(d);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
if (unselectAllButton == null) {
|
||||
add(unselectAllButton = new MenuBarButton() {
|
||||
{
|
||||
setIcon("/Common/icons/UnselectAll.png");
|
||||
setToolTipText("Отменить всё");
|
||||
setPreferredSize(d);
|
||||
setMinimumSize(d);
|
||||
setMaximumSize(d);
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
if (selectAllListener != null) {
|
||||
selectAllButton.removeActionListener(selectAllListener); }
|
||||
selectAllButton.addActionListener(selectAllListener = e -> dataSet.CheckAll(true));
|
||||
if (unselectAllListener != null) {
|
||||
unselectAllButton.removeActionListener(unselectAllListener);
|
||||
}
|
||||
unselectAllButton.addActionListener(unselectAllListener = e -> dataSet.CheckAll(false));
|
||||
}
|
||||
}
|
||||
7
src/Common/Visual/FilterInterface.java
Normal file
7
src/Common/Visual/FilterInterface.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package Common.Visual;
|
||||
public interface FilterInterface {
|
||||
void ShowMatchesCount(int count);
|
||||
default void ShowNoMatches() {
|
||||
ShowMatchesCount(0);
|
||||
}
|
||||
}
|
||||
38
src/Common/Visual/Selectable.java
Normal file
38
src/Common/Visual/Selectable.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package Common.Visual;
|
||||
import Common_old.Utils.Utils;
|
||||
|
||||
import javax.swing.*;
|
||||
public interface Selectable {
|
||||
boolean isSelected();
|
||||
default void Select(boolean flag) {
|
||||
if (isSelectionEnabled())
|
||||
select(flag);
|
||||
}
|
||||
void select(boolean flag);
|
||||
//-
|
||||
default ImageIcon GetSelectionIcon() {
|
||||
return
|
||||
isSelectionEnabled() ?
|
||||
Utils.getIcon("/Common/icons/" + (isSelected() ? "Pick" : "NotPick") + ".png") :
|
||||
GetDisabledIcon();
|
||||
}
|
||||
default ImageIcon GetDisabledIcon() {
|
||||
return Utils.getIcon("/Common/icons/Arrays/Unknown.png");
|
||||
}
|
||||
default void SwitchSelection() {
|
||||
Select(!isSelected());
|
||||
}
|
||||
//строчный контент для передачи параметров проходам.
|
||||
default String getSelectionContent() {
|
||||
return toString();
|
||||
}
|
||||
//-
|
||||
default String getSelectionText() {
|
||||
return toString();
|
||||
}
|
||||
default boolean isSelectionEnabled() {
|
||||
return true;
|
||||
}
|
||||
default void SelectAllChildren(boolean select) {
|
||||
}
|
||||
}
|
||||
8
src/Common/Visual/StatusEnum.java
Normal file
8
src/Common/Visual/StatusEnum.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package Common.Visual;
|
||||
import _VisualDVM.Syntax.VisualiserFonts;
|
||||
public interface StatusEnum {
|
||||
default String getDescription() {
|
||||
return toString();
|
||||
}
|
||||
default VisualiserFonts getFont() {return VisualiserFonts.UnknownState;}
|
||||
}
|
||||
Reference in New Issue
Block a user