From 6deadf394937a002ab2d24e48fd6cb38c11f2ed8 Mon Sep 17 00:00:00 2001 From: YanSergey Date: Sat, 10 Dec 2022 18:14:21 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20=D0=B8=20=D0=BD=D0=B0=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=B9=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clusterAdminLibrary/BackgroundTask.java | 1 - .../yanygin/clusterAdminLibrary/Config.java | 71 +++++++++++- .../yanygin/clusterAdminLibrary/Helper.java | 2 +- .../yanygin/clusterAdminLibrary/Server.java | 21 +++- .../clusterAdminLibraryUI/SettingsDialog.java | 81 ++++++++++--- .../clusterAdminLibraryUI/ViewerArea.java | 108 +++++++++++------- .../clusterAdminLibraryUI/messages.properties | 7 +- .../messages_ru_RU.properties | 7 +- .../main/resources/icons/taskCompleted.png | Bin 533 -> 323 bytes .../src/main/resources/icons/taskRunning.png | Bin 854 -> 668 bytes .../src/main/resources/logback.xml | 15 +-- 11 files changed, 230 insertions(+), 83 deletions(-) diff --git a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/BackgroundTask.java b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/BackgroundTask.java index 183e3e6..3f0b22c 100644 --- a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/BackgroundTask.java +++ b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/BackgroundTask.java @@ -47,7 +47,6 @@ enum TaskState { static Image taskRunning = Helper.getImage("taskRunning.png"); // $NON-NLS-1$ static Image taskCompleted = Helper.getImage("taskCompleted.png"); // $NON-NLS-1$ static Image taskError = Helper.getImage("taskError.png"); // $NON-NLS-1$ - // Image currentIcon; Date startDate; Date finishDate; diff --git a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Config.java b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Config.java index cc70354..2d692c4 100644 --- a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Config.java +++ b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Config.java @@ -34,7 +34,8 @@ import org.eclipse.swt.widgets.Shell; import org.json.JSONArray; import org.json.JSONObject; -import org.slf4j.Logger; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; import org.slf4j.LoggerFactory; import ru.yanygin.clusterAdminLibrary.ColumnProperties.RowSortDirection; import ru.yanygin.clusterAdminLibrary.InfoBaseInfoShortExt.InfobasesSortDirection; @@ -122,6 +123,14 @@ public class Config { @Expose private InfobasesSortDirection infobasesSortDirection = InfobasesSortDirection.DISABLE; + @SerializedName("ListRefreshRate") + @Expose + private int listRefreshRate = 5000; + + @SerializedName("LoggerLevel") + @Expose + private String loggerLevel = "error"; + @SerializedName("Servers") @Expose private Map servers = new HashMap<>(); @@ -147,8 +156,12 @@ public class Config { private ColumnProperties wsColumnProperties = new ColumnProperties(0); private static final Logger LOGGER = - LoggerFactory.getLogger("clusterAdminLibrary"); //$NON-NLS-1$ - private static final String DEFAULT_CONFIG_PATH = "config.json"; //$NON-NLS-1$ + (Logger) LoggerFactory.getLogger(Config.class.getSimpleName()); + + private static final Logger ROOT_LOGGER = + (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); + + private static final String DEFAULT_CONFIG_PATH = "config.json"; // $NON-NLS-1$ private static final String TEMP_CONFIG_PATH = "config_temp.json"; //$NON-NLS-1$ public static Config currentConfig; @@ -844,6 +857,56 @@ public void setInfobasesSortDirection(InfobasesSortDirection sortDirection) { this.infobasesSortDirection = sortDirection; } + /** + * Получить установленный уровень логирования. + * + * @return уровень логирования + */ + public String getLoggerLevel() { + return loggerLevel; + } + + /** + * Установить уровень логирования. + * + * @param level - уровень логирования + */ + public void setLoggerLevel(String level) { + this.loggerLevel = level; + applyLoggerLevel(); + } + + /** Применить уровень логирования из конфига. */ + private void applyLoggerLevel() { + + ROOT_LOGGER.setLevel(Level.toLevel("info")); + ROOT_LOGGER.info("logger level switching to <{}>", loggerLevel); // $NON-NLS-1$ + ROOT_LOGGER.setLevel(Level.toLevel(loggerLevel)); + + ROOT_LOGGER.error("test logger level = error"); // $NON-NLS-1$ + ROOT_LOGGER.warn("test logger level = warn"); // $NON-NLS-1$ + ROOT_LOGGER.info("test logger level = info"); // $NON-NLS-1$ + ROOT_LOGGER.debug("test logger level = debug"); // $NON-NLS-1$ + } + + /** + * Получить частоту обновления списка. + * + * @return частота обновления списка (миллисекунд) + */ + public int getListRrefreshRate() { + return listRefreshRate; + } + + /** + * Установка частоты обновления списка. + * + * @param refreshRate - частота обновления списка (миллисекунд) + */ + public void setListRrefreshRate(int refreshRate) { + this.listRefreshRate = refreshRate; + } + /** * Получение свойства колонок списков. * @@ -1019,6 +1082,8 @@ public static Config readConfig(String configPath) { java.util.Locale.setDefault(locale); Messages.reloadBundle(locale); // TODO не совсем понятно как работает } + + config.applyLoggerLevel(); } LOGGER.info("Config file read successfully"); //$NON-NLS-1$ return config; diff --git a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Helper.java b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Helper.java index 72a6dde..b062ac2 100644 --- a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Helper.java +++ b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Helper.java @@ -48,7 +48,7 @@ public static Image getImage(String name) { public static void showMessageBox(String message) { MessageBox messageBox = new MessageBox(Display.getDefault().getActiveShell()); // SWT.ICON_INFORMATION | SWT.OK - // messageBox.setText("Information"); + messageBox.setText("Information"); messageBox.setMessage(message); messageBox.open(); } diff --git a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Server.java b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Server.java index 4e8b7f9..9194029 100644 --- a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Server.java +++ b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibrary/Server.java @@ -131,6 +131,7 @@ public class Server implements Comparable { private boolean available; private Process localRasProcess; private String connectionError = ""; //$NON-NLS-1$; + boolean silentConnectionMode = false; // private String agentVersion = ""; //$NON-NLS-1$ private String agentVersion = Messages.getString("Server.NotConnect"); //$NON-NLS-1$ @@ -371,6 +372,15 @@ public String getConnectionError() { return connectionError; } + /** + * Показывает, нужно ли выводить ошибку подключения. + * + * @return выводить ошибку подключения + */ + public boolean needShowConnectionError() { + return !connectionError.isBlank() && !silentConnectionMode; + } + /** * Получение ключа сервера в виде "Server:1541". * @@ -777,7 +787,10 @@ private void computeServerParams(String serverAddress) { public boolean isConnected() { boolean isConnected = (agentConnection != null); - if (!isConnected) { + if (isConnected) { + serverState = ServerState.CONNECTED; + } else if (serverState != ServerState.CONNECTING) { + serverState = ServerState.DISCONNECT; LOGGER.info( "The connection a server <{}> is not established", //$NON-NLS-1$ this.getServerKey()); @@ -803,6 +816,7 @@ public boolean connectToServer(boolean disconnectAfter, boolean silentMode) { available = false; connectionError = ""; serverState = ServerState.CONNECTING; + silentConnectionMode = silentMode; // все вызовы здесь проверить на Helper.showMessageBox // этого тут быть не должно, потому что выполняется в отдельном потоке @@ -816,8 +830,8 @@ public boolean connectToServer(boolean disconnectAfter, boolean silentMode) { int currentRasPort = useLocalRas ? localRasPort : this.rasPort; // try { - // Thread.sleep(30000); - // } catch (InterruptedException e) { // TODO Auto-generated catch block + // Thread.sleep(5000); + // } catch (InterruptedException e) { // TODO Искусственная задержка подключения // e.printStackTrace(); // } try { @@ -1046,6 +1060,7 @@ public void disconnectFromAgent() { } finally { agentConnection = null; agentConnector = null; + serverState = ServerState.DISCONNECT; } } diff --git a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/SettingsDialog.java b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/SettingsDialog.java index 1cfa7ed..d5e974a 100644 --- a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/SettingsDialog.java +++ b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/SettingsDialog.java @@ -47,6 +47,11 @@ public class SettingsDialog extends Dialog { private Button btnRowSortAsPrevious; private Button btnRowSortAsc; private Button btnRowSortDesc; + private Button btnLoggerLevelOff; + private Button btnLoggerLevelError; + private Button btnLoggerLevelWarning; + private Button btnLoggerLevelInfo; + private Button btnLoggerLevelDebug; private static final String LOCALE_RU = "ru-RU"; //$NON-NLS-1$ @@ -130,7 +135,7 @@ protected Control createDialogArea(Composite parent) { Group grpLocale = new Group(container, SWT.NONE); grpLocale.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); - grpLocale.setText(Strings.LOCALE); + grpLocale.setText(Strings.LOCALE_TITLE); grpLocale.setLayout(new GridLayout(1, false)); btnLocaleSystem = new Button(grpLocale, SWT.RADIO); @@ -143,7 +148,8 @@ protected Control createDialogArea(Composite parent) { btnLocaleRussian.setText(Strings.LOCALE_RUSSIAN); Group grpHighlight = new Group(container, SWT.NONE); - grpHighlight.setText(Strings.HIGHLIGHT); + grpHighlight.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + grpHighlight.setText(Strings.HIGHLIGHT_TITLE); grpHighlight.setLayout(new GridLayout(2, false)); btnHighlightNewItems = new Button(grpHighlight, SWT.CHECK); @@ -187,7 +193,8 @@ protected Control createDialogArea(Composite parent) { lblWatchSessionsColor.setLayoutData(gdLblWatchSessionsColor); Group grpRowSortDirection = new Group(container, SWT.NONE); - grpRowSortDirection.setText(Strings.ROW_SORT_DIRECTION); + grpRowSortDirection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + grpRowSortDirection.setText(Strings.ROW_SORT_DIRECTION_TITLE); grpRowSortDirection.setLayout(new GridLayout(1, false)); btnRowSortAsPrevious = new Button(grpRowSortDirection, SWT.RADIO); @@ -199,14 +206,35 @@ protected Control createDialogArea(Composite parent) { btnRowSortDesc = new Button(grpRowSortDirection, SWT.RADIO); btnRowSortDesc.setText(Strings.ROW_SORT_DIRECTION_DESCENDING); - btnReadClipboard = new Button(container, SWT.CHECK); - btnReadClipboard.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); + Group grpLoggerLevel = new Group(container, SWT.NONE); + grpLoggerLevel.setLayout(new GridLayout(1, false)); + grpLoggerLevel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + grpLoggerLevel.setText(Strings.LOGGER_LEVEL_TITLE); + + btnLoggerLevelOff = new Button(grpLoggerLevel, SWT.RADIO); + btnLoggerLevelOff.setText("off"); + + btnLoggerLevelError = new Button(grpLoggerLevel, SWT.RADIO); + btnLoggerLevelError.setText("error"); + + btnLoggerLevelWarning = new Button(grpLoggerLevel, SWT.RADIO); + btnLoggerLevelWarning.setText("warning"); + + btnLoggerLevelInfo = new Button(grpLoggerLevel, SWT.RADIO); + btnLoggerLevelInfo.setText("info"); + + btnLoggerLevelDebug = new Button(grpLoggerLevel, SWT.RADIO); + btnLoggerLevelDebug.setText("debug"); + + Group grpOther = new Group(container, SWT.NONE); + grpOther.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + grpOther.setLayout(new GridLayout(1, false)); + + btnReadClipboard = new Button(grpOther, SWT.CHECK); btnReadClipboard.setText(Strings.READ_CLIPBOARD); - btnCheckUpdate = new Button(container, SWT.CHECK); - btnCheckUpdate.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); + btnCheckUpdate = new Button(grpOther, SWT.CHECK); btnCheckUpdate.setText(Strings.CHECK_UPDATE); - new Label(container, SWT.NONE); initProperties(); @@ -236,17 +264,25 @@ private void initProperties() { btnReadClipboard.setSelection(config.isReadClipboard()); btnCheckUpdate.setSelection(config.checkingUpdate()); - if (config.getLocale() == null) { + final String locale = config.getLocale(); + if (locale == null) { btnLocaleSystem.setSelection(true); } else { - btnLocaleEnglish.setSelection(config.getLocale().equals(Locale.ENGLISH.toLanguageTag())); - btnLocaleRussian.setSelection(config.getLocale().equals(LOCALE_RU)); + btnLocaleEnglish.setSelection(locale.equals(Locale.ENGLISH.toLanguageTag())); + btnLocaleRussian.setSelection(locale.equals(LOCALE_RU)); } final RowSortDirection rowSortDirection = config.getRowSortDirection(); btnRowSortAsPrevious.setSelection(rowSortDirection == RowSortDirection.DISABLE); btnRowSortAsc.setSelection(rowSortDirection == RowSortDirection.ASC); btnRowSortDesc.setSelection(rowSortDirection == RowSortDirection.DESC); + + final String loggerLevel = config.getLoggerLevel(); + btnLoggerLevelOff.setSelection(loggerLevel.equals(btnLoggerLevelOff.getText())); + btnLoggerLevelError.setSelection(loggerLevel.equals(btnLoggerLevelError.getText())); + btnLoggerLevelWarning.setSelection(loggerLevel.equals(btnLoggerLevelWarning.getText())); + btnLoggerLevelInfo.setSelection(loggerLevel.equals(btnLoggerLevelInfo.getText())); + btnLoggerLevelDebug.setSelection(loggerLevel.equals(btnLoggerLevelDebug.getText())); } private void saveProperties() { @@ -289,6 +325,21 @@ private void saveProperties() { config.setRowSortDirection(RowSortDirection.DISABLE); } + String loggerLevel; + if (btnLoggerLevelOff.getSelection()) { + loggerLevel = btnLoggerLevelOff.getText(); + } else if (btnLoggerLevelError.getSelection()) { + loggerLevel = btnLoggerLevelError.getText(); + } else if (btnLoggerLevelWarning.getSelection()) { + loggerLevel = btnLoggerLevelWarning.getText(); + } else if (btnLoggerLevelInfo.getSelection()) { + loggerLevel = btnLoggerLevelInfo.getText(); + } else if (btnLoggerLevelDebug.getSelection()) { + loggerLevel = btnLoggerLevelDebug.getText(); + } else { + loggerLevel = btnLoggerLevelOff.getText(); + } + config.setLoggerLevel(loggerLevel); } /** @@ -333,24 +384,26 @@ private static class Strings { static final String SHOW_INFOBASE_DESCRIPTION = getString("ShowInfobaseDescription"); static final String SHOW_LOCAL_RAS_CONNECTINFO = getString("ShowLocalRASConnectInfo"); - static final String LOCALE = getString("Locale"); + static final String LOCALE_TITLE = getString("LocaleTitle"); static final String LOCALE_SYSTEM = getString("LocaleSystem"); static final String LOCALE_ENGLISH = getString("LocaleEnglish"); static final String LOCALE_RUSSIAN = getString("LocaleRussian"); - static final String HIGHLIGHT = getString("Highlight"); + static final String HIGHLIGHT_TITLE = getString("HighlightTitle"); static final String HIGHLIGHT_NEW_ITEMS = getString("HighlightNewItems"); static final String HIGHLIGHT_DURATION = getString("HighlightDuration"); static final String SHADOW_SLEEP_SESSIONS = getString("ShadowSleepSessions"); static final String WATCH_SESSIONS = getString("WatchSessions"); - static final String ROW_SORT_DIRECTION = getString("RowSortDirection"); + static final String ROW_SORT_DIRECTION_TITLE = getString("RowSortDirectionTitle"); static final String ROW_SORT_DIRECTION_AS_PREVIOUS = getString("RowSortDirectionAsPrevious"); static final String ROW_SORT_DIRECTION_ASCENDING = getString("RowSortDirectionAscending"); static final String ROW_SORT_DIRECTION_DESCENDING = getString("RowSortDirectionDescending"); static final String READ_CLIPBOARD = getString("ReadClipboard"); static final String CHECK_UPDATE = getString("CheckUpdate"); + + static final String LOGGER_LEVEL_TITLE = getString("LoggerLevelTitle"); static String getString(String key) { return Messages.getString("SettingsDialog." + key); //$NON-NLS-1$ diff --git a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/ViewerArea.java b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/ViewerArea.java index 2001d71..e0b01f4 100644 --- a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/ViewerArea.java +++ b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/ViewerArea.java @@ -10,7 +10,6 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; -import java.util.Date; import java.util.EnumMap; import java.util.HashMap; import java.util.List; @@ -40,7 +39,6 @@ import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; @@ -280,6 +278,7 @@ public void widgetSelected(SelectionEvent evt) { (serverKey, server) -> { addServerItemInServersTree(server); }); + columnServer.pack(); runAutonnectAllServers(); @@ -385,10 +384,6 @@ private void initToolbar(ToolBar toolBar) { toolItem.setImage(updateIcon24); updateTablesListener = new UpdateTablesSelectionListener(toolItem); - toolItem.addSelectionListener(updateTablesListener); - - updateTablesListener.add("Включить автообновление"); - updateTablesListener.add("Задать период автообновления"); toolBar.pack(); } @@ -1072,7 +1067,7 @@ private UUID getCurrentWorkingServerId() { } private Server getServer(TreeItem item) { - if (item == null) { + if (item == null || item.isDisposed()) { LOGGER.error("Error get Server from serverItem"); // $NON-NLS-1$ return null; } @@ -1170,9 +1165,7 @@ private void connectServerItem(TreeItem serverItem, boolean silentMode) { Thread thread = new Thread( () -> { - Date startDate = new Date(); server.connectToServer(false, silentMode); - Date finishDate = new Date(); }); thread.start(); @@ -1190,7 +1183,7 @@ private void disconnectServerItem(TreeItem serverItem) { if (server == null) { return; } - server.disconnectFromAgent(); + server.disconnectFromAgent(); // TODO надо сюда переместить updateTreeItemState и dispose server.updateTreeItemState(serverItem); // serverItem.setImage(serverIcon); @@ -2517,15 +2510,9 @@ public Map fillParams(File script, TreeItem infobaseItem) { params.put(paramKey, paramValue); } - // env.put("infobase", server.getInfoBaseName(clusterId, infobaseId)); //$NON-NLS-1$ - // env.put("serverName", server.getAgentHost()); // $NON-NLS-1$ - // env.put("agentPort", server.getAgentPortAsString()); // $NON-NLS-1$ - // env.put("managerPort",String.valueOf(server.getClusterInfo(clusterId).getMainPort())); - // //$NON-NLS-1$ - - // env.put("infobase", "dev1"); // $NON-NLS-1$ - // env.put("serverName", "server123"); // $NON-NLS-1$ - // env.put("serverPort", "4541"); // $NON-NLS-1$ + // params.put("infobase", "dev1"); // $NON-NLS-1$ + // params.put("serverName", "server123"); // $NON-NLS-1$ + // params.put("managerPort", "4541"); // $NON-NLS-1$ return params; } @@ -3082,6 +3069,7 @@ public void run() { if (server == null) { return; } + server.updateTreeItemState(serverItem); if (server.isConnected() || !server.getConnectionError().isBlank()) { doneItems.add(serverItem); @@ -3099,12 +3087,12 @@ public void run() { if (server == null) { return; } - server.updateTreeItemState(serverItem); + // server.updateTreeItemState(serverItem); if (server.isConnected()) { updateClustersInTree(serverItem); } - if (!server.getConnectionError().isBlank()) { + if (server.needShowConnectionError()) { Helper.showMessageBox(server.getConnectionError()); } } @@ -3131,35 +3119,72 @@ public void run() { class UpdateTablesSelectionListener extends SelectionAdapter { - private ToolItem dropdown; - private Menu menu; + private ToolItem mainButton; + private Menu dropdownMenu; + private int refreshRate = config.getListRrefreshRate(); + + public UpdateTablesSelectionListener(ToolItem mainButton) { + this.mainButton = mainButton; + this.mainButton.addSelectionListener(this); + + dropdownMenu = new Menu(mainButton.getParent().getShell()); + + this.add(dropdownMenu, "Автообновление", SWT.CHECK, null); - public UpdateTablesSelectionListener(ToolItem dropdown) { - this.dropdown = dropdown; - menu = new Menu(dropdown.getParent().getShell()); + // this.add(dropdownMenu, "Задать период автообновления", SWT.PUSH); + Menu subMenuUpdatePeriod = addItemGroupInMenu(dropdownMenu, "Период", null); + // подменю с секундами = 1, 2, 5, 10 + this.add(subMenuUpdatePeriod, "1 сек", SWT.RADIO, 1000); + this.add(subMenuUpdatePeriod, "2 сек", SWT.RADIO, 2000); + this.add(subMenuUpdatePeriod, "5 сек", SWT.RADIO, 5000); + this.add(subMenuUpdatePeriod, "10 сек", SWT.RADIO, 10000); } - public void add(String item) { - MenuItem menuItem = new MenuItem(menu, SWT.CHECK); - menuItem.setText(item); + public void add(Menu parentMenu, String title, int style, Object data) { + MenuItem menuItem = new MenuItem(parentMenu, style); + menuItem.setText(title); + menuItem.setData(data); + if (style == SWT.CHECK) { + menuItem.setImage(updateAutoIcon24); + } + if (style == SWT.RADIO) { + menuItem.setSelection((int) data == refreshRate); + } + menuItem.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { MenuItem selected = (MenuItem) event.widget; - if (selected.getSelection()) { - updateListTimer = new Timer(true); - updateListTimer.schedule(new UpdateListTimer(), 1000, 5000); - dropdown.setImage(updateAutoIcon24); - } else { - updateListTimer.cancel(); - updateListTimer = null; + switch (selected.getStyle()) { + case SWT.CHECK: + if (selected.getSelection()) { + updateListTimer = new Timer(true); + updateListTimer.schedule(new UpdateListTimer(), 1000, refreshRate); + mainButton.setImage(updateAutoIcon24); + } else { + updateListTimer.cancel(); + updateListTimer = null; + mainButton.setImage(updateIcon24); + } + break; + + case SWT.RADIO: + if (selected.getSelection()) { + refreshRate = (int) selected.getData(); + config.setListRrefreshRate(refreshRate); + if (updateListTimer != null) { + updateListTimer.cancel(); + updateListTimer = new Timer(true); + updateListTimer.schedule(new UpdateListTimer(), 1000, refreshRate); + } + } + break; - // dropdown.setText(Strings.CONTEXT_MENU_UPDATE); // + " \n(ручное)" - dropdown.setImage(updateIcon24); + default: + break; } - } }); } @@ -3170,10 +3195,9 @@ public void widgetSelected(SelectionEvent event) { ToolItem item = (ToolItem) event.widget; Rectangle rect = item.getBounds(); Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y)); - menu.setLocation(pt.x, pt.y + rect.height); - menu.setVisible(true); + dropdownMenu.setLocation(pt.x, pt.y + rect.height); + dropdownMenu.setVisible(true); } else { - System.out.println(dropdown.getText() + " Pressed"); fillTabs(); } } diff --git a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/messages.properties b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/messages.properties index 032c125..1dbbe2f 100644 --- a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/messages.properties +++ b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/messages.properties @@ -110,18 +110,19 @@ SettingsDialog.ExpandNodesInTree = Expand nodes in tree SettingsDialog.ExpandServers = Servers SettingsDialog.ExpandWorkingProcesses = Working processes SettingsDialog.ExpandWorkingServers = Working servers -SettingsDialog.Highlight = Highlight SettingsDialog.HighlightDuration = Highlight duration (sec) SettingsDialog.HighlightNewItems = Highlight new items -SettingsDialog.Locale = Locale (need restart) +SettingsDialog.HighlightTitle = Highlight SettingsDialog.LocaleEnglish = English SettingsDialog.LocaleRussian = Russian SettingsDialog.LocaleSystem = System +SettingsDialog.LocaleTitle = Locale (need restart) +SettingsDialog.LoggerLevelTitle = Logger level SettingsDialog.ReadClipboard = Read clipboard (when adding server) -SettingsDialog.RowSortDirection = Row sort direction SettingsDialog.RowSortDirectionAsPrevious = As previous SettingsDialog.RowSortDirectionAscending = Descending SettingsDialog.RowSortDirectionDescending = Ascending +SettingsDialog.RowSortDirectionTitle = Row sort direction SettingsDialog.ShadowSleepSessions = Shadow sleep sessions SettingsDialog.ShowInfo = Additional info SettingsDialog.ShowInfobaseDescription = Show infobase description diff --git a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/messages_ru_RU.properties b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/messages_ru_RU.properties index dd80728..6b3bf02 100644 --- a/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/messages_ru_RU.properties +++ b/clusterAdminLibrary/src/main/java/ru/yanygin/clusterAdminLibraryUI/messages_ru_RU.properties @@ -110,18 +110,19 @@ SettingsDialog.ExpandNodesInTree = \u0420\u0430\u0437\u0432\u043E\u0440 SettingsDialog.ExpandServers = \u0421\u0435\u0440\u0432\u0435\u0440\u0430 SettingsDialog.ExpandWorkingProcesses = \u0420\u0430\u0431\u043E\u0447\u0438\u0435 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u044B SettingsDialog.ExpandWorkingServers = \u0420\u0430\u0431\u043E\u0447\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 -SettingsDialog.Highlight = \u041F\u043E\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u043D\u0438\u0435 SettingsDialog.HighlightDuration = \u0414\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C \u043F\u043E\u0434\u0441\u0432\u0435\u0442\u043A\u0438 (\u0441\u0435\u043A) SettingsDialog.HighlightNewItems = \u041F\u043E\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0442\u044C \u043D\u043E\u0432\u044B\u0435 \u0441\u0442\u0440\u043E\u043A\u0438 -SettingsDialog.Locale = \u042F\u0437\u044B\u043A \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A) +SettingsDialog.HighlightTitle = \u041F\u043E\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u043D\u0438\u0435 SettingsDialog.LocaleEnglish = \u0410\u043D\u0433\u043B\u0438\u0439\u0441\u043A\u0438\u0439 SettingsDialog.LocaleRussian = \u0420\u0443\u0441\u0441\u043A\u0438\u0439 SettingsDialog.LocaleSystem = \u0421\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0439 +SettingsDialog.LocaleTitle = \u042F\u0437\u044B\u043A \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A) +SettingsDialog.LoggerLevelTitle = \u0423\u0440\u043E\u0432\u0435\u043D\u044C \u043B\u043E\u0433\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F SettingsDialog.ReadClipboard = \u0427\u0438\u0442\u0430\u0442\u044C \u0431\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0435\u043D\u0430 (\u043F\u0440\u0438 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430) -SettingsDialog.RowSortDirection = \u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438 \u0441\u0442\u0440\u043E\u043A SettingsDialog.RowSortDirectionAsPrevious = \u041A\u0430\u043A \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F SettingsDialog.RowSortDirectionAscending = \u041F\u043E \u0443\u0431\u044B\u0432\u0430\u043D\u0438\u044E SettingsDialog.RowSortDirectionDescending = \u041F\u043E \u0432\u043E\u0437\u0440\u0430\u0441\u0442\u0430\u043D\u0438\u044E +SettingsDialog.RowSortDirectionTitle = \u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438 \u0441\u0442\u0440\u043E\u043A SettingsDialog.ShadowSleepSessions = \u0417\u0430\u0442\u0435\u043D\u044F\u0442\u044C \u0441\u043F\u044F\u0446\u0438\u0435 \u0441\u0435\u0430\u043D\u0441\u044B SettingsDialog.ShowInfo = \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F SettingsDialog.ShowInfobaseDescription = \u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0438\u043D\u0444\u043E\u0431\u0430\u0437\u044B diff --git a/clusterAdminLibrary/src/main/resources/icons/taskCompleted.png b/clusterAdminLibrary/src/main/resources/icons/taskCompleted.png index b826ee8be985adf38e8fcb8bd1e4138ebdc081b0..6925aedbebc07ddcf4c66a2fbb1befd37a14fc98 100644 GIT binary patch delta 258 zcmV+d0sa1!1j7Q5Nq@os00P1R+mhLk0002kNkla5MTTG^_LSfNP-xErkUZ_x8I_Fe*HBd$^}?7GyMMf=NXXc2sQwy zfE!2^192PBUw=SiFn~|<8{$@nx62Ef1o0B4knjfG1~m;e9(07*qo IM6N<$f`n{n4gdfE delta 470 zcmV;{0V)2&0+j@iNq@rt00P4S3DrAv00051Nkld`;8oplz$xn&g~eM!5nA00yJtH95lD&+x%!3D=n4JNFa*Zx&~E*}^(S4#6> zlmYlythu6knuf&h*#|+)?JDV`Spn<^D`oPTE0KX#zXZI;;&QqbntM%JoE_YvkLJJ| z@RQWj!c06&9e+H|s4?I@QjXMn@lAs9DY?s@NzusDl(Pdc>TLI+^fvQJN{6YsnnpFI z^#=(hmL!@vRcli@mcS;FZ2nm;p0>*zEoa*397E=BN-_Yu%ixuwnTWb#O21dT6f+0o z(<*bp_%N+X1_)aLUTC3W*>gETHofqwsF0bWPnd7OMo(G?E42PWn_%O=t$YP0*~%V9P0+IWi5J9!13jhEB M07*qoM6N<$g0WHH&Hw-a diff --git a/clusterAdminLibrary/src/main/resources/icons/taskRunning.png b/clusterAdminLibrary/src/main/resources/icons/taskRunning.png index cbfdb3da975025a9c0c3a6800154d1610ce31925..2f2a07209f7f747a6ce8099f5aee6bc9c8a3ad36 100644 GIT binary patch delta 606 zcmV-k0-^oZ2AlY00XW8%2`vH0006pNklru4P%~&vq)mchPcj z;~sTiG2JMjo;wk@rmkNxSU{2_Fbutq9hQc80VbH^Vt8A2@Tv}iBmT;N{7{#T9 z?8i6!aACLYI55UAlYWdG+jbN7Ls1l2QPp>s28YPai6>-kWu3g9Um&T6k4W$30akL- z&HRh615pqmAj$fngbA^er$JGJphpZi-qj6fdiy|<<$sGb&HYjKBNB={8=0OV*@8pf zT8PY7u+PTR8P-M0&35s15Kfpk`fuIge$amboWZ+e5RIEdp5(L^5Va#mL)Pk7D6T9* zp4#e?-+ul04pGzW^71*&@6cIz+H)-SKvN_hlZv@6@rxfqC>VR;82SjcSv%)l?98GE=Sp>?rRBKZ2*GAR%c#($Mk zZZ-dKHeKxt(GN|G%%>6|kO_<=6oP%BSnt@Ohrp3-uWP_R_j zH-1e&#ytXSAK(L+@e8)*m2GZR_)1A%tG-b+Wr(cU=`Z2@pVY5=?{q6uERA}ObE(97FTXc~HN<#`wH9}=nfZW-k(Pi1WU zy8sFcU_01057Y^SqC~NWlxmM&sA7d8aYNaOEN;e1c&Fn5tpC5{s(@U%IuNgXL4^DS Y&J&*(b9h5EoB#j-07*qoM6N<$f_dt71ONa4 diff --git a/clusterAdminLibrary/src/main/resources/logback.xml b/clusterAdminLibrary/src/main/resources/logback.xml index de37872..c8d3af0 100644 --- a/clusterAdminLibrary/src/main/resources/logback.xml +++ b/clusterAdminLibrary/src/main/resources/logback.xml @@ -23,21 +23,10 @@ - - - - - - - - - - - - - + + \ No newline at end of file