упраздение лишних енумов в оформлении таблиц и деревьев.
This commit is contained in:
89
src/_VisualDVM/Visual/Tables/EditorFilesHyperlinks.java
Normal file
89
src/_VisualDVM/Visual/Tables/EditorFilesHyperlinks.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package _VisualDVM.Visual.Tables;
|
||||
import _VisualDVM.ProjectData.Files.UI.FilesHyperlinksPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.CellEditorListener;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
import java.awt.*;
|
||||
import java.util.EventObject;
|
||||
import java.util.Objects;
|
||||
import java.util.Vector;
|
||||
public class EditorFilesHyperlinks extends FilesHyperlinksPanel implements TableCellEditor {
|
||||
protected transient ChangeEvent changeEvent;
|
||||
@Override
|
||||
public Component getTableCellEditorComponent(
|
||||
JTable table, Object value, boolean isSelected, int row, int column) {
|
||||
if (value instanceof Vector) {
|
||||
UpdateByCell((Vector) value);
|
||||
this.Hyperlinks.setBackground(table.getSelectionBackground());
|
||||
Hyperlinks.setSelectionBackground(table.getSelectionBackground());
|
||||
Hyperlinks.setSelectionForeground(table.getSelectionForeground());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
return links;
|
||||
}
|
||||
//Copied from AbstractCellEditor
|
||||
//protected EventListenerList listenerList = new EventListenerList();
|
||||
@Override
|
||||
public boolean isCellEditable(EventObject e) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldSelectCell(EventObject anEvent) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean stopCellEditing() {
|
||||
fireEditingStopped();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void cancelCellEditing() {
|
||||
fireEditingCanceled();
|
||||
}
|
||||
@Override
|
||||
public void addCellEditorListener(CellEditorListener l) {
|
||||
listenerList.add(CellEditorListener.class, l);
|
||||
}
|
||||
@Override
|
||||
public void removeCellEditorListener(CellEditorListener l) {
|
||||
listenerList.remove(CellEditorListener.class, l);
|
||||
}
|
||||
public CellEditorListener[] getCellEditorListeners() {
|
||||
return listenerList.getListeners(CellEditorListener.class);
|
||||
}
|
||||
protected void fireEditingStopped() {
|
||||
// Guaranteed to return a non-null array
|
||||
Object[] listeners = listenerList.getListenerList();
|
||||
// Process the listeners last to first, notifying
|
||||
// those that are interested in this event
|
||||
for (int i = listeners.length - 2; i >= 0; i -= 2) {
|
||||
if (listeners[i] == CellEditorListener.class) {
|
||||
// Lazily create the event:
|
||||
if (Objects.isNull(changeEvent)) {
|
||||
changeEvent = new ChangeEvent(this);
|
||||
}
|
||||
((CellEditorListener) listeners[i + 1]).editingStopped(changeEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void fireEditingCanceled() {
|
||||
// Guaranteed to return a non-null array
|
||||
Object[] listeners = listenerList.getListenerList();
|
||||
// Process the listeners last to first, notifying
|
||||
// those that are interested in this event
|
||||
for (int i = listeners.length - 2; i >= 0; i -= 2) {
|
||||
if (listeners[i] == CellEditorListener.class) {
|
||||
// Lazily create the event:
|
||||
if (Objects.isNull(changeEvent)) {
|
||||
changeEvent = new ChangeEvent(this);
|
||||
}
|
||||
((CellEditorListener) listeners[i + 1]).editingCanceled(changeEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
src/_VisualDVM/Visual/Tables/RendererConfigurationAuto.java
Normal file
11
src/_VisualDVM/Visual/Tables/RendererConfigurationAuto.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package _VisualDVM.Visual.Tables;
|
||||
import Common.Visual.Tables.RendererDBObject;
|
||||
import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
|
||||
public class RendererConfigurationAuto extends RendererDBObject {
|
||||
@Override
|
||||
public void Display() {
|
||||
if (value != null) {
|
||||
setIcon(((Configuration) value).GetAutoIcon());
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/_VisualDVM/Visual/Tables/RendererHyperlinks.java
Normal file
15
src/_VisualDVM/Visual/Tables/RendererHyperlinks.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package _VisualDVM.Visual.Tables;
|
||||
import Common.Visual.Controls.HyperlinksStyledList;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import java.awt.*;
|
||||
import java.util.Vector;
|
||||
public class RendererHyperlinks extends HyperlinksStyledList implements TableCellRenderer {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
|
||||
setListData((Vector) value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
39
src/_VisualDVM/Visual/Tables/SwitcherConfigurationAuto.java
Normal file
39
src/_VisualDVM/Visual/Tables/SwitcherConfigurationAuto.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package _VisualDVM.Visual.Tables;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Visual.Tables.EditorDBObject;
|
||||
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;
|
||||
public class SwitcherConfigurationAuto extends EditorDBObject<Configuration> {
|
||||
@Override
|
||||
public void Action() {
|
||||
value.SwitchAuto();
|
||||
setIcon(value.GetAutoIcon());
|
||||
///-
|
||||
Pass pass = new EditServerObject<TestingServer, Configuration>(Global.testingServer, Configuration.class) {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (Configuration) args[0];
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Обновить флаг автоматического тестирования";
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
VisualCaches.RefreshCache(target);
|
||||
if (target instanceof SapforConfiguration)
|
||||
Global.testingServer.db.sapforConfigurations.ShowUI(target.id);
|
||||
}
|
||||
};
|
||||
pass.Do(value);
|
||||
}
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user