Skip to content

Commit

Permalink
Progress
Browse files Browse the repository at this point in the history
  • Loading branch information
apryamostanov committed May 9, 2020
1 parent ca79073 commit 9a11d64
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import io.infinite.http.HttpResponse
import io.infinite.http.SenderDefaultHttps
import io.infinite.orbit.entities.User
import io.infinite.orbit.gui.forms.MainForm
import io.infinite.orbit.gui.forms.OrbitModel
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.ApplicationArguments
Expand Down Expand Up @@ -49,7 +50,7 @@ import java.awt.*
"io.infinite.ascend",
"io.infinite.orbit"
])
class OrbitGuiApp implements ApplicationRunner {
class OrbitGuiApp implements ApplicationRunner, OrbitModel {

static OrbitGuiApp instance

Expand Down Expand Up @@ -77,7 +78,7 @@ class OrbitGuiApp implements ApplicationRunner {

static Authorization adminScopeAuthorization

MainForm mainForm = new MainForm()
MainForm mainForm = new MainForm(this)

SwingBuilder swingBuilder = new SwingBuilder()

Expand Down Expand Up @@ -153,7 +154,6 @@ class OrbitGuiApp implements ApplicationRunner {
log.debug("Authorized", adminScopeAuthorization)
showPanel(panel)
scanAuthorization = true
updateAll()
} catch (Exception e) {
unauthorized(e.getMessage())
}
Expand Down Expand Up @@ -227,8 +227,9 @@ class OrbitGuiApp implements ApplicationRunner {

void updateAll() {
DefaultTableModel model = (DefaultTableModel) mainForm.jTable1.getModel()
model.rowCount = 0
getUsers().each {
model.addRow([it.id, it.guid, it.creationDate, it.phone])
model.addRow(it.id, it.guid.toString(), it.creationDate.toString(), it.phone)
}
}

Expand Down
18 changes: 15 additions & 3 deletions orbit-gui/src/main/java/io/infinite/orbit/gui/forms/MainForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
*/
public class MainForm extends javax.swing.JPanel {

OrbitModel model;

/**
* Creates new form MainForm
*/
public MainForm() {
public MainForm(OrbitModel orbitModel) {
this.model = orbitModel;
initComponents();
}

Expand All @@ -40,6 +43,11 @@ private void initComponents() {
jButton4 = new javax.swing.JButton();

jButton1.setText("♻");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
Expand All @@ -50,7 +58,7 @@ private void initComponents() {
}
) {
Class[] types = new Class [] {
java.lang.Long.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
java.lang.Long.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
};

public Class getColumnClass(int columnIndex) {
Expand Down Expand Up @@ -86,7 +94,7 @@ public Class getColumnClass(int columnIndex) {

},
new String [] {
"ID", "GUID", "OTP", "Creation Date", "Expiry Date", "Attempts Count", "Max. Attempts Count", "Duration Seconds"
"ID", "Namespace", "GUID", "OTP", "Creation Date", "Expiry Date", "Attempts Count", "Max. Attempts Count", "Duration Seconds"
}
) {
Class[] types = new Class [] {
Expand Down Expand Up @@ -135,6 +143,10 @@ public Class getColumnClass(int columnIndex) {
);
}// </editor-fold>

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
model.updateAll();
}


// Variables declaration - do not modify
public javax.swing.JButton jButton1;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.infinite.orbit.gui.forms;

public interface OrbitModel {

void updateAll();

}

0 comments on commit 9a11d64

Please sign in to comment.