├── LICENSE ├── README.md ├── doc └── influxDBWorkBenchBanner.jpg ├── lib ├── converter-moshi-2.3.0.jar ├── influxdb-java-2.8.jar ├── json-simple-1.1.1.jar ├── logging-interceptor-3.9.1.jar ├── moshi-1.4.0.jar ├── msgpack-0.6.0.jar ├── okhttp-3.9.1.jar ├── okio-1.13.0.jar └── retrofit-2.3.0.jar └── src ├── com └── entropiadevelopments │ └── influxdbworkbench │ ├── InfluxDBWorkBench.java │ ├── datamodel │ ├── InfluxDBConnection.java │ ├── InfluxDBDataBase.java │ ├── InfluxDBMeasuramet.java │ ├── InfluxDBRetentionPolicy.java │ └── InfluxDBTreeElement.java │ ├── facility │ └── InfluxDBFacility.java │ └── gui │ ├── InfluxDBWorkBenchGUI.java │ ├── common │ ├── ButtonPanel.java │ ├── EnhancedDialog.java │ ├── EnhancedJPanel.java │ ├── EnhancedTable.java │ ├── EnhancedTableModel.java │ ├── GuiToolkit.java │ ├── IntegerField.java │ └── TableRecord.java │ ├── components │ ├── InfluxDBJTree.java │ ├── InfluxDBMenuBar.java │ ├── InfluxDBStatusBarPanel.java │ ├── InfluxDBToolBar.java │ ├── InfluxDBTreeNode.java │ ├── InfluxDBTreePanel.java │ ├── InfluxDBWorkArea.java │ ├── MainWindowPanel.java │ ├── actionpanels │ │ ├── ActionPanel.java │ │ ├── ConnectionSettingsDialog.java │ │ ├── ConnectionsTable.java │ │ ├── CreateDatabaseDialog.java │ │ ├── CreatePolicyDialog.java │ │ ├── EditPolicyDialog.java │ │ ├── KeyFieldsTable.java │ │ ├── ManageConnectionsDialog.java │ │ ├── NewQueryActionPanel.java │ │ ├── QueryResultTable.java │ │ ├── RetentionPoliciesTable.java │ │ ├── RetentionPolicyPanel.java │ │ ├── SeriesTable.java │ │ ├── ShowDiagnosticsActionPanel.java │ │ ├── ShowFieldKeysActionPanel.java │ │ ├── ShowSeriesPanel.java │ │ ├── ShowTagKeysActionPanel.java │ │ ├── ShowTagValueActionPanel.java │ │ ├── ShowUsersActionPanel.java │ │ ├── TagKeysTable.java │ │ └── TagKeysValuesTable.java │ └── actions │ │ ├── AboutAction.java │ │ ├── AllowUntrustedSLLAction.java │ │ ├── BasicAbstractAction.java │ │ ├── CreateDataBaseAction.java │ │ ├── DiagnosticsAction.java │ │ ├── DisconnectAction.java │ │ ├── DropDatabaseAction.java │ │ ├── DropMeasuramentAction.java │ │ ├── DropSeriesAction.java │ │ ├── EnglishDateFormatAction.java │ │ ├── ExitAction.java │ │ ├── ExportSettingstAction.java │ │ ├── ImportSettinsAction.java │ │ ├── LatinDateFormatAction.java │ │ ├── ManageAction.java │ │ ├── NewQueryAction.java │ │ ├── RefreshAction.java │ │ ├── RunBackFillAction.java │ │ ├── RunQueryAction.java │ │ ├── ShowContinuousQueriesAction.java │ │ ├── ShowDiagnosticsAction.java │ │ ├── ShowFieldKeysAction.java │ │ ├── ShowQueriesAction.java │ │ ├── ShowRetentionPoliciesAction.java │ │ ├── ShowSeriesAction.java │ │ ├── ShowStaticsAction.java │ │ ├── ShowTagKeysAction.java │ │ ├── ShowTagValuesAction.java │ │ ├── ShowUsersAction.java │ │ ├── Time12hFormatAction.java │ │ └── Time24hFormatAction.java │ └── resources │ └── icons │ ├── BackFill.png │ ├── Connection.png │ ├── ContinuousQuery.png │ ├── CreateConnection.png │ ├── CreateContinuousQuery.png │ ├── CreateDatabase.png │ ├── CreateRetentionPolicy.png │ ├── CreateUser.png │ ├── Database.png │ ├── Date.png │ ├── Diagnostics.png │ ├── Disconnect.png │ ├── DropContinuousQuery.png │ ├── DropDatabase.png │ ├── DropMeasurement.png │ ├── DropRetentionPolicy.png │ ├── DropSeries.png │ ├── DropUser.png │ ├── EditConnection.png │ ├── EditPrivilege.png │ ├── EditRetentionPolicy.png │ ├── EditUser.png │ ├── FieldKeys.png │ ├── GrantPrivilege.png │ ├── InfluxDBWorkBench.png │ ├── Info.png │ ├── KillQuery.png │ ├── Measurement.png │ ├── NewQuery.png │ ├── Password.png │ ├── Refresh.png │ ├── RetentionPolicy.png │ ├── RunQuery.png │ ├── Series.png │ ├── ShowQueries.png │ ├── ShowSeries.png │ ├── Stats.png │ ├── TagKeys.png │ ├── TagValues.png │ ├── Time.png │ ├── Users.png │ └── empty.png └── info └── clearthought └── layout ├── SingleFiledLayout.java ├── TableLayout.java ├── TableLayoutConstants.java └── TableLayoutConstraints.java /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 JorgeMaker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![influxDBWorkBench](doc/influxDBWorkBenchBanner.jpg?raw=true) 2 | # - InfluxDB WorkBench - 3 | 4 | **InfluxDB WorkBench is a GUI management tool for [the InfluxDB time series database](https://www.influxdata.com/time-series-platform/influxdb/) 5 | written in Java that runs on Windows , Mac OS X and Unix/Linux, etc** 6 | InfluxDB WorkBench is an application coping the functionality of [InfluxDB Studio](https://github.com/CymaticLabs/InfluxDBStudio) which can only 7 | be run on Windows, but written in java and therefore you can run it any platform. 8 | 9 | The following are planned features implemented by [InfluxDB Studio](https://github.com/CymaticLabs/InfluxDBStudio) that are not yet implemented in 10 | the current version of InfluxDB WorkBench: 11 | 12 | * Refresh 13 | * Show Users 14 | * Show Statics 15 | * Show Diagnostics 16 | * Show Queries 17 | * Show Continuous Queries 18 | * Run Back Fill 19 | 20 | You can download an executable file for [Windows](https://github.com/JorgeMaker/InfluxDBWorkBench/releases/download/1.0/InfluxDBWorkBench.exe) , [Mac OS X](https://github.com/JorgeMaker/InfluxDBWorkBench/releases/download/1.0/InfluxDBWorkBench.app.zip), or an executable [Jar file](https://github.com/JorgeMaker/InfluxDBWorkBench/releases/download/1.0/influxDBWorkBench.jar) to run anywhere. You just need having installed JRE 1.7 or higher. Download a the executable filfe and store it in a folder where you have write permissions since the application generates a file to store the data used to connect to each InfluxDB instance. 21 | 22 | Because Influx WorkBench copies the functionality of Influx Studio works exactly the same. You can consult the user guide found [here](https://github.com/CymaticLabs/InfluxDBStudio/blob/master/README.md) 23 | -------------------------------------------------------------------------------- /doc/influxDBWorkBenchBanner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/doc/influxDBWorkBenchBanner.jpg -------------------------------------------------------------------------------- /lib/converter-moshi-2.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/lib/converter-moshi-2.3.0.jar -------------------------------------------------------------------------------- /lib/influxdb-java-2.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/lib/influxdb-java-2.8.jar -------------------------------------------------------------------------------- /lib/json-simple-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/lib/json-simple-1.1.1.jar -------------------------------------------------------------------------------- /lib/logging-interceptor-3.9.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/lib/logging-interceptor-3.9.1.jar -------------------------------------------------------------------------------- /lib/moshi-1.4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/lib/moshi-1.4.0.jar -------------------------------------------------------------------------------- /lib/msgpack-0.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/lib/msgpack-0.6.0.jar -------------------------------------------------------------------------------- /lib/okhttp-3.9.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/lib/okhttp-3.9.1.jar -------------------------------------------------------------------------------- /lib/okio-1.13.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/lib/okio-1.13.0.jar -------------------------------------------------------------------------------- /lib/retrofit-2.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/lib/retrofit-2.3.0.jar -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/InfluxDBWorkBench.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench; 2 | 3 | import com.entropiadevelopments.influxdbworkbench.gui.InfluxDBWorkBenchGUI; 4 | 5 | public class InfluxDBWorkBench { 6 | 7 | private InfluxDBWorkBenchGUI influxDBWorkBenchGUI; 8 | 9 | public InfluxDBWorkBench() { 10 | 11 | influxDBWorkBenchGUI = new InfluxDBWorkBenchGUI(); 12 | } 13 | public static void main(String[] args) { 14 | InfluxDBWorkBench influxDBWorkBench = new InfluxDBWorkBench(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/datamodel/InfluxDBConnection.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.datamodel; 2 | 3 | import org.json.simple.JSONObject; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.common.TableRecord; 6 | 7 | public class InfluxDBConnection extends InfluxDBTreeElement implements TableRecord { 8 | 9 | private String connectionName; 10 | private String ipAddresss; 11 | private long port; 12 | private String database; 13 | private String userName; 14 | private String password; 15 | private boolean useSLL; 16 | 17 | 18 | public InfluxDBConnection(JSONObject jsonConnection) { 19 | super(null); 20 | connectionName = (String) jsonConnection.get("connectionName"); 21 | ipAddresss = (String) jsonConnection.get("iIPAddress"); 22 | port = (long) jsonConnection.get("port"); 23 | database = (String) jsonConnection.get("database"); 24 | userName = (String) jsonConnection.get("userName"); 25 | password = (String) jsonConnection.get("password"); 26 | useSLL = (boolean) jsonConnection.get("useSLL"); 27 | id = (String) jsonConnection.get("id"); 28 | } 29 | public InfluxDBConnection() { 30 | super(null); 31 | 32 | } 33 | 34 | public void setConnectionName(String connName) { 35 | connectionName = connName; 36 | } 37 | 38 | public String getConnectionName() { 39 | return connectionName; 40 | } 41 | 42 | public InfluxDBConnection(String name) { 43 | super(name); 44 | } 45 | 46 | public String getIpAddresss() { 47 | return ipAddresss; 48 | } 49 | 50 | public void setIpAddresss(String ipAddresss) { 51 | this.ipAddresss = ipAddresss; 52 | } 53 | 54 | public long getPort() { 55 | return port; 56 | } 57 | 58 | public void setPort(int potrt) { 59 | this.port = potrt; 60 | } 61 | 62 | public String getDatabase() { 63 | return database; 64 | } 65 | 66 | public void setDatabase(String database) { 67 | this.database = database; 68 | } 69 | 70 | public String getUserName() { 71 | return userName; 72 | } 73 | 74 | public void setUserName(String userName) { 75 | this.userName = userName; 76 | } 77 | 78 | public String getPassword() { 79 | return password; 80 | } 81 | 82 | public void setPassword(String password) { 83 | this.password = password; 84 | } 85 | 86 | public boolean isUseSLL() { 87 | return useSLL; 88 | } 89 | 90 | public void setUseSLL(boolean useSLL) { 91 | this.useSLL = useSLL; 92 | } 93 | 94 | @Override 95 | public int getNodeType() { 96 | // TODO Auto-generated method stub 97 | return SERVER; 98 | } 99 | 100 | public JSONObject toJSon() { 101 | JSONObject connection = new JSONObject(); 102 | connection.put("connectionName", connectionName); 103 | connection.put("iIPAddress", ipAddresss); 104 | connection.put("port", port); 105 | connection.put("database", database); 106 | connection.put("userName", userName); 107 | connection.put("password", password); 108 | connection.put("useSLL", useSLL); 109 | connection.put("id", id); 110 | 111 | return connection; 112 | } 113 | 114 | @Override 115 | public Object getFieldAt(int fieldIndex) { 116 | switch (fieldIndex) { 117 | case 0: 118 | return connectionName; 119 | case 1: 120 | return ipAddresss + " : " + port; 121 | } 122 | return null; 123 | } 124 | @Override 125 | public int getNumberOfField() { 126 | return 2; 127 | } 128 | @Override 129 | public void setFieldAt(int fieldIndex, Object field) { 130 | } 131 | @Override 132 | public String toString() { 133 | return connectionName; 134 | } 135 | @Override 136 | public InfluxDBConnection getConnection() { 137 | return this; 138 | } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/datamodel/InfluxDBDataBase.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.datamodel; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class InfluxDBDataBase extends InfluxDBTreeElement{ 6 | private String databaseName; 7 | private ArrayList measuraments; 8 | private InfluxDBConnection connection; 9 | 10 | public InfluxDBDataBase(String name,InfluxDBConnection connection ) { 11 | super(name); 12 | databaseName = name; 13 | measuraments = new ArrayList (); 14 | this.connection = connection; 15 | } 16 | public InfluxDBDataBase(String name, ArrayList measuraments , InfluxDBConnection connection) { 17 | super(name); 18 | this.measuraments = measuraments; 19 | this.connection = connection; 20 | } 21 | public ArrayList getMeasuraments() { 22 | return measuraments; 23 | } 24 | public void addMeasurament(InfluxDBMeasuramet influxDBMeasuramet) { 25 | measuraments.add(influxDBMeasuramet); 26 | } 27 | 28 | public void setMeasuraments(ArrayList measuraments) { 29 | this.measuraments = measuraments; 30 | } 31 | @Override 32 | public int getNodeType() { 33 | 34 | return DATABASE; 35 | } 36 | public String toString() { 37 | return databaseName; 38 | } 39 | @Override 40 | public InfluxDBConnection getConnection() { 41 | return connection; 42 | } 43 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/datamodel/InfluxDBMeasuramet.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.datamodel; 2 | 3 | public class InfluxDBMeasuramet extends InfluxDBTreeElement{ 4 | 5 | private String measuramentName; 6 | private InfluxDBConnection connection; 7 | private String database; 8 | 9 | public InfluxDBMeasuramet(String name, String database, InfluxDBConnection connection) { 10 | super(name); 11 | measuramentName = name; 12 | this.connection = connection; 13 | this.database = database; 14 | } 15 | 16 | @Override 17 | public int getNodeType() { 18 | return MEASURAMENT; 19 | } 20 | @Override 21 | public String toString() { 22 | return measuramentName; 23 | } 24 | 25 | @Override 26 | public InfluxDBConnection getConnection() { 27 | return connection; 28 | } 29 | public String getDatabase() { 30 | return database; 31 | } 32 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/datamodel/InfluxDBRetentionPolicy.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.datamodel; 2 | 3 | import java.util.ArrayList; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.common.TableRecord; 6 | 7 | public class InfluxDBRetentionPolicy implements TableRecord{ 8 | 9 | private String policyName; 10 | private String duration; 11 | private String shardGroup; 12 | private double replication; 13 | private boolean isDefault; 14 | private InfluxDBConnection connection; 15 | private String dataBase; 16 | 17 | public InfluxDBRetentionPolicy(InfluxDBConnection connection) { 18 | this.connection = connection; 19 | } 20 | 21 | public InfluxDBRetentionPolicy(InfluxDBConnection connection, ArrayList data) { 22 | this.connection = connection; 23 | policyName = (String)data.get(0); 24 | duration = (String)data.get(1); 25 | shardGroup = (String)data.get(2); 26 | replication = (double)data.get(3); 27 | isDefault = (boolean)data.get(4); 28 | } 29 | 30 | public String getPolicyName() { 31 | return policyName; 32 | } 33 | public void setPolicyName(String policyName) { 34 | this.policyName = policyName; 35 | } 36 | public String getDuration() { 37 | return duration; 38 | } 39 | public void setDuration(String duration) { 40 | this.duration = duration; 41 | } 42 | public String getShardGroup() { 43 | return shardGroup; 44 | } 45 | public void setShardGroup(String shardGroup) { 46 | this.shardGroup = shardGroup; 47 | } 48 | public double getReplication() { 49 | return replication; 50 | } 51 | public boolean getISDefault() { 52 | return isDefault; 53 | } 54 | 55 | public void setReplication(int replication) { 56 | this.replication = replication; 57 | } 58 | public boolean isDefault() { 59 | return isDefault; 60 | } 61 | public void setDefault(boolean isDefault) { 62 | this.isDefault = isDefault; 63 | } 64 | public InfluxDBConnection getConnection() { 65 | return connection; 66 | } 67 | public void setConnection(InfluxDBConnection connection) { 68 | this.connection = connection; 69 | } 70 | @Override 71 | public Object getFieldAt(int fieldIndex) { 72 | switch(fieldIndex) { 73 | case 0: 74 | return policyName; 75 | case 1: 76 | return duration; 77 | case 2: 78 | return shardGroup; 79 | case 3: 80 | return replication; 81 | case 4: 82 | return isDefault; 83 | } 84 | return null; 85 | } 86 | @Override 87 | public int getNumberOfField() { 88 | return 5; 89 | } 90 | @Override 91 | public void setFieldAt(int fieldIndex, Object field) { 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/datamodel/InfluxDBTreeElement.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.datamodel; 2 | 3 | public abstract class InfluxDBTreeElement { 4 | 5 | public static final int SERVER = 1; 6 | public static final int DATABASE = 2; 7 | public static final int MEASURAMENT = 3; 8 | 9 | protected String id; 10 | 11 | public InfluxDBTreeElement(String id) { 12 | setName(id); 13 | } 14 | 15 | public String getID() { 16 | return id; 17 | } 18 | 19 | public void setName(String id) { 20 | this.id = id; 21 | } 22 | 23 | public abstract int getNodeType(); 24 | public abstract InfluxDBConnection getConnection(); 25 | } 26 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/facility/InfluxDBFacility.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.facility; 2 | 3 | import java.util.HashMap; 4 | 5 | import org.influxdb.InfluxDB; 6 | import org.influxdb.InfluxDBFactory; 7 | import org.influxdb.dto.Pong; 8 | import org.influxdb.dto.Query; 9 | import org.influxdb.dto.QueryResult; 10 | 11 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 12 | 13 | public class InfluxDBFacility { 14 | 15 | private static InfluxDBFacility facility; 16 | private HashMap connectionsRepository; 17 | 18 | private InfluxDBFacility() { 19 | connectionsRepository = new HashMap (); 20 | } 21 | public InfluxDB getInfluxDB(InfluxDBConnection connection) { 22 | if (connection != null) { 23 | String connectionString = "http://"+connection.getIpAddresss()+":"+connection.getPort(); 24 | 25 | InfluxDB influxDB = connectionsRepository.get(connection); 26 | if (influxDB != null){ 27 | return influxDB; 28 | } 29 | else { 30 | if( (connection.getUserName() == null || connection.getUserName().trim().equalsIgnoreCase("")) && 31 | (connection.getPassword() == null || connection.getPassword().trim().equalsIgnoreCase(""))){ 32 | influxDB = InfluxDBFactory.connect(connectionString); 33 | } 34 | else { 35 | influxDB = InfluxDBFactory.connect(connectionString,connection.getUserName(),connection.getPassword()); 36 | } 37 | if(connection.getDatabase() != null) { 38 | influxDB.setDatabase(connection.getDatabase()); 39 | } 40 | connectionsRepository.put(connection, influxDB); 41 | return influxDB; 42 | } 43 | } 44 | else return null; 45 | } 46 | public void closeAndRemoveConnection(InfluxDBConnection connection) { 47 | InfluxDB influxDB =connectionsRepository.get(connection); 48 | influxDB.close(); 49 | connectionsRepository.remove(connection); 50 | } 51 | 52 | public Pong pingConnection(InfluxDBConnection connection) { 53 | InfluxDB influxDB = getInfluxDB(connection); 54 | return influxDB.ping(); 55 | } 56 | 57 | public QueryResult query(String queryString , String databaseName, InfluxDBConnection connection){ 58 | Query query = new Query(queryString, databaseName); 59 | InfluxDB influxDB = getInfluxDB(connection); 60 | return influxDB.query(query); 61 | } 62 | public static InfluxDBFacility getFacilityReference(){ 63 | if(facility == null){ 64 | facility = new InfluxDBFacility(); 65 | } 66 | return facility; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/InfluxDBWorkBenchGUI.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui; 2 | 3 | import java.awt.Dimension; 4 | import java.awt.Toolkit; 5 | import java.awt.event.WindowAdapter; 6 | import java.awt.event.WindowEvent; 7 | 8 | import javax.swing.JFrame; 9 | import javax.swing.UIManager; 10 | 11 | import com.entropiadevelopments.influxdbworkbench.gui.common.GuiToolkit; 12 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBMenuBar; 13 | import com.entropiadevelopments.influxdbworkbench.gui.components.MainWindowPanel; 14 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.ManageConnectionsDialog; 15 | 16 | public class InfluxDBWorkBenchGUI extends JFrame { 17 | 18 | private static final long serialVersionUID = 3004554741430283817L; 19 | private InfluxDBMenuBar menuBar; 20 | private MainWindowPanel mainWindowPanel; 21 | 22 | public InfluxDBWorkBenchGUI() { 23 | super("InfluxDB WorkBench"); 24 | 25 | switch (UIManager.getSystemLookAndFeelClassName()){ 26 | case "com.apple.laf.AquaLookAndFeel": 27 | setAppleLookAndFeel(); 28 | break; 29 | case "com.sun.java.swing.plaf.windows.WindowsLookAndFeel": 30 | setWindowsLookAndFeel(); 31 | break; 32 | } 33 | 34 | mainWindowPanel = new MainWindowPanel(); 35 | menuBar = new InfluxDBMenuBar(mainWindowPanel.getWorkAreaReference(), mainWindowPanel.getTreePanelReference()); 36 | setJMenuBar(menuBar); 37 | getContentPane().add(mainWindowPanel); 38 | addWindowListener(new WindowAdapter() { 39 | public void windowClosing(WindowEvent evt) { 40 | System.exit(0); 41 | } 42 | }); 43 | setSize(900, 600); 44 | Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); 45 | this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2); 46 | setVisible(true); 47 | ManageConnectionsDialog connectinsDialog = new ManageConnectionsDialog(null, mainWindowPanel.getTreePanelReference()); 48 | } 49 | private void setWindowsLookAndFeel() { 50 | GuiToolkit.setDefaultFont(); 51 | try{ 52 | setDefaultLookAndFeelDecorated(true); 53 | UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); 54 | this.setIconImage(GuiToolkit.getImageIcon("InfluxDBWorkBench.png").getImage()); 55 | } 56 | catch(Exception exception) { 57 | exception.printStackTrace(System.out); 58 | } 59 | } 60 | private void setAppleLookAndFeel() { 61 | // Set the font for all GUI Components 62 | GuiToolkit.setDefaultFont(); 63 | try{ 64 | setDefaultLookAndFeelDecorated(true); 65 | System.setProperty("apple.laf.useScreenMenuBar", "true"); 66 | System.setProperty("com.apple.mrj.application.apple.menu.about.name", "InfluxDB WorkBench"); 67 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 68 | System.setProperty("com.apple.macos.smallTabs", "true"); 69 | } 70 | catch(Exception exception) { 71 | exception.printStackTrace(System.out); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/common/ButtonPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.common; 2 | 3 | import javax.swing.JPanel; 4 | 5 | import javax.swing.BorderFactory; 6 | 7 | import javax.swing.JButton; 8 | import java.util.Vector; 9 | import java.awt.Dimension; 10 | import java.awt.GridLayout; 11 | 12 | public class ButtonPanel extends JPanel { 13 | 14 | private static final long serialVersionUID = -9119415391066095779L; 15 | private Vector buttonsStore; 16 | /** Creates a new instance of ButtonPanel */ 17 | public ButtonPanel(int verticalSize, int border, int buttonNumber, int buttonGap) { 18 | buttonsStore = new Vector(buttonNumber); 19 | 20 | setPreferredSize(new Dimension(Short.MAX_VALUE,verticalSize)); 21 | setMaximumSize(new Dimension(Short.MAX_VALUE,verticalSize)); 22 | setMinimumSize(new Dimension(Short.MAX_VALUE,verticalSize)); 23 | 24 | setLayout(new GridLayout(0,buttonNumber,buttonGap,0)); 25 | setBorder(BorderFactory.createEmptyBorder(border, border, border ,border)); 26 | } 27 | public void addButton(JButton button){ 28 | buttonsStore.add(button); 29 | layoutButton(button); 30 | } 31 | private void layoutButton(JButton button){ 32 | this.add(button); 33 | } 34 | public void setEnabledPanel(boolean aFlag){ 35 | for(int index = 0; index< buttonsStore.size(); index++){ 36 | ((JButton)buttonsStore.get(index)).setEnabled(aFlag); 37 | } 38 | this.setEnabled(aFlag); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/common/EnhancedDialog.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.common; 2 | 3 | import javax.swing.JDialog; 4 | import javax.swing.JFrame; 5 | 6 | 7 | import javax.swing.JButton; 8 | import javax.swing.BorderFactory; 9 | 10 | import java.awt.event.ActionEvent; 11 | import java.awt.event.ActionListener; 12 | 13 | import java.awt.Component; 14 | import java.awt.LayoutManager; 15 | 16 | import info.clearthought.layout.TableLayout; 17 | 18 | public abstract class EnhancedDialog extends JDialog implements ActionListener{ 19 | 20 | private static final long serialVersionUID = -6298846922943313807L; 21 | private JButton cancelButton; 22 | private JButton okButton; 23 | 24 | private EnhancedJPanel mainPanel; 25 | private EnhancedJPanel internalPanel; 26 | 27 | public EnhancedDialog(JFrame jFrame, String title, boolean modal, String okLabel,String cancelLabel ){ 28 | super(jFrame,title,modal); 29 | intBasicComponents(okLabel,cancelLabel ); 30 | layuotBasicComponents(); 31 | } 32 | private void intBasicComponents(String okLabel,String cancelLabel ){ 33 | 34 | cancelButton = new JButton(cancelLabel); 35 | cancelButton.addActionListener(this); 36 | 37 | okButton = new JButton(okLabel); 38 | okButton.addActionListener(this); 39 | 40 | mainPanel = new EnhancedJPanel(); 41 | mainPanel.setBorder(BorderFactory.createEtchedBorder()); 42 | 43 | internalPanel = new EnhancedJPanel(); 44 | 45 | } 46 | private void layuotBasicComponents(){ 47 | 48 | double border = 5; 49 | double size [][] = { 50 | {border,0.25,border,0.25,border,0.25,border,0.25,border}, 51 | {border,TableLayout.FILL,border*2,20,border} 52 | }; 53 | mainPanel.setLayout(new TableLayout(size)); 54 | 55 | mainPanel.add(internalPanel,"1,1,7,1"); 56 | mainPanel.add(okButton, "3,3"); 57 | mainPanel.add(cancelButton, "5,3"); 58 | 59 | getContentPane().add(mainPanel); 60 | } 61 | public void addComponentToInternalPanel(Component comp, Object constraint){ 62 | internalPanel.add(comp,constraint); 63 | } 64 | public void setLayoutToInternalPanel(LayoutManager mngr){ 65 | internalPanel.setLayout(mngr); 66 | } 67 | public void actionPerformed(ActionEvent event) { 68 | if(event.getSource().equals(okButton)){ 69 | okButtonPressedAction(); 70 | } 71 | else if(event.getSource().equals(cancelButton)){ 72 | cancelButtonPressedAction(); 73 | } 74 | } 75 | protected abstract void okButtonPressedAction(); 76 | protected abstract void cancelButtonPressedAction(); 77 | 78 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/common/EnhancedJPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.common; 2 | 3 | 4 | import javax.swing.JPanel; 5 | 6 | import com.entropiadevelopments.influxdbworkbench.gui.common.GuiToolkit; 7 | 8 | import java.awt.Font; 9 | 10 | 11 | public class EnhancedJPanel extends JPanel { 12 | 13 | private static final long serialVersionUID = -2069219152382542555L; 14 | public static final Font FONT = GuiToolkit.getFont(); 15 | public EnhancedJPanel(){ 16 | this.setFont(FONT); 17 | } 18 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/common/EnhancedTable.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.common; 2 | 3 | import javax.swing.JTable; 4 | 5 | import java.util.Vector; 6 | import java.awt.Color; 7 | import javax.swing.UIManager; 8 | import javax.swing.table.TableCellRenderer; 9 | import javax.swing.ListSelectionModel; 10 | 11 | public class EnhancedTable extends JTable { 12 | 13 | private static final long serialVersionUID = 1L; 14 | private EnhancedTableModel tableModel; 15 | /** Creates a new instance of BasicTable */ 16 | public EnhancedTable(EnhancedTableModel model) { 17 | setModel(model); 18 | getTableHeader().setReorderingAllowed(false); 19 | setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 20 | } 21 | public EnhancedTable() { 22 | getTableHeader().setReorderingAllowed(false); 23 | setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 24 | } 25 | public void setModel(EnhancedTableModel model){ 26 | tableModel = model; 27 | super.setModel(tableModel); 28 | } 29 | public void addTableRecord(TableRecord record){ 30 | tableModel.addTableRecord(record); 31 | tableModel.fireTableDataChanged(); 32 | } 33 | public void changeTableRecord(TableRecord record, int rowIndex){ 34 | tableModel.changeTableRecord(record, rowIndex); 35 | tableModel.fireTableDataChanged(); 36 | } 37 | public void removeSelectedRows() { 38 | int[] slectedRows = this.getSelectedRows(); 39 | if(slectedRows.length == 0) return; 40 | Vector toDeleteVector = new Vector(); 41 | for(int i=0; i getAllRowsVector(){ 54 | return tableModel.getAllRowsVector(); 55 | } 56 | public void removeAllRows(){ 57 | tableModel.removeAllRows(); 58 | tableModel.fireTableDataChanged(); 59 | } 60 | public void setAllRows(Vector alllRows){ 61 | tableModel.addAllRows(alllRows); 62 | tableModel.fireTableDataChanged(); 63 | } 64 | public void setUniqueCellRender(TableCellRenderer cellRender){ 65 | for(int i =0; i rowsVector; 12 | private ArrayList columnNames; 13 | 14 | public EnhancedTableModel(ArrayList nameOfColums) { 15 | rowsVector = new Vector(); 16 | this.columnNames = new ArrayList(); 17 | for (String value: nameOfColums) { 18 | this.columnNames.add(value); 19 | } 20 | } 21 | 22 | public String getColumnName(int column) { 23 | 24 | return (String) columnNames.get(column); 25 | } 26 | 27 | public int getColumnCount() { 28 | return columnNames.size(); 29 | } 30 | 31 | public void addTableRecord(TableRecord record) { 32 | rowsVector.add(record); 33 | } 34 | 35 | public TableRecord getValueAtRow(int rowIndex) { 36 | return (TableRecord) rowsVector.get(rowIndex); 37 | } 38 | 39 | public void removeRow(int row) { 40 | if (rowsVector.isEmpty()) { 41 | return; 42 | } else if (rowsVector.size() >= row) { 43 | rowsVector.remove(row); 44 | } 45 | } 46 | public boolean hasTableRecord(TableRecord record) { 47 | if (rowsVector.contains(record)) return true; 48 | else return false; 49 | } 50 | 51 | public void removeAllRows() { 52 | if (rowsVector.isEmpty()) { 53 | return; 54 | } else { 55 | rowsVector.removeAllElements(); 56 | } 57 | } 58 | 59 | public Vector getAllRowsVector() { 60 | return rowsVector; 61 | } 62 | 63 | public void addAllRows(Vector alllRows) { 64 | if (alllRows != null) { 65 | rowsVector = alllRows; 66 | } else 67 | removeAllRows(); 68 | } 69 | 70 | public void removeRow(TableRecord record) { 71 | if (rowsVector.isEmpty()) { 72 | return; 73 | } else if (rowsVector.contains(record)) { 74 | rowsVector.remove(record); 75 | } 76 | } 77 | 78 | public void changeTableRecord(TableRecord record, int rowIndex) { 79 | rowsVector.setElementAt(record, rowIndex); 80 | } 81 | 82 | public int getRowCount() { 83 | return rowsVector.size(); 84 | } 85 | 86 | public Object getValueAt(int rowIndex, int columnIndex) { 87 | if (((TableRecord) rowsVector.get(rowIndex)) != null) { 88 | return ((TableRecord) rowsVector.get(rowIndex)).getFieldAt(columnIndex); 89 | } else { 90 | return ""; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/common/GuiToolkit.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.common; 2 | 3 | import javax.swing.Icon; 4 | import javax.swing.ImageIcon; 5 | import javax.swing.JComponent; 6 | import javax.swing.UIManager; 7 | 8 | import java.util.Hashtable; 9 | import java.util.Enumeration; 10 | 11 | import java.awt.Font; 12 | import java.awt.Component; 13 | 14 | public class GuiToolkit { 15 | 16 | private final static String ICONPATH = "com/entropiadevelopments/influxdbworkbench/gui/resources/icons/"; 17 | private final static Font FONT = new Font("Arial",Font.PLAIN,11); 18 | 19 | public static Font getFont(){ 20 | return FONT; 21 | } 22 | public static void setDefaultFont() { 23 | Hashtable oUIDefault = UIManager.getDefaults(); 24 | Enumeration oKey = oUIDefault.keys(); 25 | String oStringKey = null; 26 | while (oKey.hasMoreElements()){ 27 | oStringKey = oKey.nextElement().toString(); 28 | if (oStringKey.endsWith("font") || oStringKey.endsWith("acceleratorFont")){ 29 | UIManager.put(oStringKey, FONT); 30 | } 31 | } 32 | try { 33 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 34 | } catch (Exception e){ 35 | e.printStackTrace(); 36 | } 37 | } 38 | public static void applyFont(JComponent c){ 39 | c.setFont(FONT); 40 | Component comp[] = c.getComponents(); 41 | for(int i=0; i nameOfColums = new ArrayList (); 25 | nameOfColums.add("Name"); 26 | nameOfColums.add("Adress"); 27 | EnhancedTableModel tableModel = new EnhancedTableModel(nameOfColums); 28 | setModel(tableModel); 29 | } 30 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/CreateDatabaseDialog.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.BorderLayout; 4 | 5 | import javax.swing.JFrame; 6 | import javax.swing.JLabel; 7 | import javax.swing.JTextField; 8 | 9 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 10 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 11 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 12 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedDialog; 13 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 14 | 15 | public class CreateDatabaseDialog extends EnhancedDialog{ 16 | 17 | private JTextField dataBaseField; 18 | private static final long serialVersionUID = 1L; 19 | private InfluxDBTreePanel treePanelReference; 20 | 21 | public CreateDatabaseDialog(JFrame parent, InfluxDBTreePanel treePanelReference) { 22 | 23 | super(parent,"Create Database", true, "Create", "Cancel"); 24 | this.treePanelReference = treePanelReference; 25 | 26 | dataBaseField = new JTextField (); 27 | setLayoutToInternalPanel(new BorderLayout()); 28 | addComponentToInternalPanel(new JLabel ("RaspberryPi"), BorderLayout.NORTH); 29 | addComponentToInternalPanel(dataBaseField, BorderLayout.SOUTH); 30 | pack(); 31 | setResizable(false); 32 | setLocationRelativeTo(parent); 33 | setVisible(true); 34 | 35 | } 36 | @Override 37 | protected void okButtonPressedAction(){ 38 | String databaseName = dataBaseField.getText(); 39 | if (databaseName != null) { 40 | InfluxDBTreeElement selectedTreeElement = treePanelReference.getSelectedTreeElement(); 41 | if (selectedTreeElement != null) { 42 | InfluxDBConnection connection = selectedTreeElement.getConnection(); 43 | InfluxDBFacility.getFacilityReference().getInfluxDB(connection).createDatabase(databaseName); 44 | treePanelReference.addDatabase(connection, databaseName); 45 | } 46 | } 47 | dispose(); 48 | } 49 | 50 | @Override 51 | protected void cancelButtonPressedAction() { 52 | dispose(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/CreatePolicyDialog.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import javax.swing.JCheckBox; 4 | import javax.swing.JFrame; 5 | import javax.swing.JLabel; 6 | import javax.swing.JTextField; 7 | 8 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 9 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBRetentionPolicy; 10 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedDialog; 11 | import com.entropiadevelopments.influxdbworkbench.gui.common.IntegerField; 12 | 13 | import info.clearthought.layout.TableLayout; 14 | 15 | public class CreatePolicyDialog extends EnhancedDialog { 16 | 17 | private static final long serialVersionUID = 8828979599801843270L; 18 | private JTextField policyNameField; 19 | private JTextField durationField; 20 | private IntegerField replicationField; 21 | private JCheckBox defaultCheckBox; 22 | 23 | private InfluxDBConnection connection; 24 | private RetentionPolicyPanel retentionPanelReference; 25 | 26 | public CreatePolicyDialog(JFrame jFrame, InfluxDBConnection connection, 27 | RetentionPolicyPanel retentionPanelReference) { 28 | super(jFrame, "Create Retention Policy", true, "Create", "Cancel"); 29 | 30 | this.connection = connection; 31 | this.retentionPanelReference = retentionPanelReference; 32 | 33 | policyNameField = new JTextField(); 34 | durationField = new JTextField(); 35 | replicationField = new IntegerField(); 36 | defaultCheckBox = new JCheckBox(); 37 | 38 | double border = 5; 39 | double size[][] = { { border, 120, border, 200, border }, 40 | { border, 30, border, 30, border, 30, border, 30, border, 30, border } }; 41 | 42 | setLayoutToInternalPanel(new TableLayout(size)); 43 | addComponentToInternalPanel(new JLabel("Policy Name: "), "1,1"); 44 | addComponentToInternalPanel(policyNameField, "3,1"); 45 | 46 | addComponentToInternalPanel(new JLabel("Duration: "), "1,3"); 47 | addComponentToInternalPanel(durationField, "3,3"); 48 | 49 | addComponentToInternalPanel(new JLabel("Replication: "), "1,5"); 50 | addComponentToInternalPanel(replicationField, "3,5"); 51 | 52 | addComponentToInternalPanel(new JLabel("Default: "), "1,7"); 53 | addComponentToInternalPanel(defaultCheckBox, "3,7"); 54 | 55 | pack(); 56 | setResizable(false); 57 | setLocationRelativeTo(jFrame); 58 | setVisible(true); 59 | } 60 | 61 | private InfluxDBRetentionPolicy recollectData() { 62 | 63 | InfluxDBRetentionPolicy influxDBRetentionPolicy = new InfluxDBRetentionPolicy(connection); 64 | if ((policyNameField.getText() == "") || (durationField.getText() == null) 65 | || (replicationField.getText() == "")) { 66 | return null; 67 | } else { 68 | try { 69 | 70 | influxDBRetentionPolicy.setDefault(defaultCheckBox.isSelected()); 71 | influxDBRetentionPolicy.setDuration(durationField.getText()); 72 | influxDBRetentionPolicy.setPolicyName(policyNameField.getText()); 73 | influxDBRetentionPolicy.setReplication(Integer.parseInt(replicationField.getText())); 74 | 75 | return influxDBRetentionPolicy; 76 | 77 | } catch (NumberFormatException numberFormatException) { 78 | return null; 79 | } 80 | } 81 | } 82 | 83 | @Override 84 | protected void okButtonPressedAction() { 85 | retentionPanelReference.addRetentionPolicy(recollectData()); 86 | dispose(); 87 | } 88 | 89 | @Override 90 | protected void cancelButtonPressedAction() { 91 | dispose(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/EditPolicyDialog.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import javax.swing.JCheckBox; 4 | import javax.swing.JFrame; 5 | import javax.swing.JLabel; 6 | import javax.swing.JTextField; 7 | 8 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 9 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBRetentionPolicy; 10 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedDialog; 11 | import com.entropiadevelopments.influxdbworkbench.gui.common.IntegerField; 12 | 13 | import info.clearthought.layout.TableLayout; 14 | 15 | public class EditPolicyDialog extends EnhancedDialog { 16 | 17 | private static final long serialVersionUID = -3462109819564066726L; 18 | private JTextField policyNameField; 19 | private JTextField durationField; 20 | private IntegerField replicationField; 21 | private JCheckBox defaultCheckBox; 22 | 23 | private InfluxDBConnection connection; 24 | private RetentionPolicyPanel retentionPanelReference; 25 | 26 | public EditPolicyDialog(JFrame jFrame, InfluxDBConnection connection, RetentionPolicyPanel retentionPanelReference, 27 | InfluxDBRetentionPolicy editedRP) { 28 | super(jFrame, "Create Retention Policy", true, "Edit", "Cancel"); 29 | 30 | this.connection = connection; 31 | this.retentionPanelReference = retentionPanelReference; 32 | 33 | policyNameField = new JTextField(); 34 | durationField = new JTextField(); 35 | replicationField = new IntegerField(); 36 | defaultCheckBox = new JCheckBox(); 37 | 38 | double border = 5; 39 | double size[][] = { { border, 120, border, 200, border }, 40 | { border, 30, border, 30, border, 30, border, 30, border, 30, border } }; 41 | 42 | setLayoutToInternalPanel(new TableLayout(size)); 43 | addComponentToInternalPanel(new JLabel("Policy Name: "), "1,1"); 44 | addComponentToInternalPanel(policyNameField, "3,1"); 45 | 46 | addComponentToInternalPanel(new JLabel("Duration: "), "1,3"); 47 | addComponentToInternalPanel(durationField, "3,3"); 48 | 49 | addComponentToInternalPanel(new JLabel("Replication: "), "1,5"); 50 | addComponentToInternalPanel(replicationField, "3,5"); 51 | 52 | addComponentToInternalPanel(new JLabel("Default: "), "1,7"); 53 | addComponentToInternalPanel(defaultCheckBox, "3,7"); 54 | 55 | loadValues(editedRP); 56 | 57 | pack(); 58 | setResizable(false); 59 | setLocationRelativeTo(jFrame); 60 | setVisible(true); 61 | } 62 | 63 | private void loadValues(InfluxDBRetentionPolicy editedRP) { 64 | if (editedRP!= null) { 65 | policyNameField.setText(editedRP.getPolicyName()); 66 | durationField.setText(editedRP.getDuration()); 67 | replicationField.setText(Double.toString((editedRP.getReplication()))); 68 | defaultCheckBox.setSelected(editedRP.isDefault()); 69 | } 70 | } 71 | 72 | private InfluxDBRetentionPolicy recollectData() { 73 | 74 | InfluxDBRetentionPolicy influxDBRetentionPolicy = new InfluxDBRetentionPolicy(connection); 75 | influxDBRetentionPolicy.setDefault(defaultCheckBox.isSelected()); 76 | influxDBRetentionPolicy.setDuration(durationField.getText()); 77 | influxDBRetentionPolicy.setPolicyName(policyNameField.getText()); 78 | influxDBRetentionPolicy.setReplication(Integer.parseInt(replicationField.getText())); 79 | 80 | return influxDBRetentionPolicy; 81 | } 82 | 83 | @Override 84 | protected void okButtonPressedAction() { 85 | retentionPanelReference.editRetentionPolicy(recollectData()); 86 | dispose(); 87 | } 88 | 89 | @Override 90 | protected void cancelButtonPressedAction() { 91 | dispose(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/KeyFieldsTable.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.Color; 4 | import java.util.ArrayList; 5 | 6 | import javax.swing.table.JTableHeader; 7 | 8 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTable; 9 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTableModel; 10 | 11 | public class KeyFieldsTable extends EnhancedTable{ 12 | 13 | private static final long serialVersionUID = 4743143214081243444L; 14 | 15 | public KeyFieldsTable() { 16 | 17 | setGridColor(Color.LIGHT_GRAY); 18 | setShowHorizontalLines(true); 19 | setShowVerticalLines(true); 20 | JTableHeader header = getTableHeader(); 21 | header.setBackground(Color.LIGHT_GRAY); 22 | setTableHeader(header); 23 | ArrayList nameOfColums = new ArrayList (); 24 | nameOfColums.add("#"); 25 | nameOfColums.add("Field Key"); 26 | nameOfColums.add("Field Type"); 27 | EnhancedTableModel tableModel = new EnhancedTableModel(nameOfColums); 28 | setModel(tableModel); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/ManageConnectionsDialog.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Dimension; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | 8 | import java.io.FileReader; 9 | import java.io.FileWriter; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | import java.nio.file.FileSystems; 13 | import java.nio.file.Path; 14 | import java.util.Vector; 15 | 16 | import javax.swing.JButton; 17 | import javax.swing.JFrame; 18 | import javax.swing.JOptionPane; 19 | import javax.swing.JScrollPane; 20 | import javax.swing.border.EtchedBorder; 21 | 22 | import org.json.simple.JSONArray; 23 | import org.json.simple.JSONObject; 24 | import org.json.simple.parser.JSONParser; 25 | import org.json.simple.parser.ParseException; 26 | 27 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 28 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 29 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedDialog; 30 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedJPanel; 31 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTableModel; 32 | import com.entropiadevelopments.influxdbworkbench.gui.common.GuiToolkit; 33 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 34 | 35 | import info.clearthought.layout.TableLayout; 36 | 37 | public class ManageConnectionsDialog extends EnhancedDialog implements ActionListener { 38 | 39 | private static final long serialVersionUID = -6349599499459674834L; 40 | private JButton createButton; 41 | private JButton editButton; 42 | private JButton removeButton; 43 | private ConnectionsTable connectionsTable; 44 | private InfluxDBTreePanel treepanelReference; 45 | 46 | public ManageConnectionsDialog(JFrame parent, InfluxDBTreePanel treepanel) { 47 | super(parent, "Manage InfluxDB Connections", true, "Connect", "Cancel"); 48 | 49 | treepanelReference = treepanel; 50 | 51 | createButton = new JButton("Create"); 52 | createButton.setIcon(GuiToolkit.getIcon("CreateConnection.png")); 53 | createButton.addActionListener(this); 54 | 55 | editButton = new JButton("Edit"); 56 | editButton.setIcon(GuiToolkit.getIcon("EditConnection.png")); 57 | editButton.addActionListener(this); 58 | 59 | removeButton = new JButton("Remove"); 60 | removeButton.setIcon(GuiToolkit.getIcon("Disconnect.png")); 61 | removeButton.addActionListener(this); 62 | 63 | EnhancedJPanel buttonsPanel = layoutTopButtonsPanel(); 64 | connectionsTable = new ConnectionsTable(); 65 | 66 | 67 | JSONArray array = loadConnectionsFile(); 68 | for (Object connObj : array) { 69 | connectionsTable.addTableRecord(new InfluxDBConnection((JSONObject) connObj)); 70 | 71 | } 72 | setLayoutToInternalPanel(new BorderLayout()); 73 | addComponentToInternalPanel(buttonsPanel, BorderLayout.NORTH); 74 | addComponentToInternalPanel(new JScrollPane(connectionsTable), BorderLayout.CENTER); 75 | pack(); 76 | setResizable(false); 77 | setLocationRelativeTo(parent); 78 | setVisible(true); 79 | } 80 | 81 | public void actionPerformed(ActionEvent event) { 82 | 83 | if (event.getSource().equals(createButton)) { 84 | ConnectionSettingsDialog ConnectionSettingsDialog = new ConnectionSettingsDialog(this, null); 85 | } 86 | if (event.getSource().equals(removeButton)) { 87 | int selectedRowIndex = connectionsTable.getSelectedRow(); 88 | if (selectedRowIndex >= 0) { 89 | EnhancedTableModel model = (EnhancedTableModel) connectionsTable.getModel(); 90 | 91 | InfluxDBConnection conection = (InfluxDBConnection) model.getValueAtRow(selectedRowIndex); 92 | JSONArray connectionsArray = loadConnectionsFile(); 93 | connectionsArray.remove(conection.toJSon()); 94 | saveArrayConnections(connectionsArray); 95 | model.removeRow(selectedRowIndex); 96 | connectionsTable.repaint(); 97 | } 98 | } 99 | if (event.getSource().equals(editButton)) { 100 | int selectedRowIndex = connectionsTable.getSelectedRow(); 101 | if (selectedRowIndex >= 0) { 102 | EnhancedTableModel model = (EnhancedTableModel) connectionsTable.getModel(); 103 | InfluxDBConnection conection = (InfluxDBConnection) model.getValueAtRow(selectedRowIndex); 104 | ConnectionSettingsDialog ConnectionSettingsDialog = new ConnectionSettingsDialog(this, conection); 105 | } 106 | } 107 | super.actionPerformed(event); 108 | 109 | } 110 | 111 | public JSONArray loadConnectionsFile() { 112 | Path path = FileSystems.getDefault().getPath("connections.json").toAbsolutePath(); 113 | try { 114 | JSONParser parser = new JSONParser(); 115 | JSONArray array = (JSONArray) parser.parse(new FileReader(path.toString())); 116 | return array; 117 | } catch (ParseException e) { 118 | return new JSONArray(); 119 | 120 | } catch (Exception e) { 121 | //JOptionPane.showMessageDialog(this, "Not possible to read connections file ", "Failure",JOptionPane.ERROR_MESSAGE); 122 | } 123 | return new JSONArray(); 124 | } 125 | 126 | @Override 127 | public Dimension getPreferredSize() { 128 | return new Dimension(350, 200); 129 | } 130 | 131 | private EnhancedJPanel layoutTopButtonsPanel() { 132 | 133 | EnhancedJPanel buttonsPanel = new EnhancedJPanel(); 134 | double border = 1; 135 | double size[][] = { { border, 100, border, 100, border, 100, border }, { 25, border } }; 136 | 137 | buttonsPanel.setLayout(new TableLayout(size)); 138 | buttonsPanel.add(createButton, "1,0"); 139 | buttonsPanel.add(editButton, "3,0"); 140 | buttonsPanel.add(removeButton, "5,0"); 141 | 142 | buttonsPanel.setBorder(new EtchedBorder()); 143 | 144 | return buttonsPanel; 145 | 146 | } 147 | 148 | public void addConnection(InfluxDBConnection influxDBConnection) { 149 | 150 | JSONArray array = loadConnectionsFile(); 151 | if (isANewConnection(influxDBConnection,array) == null) { 152 | array.add(influxDBConnection.toJSon()); 153 | saveArrayConnections(array); 154 | connectionsTable.addTableRecord(influxDBConnection); 155 | } 156 | else { 157 | EnhancedTableModel model = (EnhancedTableModel) connectionsTable.getModel(); 158 | JSONArray connectionsArray = loadConnectionsFile(); 159 | InfluxDBConnection editedConnection = isANewConnection(influxDBConnection,array); 160 | connectionsArray.remove(editedConnection.toJSon()); 161 | connectionsArray.add(influxDBConnection.toJSon()); 162 | saveArrayConnections(connectionsArray); 163 | Vector rows =model.getAllRowsVector(); 164 | Vector newRows = new Vector(); 165 | for (Object obj: rows) { 166 | InfluxDBConnection conn = (InfluxDBConnection) obj; 167 | if (conn.getID().equals(influxDBConnection.getID())) { 168 | } 169 | else { 170 | newRows.add(obj); 171 | } 172 | } 173 | model.addAllRows(newRows); 174 | connectionsTable.repaint(); 175 | model.addTableRecord(influxDBConnection); 176 | connectionsTable.repaint(); 177 | } 178 | 179 | } 180 | private InfluxDBConnection isANewConnection(InfluxDBConnection influxDBConnection,JSONArray array ) { 181 | 182 | for (Object object: array) { 183 | InfluxDBConnection storedConnection = new InfluxDBConnection((JSONObject) object); 184 | if (influxDBConnection.getID().equals(storedConnection.getID())) { 185 | return storedConnection; 186 | } 187 | } 188 | return null; 189 | } 190 | 191 | private void saveArrayConnections(JSONArray array) { 192 | try { 193 | Path path = FileSystems.getDefault().getPath("connections.json").toAbsolutePath(); 194 | FileWriter fileWriter = new FileWriter(path.toString()); 195 | PrintWriter printWriter = new PrintWriter(fileWriter); 196 | printWriter.print(array.toJSONString()); 197 | printWriter.close(); 198 | 199 | } catch (IOException e) { 200 | JOptionPane.showMessageDialog(this, "Not possible to save connection ", "Failure", 201 | JOptionPane.ERROR_MESSAGE); 202 | } 203 | 204 | } 205 | 206 | protected void okButtonPressedAction() { 207 | int selectedRowIndex = connectionsTable.getSelectedRow(); 208 | if (selectedRowIndex >= 0) { 209 | InfluxDBConnection influxDBConnection = (InfluxDBConnection) connectionsTable.getAllRowsVector() 210 | .get(selectedRowIndex); 211 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 212 | facility.getInfluxDB(influxDBConnection); 213 | treepanelReference.addInfluxDBServer(influxDBConnection); 214 | dispose(); 215 | } 216 | } 217 | 218 | protected void cancelButtonPressedAction() { 219 | dispose(); 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/NewQueryActionPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Dimension; 5 | 6 | import java.awt.event.ActionEvent; 7 | import java.awt.event.ActionListener; 8 | 9 | import javax.swing.JButton; 10 | import javax.swing.JLabel; 11 | import javax.swing.JScrollPane; 12 | import javax.swing.JSplitPane; 13 | import javax.swing.JTabbedPane; 14 | import javax.swing.JTextArea; 15 | import javax.swing.border.EtchedBorder; 16 | 17 | import org.influxdb.dto.QueryResult; 18 | import org.influxdb.dto.QueryResult.Series; 19 | 20 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 21 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 22 | import com.entropiadevelopments.influxdbworkbench.gui.common.ButtonPanel; 23 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedJPanel; 24 | import com.entropiadevelopments.influxdbworkbench.gui.common.GuiToolkit; 25 | 26 | import org.influxdb.dto.QueryResult.Result; 27 | 28 | import info.clearthought.layout.TableLayout; 29 | 30 | public class NewQueryActionPanel extends ActionPanel implements ActionListener { 31 | 32 | private static final long serialVersionUID = -624272778516469677L; 33 | private InfluxDBFacility influxDBFacility; 34 | private JSplitPane mainPanel; 35 | private JTextArea textArea; 36 | private JLabel messagelabel; 37 | private ButtonPanel buttonPanel; 38 | private JButton runQueryButton; 39 | private JButton clearButton; 40 | private JTabbedPane bottomPanel; 41 | private long responseTime; 42 | 43 | private InfluxDBConnection connection; 44 | private String mesurementName; 45 | private String databaseName; 46 | 47 | public NewQueryActionPanel(InfluxDBConnection connection, String mesurementName, String databaseName) { 48 | 49 | super(connection.getConnectionName() + "." + mesurementName, "NewQuery.png"); 50 | 51 | this.connection = connection; 52 | this.mesurementName = mesurementName; 53 | this.databaseName = databaseName; 54 | 55 | influxDBFacility = InfluxDBFacility.getFacilityReference(); 56 | setBorder(new EtchedBorder()); 57 | setLayout(new BorderLayout()); 58 | initComponets(); 59 | layuotComponets(); 60 | add(mainPanel); 61 | } 62 | 63 | private void initComponets() { 64 | 65 | mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT); 66 | mainPanel.setDividerSize(5); 67 | textArea = new JTextArea(" SELECT * FROM \"" + mesurementName + "\" WHERE time > now() -5m"); 68 | textArea.setPreferredSize(new Dimension(600, 600)); 69 | messagelabel = new JLabel(); 70 | buttonPanel = new ButtonPanel(30, 5, 2, 5); 71 | clearButton = new JButton("Clear results"); 72 | clearButton.setIcon(GuiToolkit.getIcon("DropMeasurement.png")); 73 | clearButton.addActionListener(this); 74 | runQueryButton = new JButton("Run Query"); 75 | runQueryButton.setIcon(GuiToolkit.getIcon("RunQuery.png")); 76 | runQueryButton.addActionListener(this); 77 | buttonPanel.addButton(runQueryButton); 78 | buttonPanel.addButton(clearButton); 79 | bottomPanel = new JTabbedPane(); 80 | } 81 | 82 | private void layuotComponets() { 83 | setLayout(new BorderLayout()); 84 | layuotTopPanel(); 85 | layuotBottomPanel(); 86 | } 87 | 88 | private void layuotTopPanel() { 89 | EnhancedJPanel topPanel = new EnhancedJPanel(); 90 | double size[][] = { { TableLayout.FILL }, { TableLayout.FILL, 30, 30 } }; 91 | topPanel.setLayout(new TableLayout(size)); 92 | JScrollPane scrollPane = createNewScrollPaneWithEditor(textArea); 93 | scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); 94 | scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); 95 | topPanel.add(scrollPane, "0,0"); 96 | topPanel.add(buttonPanel, "0,1"); 97 | topPanel.add(messagelabel, "0,2"); 98 | topPanel.setPreferredSize(new Dimension(0, 150)); 99 | mainPanel.setTopComponent(topPanel); 100 | } 101 | 102 | private JScrollPane createNewScrollPaneWithEditor(JTextArea textArea) { 103 | JScrollPane scrollPane = new JScrollPane(); 104 | scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); 105 | scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); 106 | scrollPane.getViewport().add(textArea); 107 | scrollPane.getViewport().setPreferredSize(textArea.getPreferredSize()); 108 | return scrollPane; 109 | } 110 | 111 | private void layuotBottomPanel() { 112 | bottomPanel.setTabPlacement(JTabbedPane.TOP); 113 | bottomPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); 114 | mainPanel.setBottomComponent(bottomPanel); 115 | } 116 | 117 | private void putResulQueryTabedPanels(QueryResult queryResult) { 118 | for (Result result : queryResult.getResults()) { 119 | putResulqueryTab(result); 120 | } 121 | } 122 | 123 | private void putResulqueryTab(Result result) { 124 | if (!result.hasError()) { 125 | int seriesCounter = 1; 126 | int totalNumOfRows = 0; 127 | if (result.getSeries() != null) { 128 | for (Series serie : result.getSeries()) { 129 | QueryResultTable queryResultTable = new QueryResultTable(serie); 130 | bottomPanel.addTab("Result " + seriesCounter, new JScrollPane(queryResultTable)); 131 | seriesCounter++; 132 | totalNumOfRows = totalNumOfRows + queryResultTable.getNumOfRows(); 133 | } 134 | messagelabel.setText(" Results " + totalNumOfRows + ", response time : " + responseTime + " ms"); 135 | } 136 | } 137 | } 138 | 139 | public QueryResult executeQuery() { 140 | String query = textArea.getText(); 141 | QueryResult queryResult = influxDBFacility.query(query,databaseName,connection); 142 | if (queryResult.hasError()) { 143 | return null; 144 | } else { 145 | return queryResult; 146 | } 147 | } 148 | 149 | @Override 150 | public void runQuery(){ 151 | long timeInit = System.currentTimeMillis(); 152 | QueryResult queryResult = executeQuery(); 153 | long timeEnd = System.currentTimeMillis(); 154 | responseTime = (timeEnd - timeInit); 155 | bottomPanel.removeAll(); 156 | putResulQueryTabedPanels(queryResult); 157 | 158 | } 159 | @Override 160 | public void actionPerformed(ActionEvent actionEvent) { 161 | if (actionEvent.getSource().equals(runQueryButton)) { 162 | runQuery(); 163 | } 164 | if (actionEvent.getSource().equals(clearButton)) { 165 | bottomPanel.removeAll(); 166 | messagelabel.setText(""); 167 | } 168 | } 169 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/QueryResultTable.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.util.ArrayList; 6 | import java.util.Vector; 7 | 8 | import javax.swing.JLabel; 9 | import javax.swing.JTable; 10 | import javax.swing.table.AbstractTableModel; 11 | import javax.swing.table.JTableHeader; 12 | import javax.swing.table.TableCellRenderer; 13 | 14 | import org.influxdb.dto.QueryResult.Series; 15 | 16 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTable; 17 | import com.entropiadevelopments.influxdbworkbench.gui.common.TableRecord; 18 | 19 | public class QueryResultTable extends EnhancedTable { 20 | 21 | private static final long serialVersionUID = 1L; 22 | private QueryResultTableModel tableModel; 23 | private int numOfrows; 24 | 25 | public QueryResultTable(Series serie) { 26 | setUpUI(); 27 | numOfrows = 1; 28 | ArrayList columNames = new ArrayList(serie.getColumns()); 29 | tableModel = new QueryResultTableModel(columNames); 30 | for (Object valuesList : serie.getValues()) { 31 | ArrayList rowValues = (ArrayList) valuesList; 32 | QueryResultTableRecord tableRecord = new QueryResultTableRecord(numOfrows, rowValues); 33 | tableModel.addTableRecord(tableRecord); 34 | numOfrows++; 35 | } 36 | setModel(tableModel); 37 | } 38 | 39 | private void setUpUI() { 40 | setGridColor(Color.LIGHT_GRAY); 41 | setShowHorizontalLines(true); 42 | setShowVerticalLines(true); 43 | JTableHeader header = getTableHeader(); 44 | header.setBackground(Color.LIGHT_GRAY); 45 | setTableHeader(header); 46 | setAutoResizeMode(JTable.AUTO_RESIZE_OFF); 47 | 48 | } 49 | 50 | @Override 51 | public Component prepareRenderer(TableCellRenderer renderer, int row, int col) { 52 | Component comp = super.prepareRenderer(renderer, row, col); 53 | ((JLabel) comp).setHorizontalAlignment(JLabel.LEFT); 54 | return comp; 55 | } 56 | 57 | public int getNumOfRows() { 58 | return numOfrows - 1; 59 | } 60 | 61 | class QueryResultTableRecord implements TableRecord { 62 | 63 | private ArrayList tabelRecordData; 64 | 65 | public QueryResultTableRecord(int recordNumber, ArrayList data) { 66 | tabelRecordData = new ArrayList(); 67 | tabelRecordData.add(recordNumber); 68 | for (Object element : data) { 69 | tabelRecordData.add(element); 70 | } 71 | } 72 | 73 | @Override 74 | public Object getFieldAt(int fieldIndex) { 75 | return tabelRecordData.get(fieldIndex); 76 | } 77 | 78 | @Override 79 | public int getNumberOfField() { 80 | return tabelRecordData.size(); 81 | } 82 | 83 | @Override 84 | public void setFieldAt(int fieldIndex, Object field) { 85 | tabelRecordData.set(fieldIndex, field); 86 | 87 | } 88 | } 89 | 90 | class QueryResultTableModel extends AbstractTableModel { 91 | 92 | private static final long serialVersionUID = 8919352997347026280L; 93 | private Vector rowsVector; 94 | private ArrayList columnNames; 95 | 96 | public QueryResultTableModel(ArrayList nameOfColums) { 97 | rowsVector = new Vector(); 98 | this.columnNames = new ArrayList(); 99 | this.columnNames.add("#"); 100 | for (String value : nameOfColums) { 101 | this.columnNames.add(value); 102 | } 103 | } 104 | 105 | public String getColumnName(int column) { 106 | 107 | return (String) columnNames.get(column); 108 | } 109 | 110 | public int getColumnCount() { 111 | return columnNames.size(); 112 | } 113 | 114 | public void addTableRecord(TableRecord record) { 115 | rowsVector.add(record); 116 | } 117 | 118 | public TableRecord getValueAtRow(int rowIndex) { 119 | return (TableRecord) rowsVector.get(rowIndex); 120 | } 121 | 122 | public void removeRow(int row) { 123 | if (rowsVector.isEmpty()) { 124 | return; 125 | } else if (rowsVector.size() >= row) { 126 | rowsVector.remove(row); 127 | } 128 | } 129 | 130 | public boolean hasTableRecord(TableRecord record) { 131 | if (rowsVector.contains(record)) 132 | return true; 133 | else 134 | return false; 135 | } 136 | 137 | public void removeAllRows() { 138 | if (rowsVector.isEmpty()) { 139 | return; 140 | } else { 141 | rowsVector.removeAllElements(); 142 | } 143 | } 144 | 145 | public Vector getAllRowsVector() { 146 | return rowsVector; 147 | } 148 | 149 | public void addAllRows(Vector alllRows) { 150 | if (alllRows != null) { 151 | rowsVector = alllRows; 152 | } else 153 | removeAllRows(); 154 | } 155 | 156 | public void removeRow(TableRecord record) { 157 | if (rowsVector.isEmpty()) { 158 | return; 159 | } else if (rowsVector.contains(record)) { 160 | rowsVector.remove(record); 161 | } 162 | } 163 | 164 | public void changeTableRecord(TableRecord record, int rowIndex) { 165 | rowsVector.setElementAt(record, rowIndex); 166 | } 167 | 168 | public int getRowCount() { 169 | return rowsVector.size(); 170 | } 171 | 172 | public Object getValueAt(int rowIndex, int columnIndex) { 173 | if (((TableRecord) rowsVector.get(rowIndex)) != null) { 174 | return ((TableRecord) rowsVector.get(rowIndex)).getFieldAt(columnIndex); 175 | } else { 176 | return ""; 177 | } 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/RetentionPoliciesTable.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.Color; 4 | import java.util.ArrayList; 5 | 6 | import javax.swing.table.JTableHeader; 7 | 8 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTable; 9 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTableModel; 10 | 11 | public class RetentionPoliciesTable extends EnhancedTable { 12 | 13 | public RetentionPoliciesTable(){ 14 | setGridColor(Color.LIGHT_GRAY); 15 | setShowHorizontalLines(true); 16 | setShowVerticalLines(true); 17 | JTableHeader header = getTableHeader(); 18 | header.setBackground(Color.LIGHT_GRAY); 19 | setTableHeader(header); 20 | ArrayList nameOfColums = new ArrayList (); 21 | nameOfColums.add("Policy Name"); 22 | nameOfColums.add("Duration Name"); 23 | nameOfColums.add("Shard Group Duration"); 24 | nameOfColums.add("Replica N"); 25 | nameOfColums.add("Default"); 26 | EnhancedTableModel tableModel = new EnhancedTableModel(nameOfColums); 27 | setModel(tableModel); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/RetentionPolicyPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | 9 | import javax.swing.JButton; 10 | import javax.swing.JComboBox; 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JOptionPane; 14 | import javax.swing.JScrollPane; 15 | import javax.swing.SwingUtilities; 16 | import javax.swing.border.EtchedBorder; 17 | import javax.swing.event.ListSelectionEvent; 18 | import javax.swing.event.ListSelectionListener; 19 | 20 | import org.influxdb.InfluxDB; 21 | import org.influxdb.dto.Query; 22 | import org.influxdb.dto.QueryResult; 23 | import org.influxdb.dto.QueryResult.Result; 24 | import org.influxdb.dto.QueryResult.Series; 25 | 26 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 27 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBRetentionPolicy; 28 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 29 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedJPanel; 30 | import com.entropiadevelopments.influxdbworkbench.gui.common.GuiToolkit; 31 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 32 | 33 | import info.clearthought.layout.TableLayout; 34 | 35 | public class RetentionPolicyPanel extends ActionPanel implements ActionListener, ListSelectionListener{ 36 | 37 | private JComboBox databaseComboBox; 38 | 39 | private JButton createPolicyButton; 40 | private JButton alterPolicyButton; 41 | private JButton dropPolicyButton; 42 | 43 | private RetentionPoliciesTable policiesTable; 44 | 45 | private EnhancedJPanel topPanel; 46 | private EnhancedJPanel bottomPanel; 47 | 48 | private InfluxDBConnection connection; 49 | private HashMap seriedHashMap; 50 | 51 | private InfluxDBRetentionPolicy setectedRetentionPolicy; 52 | private InfluxDBTreePanel treePanelReference; 53 | 54 | public RetentionPolicyPanel(InfluxDBTreePanel treePanelReference, InfluxDBConnection connection) { 55 | super(connection.getConnectionName() + ".policies", "RetentionPolicy.png"); 56 | this.connection = connection; 57 | this.treePanelReference = treePanelReference; 58 | seriedHashMap = new HashMap(); 59 | setBorder(new EtchedBorder()); 60 | setLayout(new BorderLayout()); 61 | 62 | initComponets(); 63 | layuotComponets(); 64 | add(topPanel, BorderLayout.NORTH); 65 | add(bottomPanel, BorderLayout.CENTER); 66 | runQuery(); 67 | } 68 | 69 | private void initComponets() { 70 | 71 | databaseComboBox = new JComboBox(); 72 | databaseComboBox.addActionListener (this); 73 | createPolicyButton = new JButton("Create Policy"); 74 | 75 | createPolicyButton.setIcon(GuiToolkit.getIcon("CreateRetentionPolicy.png")); 76 | createPolicyButton.addActionListener(this); 77 | 78 | alterPolicyButton = new JButton("AlterPpolicy"); 79 | alterPolicyButton.setIcon(GuiToolkit.getIcon("EditRetentionPolicy.png")); 80 | alterPolicyButton.setEnabled(false); 81 | alterPolicyButton.addActionListener(this); 82 | 83 | dropPolicyButton = new JButton("Drop Policy"); 84 | dropPolicyButton.setIcon(GuiToolkit.getIcon("DropRetentionPolicy.png")); 85 | dropPolicyButton.setEnabled(false); 86 | dropPolicyButton.addActionListener(this); 87 | 88 | policiesTable = new RetentionPoliciesTable(); 89 | policiesTable.getSelectionModel().addListSelectionListener(this); 90 | 91 | topPanel = new EnhancedJPanel(); 92 | bottomPanel = new EnhancedJPanel(); 93 | 94 | } 95 | private void layuotComponets() { 96 | setLayout(new BorderLayout()); 97 | layuotTopPanel(); 98 | layuotBottomPanel(); 99 | 100 | } 101 | 102 | private void layuotBottomPanel() { 103 | double size[][] = { { TableLayout.FILL }, { TableLayout.FILL } }; 104 | 105 | bottomPanel.setLayout(new TableLayout(size)); 106 | bottomPanel.add(new JScrollPane(policiesTable), "0,0"); 107 | 108 | } 109 | 110 | private void layuotTopPanel() { 111 | double border = 5; 112 | double field = 120; 113 | double size[][] = { { 10, 100, border, 150, border, field, border, field, border, field, border }, 114 | { border, 30, border } }; 115 | topPanel.setLayout(new TableLayout(size)); 116 | 117 | topPanel.add(new JLabel("Select database:"), "1,1"); 118 | topPanel.add(databaseComboBox, "3,1"); 119 | topPanel.add(createPolicyButton, "5,1"); 120 | topPanel.add(alterPolicyButton, "7,1"); 121 | topPanel.add(dropPolicyButton, "9,1"); 122 | 123 | topPanel.setBorder(new EtchedBorder()); 124 | 125 | } 126 | private void putSerieInTable(Series serie) { 127 | policiesTable.removeAllRows(); 128 | if (serie != null) { 129 | for (Object valuesList : serie.getValues()) { 130 | ArrayList rowValues = (ArrayList) valuesList; 131 | InfluxDBRetentionPolicy retentionPolicy = new InfluxDBRetentionPolicy(connection, rowValues); 132 | policiesTable.addTableRecord(retentionPolicy); 133 | } 134 | } 135 | 136 | } 137 | @Override 138 | public void runQuery() { 139 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 140 | // databaseComboBox.removeAll(); 141 | seriedHashMap.clear(); 142 | InfluxDB influxDB = facility.getInfluxDB(connection); 143 | for (String databaseName : influxDB.describeDatabases()) { 144 | databaseComboBox.addItem(databaseName); 145 | Query query = new Query("SHOW RETENTION POLICIES", databaseName); 146 | QueryResult queryResult = influxDB.query(query); 147 | for (Result result : queryResult.getResults()) { 148 | for (Series serie : result.getSeries()) { 149 | seriedHashMap.put(databaseName, serie); 150 | } 151 | } 152 | } 153 | Series serie = seriedHashMap.get(databaseComboBox.getSelectedItem()); 154 | putSerieInTable(serie); 155 | } 156 | @Override 157 | public void actionPerformed (ActionEvent actionEvent) { 158 | if(actionEvent.getSource().equals(databaseComboBox)) { 159 | Series serie = seriedHashMap.get(databaseComboBox.getSelectedItem()); 160 | putSerieInTable(serie); 161 | } 162 | if(actionEvent.getSource().equals(createPolicyButton)){ 163 | JFrame rootFrame = (JFrame) SwingUtilities.getRoot(treePanelReference); 164 | CreatePolicyDialog createPolicyDialog = new CreatePolicyDialog(rootFrame, connection, this); 165 | 166 | } 167 | if(actionEvent.getSource().equals(alterPolicyButton)){ 168 | JFrame rootFrame = (JFrame) SwingUtilities.getRoot(treePanelReference); 169 | if (setectedRetentionPolicy != null) { 170 | EditPolicyDialog editPolicyDialog = new EditPolicyDialog(rootFrame, connection, this, setectedRetentionPolicy); 171 | } 172 | 173 | } 174 | if(actionEvent.getSource().equals(dropPolicyButton)){ 175 | 176 | JFrame rootFrame = (JFrame) SwingUtilities.getRoot(treePanelReference); 177 | int response = JOptionPane.showConfirmDialog(rootFrame, "Do you want drop retention policy?", "Confirm", 178 | JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); 179 | if (response == JOptionPane.NO_OPTION) { 180 | return; 181 | } else if (response == JOptionPane.YES_OPTION) { 182 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 183 | InfluxDB influxDB = facility.getInfluxDB(connection); 184 | influxDB.dropRetentionPolicy(setectedRetentionPolicy.getPolicyName(),(String) databaseComboBox.getSelectedItem()); 185 | policiesTable.removeSelectedRows(); 186 | } else if (response == JOptionPane.CLOSED_OPTION) { 187 | return; 188 | } 189 | } 190 | } 191 | 192 | @Override 193 | public void valueChanged(ListSelectionEvent event) { 194 | setectedRetentionPolicy = (InfluxDBRetentionPolicy) policiesTable.getSelectedRowRecord(); 195 | alterPolicyButton.setEnabled(true); 196 | dropPolicyButton.setEnabled(true); 197 | } 198 | 199 | public void addRetentionPolicy(InfluxDBRetentionPolicy retentionPolicy) { 200 | if (retentionPolicy != null) { 201 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 202 | InfluxDB influxDB = facility.getInfluxDB(connection); 203 | influxDB.createRetentionPolicy(retentionPolicy.getPolicyName(),(String)databaseComboBox.getSelectedItem(), retentionPolicy.getDuration(), (int) retentionPolicy.getReplication(), retentionPolicy.isDefault()); 204 | policiesTable.addTableRecord(retentionPolicy); 205 | } 206 | } 207 | 208 | public void editRetentionPolicy(InfluxDBRetentionPolicy retentionPolicy) { 209 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 210 | InfluxDB influxDB = facility.getInfluxDB(connection); 211 | influxDB.dropRetentionPolicy(setectedRetentionPolicy.getPolicyName(), (String)databaseComboBox.getSelectedItem()); 212 | influxDB.createRetentionPolicy(retentionPolicy.getPolicyName(),(String)databaseComboBox.getSelectedItem(), retentionPolicy.getDuration(), (int) retentionPolicy.getReplication(), retentionPolicy.isDefault()); 213 | policiesTable.removeSelectedRows(); 214 | policiesTable.addTableRecord(retentionPolicy); 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/SeriesTable.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.Color; 4 | import java.util.ArrayList; 5 | 6 | import javax.swing.table.JTableHeader; 7 | 8 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTable; 9 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTableModel; 10 | 11 | 12 | public class SeriesTable extends EnhancedTable{ 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | public SeriesTable(){ 17 | 18 | setGridColor(Color.LIGHT_GRAY); 19 | setShowHorizontalLines(true); 20 | setShowVerticalLines(true); 21 | JTableHeader header = getTableHeader(); 22 | header.setBackground(Color.LIGHT_GRAY); 23 | setTableHeader(header); 24 | ArrayList nameOfColums = new ArrayList (); 25 | nameOfColums.add("#"); 26 | nameOfColums.add("Host"); 27 | EnhancedTableModel tableModel = new EnhancedTableModel(nameOfColums); 28 | setModel(tableModel); 29 | } 30 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/ShowDiagnosticsActionPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.BorderLayout; 4 | 5 | import javax.swing.BorderFactory; 6 | import javax.swing.JLabel; 7 | import javax.swing.border.EtchedBorder; 8 | 9 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 10 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 11 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedJPanel; 12 | 13 | import info.clearthought.layout.TableLayout; 14 | 15 | public class ShowDiagnosticsActionPanel extends ActionPanel { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | private EnhancedJPanel mainPanel; 20 | 21 | private EnhancedJPanel systemPanel; 22 | private JLabel pidValueLabel; 23 | private JLabel currentTimeValueLabel ; 24 | private JLabel startedValueLabel; 25 | private JLabel upTimeValueLabel ; 26 | 27 | private EnhancedJPanel buildPanel; 28 | 29 | private JLabel branchValueLabel; 30 | private JLabel commitValueLabel; 31 | private JLabel versionValueLabel; 32 | 33 | private EnhancedJPanel goRuntimePanel; 34 | 35 | private JLabel architectureValueLabel; 36 | private JLabel maxProcsValueLabel; 37 | private JLabel osValueLabel; 38 | private JLabel versionGOValueLabel; 39 | 40 | private JLabel hotnameValueLabel; 41 | 42 | 43 | private EnhancedJPanel networkPanel; 44 | 45 | public ShowDiagnosticsActionPanel(InfluxDBConnection connection) { 46 | super("Show Diagnostics", "Diagnostics.png"); 47 | setBorder(new EtchedBorder()); 48 | setLayout(new BorderLayout()); 49 | initComponets(); 50 | layuotComponets(); 51 | add(mainPanel); 52 | } 53 | 54 | private void initComponets(){ 55 | mainPanel = new EnhancedJPanel(); 56 | systemPanel = new EnhancedJPanel(); 57 | systemPanel.setBorder(BorderFactory.createTitledBorder("System")); 58 | buildPanel = new EnhancedJPanel(); 59 | buildPanel.setBorder(BorderFactory.createTitledBorder("Build")); 60 | goRuntimePanel = new EnhancedJPanel(); 61 | goRuntimePanel.setBorder(BorderFactory.createTitledBorder("Go Runtime")); 62 | networkPanel = new EnhancedJPanel(); 63 | networkPanel.setBorder(BorderFactory.createTitledBorder("Network")); 64 | 65 | pidValueLabel = new JLabel("430"); 66 | currentTimeValueLabel = new JLabel("05/12/2018 23:25:15"); 67 | startedValueLabel = new JLabel("03/11/2018 12:45:20"); 68 | upTimeValueLabel = new JLabel("0d 4h 39m 52s 458ms"); 69 | 70 | branchValueLabel = new JLabel("1.7"); 71 | commitValueLabel = new JLabel("ksaskjkhqeunnsadhgsbbhywemnbsdasasasfrg"); 72 | versionValueLabel = new JLabel("1.7.1"); 73 | 74 | architectureValueLabel = new JLabel("arm"); 75 | maxProcsValueLabel = new JLabel("4"); 76 | osValueLabel = new JLabel("Linux"); 77 | versionGOValueLabel = new JLabel("go 1.1"); 78 | 79 | hotnameValueLabel = new JLabel("raspberrypi:"); 80 | 81 | } 82 | 83 | private void layuotComponets(){ 84 | layuotMainPanel(); 85 | layuotSystemPanel(); 86 | layuotBuildPanel(); 87 | layuotGoRuntimePanel(); 88 | layuotNetworkPanel(); 89 | 90 | } 91 | 92 | private void layuotBuildPanel() { 93 | JLabel branchLabel = new JLabel("Branch:"); 94 | JLabel commitLabel = new JLabel("Commit:"); 95 | JLabel versionLabel = new JLabel("Version:"); 96 | double border = 5; 97 | double widthTag = 90; 98 | double widthValue = 300; 99 | double tall = 20; 100 | double size [][] = { 101 | {border,widthTag, border,widthValue,TableLayout.FILL }, 102 | {border,tall,border,tall,border,tall,TableLayout.FILL} 103 | }; 104 | buildPanel.setLayout(new TableLayout(size)); 105 | buildPanel.add(branchLabel,"1,1"); 106 | buildPanel.add(commitLabel,"1,3"); 107 | buildPanel.add(versionLabel,"1,5"); 108 | 109 | buildPanel.add(branchValueLabel,"3,1"); 110 | buildPanel.add(commitValueLabel,"3,3"); 111 | buildPanel.add(versionValueLabel,"3,5"); 112 | } 113 | 114 | private void layuotNetworkPanel() { 115 | JLabel hotnameLabel = new JLabel("Hostname:"); 116 | double border = 5; 117 | double widthTag = 90; 118 | double widthValue = 120; 119 | double tall = 20; 120 | 121 | double size [][] = { 122 | {border,widthTag, border,widthValue,TableLayout.FILL }, 123 | {border,tall,border,TableLayout.FILL} 124 | }; 125 | networkPanel.setLayout(new TableLayout(size)); 126 | networkPanel.add(hotnameLabel,"1,1"); 127 | networkPanel.add(hotnameValueLabel,"3,1"); 128 | 129 | } 130 | 131 | private void layuotGoRuntimePanel() { 132 | JLabel architectureLabel = new JLabel("Architecture:"); 133 | JLabel maxProcsLabel = new JLabel("Commit:"); 134 | JLabel osLabel = new JLabel("OS:"); 135 | JLabel versionLabel = new JLabel("Version:"); 136 | double border = 5; 137 | double widthTag = 90; 138 | double widthValue = 300; 139 | double tall = 20; 140 | double size [][] = { 141 | {border,widthTag, border,widthValue,TableLayout.FILL }, 142 | {border,tall,border,tall,border,tall,border,tall,TableLayout.FILL} 143 | }; 144 | goRuntimePanel.setLayout(new TableLayout(size)); 145 | goRuntimePanel.add(architectureLabel,"1,1"); 146 | goRuntimePanel.add(maxProcsLabel,"1,3"); 147 | goRuntimePanel.add(osLabel,"1,5"); 148 | goRuntimePanel.add(versionLabel,"1,7"); 149 | 150 | goRuntimePanel.add(architectureValueLabel,"3,1"); 151 | goRuntimePanel.add(maxProcsValueLabel,"3,3"); 152 | goRuntimePanel.add(osValueLabel,"3,5"); 153 | goRuntimePanel.add(versionGOValueLabel,"3,7"); 154 | 155 | } 156 | 157 | private void layuotSystemPanel() { 158 | JLabel pidLabel = new JLabel("PID:"); 159 | JLabel currentTimeLabel = new JLabel("Current Time:"); 160 | JLabel startedLabel = new JLabel("Started"); 161 | JLabel upTimeLabel = new JLabel("Uptime:"); 162 | 163 | double border = 5; 164 | double widthTag = 90; 165 | double widthValue = 120; 166 | double tall = 20; 167 | 168 | double size [][] = { 169 | {border,widthTag, border,widthValue,TableLayout.FILL }, 170 | {border,tall,border,tall,border,tall,border,tall,TableLayout.FILL} 171 | }; 172 | systemPanel.setLayout(new TableLayout(size)); 173 | systemPanel.add(pidLabel,"1,1"); 174 | systemPanel.add(currentTimeLabel,"1,3"); 175 | systemPanel.add(startedLabel,"1,5"); 176 | systemPanel.add(upTimeLabel,"1,7"); 177 | 178 | systemPanel.add(pidValueLabel,"3,1"); 179 | systemPanel.add(currentTimeValueLabel,"3,3"); 180 | systemPanel.add(startedValueLabel,"3,5"); 181 | systemPanel.add(upTimeValueLabel,"3,7"); 182 | 183 | } 184 | 185 | private void layuotMainPanel(){ 186 | 187 | double border = 5; 188 | double size [][] = { 189 | {border, TableLayout.FILL, border}, 190 | {border,130,border, 100,border,130,border,50,border} 191 | }; 192 | mainPanel.setLayout(new TableLayout(size)); 193 | mainPanel.add(systemPanel,"1,1"); 194 | mainPanel.add(buildPanel,"1,3"); 195 | mainPanel.add(goRuntimePanel,"1,5"); 196 | mainPanel.add(networkPanel,"1,7"); 197 | } 198 | 199 | @Override 200 | public void runQuery() { 201 | InfluxDBFacility influxDBFacility = InfluxDBFacility.getFacilityReference(); 202 | } 203 | 204 | } 205 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/ShowFieldKeysActionPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.BorderLayout; 4 | import java.util.List; 5 | 6 | import javax.swing.JScrollPane; 7 | import javax.swing.border.EtchedBorder; 8 | 9 | import org.influxdb.InfluxDB; 10 | import org.influxdb.dto.Query; 11 | import org.influxdb.dto.QueryResult; 12 | import org.influxdb.dto.QueryResult.Result; 13 | import org.influxdb.dto.QueryResult.Series; 14 | 15 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 16 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 17 | import com.entropiadevelopments.influxdbworkbench.gui.common.TableRecord; 18 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.ShowTagKeysActionPanel.TagKeyTableRecord; 19 | 20 | public class ShowFieldKeysActionPanel extends ActionPanel { 21 | 22 | static final long serialVersionUID = -1207305966403205210L; 23 | private InfluxDBConnection connection; 24 | private String mesurementName; 25 | private String databaseName; 26 | 27 | private JScrollPane mainPanel; 28 | private KeyFieldsTable keyFieldsTable; 29 | 30 | public ShowFieldKeysActionPanel(InfluxDBConnection connection, String mesurementName, String databaseName) { 31 | 32 | super(connection.getConnectionName() + "." + mesurementName + ".fieldKeys", "FieldKeys.png"); 33 | 34 | this.connection = connection; 35 | this.mesurementName = mesurementName; 36 | this.databaseName = databaseName; 37 | 38 | setBorder(new EtchedBorder()); 39 | setLayout(new BorderLayout()); 40 | initComponets(); 41 | runQuery(); 42 | add(mainPanel); 43 | } 44 | 45 | private void initComponets() { 46 | keyFieldsTable = new KeyFieldsTable(); 47 | mainPanel = new JScrollPane(keyFieldsTable); 48 | } 49 | 50 | @Override 51 | public void runQuery() { 52 | keyFieldsTable.removeAllRows(); 53 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 54 | InfluxDB influxDB = facility.getInfluxDB(connection); 55 | Query query = new Query("SHOW FIELD KEYS FROM \"" + mesurementName + "\"", databaseName); 56 | QueryResult reuslt = influxDB.query(query); 57 | for (Result result : reuslt.getResults()) { 58 | for (Series series : result.getSeries()) { 59 | int num = 1; 60 | for (List list : series.getValues()) { 61 | keyFieldsTable.addTableRecord(new FieldKeysTableRecord(num, (String)list.get(0), (String)list.get(1))); 62 | num++; 63 | } 64 | } 65 | } 66 | } 67 | 68 | class FieldKeysTableRecord implements TableRecord { 69 | private int num; 70 | private String fieldKey; 71 | private String fieldType; 72 | 73 | public FieldKeysTableRecord(int num, String fieldKey, String fieldType) { 74 | this.num = num; 75 | this.fieldKey = fieldKey; 76 | this.fieldType = fieldType; 77 | } 78 | 79 | @Override 80 | public Object getFieldAt(int fieldIndex) { 81 | if (fieldIndex == 0) 82 | return num; 83 | if (fieldIndex == 1) 84 | return fieldKey; 85 | if (fieldIndex == 2) 86 | return fieldType; 87 | return null; 88 | } 89 | 90 | @Override 91 | public int getNumberOfField() { 92 | return 3; 93 | } 94 | 95 | @Override 96 | public void setFieldAt(int fieldIndex, Object field) { 97 | 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/ShowSeriesPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.BorderLayout; 4 | import java.util.List; 5 | 6 | import javax.swing.JScrollPane; 7 | import javax.swing.border.EtchedBorder; 8 | 9 | import org.influxdb.InfluxDB; 10 | import org.influxdb.dto.Query; 11 | import org.influxdb.dto.QueryResult; 12 | import org.influxdb.dto.QueryResult.Result; 13 | import org.influxdb.dto.QueryResult.Series; 14 | 15 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 16 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 17 | import com.entropiadevelopments.influxdbworkbench.gui.common.TableRecord; 18 | 19 | public class ShowSeriesPanel extends ActionPanel { 20 | 21 | private static final long serialVersionUID = 1L; 22 | private InfluxDBConnection connection; 23 | private String mesurementName; 24 | private String databaseName; 25 | 26 | private JScrollPane mainPanel; 27 | private SeriesTable seriesTable; 28 | 29 | public ShowSeriesPanel(InfluxDBConnection connection, String mesurementName, String databaseName) { 30 | 31 | super(connection.getConnectionName() + "." + mesurementName + ".series", "Series.png"); 32 | 33 | this.connection = connection; 34 | this.mesurementName = mesurementName; 35 | this.databaseName = databaseName; 36 | 37 | setBorder(new EtchedBorder()); 38 | setLayout(new BorderLayout()); 39 | initComponets(); 40 | runQuery(); 41 | add(mainPanel); 42 | } 43 | 44 | private void initComponets() { 45 | seriesTable = new SeriesTable(); 46 | mainPanel = new JScrollPane(seriesTable); 47 | } 48 | 49 | @Override 50 | public void runQuery() { 51 | seriesTable.removeAllRows(); 52 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 53 | InfluxDB influxDB = facility.getInfluxDB(connection); 54 | Query query = new Query("SHOW SERIES FROM \"" + mesurementName + "\"", databaseName); 55 | QueryResult reuslt = influxDB.query(query); 56 | for (Result result : reuslt.getResults()) { 57 | for (Series series : result.getSeries()) { 58 | int num = 1; 59 | for (List list : series.getValues()) { 60 | seriesTable.addTableRecord(new SerieRecord(num, getHost((String) list.get(0)))); 61 | num++; 62 | } 63 | } 64 | } 65 | } 66 | 67 | private String getHost(String result){ 68 | String[] parts = result.split(","); 69 | for (int i = 0; i < parts.length; i++){ 70 | if (parts[i].contains("host")) { 71 | String[] values = parts[i].split("="); 72 | return values[1]; 73 | } 74 | } 75 | return null; 76 | } 77 | 78 | class SerieRecord implements TableRecord { 79 | private int num; 80 | private String host; 81 | 82 | public SerieRecord(int num, String host) { 83 | this.num = num; 84 | this.host = host; 85 | 86 | } 87 | @Override 88 | public Object getFieldAt(int fieldIndex) { 89 | if (fieldIndex == 0) 90 | return num; 91 | if (fieldIndex == 1) 92 | return host; 93 | return null; 94 | } 95 | @Override 96 | public int getNumberOfField() { 97 | return 2; 98 | } 99 | @Override 100 | public void setFieldAt(int fieldIndex, Object field) { 101 | 102 | } 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/ShowTagKeysActionPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.BorderLayout; 4 | import java.util.List; 5 | 6 | import javax.swing.JScrollPane; 7 | import javax.swing.border.EtchedBorder; 8 | 9 | import org.influxdb.InfluxDB; 10 | import org.influxdb.dto.Query; 11 | import org.influxdb.dto.QueryResult; 12 | import org.influxdb.dto.QueryResult.Result; 13 | import org.influxdb.dto.QueryResult.Series; 14 | 15 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 16 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 17 | import com.entropiadevelopments.influxdbworkbench.gui.common.TableRecord; 18 | 19 | public class ShowTagKeysActionPanel extends ActionPanel { 20 | 21 | private static final long serialVersionUID = -7077134831254192379L; 22 | private InfluxDBConnection connection; 23 | private String mesurementName; 24 | private String databaseName; 25 | 26 | private JScrollPane mainPanel; 27 | private TagKeysTable tagsKeyTable; 28 | 29 | public ShowTagKeysActionPanel(InfluxDBConnection connection, String mesurementName, String databaseName) { 30 | 31 | super(connection.getConnectionName()+ "."+ mesurementName+".tagKeys", "TagKeys.png"); 32 | 33 | this.connection = connection; 34 | this.mesurementName = mesurementName; 35 | this.databaseName = databaseName; 36 | 37 | setBorder(new EtchedBorder()); 38 | setLayout(new BorderLayout()); 39 | initComponets(); 40 | runQuery(); 41 | add(mainPanel); 42 | 43 | } 44 | private void initComponets() { 45 | tagsKeyTable = new TagKeysTable(); 46 | mainPanel = new JScrollPane(tagsKeyTable); 47 | 48 | } 49 | @Override 50 | public void runQuery() { 51 | tagsKeyTable.removeAllRows(); 52 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 53 | InfluxDB influxDB = facility.getInfluxDB(connection); 54 | Query query = new Query("SHOW TAG KEYS FROM \""+mesurementName +"\" ", databaseName); 55 | QueryResult reuslt = influxDB.query(query); 56 | for (Result result : reuslt.getResults()) { 57 | if(reuslt != null) { 58 | for (Series series: result.getSeries()){ 59 | int num =1; 60 | if (series!= null) { 61 | for(List list : series.getValues()){ 62 | tagsKeyTable.addTableRecord(new TagKeyTableRecord(num,(String)list.get(0))); 63 | num++; 64 | } 65 | } 66 | } 67 | } 68 | } 69 | } 70 | 71 | class TagKeyTableRecord implements TableRecord{ 72 | private int num; 73 | private String tagKey; 74 | 75 | public TagKeyTableRecord(int num, String tagKey) { 76 | this.num = num; 77 | this.tagKey = tagKey; 78 | } 79 | @Override 80 | public Object getFieldAt(int fieldIndex) { 81 | if (fieldIndex==0) return num; 82 | if (fieldIndex==1) return tagKey; 83 | return null; 84 | } 85 | 86 | @Override 87 | public int getNumberOfField() { 88 | return 2; 89 | } 90 | 91 | @Override 92 | public void setFieldAt(int fieldIndex, Object field) { 93 | 94 | } 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/ShowTagValueActionPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | 10 | import javax.swing.JComboBox; 11 | import javax.swing.JLabel; 12 | import javax.swing.JPanel; 13 | import javax.swing.JScrollPane; 14 | import javax.swing.border.EtchedBorder; 15 | 16 | import org.influxdb.InfluxDB; 17 | import org.influxdb.dto.Query; 18 | import org.influxdb.dto.QueryResult; 19 | import org.influxdb.dto.QueryResult.Result; 20 | import org.influxdb.dto.QueryResult.Series; 21 | 22 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 23 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 24 | import com.entropiadevelopments.influxdbworkbench.gui.common.TableRecord; 25 | 26 | import info.clearthought.layout.TableLayout; 27 | 28 | public class ShowTagValueActionPanel extends ActionPanel implements ActionListener{ 29 | 30 | private static final long serialVersionUID = 1L; 31 | private InfluxDBConnection connection; 32 | private String mesurementName; 33 | private String databaseName; 34 | private boolean layedOut; 35 | 36 | private JScrollPane tablePanel; 37 | private TagKeysValuesTable tagKeysValuesTable; 38 | private JPanel topPanel; 39 | private JComboBox keyCombo; 40 | private HashMap> reultsHashMap; 41 | 42 | 43 | public ShowTagValueActionPanel(InfluxDBConnection connection, String mesurementName, String databaseName) { 44 | 45 | super(connection.getConnectionName () + "."+ mesurementName +".tagValues", "TagValues.png"); 46 | 47 | this.connection = connection; 48 | this.mesurementName = mesurementName; 49 | this.databaseName = databaseName; 50 | reultsHashMap = new HashMap>(); 51 | layedOut = false; 52 | 53 | 54 | setBorder(new EtchedBorder()); 55 | setLayout(new BorderLayout()); 56 | 57 | initComponets(); 58 | layoutConponents(); 59 | runQuery(); 60 | 61 | setLayout(new BorderLayout()); 62 | 63 | add(topPanel, BorderLayout.NORTH); 64 | add(tablePanel, BorderLayout.CENTER); 65 | layedOut = true; 66 | } 67 | private void layoutConponents() { 68 | 69 | topPanel = new JPanel(); 70 | double border = 1; 71 | double size[][] = { { border, 80, border, 100 ,TableLayout.FILL }, 72 | { border, 30, border } }; 73 | topPanel.setLayout(new TableLayout(size)); 74 | topPanel.add( new JLabel("Tag Keys: ") ,"1,1"); 75 | topPanel.add( keyCombo ,"3,1"); 76 | 77 | 78 | } 79 | private void initComponets() { 80 | keyCombo = new JComboBox (); 81 | 82 | keyCombo.addActionListener(this); 83 | tagKeysValuesTable = new TagKeysValuesTable(); 84 | 85 | 86 | tablePanel = new JScrollPane(tagKeysValuesTable); 87 | } 88 | 89 | @Override 90 | public void runQuery(){ 91 | tagKeysValuesTable.removeAllRows(); 92 | keyCombo.removeAllItems(); 93 | ArrayList tagKeyList = getAllKeys(); 94 | for (String key: tagKeyList){ 95 | ArrayList values = new ArrayList(); 96 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 97 | InfluxDB influxDB = facility.getInfluxDB(connection); 98 | Query query = new Query("SHOW TAG VALUES FROM \""+mesurementName +"\" WITH KEY = \""+key+ "\"", databaseName); 99 | QueryResult reuslt = influxDB.query(query); 100 | for (Result result : reuslt.getResults()){ 101 | for (Series series: result.getSeries()){ 102 | int num =1; 103 | for(List list : series.getValues()){ 104 | values.add(new TagKeyValuesRecord(num,(String)list.get(1))); 105 | num++; 106 | } 107 | } 108 | } 109 | reultsHashMap.put(key, values); 110 | } 111 | for (TableRecord record: reultsHashMap.get(keyCombo.getSelectedItem())){ 112 | tagKeysValuesTable.addTableRecord(record); 113 | } 114 | } 115 | 116 | private ArrayList getAllKeys(){ 117 | ArrayList tagList = new ArrayList(); 118 | InfluxDBFacility facility = InfluxDBFacility.getFacilityReference(); 119 | InfluxDB influxDB = facility.getInfluxDB(connection); 120 | Query query = new Query("SHOW TAG KEYS FROM \""+mesurementName +"\" ", databaseName); 121 | QueryResult reuslt = influxDB.query(query); 122 | 123 | for (Result result : reuslt.getResults()) { 124 | for (Series series: result.getSeries()){ 125 | for(List list : series.getValues()){ 126 | tagList.add((String)list.get(0)); 127 | keyCombo.addItem((String)list.get(0)); 128 | } 129 | } 130 | } 131 | return tagList; 132 | } 133 | @Override 134 | public void actionPerformed(ActionEvent actionEvent) { 135 | if(layedOut){ 136 | if(actionEvent.getSource().equals(keyCombo)){ 137 | tagKeysValuesTable.removeAllRows(); 138 | ArrayList records = reultsHashMap.get(keyCombo.getSelectedItem()); 139 | if (records != null) { 140 | for(TableRecord record : records) { 141 | tagKeysValuesTable.addTableRecord(record); 142 | } 143 | } 144 | } 145 | } 146 | } 147 | class TagKeyValuesRecord implements TableRecord{ 148 | private int num; 149 | private String tagKey; 150 | 151 | public TagKeyValuesRecord(int num, String tagKey) { 152 | this.num = num; 153 | this.tagKey = tagKey; 154 | } 155 | @Override 156 | public Object getFieldAt(int fieldIndex) { 157 | if (fieldIndex == 0) return num; 158 | if (fieldIndex == 1) return tagKey; 159 | return null; 160 | } 161 | 162 | @Override 163 | public int getNumberOfField() { 164 | return 2; 165 | } 166 | 167 | @Override 168 | public void setFieldAt(int fieldIndex, Object field) { 169 | } 170 | } 171 | 172 | 173 | } 174 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/ShowUsersActionPanel.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | public class ShowUsersActionPanel extends ActionPanel{ 4 | 5 | private static final long serialVersionUID = -624272778516469677L; 6 | 7 | public ShowUsersActionPanel() { 8 | super("RespberryPi.users", "Users.png"); 9 | } 10 | 11 | @Override 12 | public void runQuery() { 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/TagKeysTable.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.Color; 4 | import java.util.ArrayList; 5 | 6 | import javax.swing.table.JTableHeader; 7 | 8 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTable; 9 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTableModel; 10 | 11 | public class TagKeysTable extends EnhancedTable{ 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public TagKeysTable(){ 16 | 17 | setGridColor(Color.LIGHT_GRAY); 18 | setShowHorizontalLines(true); 19 | setShowVerticalLines(true); 20 | JTableHeader header = getTableHeader(); 21 | header.setBackground(Color.LIGHT_GRAY); 22 | setTableHeader(header); 23 | ArrayList nameOfColums = new ArrayList (); 24 | nameOfColums.add("#"); 25 | nameOfColums.add("Tag Key"); 26 | EnhancedTableModel tableModel = new EnhancedTableModel(nameOfColums); 27 | setModel(tableModel); 28 | } 29 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actionpanels/TagKeysValuesTable.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels; 2 | 3 | import java.awt.Color; 4 | import java.util.ArrayList; 5 | 6 | import javax.swing.table.JTableHeader; 7 | 8 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTable; 9 | import com.entropiadevelopments.influxdbworkbench.gui.common.EnhancedTableModel; 10 | 11 | public class TagKeysValuesTable extends EnhancedTable{ 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public TagKeysValuesTable() { 16 | 17 | setGridColor(Color.LIGHT_GRAY); 18 | setShowHorizontalLines(true); 19 | setShowVerticalLines(true); 20 | JTableHeader header = getTableHeader(); 21 | header.setBackground(Color.LIGHT_GRAY); 22 | setTableHeader(header); 23 | ArrayList nameOfColums = new ArrayList(); 24 | nameOfColums.add("#"); 25 | nameOfColums.add("Tag Value"); 26 | EnhancedTableModel tableModel = new EnhancedTableModel(nameOfColums); 27 | setModel(tableModel); 28 | } 29 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/AboutAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | 4 | import java.awt.event.ActionEvent; 5 | 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 8 | 9 | public class AboutAction extends BasicAbstractAction{ 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | 13 | public AboutAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 14 | super("AboutAction", null, null,workAreaReference, treePanelReference); 15 | } 16 | 17 | @Override 18 | public void actionPerformed(ActionEvent event) { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/AllowUntrustedSLLAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class AllowUntrustedSLLAction extends BasicAbstractAction{ 9 | 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | 13 | public AllowUntrustedSLLAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 14 | super("Allow Untrusted SLL", null, null, workAreaReference, treePanelReference); 15 | } 16 | 17 | @Override 18 | public void actionPerformed(ActionEvent event) { 19 | } 20 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/BasicAbstractAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.Color; 4 | 5 | import javax.swing.AbstractAction; 6 | import javax.swing.BorderFactory; 7 | import javax.swing.ToolTipManager; 8 | import javax.swing.UIManager; 9 | import javax.swing.border.Border; 10 | 11 | import com.entropiadevelopments.influxdbworkbench.gui.common.GuiToolkit; 12 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 13 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 14 | 15 | public abstract class BasicAbstractAction extends AbstractAction { 16 | 17 | private static final long serialVersionUID = -9098489003565895768L; 18 | 19 | private String iconName; 20 | private String name; 21 | protected InfluxDBWorkArea workAreaReference; 22 | protected InfluxDBTreePanel treePanelReference; 23 | 24 | public BasicAbstractAction(String name, String iconName, String tooltip, InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference) { 25 | 26 | this.iconName = iconName; 27 | this.name = name; 28 | this.workAreaReference = workAreaReference; 29 | this.treePanelReference = treePanelReference; 30 | if (name != null) { 31 | putValue(AbstractAction.NAME,name); 32 | } 33 | if (iconName != null) { 34 | this.putValue(AbstractAction.SMALL_ICON, GuiToolkit.getIcon(iconName)); 35 | } 36 | if (tooltip != null) { 37 | this.putValue(AbstractAction.SHORT_DESCRIPTION,tooltip); 38 | } 39 | setupUI(); 40 | } 41 | public void setupUI() { 42 | UIManager.put("ToolTip.background", Color.LIGHT_GRAY); 43 | ToolTipManager.sharedInstance().setInitialDelay(500); 44 | Border border = BorderFactory.createLineBorder(new Color(76,79,83)); // The color is #4c4f53. 45 | UIManager.put("ToolTip.border", border); 46 | UIManager.put("ToolTip.font", GuiToolkit.getFont()); 47 | } 48 | public String getIconName () { 49 | return iconName; 50 | 51 | } 52 | public String getName () { 53 | return name; 54 | } 55 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/CreateDataBaseAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | import javax.swing.JFrame; 5 | import javax.swing.SwingUtilities; 6 | 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 8 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 9 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.CreateDatabaseDialog; 10 | 11 | public class CreateDataBaseAction extends BasicAbstractAction{ 12 | 13 | private static final long serialVersionUID = 5467740924384849511L; 14 | 15 | public CreateDataBaseAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 16 | super("Create DataBase", "CreateDataBase.png", "Create DataBase", workAreaReference, treePanelReference); 17 | } 18 | 19 | @Override 20 | public void actionPerformed(ActionEvent event) { 21 | CreateDatabaseDialog dialog = new CreateDatabaseDialog((JFrame) SwingUtilities.getRoot(treePanelReference),treePanelReference ); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/DiagnosticsAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | 4 | import java.awt.event.ActionEvent; 5 | 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 8 | 9 | 10 | public class DiagnosticsAction extends BasicAbstractAction{ 11 | 12 | private static final long serialVersionUID = 5467740924384849511L; 13 | public DiagnosticsAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 14 | super("Show Users", "Diagnostics.png", "Show Users",workAreaReference, treePanelReference); 15 | } 16 | 17 | @Override 18 | public void actionPerformed(ActionEvent event) { 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/DisconnectAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 6 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 8 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 9 | 10 | public class DisconnectAction extends BasicAbstractAction{ 11 | 12 | private static final long serialVersionUID = 5467740924384849511L; 13 | 14 | public DisconnectAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 15 | super("Disconnect", "Disconnect.png", "Disconnect",workAreaReference, treePanelReference); 16 | } 17 | @Override 18 | public void actionPerformed(ActionEvent event) { 19 | 20 | InfluxDBTreeElement selectedTreeElement = treePanelReference.getSelectedTreeElement(); 21 | if(selectedTreeElement != null) { 22 | InfluxDBConnection connection = selectedTreeElement.getConnection(); 23 | treePanelReference.disconnectServer(connection); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/DropDatabaseAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import javax.swing.JFrame; 6 | import javax.swing.JOptionPane; 7 | import javax.swing.SwingUtilities; 8 | 9 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 10 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBDataBase; 11 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 12 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 13 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 14 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 15 | 16 | public class DropDatabaseAction extends BasicAbstractAction { 17 | 18 | private static final long serialVersionUID = 5467740924384849511L; 19 | 20 | public DropDatabaseAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference) { 21 | super("Drop Database", "DropDatabase.png", "Drop Database", workAreaReference, treePanelReference); 22 | } 23 | 24 | @Override 25 | public void actionPerformed(ActionEvent event) { 26 | 27 | InfluxDBTreeElement selectedTreeElement = treePanelReference.getSelectedTreeElement(); 28 | if (selectedTreeElement != null) { 29 | if (selectedTreeElement.getClass().equals(InfluxDBDataBase.class)) { 30 | int response = JOptionPane.showConfirmDialog((JFrame) SwingUtilities.getWindowAncestor(workAreaReference), "Do you want delete database ?", "Confirm", 31 | JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); 32 | if (response == JOptionPane.NO_OPTION) { 33 | return; 34 | } else if (response == JOptionPane.YES_OPTION) { 35 | String databaseName = ((InfluxDBDataBase) selectedTreeElement).getID(); 36 | InfluxDBConnection connection = selectedTreeElement.getConnection(); 37 | InfluxDBFacility.getFacilityReference().getInfluxDB(connection).deleteDatabase(databaseName); 38 | treePanelReference.removeNode(selectedTreeElement); 39 | } else if (response == JOptionPane.CLOSED_OPTION) { 40 | return; 41 | } 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/DropMeasuramentAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import javax.swing.JOptionPane; 6 | import javax.swing.SwingUtilities; 7 | 8 | import org.influxdb.dto.Query; 9 | 10 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 11 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBMeasuramet; 12 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 13 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 14 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 15 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 16 | 17 | public class DropMeasuramentAction extends BasicAbstractAction{ 18 | 19 | private static final long serialVersionUID = 5467740924384849511L; 20 | public DropMeasuramentAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 21 | super("Drop Measurament", "DropMeasurement.png", "Drop Measurament", workAreaReference, treePanelReference); 22 | } 23 | @Override 24 | public void actionPerformed(ActionEvent event) { 25 | InfluxDBTreeElement selectedTreeElement = treePanelReference.getSelectedTreeElement(); 26 | if (selectedTreeElement != null) { 27 | if (selectedTreeElement.getClass().equals(InfluxDBMeasuramet.class)) { 28 | int response = JOptionPane.showConfirmDialog(SwingUtilities.getRoot(treePanelReference), 29 | "Do you want drop measurament?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); 30 | if (response == JOptionPane.NO_OPTION) { 31 | return; 32 | 33 | } else if (response == JOptionPane.YES_OPTION){ 34 | String measuramentName = ((InfluxDBMeasuramet) selectedTreeElement).toString(); 35 | String databaseName = ((InfluxDBMeasuramet) selectedTreeElement).getDatabase(); 36 | InfluxDBConnection connection = selectedTreeElement.getConnection(); 37 | Query query = new Query("DROP MEASUREMENT \""+measuramentName+"\"", databaseName); 38 | InfluxDBFacility.getFacilityReference().getInfluxDB(connection).query(query); 39 | treePanelReference.removeNode(selectedTreeElement); 40 | 41 | } else if (response == JOptionPane.CLOSED_OPTION) { 42 | return; 43 | } 44 | } 45 | } 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/DropSeriesAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import javax.swing.JOptionPane; 6 | import javax.swing.SwingUtilities; 7 | 8 | import org.influxdb.dto.Query; 9 | 10 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBConnection; 11 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBMeasuramet; 12 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 13 | import com.entropiadevelopments.influxdbworkbench.facility.InfluxDBFacility; 14 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 15 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 16 | 17 | public class DropSeriesAction extends BasicAbstractAction { 18 | 19 | private static final long serialVersionUID = 5467740924384849511L; 20 | 21 | public DropSeriesAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference) { 22 | super("Drop Series", "DropSeries.png", "Drop Series", workAreaReference, treePanelReference); 23 | } 24 | 25 | @Override 26 | public void actionPerformed(ActionEvent event) { 27 | InfluxDBTreeElement selectedTreeElement = treePanelReference.getSelectedTreeElement(); 28 | if (selectedTreeElement != null) { 29 | if (selectedTreeElement.getClass().equals(InfluxDBMeasuramet.class)) { 30 | int response = JOptionPane.showConfirmDialog(SwingUtilities.getRoot(treePanelReference), 31 | "Do you want drop series?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); 32 | if (response == JOptionPane.NO_OPTION) { 33 | return; 34 | } else if (response == JOptionPane.YES_OPTION) { 35 | 36 | String masuramentName = ((InfluxDBMeasuramet) selectedTreeElement).toString(); 37 | String databaseName = ((InfluxDBMeasuramet) selectedTreeElement).getDatabase(); 38 | InfluxDBConnection connection = selectedTreeElement.getConnection(); 39 | Query query = new Query("DROP SERIES FROM " + masuramentName, databaseName); 40 | InfluxDBFacility.getFacilityReference().getInfluxDB(connection).query(query); 41 | 42 | } else if (response == JOptionPane.CLOSED_OPTION) { 43 | return; 44 | } 45 | } 46 | } 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/EnglishDateFormatAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | 4 | import java.awt.event.ActionEvent; 5 | 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 8 | 9 | public class EnglishDateFormatAction extends BasicAbstractAction{ 10 | 11 | 12 | private static final long serialVersionUID = 5467740924384849511L; 13 | 14 | public EnglishDateFormatAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 15 | super("12/31/2018 mm/dd/yyyy", null, null,workAreaReference, treePanelReference); 16 | } 17 | @Override 18 | public void actionPerformed(ActionEvent event) { 19 | } 20 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ExitAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class ExitAction extends BasicAbstractAction{ 9 | 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | 13 | public ExitAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 14 | super("Exit", null, null, workAreaReference, treePanelReference); 15 | } 16 | @Override 17 | public void actionPerformed(ActionEvent event) { 18 | System.exit(0); 19 | } 20 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ExportSettingstAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | 4 | import java.awt.event.ActionEvent; 5 | 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 8 | 9 | public class ExportSettingstAction extends BasicAbstractAction{ 10 | 11 | 12 | private static final long serialVersionUID = 5467740924384849511L; 13 | 14 | public ExportSettingstAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 15 | 16 | super("Settings", null, null,workAreaReference, treePanelReference); 17 | } 18 | 19 | @Override 20 | public void actionPerformed(ActionEvent event) { 21 | } 22 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ImportSettinsAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class ImportSettinsAction extends BasicAbstractAction{ 9 | 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | 13 | public ImportSettinsAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 14 | super("Settings", null, null,workAreaReference, treePanelReference); 15 | } 16 | 17 | @Override 18 | public void actionPerformed(ActionEvent event) { 19 | } 20 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/LatinDateFormatAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | 4 | import java.awt.event.ActionEvent; 5 | 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 8 | 9 | public class LatinDateFormatAction extends BasicAbstractAction{ 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | 13 | public LatinDateFormatAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference ){ 14 | super("31/12/2018 dd/mm/yyyy", null, null, workAreaReference, treePanelReference); 15 | } 16 | 17 | @Override 18 | public void actionPerformed(ActionEvent event) { 19 | } 20 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ManageAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import javax.swing.JFrame; 6 | import javax.swing.SwingUtilities; 7 | 8 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 9 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 10 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.ManageConnectionsDialog; 11 | 12 | public class ManageAction extends BasicAbstractAction{ 13 | 14 | private static final long serialVersionUID = 5467740924384849511L; 15 | 16 | public ManageAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 17 | super("Manage", "EditConnection.png", "Manage connections",workAreaReference, treePanelReference); 18 | } 19 | 20 | @Override 21 | public void actionPerformed(ActionEvent event) { 22 | ManageConnectionsDialog dialog = new ManageConnectionsDialog((JFrame)SwingUtilities.getRoot(treePanelReference), treePanelReference); 23 | } 24 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/NewQueryAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | 4 | import java.awt.event.ActionEvent; 5 | 6 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBMeasuramet; 7 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 8 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 9 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 10 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.NewQueryActionPanel; 11 | 12 | public class NewQueryAction extends BasicAbstractAction{ 13 | 14 | private static final long serialVersionUID = 5467740924384849511L; 15 | public NewQueryAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 16 | super("New Query", "NewQuery.png", "New Query", workAreaReference, treePanelReference); 17 | } 18 | 19 | @Override 20 | public void actionPerformed(ActionEvent event) { 21 | 22 | InfluxDBTreeElement treeElement = treePanelReference.getSelectedTreeElement(); 23 | String measuramentName = "measurament"; 24 | String database = ""; 25 | if (treeElement != null) { 26 | if (treeElement.getClass().equals(InfluxDBMeasuramet.class)) { 27 | measuramentName = treeElement.toString(); 28 | database = ((InfluxDBMeasuramet)treeElement).getDatabase(); 29 | 30 | } 31 | workAreaReference.addWorkPanel(new NewQueryActionPanel(treeElement.getConnection(), measuramentName, database)); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/RefreshAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class RefreshAction extends BasicAbstractAction{ 9 | 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | public RefreshAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 13 | super("Refresh", "Refresh.png", "Refresh", workAreaReference, treePanelReference); 14 | } 15 | 16 | @Override 17 | public void actionPerformed(ActionEvent event) { 18 | 19 | treePanelReference.refresh(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/RunBackFillAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class RunBackFillAction extends BasicAbstractAction{ 9 | 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | 13 | 14 | public RunBackFillAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 15 | super("Run Back Fill", "BackFill.png", "Run Back Fill", workAreaReference, treePanelReference); 16 | } 17 | 18 | @Override 19 | public void actionPerformed(ActionEvent event) { 20 | } 21 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/RunQueryAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class RunQueryAction extends BasicAbstractAction{ 9 | 10 | private static final long serialVersionUID = 5467740924384849511L; 11 | 12 | 13 | public RunQueryAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference ){ 14 | super("Run Query", "RunQuery.png", "Run Query", workAreaReference, treePanelReference); 15 | 16 | } 17 | 18 | @Override 19 | public void actionPerformed(ActionEvent event) { 20 | workAreaReference.runQuery(); 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowContinuousQueriesAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class ShowContinuousQueriesAction extends BasicAbstractAction{ 9 | 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | public ShowContinuousQueriesAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 13 | super("Show Continuous Queries", "ContinuousQuery.png", "Show Continuous Queries", workAreaReference, treePanelReference); 14 | } 15 | 16 | @Override 17 | public void actionPerformed(ActionEvent event) { 18 | } 19 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowDiagnosticsAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.ShowDiagnosticsActionPanel; 8 | 9 | public class ShowDiagnosticsAction extends BasicAbstractAction{ 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | public ShowDiagnosticsAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 13 | super("Show Diagnostics", "Diagnostics.png", "Show Diagnostics",workAreaReference, treePanelReference); 14 | } 15 | @Override 16 | public void actionPerformed(ActionEvent e) { 17 | workAreaReference.addWorkPanel(new ShowDiagnosticsActionPanel(null)); 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowFieldKeysAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBMeasuramet; 6 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 8 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 9 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.ShowFieldKeysActionPanel; 10 | 11 | public class ShowFieldKeysAction extends BasicAbstractAction{ 12 | 13 | private static final long serialVersionUID = 5467740924384849511L; 14 | public ShowFieldKeysAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 15 | super("Show Field Keys", "FieldKeys.png", "Show Field Keys", workAreaReference, treePanelReference); 16 | 17 | } 18 | 19 | @Override 20 | public void actionPerformed(ActionEvent event) { 21 | InfluxDBTreeElement treeElement = treePanelReference.getSelectedTreeElement(); 22 | String measuramentName = "measurament"; 23 | String database = ""; 24 | if (treeElement != null) { 25 | if (treeElement.getClass().equals(InfluxDBMeasuramet.class)) { 26 | measuramentName = treeElement.toString(); 27 | database = ((InfluxDBMeasuramet)treeElement).getDatabase(); 28 | } 29 | workAreaReference.addWorkPanel(new ShowFieldKeysActionPanel(treeElement.getConnection(), measuramentName, database)); 30 | } 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowQueriesAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class ShowQueriesAction extends BasicAbstractAction{ 9 | 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | public ShowQueriesAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 13 | super("Show Queries", "ShowQueries.png", "Show Queries",workAreaReference, treePanelReference); 14 | } 15 | 16 | @Override 17 | public void actionPerformed(ActionEvent event) { 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowRetentionPoliciesAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 8 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.RetentionPolicyPanel; 9 | 10 | public class ShowRetentionPoliciesAction extends BasicAbstractAction{ 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | public ShowRetentionPoliciesAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 13 | super("Show Retention Policies", "RetentionPolicy.png", "Show Retention Policies",workAreaReference, treePanelReference); 14 | } 15 | 16 | @Override 17 | public void actionPerformed(ActionEvent event) { 18 | InfluxDBTreeElement treeElement = treePanelReference.getSelectedTreeElement(); 19 | if ( treeElement !=null) { 20 | workAreaReference.addWorkPanel(new RetentionPolicyPanel(treePanelReference,treeElement.getConnection())); 21 | } 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowSeriesAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBMeasuramet; 6 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 8 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 9 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.ShowSeriesPanel; 10 | 11 | public class ShowSeriesAction extends BasicAbstractAction{ 12 | 13 | private static final long serialVersionUID = 5467740924384849511L; 14 | public ShowSeriesAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 15 | super("Show Series", "Series.png", "Show Series", workAreaReference, treePanelReference); 16 | } 17 | 18 | @Override 19 | public void actionPerformed(ActionEvent event) { 20 | InfluxDBTreeElement treeElement = treePanelReference.getSelectedTreeElement(); 21 | String measuramentName = "measurament"; 22 | String database = ""; 23 | if(treeElement != null){ 24 | if (treeElement.getClass().equals(InfluxDBMeasuramet.class)) { 25 | measuramentName = treeElement.toString(); 26 | database = ((InfluxDBMeasuramet)treeElement).getDatabase(); 27 | } 28 | workAreaReference.addWorkPanel(new ShowSeriesPanel(treeElement.getConnection(), measuramentName, database)); 29 | } 30 | } 31 | } 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowStaticsAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class ShowStaticsAction extends BasicAbstractAction{ 9 | 10 | private static final long serialVersionUID = 5467740924384849511L; 11 | 12 | public ShowStaticsAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 13 | super("Show Statics", "Stats.png", "Show Statics", workAreaReference, treePanelReference); 14 | this.workAreaReference = workAreaReference; 15 | } 16 | 17 | @Override 18 | public void actionPerformed(ActionEvent event) { 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowTagKeysAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBMeasuramet; 6 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 8 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 9 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.ShowTagKeysActionPanel; 10 | 11 | public class ShowTagKeysAction extends BasicAbstractAction { 12 | 13 | private static final long serialVersionUID = 5467740924384849511L; 14 | public ShowTagKeysAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 15 | super("Show Tag Keys", "TagKeys.png","Show Tag Keys",workAreaReference,treePanelReference); 16 | } 17 | 18 | @Override 19 | public void actionPerformed(ActionEvent event) { 20 | InfluxDBTreeElement treeElement = treePanelReference.getSelectedTreeElement(); 21 | String measuramentName = "measurament"; 22 | String database = ""; 23 | if(treeElement != null){ 24 | if (treeElement.getClass().equals(InfluxDBMeasuramet.class)) { 25 | measuramentName = treeElement.toString(); 26 | database = ((InfluxDBMeasuramet)treeElement).getDatabase(); 27 | } 28 | workAreaReference.addWorkPanel(new ShowTagKeysActionPanel(treeElement.getConnection(), measuramentName, database)); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowTagValuesAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBMeasuramet; 6 | import com.entropiadevelopments.influxdbworkbench.datamodel.InfluxDBTreeElement; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 8 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 9 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.ShowTagValueActionPanel; 10 | 11 | public class ShowTagValuesAction extends BasicAbstractAction { 12 | private static final long serialVersionUID = 5467740924384849511L; 13 | public ShowTagValuesAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference) { 14 | super("Show Tag Values", "TagValues.png", "Show Tag Values",workAreaReference, treePanelReference); 15 | } 16 | @Override 17 | public void actionPerformed(ActionEvent event) { 18 | InfluxDBTreeElement treeElement = treePanelReference.getSelectedTreeElement(); 19 | String measuramentName = "measurament"; 20 | String database = ""; 21 | if (treeElement != null) { 22 | if (treeElement.getClass().equals(InfluxDBMeasuramet.class)) { 23 | measuramentName = treeElement.toString(); 24 | database = ((InfluxDBMeasuramet) treeElement).getDatabase(); 25 | } 26 | workAreaReference 27 | .addWorkPanel(new ShowTagValueActionPanel(treeElement.getConnection(), measuramentName, database)); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/ShowUsersAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.actionpanels.ShowUsersActionPanel; 8 | 9 | public class ShowUsersAction extends BasicAbstractAction{ 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | public ShowUsersAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 13 | super("Show Users", "Users.png", "Show Users",workAreaReference, treePanelReference); 14 | } 15 | 16 | @Override 17 | public void actionPerformed(ActionEvent event) { 18 | workAreaReference.addWorkPanel(new ShowUsersActionPanel()); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/Time12hFormatAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 7 | 8 | public class Time12hFormatAction extends BasicAbstractAction{ 9 | 10 | 11 | private static final long serialVersionUID = 5467740924384849511L; 12 | public Time12hFormatAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 13 | super("2:30:45 PM 12 Hour", null, null,workAreaReference, treePanelReference); 14 | } 15 | 16 | public void actionPerformed(ActionEvent event) { 17 | } 18 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/components/actions/Time24hFormatAction.java: -------------------------------------------------------------------------------- 1 | package com.entropiadevelopments.influxdbworkbench.gui.components.actions; 2 | 3 | 4 | import java.awt.event.ActionEvent; 5 | 6 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBTreePanel; 7 | import com.entropiadevelopments.influxdbworkbench.gui.components.InfluxDBWorkArea; 8 | 9 | public class Time24hFormatAction extends BasicAbstractAction{ 10 | 11 | 12 | private static final long serialVersionUID = 5467740924384849511L; 13 | public Time24hFormatAction(InfluxDBWorkArea workAreaReference, InfluxDBTreePanel treePanelReference){ 14 | super("14:30:45 24 Hour", null, null,workAreaReference, treePanelReference); 15 | } 16 | 17 | @Override 18 | public void actionPerformed(ActionEvent event) { 19 | } 20 | } -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/BackFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/BackFill.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Connection.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/ContinuousQuery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/ContinuousQuery.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateConnection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateConnection.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateContinuousQuery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateContinuousQuery.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateDatabase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateDatabase.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateRetentionPolicy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateRetentionPolicy.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateUser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/CreateUser.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Database.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Date.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Diagnostics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Diagnostics.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Disconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Disconnect.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropContinuousQuery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropContinuousQuery.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropDatabase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropDatabase.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropMeasurement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropMeasurement.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropRetentionPolicy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropRetentionPolicy.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropSeries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropSeries.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropUser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/DropUser.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/EditConnection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/EditConnection.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/EditPrivilege.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/EditPrivilege.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/EditRetentionPolicy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/EditRetentionPolicy.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/EditUser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/EditUser.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/FieldKeys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/FieldKeys.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/GrantPrivilege.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/GrantPrivilege.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/InfluxDBWorkBench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/InfluxDBWorkBench.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Info.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/KillQuery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/KillQuery.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Measurement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Measurement.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/NewQuery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/NewQuery.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Password.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Refresh.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/RetentionPolicy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/RetentionPolicy.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/RunQuery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/RunQuery.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Series.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Series.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/ShowQueries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/ShowQueries.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/ShowSeries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/ShowSeries.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Stats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Stats.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/TagKeys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/TagKeys.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/TagValues.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/TagValues.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Time.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Users.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/Users.png -------------------------------------------------------------------------------- /src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorgeMaker/InfluxDBWorkBench/30799adbc2cfc81b095af8b470b4e7046f737b60/src/com/entropiadevelopments/influxdbworkbench/gui/resources/icons/empty.png -------------------------------------------------------------------------------- /src/info/clearthought/layout/TableLayoutConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ==================================================================== 3 | * 4 | * The Clearthought Software License, Version 1.0 5 | * 6 | * Copyright (c) 2001 Daniel Barbalace. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. The original software may not be altered. However, the classes 16 | * provided may be subclasses as long as the subclasses are not 17 | * packaged in the info.clearthought package or any subpackage of 18 | * info.clearthought. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, AFFILATED BUSINESSES, 24 | * OR ANYONE ELSE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 27 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 30 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * ==================================================================== 33 | */ 34 | 35 | package info.clearthought.layout; 36 | 37 | 38 | 39 | /** 40 | * TableLayoutConstants define the constants used by all the TableLayout 41 | * classes. 42 | * 43 | * @version 2.0 11/4/03 44 | * @author Daniel E. Barbalace 45 | */ 46 | 47 | public interface TableLayoutConstants { 48 | 49 | 50 | 51 | /** Indicates that the component is left justified in its cell */ 52 | public static final int LEFT = 0; 53 | 54 | /** Indicates that the component is top justified in its cell */ 55 | public static final int TOP = 0; 56 | 57 | /** Indicates that the component is centered in its cell */ 58 | public static final int CENTER = 1; 59 | 60 | /** Indicates that the component is full justified in its cell */ 61 | public static final int FULL = 2; 62 | 63 | /** Indicates that the component is bottom justified in its cell */ 64 | public static final int BOTTOM = 3; 65 | 66 | /** Indicates that the component is right justified in its cell */ 67 | public static final int RIGHT = 3; 68 | 69 | /** Indicates that the component is leading justified in its cell. 70 | Leading justification means components are left justified if their container 71 | is left-oriented and right justified if their container is right-oriented. 72 | Trailing justification is opposite. 73 | see java.awt.Component#getComponentOrientation */ 74 | public static final int LEADING = 4; 75 | 76 | /** Indicates that the component is trailing justified in its cell. 77 | Trailing justification means components are right justified if their 78 | container is left-oriented and left justified if their container is 79 | right-oriented. Leading justification is opposite. 80 | see java.awt.Component#getComponentOrientation */ 81 | public static final int TRAILING = 5; 82 | 83 | /** Indicates that the row/column should fill the available space */ 84 | public static final double FILL = -1.0; 85 | 86 | /** Indicates that the row/column should be allocated just enough space to 87 | accomidate the preferred size of all components contained completely within 88 | this row/column. */ 89 | public static final double PREFERRED = -2.0; 90 | 91 | /** Indicates that the row/column should be allocated just enough space to 92 | accomidate the minimum size of all components contained completely within 93 | this row/column. */ 94 | public static final double MINIMUM = -3.0; 95 | 96 | /** Minimum value for an alignment */ 97 | public static final int MIN_ALIGN = 0; 98 | 99 | /** Maximum value for an alignment */ 100 | public static final int MAX_ALIGN = 3; 101 | 102 | 103 | 104 | } 105 | -------------------------------------------------------------------------------- /src/info/clearthought/layout/TableLayoutConstraints.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ==================================================================== 3 | * 4 | * The Clearthought Software License, Version 1.0 5 | * 6 | * Copyright (c) 2001 Daniel Barbalace. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. The original software may not be altered. However, the classes 16 | * provided may be subclasses as long as the subclasses are not 17 | * packaged in the info.clearthought package or any subpackage of 18 | * info.clearthought. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, AFFILATED BUSINESSES, 24 | * OR ANYONE ELSE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 27 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 30 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * ==================================================================== 33 | */ 34 | 35 | package info.clearthought.layout; 36 | 37 | 38 | 39 | import java.util.*; 40 | 41 | 42 | 43 | /** 44 | * TableLayoutConstraints binds components to their constraints. 45 | * 46 | * @version 1.1 4/4/02 47 | * @author Daniel E. Barbalace 48 | */ 49 | 50 | public class TableLayoutConstraints implements TableLayoutConstants { 51 | 52 | 53 | 54 | /** Cell in which the upper left corner of the component lays */ 55 | public int col1, row1; 56 | 57 | /** Cell in which the lower right corner of the component lays */ 58 | public int col2, row2; 59 | 60 | /** Horizontal justification if component occupies just one cell */ 61 | public int hAlign; 62 | 63 | /** Verical justification if component occupies just one cell */ 64 | public int vAlign; 65 | 66 | 67 | 68 | /** 69 | * Constructs an TableLayoutConstraints with the default settings. This 70 | * constructor is equivalent to TableLayoutConstraints(0, 0, 0, 0, FULL, FULL). 71 | */ 72 | 73 | public TableLayoutConstraints() { 74 | col1 = row1 = col2 = col2 = 0; 75 | hAlign = vAlign = FULL; 76 | } 77 | 78 | 79 | 80 | /** 81 | * Constructs an TableLayoutConstraints from a string. 82 | * 83 | * @param constraints indicates TableLayoutConstraints's position and justification 84 | * as a string in the form "row, column" or 85 | * "row, column, horizontal justification, vertical 86 | * justification" or "row 1, column 1, row 2, column 2". 87 | * It is also acceptable to delimit the paramters with 88 | * spaces instead of commas. 89 | */ 90 | 91 | public TableLayoutConstraints(String constraints) { 92 | // Use default values for any parameter not specified or specified 93 | // incorrectly. The default parameters place the component in a single 94 | // cell at column 0, row 0. The component is fully justified. 95 | col1 = 0; 96 | row1 = 0; 97 | col2 = 0; 98 | row2 = 0; 99 | hAlign = FULL; 100 | vAlign = FULL; 101 | 102 | // Parse constraints using spaces or commas 103 | StringTokenizer st = new StringTokenizer(constraints, ", "); 104 | int numToken = st.countTokens(); 105 | 106 | try { 107 | // Check constraints 108 | if ((numToken != 2) && (numToken != 4) && (numToken != 6)) 109 | throw new RuntimeException(); 110 | 111 | // Get the first column (assume component is in only one column) 112 | String tokenA = st.nextToken(); 113 | col1 = new Integer(tokenA).intValue(); 114 | col2 = col1; 115 | 116 | // Get the first row (assume component is in only one row) 117 | String tokenB = st.nextToken(); 118 | row1 = new Integer(tokenB).intValue(); 119 | row2 = row1; 120 | 121 | // Get next two tokens 122 | tokenA = st.nextToken(); 123 | tokenB = st.nextToken(); 124 | 125 | try { 126 | // Attempt to use tokens A and B as col2 and row2 127 | col2 = new Integer(tokenA).intValue(); 128 | row2 = new Integer(tokenB).intValue(); 129 | 130 | // Get next two tokens 131 | tokenA = st.nextToken(); 132 | tokenB = st.nextToken(); 133 | } 134 | catch (NumberFormatException error) { 135 | col2 = col1; 136 | row2 = row1; 137 | } 138 | 139 | // Check if token means horizontally justification the component 140 | if ((tokenA.equalsIgnoreCase("L")) || (tokenA.equalsIgnoreCase("LEFT"))) 141 | hAlign = LEFT; 142 | else if ((tokenA.equalsIgnoreCase("C")) || 143 | (tokenA.equalsIgnoreCase("CENTER"))) 144 | hAlign = CENTER; 145 | else if ((tokenA.equalsIgnoreCase("F")) || 146 | (tokenA.equalsIgnoreCase("FULL"))) 147 | hAlign = FULL; 148 | else if ((tokenA.equalsIgnoreCase("R")) || 149 | (tokenA.equalsIgnoreCase("RIGHT"))) 150 | hAlign = RIGHT; 151 | else if ((tokenA.equalsIgnoreCase("LD")) || 152 | (tokenA.equalsIgnoreCase("LEADING"))) 153 | hAlign = LEADING; 154 | else if ((tokenA.equalsIgnoreCase("TL")) || 155 | (tokenA.equalsIgnoreCase("TRAILING"))) 156 | hAlign = TRAILING; 157 | else 158 | throw new RuntimeException(); 159 | 160 | // Check if token means horizontally justification the component 161 | if ((tokenB.equalsIgnoreCase("T")) || (tokenB.equalsIgnoreCase("TOP"))) 162 | vAlign = TOP; 163 | else if ((tokenB.equalsIgnoreCase("C")) || 164 | (tokenB.equalsIgnoreCase("CENTER"))) 165 | vAlign = CENTER; 166 | else if ((tokenB.equalsIgnoreCase("F")) || 167 | (tokenB.equalsIgnoreCase("FULL"))) 168 | vAlign = FULL; 169 | else if ((tokenB.equalsIgnoreCase("B")) || 170 | (tokenB.equalsIgnoreCase("BOTTOM"))) 171 | vAlign = BOTTOM; 172 | else 173 | throw new RuntimeException(); 174 | } 175 | catch (NoSuchElementException error) {} 176 | catch (RuntimeException error) { 177 | throw new IllegalArgumentException 178 | ("Expected constraints in one of the following formats:\n" + 179 | " col1, row1\n col1, row1, col2, row2\n" + 180 | " col1, row1, hAlign, vAlign\n" + 181 | " col1, row1, col2, row2, hAlign, vAlign\n" + 182 | "Constraints provided '" + constraints + "'"); 183 | } 184 | 185 | // Make sure row2 >= row1 186 | if (row2 < row1) 187 | row2 = row1; 188 | 189 | // Make sure col2 >= col1 190 | if (col2 < col1) 191 | col2 = col1; 192 | } 193 | 194 | 195 | 196 | /** 197 | * Constructs an TableLayoutConstraints a set of constraints. 198 | * 199 | * @param col1 column where upper-left cornor of the component is placed 200 | * @param row1 row where upper-left cornor of the component is placed 201 | * @param col2 column where lower-right cornor of the component is placed 202 | * @param row2 row where lower-right cornor of the component is placed 203 | * @param hAlign horizontal justification of a component in a single cell 204 | * @param vAlign vertical justification of a component in a single cell 205 | */ 206 | 207 | public TableLayoutConstraints 208 | (int col1, int row1, int col2, int row2, int hAlign, int vAlign) { 209 | this.col1 = col1; 210 | this.row1 = row1; 211 | this.col2 = col2; 212 | this.row2 = row2; 213 | 214 | if ((hAlign < MIN_ALIGN) || (hAlign > MAX_ALIGN)) 215 | this.hAlign = FULL; 216 | else 217 | this.hAlign = hAlign; 218 | 219 | if ((vAlign < MIN_ALIGN) || (vAlign > MAX_ALIGN)) 220 | this.vAlign = FULL; 221 | else 222 | this.vAlign = vAlign; 223 | } 224 | 225 | 226 | 227 | /** 228 | * Gets a string representation of this TableLayoutConstraints. 229 | * 230 | * @return a string in the form "row 1, column 1, row 2, column 2, horizontal 231 | * justification, vertical justification" 232 | */ 233 | 234 | public String toString() { 235 | StringBuffer buffer = new StringBuffer(); 236 | 237 | buffer.append(col1); 238 | buffer.append(", "); 239 | buffer.append(row1); 240 | buffer.append(", "); 241 | 242 | buffer.append(col2); 243 | buffer.append(", "); 244 | buffer.append(row2); 245 | buffer.append(", "); 246 | 247 | final String h[] = {"left", "center", "full", "right"}; 248 | final String v[] = {"top", "center", "full", "bottom"}; 249 | 250 | buffer.append(h[hAlign]); 251 | buffer.append(", "); 252 | buffer.append(v[vAlign]); 253 | 254 | return buffer.toString(); 255 | } 256 | 257 | 258 | 259 | } 260 | --------------------------------------------------------------------------------