mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-20 13:50:45 +00:00
Updates to labtainers
This commit is contained in:
@@ -54,7 +54,7 @@ class kde_minimal::config {
|
||||
$account = parsejson($raw_account)
|
||||
$username = $account['username']
|
||||
|
||||
file { ["/home/$username/", "/home/$username/.config/"]:
|
||||
file { ["/home/$username/", "/home/$username/.config/", "/home/$username/.config/autostart/"]:
|
||||
ensure => directory,
|
||||
owner => $username,
|
||||
group => $username,
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
A GUI for managing Labpacks, replacing the functions of makepack.
|
||||
Program created by Samuel Liao, Summer Intern '21.
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Rebuild the Labtianers Lab Editor UI
|
||||
# Use -n to supress running the UI after rebuild.
|
||||
#/src/main/java/newpackage
|
||||
javac -classpath json-simple-1.1.1.jar ../src/main/java/newpackage/NewJFrame.java -d . -Xlint:unchecked || exit
|
||||
jar cmf makepackui.mf ./makepackui.jar newpackage/*.class ../src/main/resources/* || exit
|
||||
if [[ "$1" != "-n" ]]; then
|
||||
java -jar makepackui.jar &
|
||||
fi
|
||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path: json-simple-1.1.1.jar
|
||||
Main-Class: newpackage/NewJFrame
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.mycompany</groupId>
|
||||
<artifactId>MakepackUI</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.12.7.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,908 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Component class="javax.swing.JFileChooser" name="fileChooser">
|
||||
<Properties>
|
||||
<Property name="currentDirectory" type="java.io.File" editor="org.netbeans.beaninfo.editors.FileEditor">
|
||||
<SerializedValue value="-84,-19,0,5,115,114,0,12,106,97,118,97,46,105,111,46,70,105,108,101,4,45,-92,69,14,13,-28,-1,3,0,1,76,0,4,112,97,116,104,116,0,18,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,59,120,112,116,0,38,47,104,111,109,101,47,115,116,117,100,101,110,116,47,108,97,98,116,97,105,110,101,114,47,116,114,117,110,107,47,108,97,98,112,97,99,107,115,119,2,0,47,120"/>
|
||||
</Property>
|
||||
<Property name="fileFilter" type="javax.swing.filechooser.FileFilter" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="new MyCustomFilter()" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JDialog" name="labpackinfo">
|
||||
<Events>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="labpackinfoKeyPressed"/>
|
||||
</Events>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Labpack"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="TextName" alignment="0" pref="440" max="32767" attributes="0"/>
|
||||
<Component id="TextOrder" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane3" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="Create" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="TextName" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane3" pref="137" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="TextOrder" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="Create" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="Create">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Create"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CreateActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="TextName">
|
||||
<Events>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="TextNameKeyPressed"/>
|
||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="TextNameKeyTyped"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="TextOrder">
|
||||
<Events>
|
||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="TextOrderKeyTyped"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Name:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Description:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Order:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextArea" name="TextDescription">
|
||||
<Properties>
|
||||
<Property name="columns" type="int" value="20"/>
|
||||
<Property name="rows" type="int" value="5"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JDialog" name="order_and_description">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Labpack"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="save_OandD" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane1" pref="399" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="TextOrder1" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="146" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
|
||||
<Component id="TextOrder1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="save_OandD" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="save_OandD">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Save"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="save_OandDActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="TextOrder1">
|
||||
<Events>
|
||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="TextOrder1KeyTyped"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Description:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Order:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextArea" name="TextDescription1">
|
||||
<Properties>
|
||||
<Property name="columns" type="int" value="20"/>
|
||||
<Property name="rows" type="int" value="5"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="TextDescription1KeyPressed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JDialog" name="listlabpacks">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel3" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel3" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jScrollPane2" min="-2" pref="767" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jScrollPane2" min="-2" pref="539" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextArea" name="labpacktextbox">
|
||||
<Properties>
|
||||
<Property name="columns" type="int" value="20"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="rows" type="int" value="5"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="labpacktextboxKeyPressed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Menu class="javax.swing.JMenuBar" name="jMenuBar1">
|
||||
<SubComponents>
|
||||
<Menu class="javax.swing.JMenu" name="jMenu1">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="70"/>
|
||||
<Property name="text" type="java.lang.String" value="File"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
</Properties>
|
||||
<SubComponents>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="OpenButton">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="Ctrl+O"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Open"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="OpenButtonActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="NewButton">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="Ctrl+N"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="New"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="NewButtonActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="SaveButton">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="Ctrl+S"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Save"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="SaveButtonActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="QuitBUtton">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="Ctrl+Q"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Quit"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="QuitBUttonActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
<Menu class="javax.swing.JMenu" name="jMenu2">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="69"/>
|
||||
<Property name="text" type="java.lang.String" value="Edit"/>
|
||||
</Properties>
|
||||
<SubComponents>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="Order_Description">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="Ctrl+D"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Order & Description"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="Order_DescriptionActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
<Menu class="javax.swing.JMenu" name="ViewButton">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="86"/>
|
||||
<Property name="text" type="java.lang.String" value="View"/>
|
||||
</Properties>
|
||||
<SubComponents>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="list_labpacks">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="Ctrl+L"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="labpacks"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="list_labpacksActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<Menu class="javax.swing.JMenu" name="ChangeFont">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="83"/>
|
||||
<Property name="text" type="java.lang.String" value="Font Size"/>
|
||||
</Properties>
|
||||
<SubComponents>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="InreaseFont">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="Ctrl+EQUALS"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Increase"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="InreaseFontActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="DecreaseFont">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="Ctrl+MINUS"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Decrease"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DecreaseFontActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
</NonVisualComponents>
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
<Property name="title" type="java.lang.String" value="makepack"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel5" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jPanel4" max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="logo" min="-2" pref="220" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jPanel9" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jPanel9" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel4" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="56" max="-2" attributes="0"/>
|
||||
<Component id="logo" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jPanel5" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel4">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="labnotePane" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="AddNoteButton" alignment="1" min="-2" pref="77" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="labsPane" pref="210" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="Move_Down_Button" min="-2" pref="44" max="-2" attributes="0"/>
|
||||
<Component id="Move_Up_Button" alignment="1" min="-2" pref="45" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="RemoveButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
|
||||
<Component id="Move_Up_Button" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="Move_Down_Button" min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="176" max="-2" attributes="0"/>
|
||||
<Component id="RemoveButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="109" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="labsPane" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="labnotePane" pref="145" max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="AddNoteButton" min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="labsPane">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="labs in labpack"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="labs_in_labpack">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||
<StringArray count="5">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
<StringItem index="4" value="Item 5"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="Move_Up_Button"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="labs_in_labpackValueChanged"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="labnotePane">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="notes"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextPane" name="notes_box">
|
||||
<Properties>
|
||||
<Property name="focusCycleRoot" type="boolean" value="false"/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="AddNoteButton"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="AddNoteButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Save"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="This saves changes to any notes for a lab."/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="description_box"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="AddNoteButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="RemoveButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Remove"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="This button removes any selected labs from the labpack."/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="notes_box"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="RemoveButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="Move_Down_Button">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="\u005c/" containsInvalidXMLChars="true"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Move a lab down in the labpack."/>
|
||||
<Property name="name" type="java.lang.String" value="" noResource="true"/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="RemoveButton"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="Move_Down_ButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="Move_Up_Button">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="/\u005c" containsInvalidXMLChars="true"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Move a lab up in the labpack."/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="Move_Down_Button"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="Move_Up_ButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="labdescriptionPane" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="KeyPane" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="FindButton" min="-2" pref="84" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="83" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="ClearButton" min="-2" pref="73" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="92" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="LablistlPane" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="LablistlPane" pref="303" max="32767" attributes="0"/>
|
||||
<Component id="KeyPane" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
|
||||
<Component id="FindButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ClearButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="labdescriptionPane" pref="189" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="labdescriptionPane">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="lab description"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextPane" name="description_box">
|
||||
<Properties>
|
||||
<Property name="focusCycleRoot" type="boolean" value="false"/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="keywords"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="ClearButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Clear"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="This refreshes the lab list so that user can see the list of all labs after find."/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="labs_in_labpack"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ClearButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="LablistlPane">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="lab list"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="lablist">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||
<StringArray count="5">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
<StringItem index="4" value="Item 5"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Double click to add lab to labpack."/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="ClearButton"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="lablistMouseClicked"/>
|
||||
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="lablistKeyPressed"/>
|
||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="lablistValueChanged"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="KeyPane">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="keywords"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="keywords">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||
<StringArray count="5">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
<StringItem index="4" value="Item 5"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
<Property name="focusCycleRoot" type="boolean" value="true"/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="FindButton"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="FindButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Find"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="This button filters the lab list panel so that the lablist shows which labs have the selected keywords."/>
|
||||
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="lablist"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="FindButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="logo">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jLabel17"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel9">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="SaveIcon" min="-2" pref="38" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="SaveIcon" min="-2" pref="38" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="SaveIcon">
|
||||
<Properties>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="SaveIconActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 588 B |
@@ -1,20 +1,31 @@
|
||||
Labtainers: A Docker-based cyber lab framework
|
||||
==============================================
|
||||
|
||||
Labtainers include more than 45 cyber lab exercises and tools to build your own. Import a single VM appliance or install on a Linux system and your students are done with provisioning and administrative setup, for these and future lab exercises.
|
||||
Labtainers include more than 50 cyber lab exercises and tools to build your own. Import a single [VM appliance][vm-appliance] or install on a Linux system and your students are done with provisioning and administrative setup, for these and future lab exercises.
|
||||
|
||||
* Consistent lab execution environments and automated provisioning via Docker containers
|
||||
* Multi-component network topologies on a modestly performing laptop computer
|
||||
* Automated assessment of student lab activity and progress
|
||||
* Individualized lab exercises to discourage sharing solutions
|
||||
|
||||
Labtainers provide controlled and consistent execution environments in which students perform labs entirely within the confines of their computer, regardless of the Linux distribution and packages installed on the student's computer. The only requirement is that the Linux system supports Docker. See the [Papers][Papers] for additional information about the framework.
|
||||
The Labtainers website, and downloads (including VM appliances with Labtainers pre-installed) are at <https://my.nps.edu/web/c3o/labtainers>.
|
||||
Labtainers provide controlled and consistent execution environments in which students perform labs entirely within the confines of their computer, regardless of the Linux distribution and packages installed on the student's computer. Labtainers run on our [VM appliance][vm-appliancee], or on any Linux
|
||||
with Dockers installed. And Labtainers is available as cloud-based VMs, e.g., on Azure as described in the [Student Guide][student-guide].
|
||||
|
||||
[Papers]: https://my.nps.edu/web/c3o/labtainers#papers
|
||||
See the [Student Guide][student-guide] for installation and use, and the [Instructor Guide][instructor-guide] for student assessment. Developing and customizing
|
||||
lab exercises is described in the [Designer Guide][designer-guide].
|
||||
See the [Papers][Papers] for additional information about the framework.
|
||||
The Labtainers website, and downloads (including VM appliances with Labtainers pre-installed) are at <https://nps.edu/web/c3o/labtainers>.
|
||||
|
||||
Distribution created: mm/dd/yyyy
|
||||
Revision:
|
||||
[vm-appliance]: https://nps.edu/web/c3o/virtual-machine-images
|
||||
[student-guide]: docs/student/labtainer-student.pdf
|
||||
[instructor-guide]: docs/instructor/labtainer-instructor.pdf
|
||||
[designer-guide]: docs/labdesigner/labdesigner.pdf
|
||||
[Papers]: https://nps.edu/web/c3o/labtainers#papers
|
||||
|
||||
Distribution created: 11/22/2024 09:42 </br>
|
||||
Revision: v1.4.4e </br>
|
||||
Commit: a3a40d0e </br>
|
||||
Branch: master </br>
|
||||
|
||||
## Content
|
||||
[Distribution and Use](#distribution-and-use)
|
||||
@@ -26,19 +37,8 @@ Revision:
|
||||
[Release notes](#release-notes)
|
||||
|
||||
## Distribution and Use
|
||||
Labtainers was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
|
||||
However, several of the labs are derived from SEED labs from
|
||||
Syracuse University, and include copyrighted and licensed elements
|
||||
as set forth in their respective Lab Manuals. These labs include:
|
||||
bufoverflow, capabilities, formatstring, local-dns, onewayhash,
|
||||
retlibc, setuid-env, sql-inject, tcpip, webtrack, xforge and xsite.
|
||||
Please see the licensing and distribution information
|
||||
in the [docs/license.md file](docs/license.md).
|
||||
|
||||
## Guide to directories
|
||||
|
||||
@@ -52,16 +52,23 @@ retlibc, setuid-env, sql-inject, tcpip, webtrack, xforge and xsite.
|
||||
|
||||
* labs -- Files specific to each of the labs
|
||||
|
||||
* setup_scripts -- scripts for installing Labtainers and Docker and updating Labtainers
|
||||
* setup\_scripts -- scripts for installing Labtainers and Docker and updating Labtainers
|
||||
|
||||
* docs -- latex source for the labdesigner.pdf, and other documentation.
|
||||
|
||||
* UI -- Labtainers lab editor source code (Java).
|
||||
|
||||
* headless-lite -- scripts for managing Docker Workstation and cloud instances of Labtainers (systems
|
||||
that do not have native X11 servers.)
|
||||
|
||||
* scripts/designer -- Tools for building new labs and managing base Docker images.
|
||||
|
||||
* config -- system-wide configuration settings (these are not the
|
||||
lab-specific configuration settings.
|
||||
|
||||
* distrib -- distribution support scripts, e.g., for publishing labs to the Docker hub.
|
||||
|
||||
* testsets -- Test procedures and expected results. (Per-lab drivers for SimSec are not
|
||||
* testsets -- Test procedures and expected results. (Per-lab drivers for SimLab are not
|
||||
distributed).
|
||||
|
||||
* pkg-mirrors -- utility scripts for internal NPS package mirroring to reduce external
|
||||
@@ -82,6 +89,434 @@ The installation script and the update-designer.sh script set environment variab
|
||||
so you may want to logout/login, or start a new bash shell before using Labtainers the
|
||||
first time.
|
||||
|
||||
November 22, 2024
|
||||
- Replaced google cloud VM, this time due to a failure of systemd within containers.
|
||||
|
||||
September 23, 2024
|
||||
- Replaced google cloud VM, which was using the wrong Docker version
|
||||
|
||||
September 10, 2024
|
||||
- Typo in creation of imodule path
|
||||
|
||||
July 26, 2024
|
||||
- Modify capinout to not use grantpt clib function, which now seems to crash when run from a container.
|
||||
|
||||
July 22, 2024
|
||||
- Add a base container for Ubuntu22 and changes to framework to support that.
|
||||
|
||||
July 5, 2024
|
||||
- Migrate to Ubuntu 24 as the VM appliance
|
||||
- The docker pyhton package uses a broken python http library, requires package downgrade.
|
||||
- Use virtual python environment to avoid Ubuntu lockdown of python packages.
|
||||
- Add boot parameter to allow sharing systemd between containers and the VM.
|
||||
- Redirect error messages from broken tar utility on updates.
|
||||
- Ubuntu update breakage for msc packages (see update-ubuntu.sh) for version 18 VMs
|
||||
- The docker-compose command is broken, use "docker compose"
|
||||
- Force socket permissions in headless labtainers.
|
||||
- Update headless Labtainers to use Ubuntu 24
|
||||
|
||||
November 27, 2023
|
||||
- Add Google Cloud Platform option for ubuntu22 on ec2 machine.
|
||||
|
||||
September 18, 2023
|
||||
- Previous fix implementation was flawed.
|
||||
|
||||
August 8, 2023
|
||||
- Handle change to DockerHub image json format. Thanks Kees!
|
||||
|
||||
April 17, 2023
|
||||
- Force use latest lab version, e.g., iptables2 intead of iptables. Fix tab completion to only display latest. (Issue #77)
|
||||
- CyberCIEGE lab installation was failing due to X11 race condition. (Issue #76)
|
||||
- Note in CyberCIEGE readme to direct students to save collected logs in $HOME directory. (Issue #75)
|
||||
- Radius lab checkwork was incorrectly reporting "radiusd not running", missing prestop script. (Issue #74)
|
||||
- Labedit corrupted the start configuration file when the MACVLAN\_EXT option was used. (Issue #73)
|
||||
|
||||
February 1, 2023
|
||||
- Bash history for non-default users was not being saved.
|
||||
January 26, 2023
|
||||
- Modified powershell scripts for gcloud to use the selected zone to qualify VM names.
|
||||
January 4, 2023
|
||||
- Containers using systemd were failing on newer systemd present in Ubuntu 22
|
||||
- Add --zone parameter to google cloud scripts, with value derived from the set\_defaults script.
|
||||
December 21, 2022
|
||||
- Fix xforge results criteria to not expect pathname, and add check to see if POST issued to edit profile. And fix attacker
|
||||
http server to run from the home directory.
|
||||
December 19, 2022
|
||||
- Add strace lab to introduce system call tracing.
|
||||
- X11 DISPLAY value was incorrect if multiple devices in the /tmp/.X11-unix directory.
|
||||
- Use of python/bash/sh/etc with no arguments was causing capinout to crash.
|
||||
December 9, 2022
|
||||
- Modify Azure vm creation script to use a prebuilt Labtainer VM image from the Azure Community Gallery.
|
||||
- Terminals on cloud VMs crash for unknown reasons during startup or right click on the terminal. Attempt
|
||||
to address by start/stop of a terminal.
|
||||
December 5, 2022
|
||||
- When collecting artifacts, include modified files from directories of non-default users, e.g., their bash histories.
|
||||
- Alter web assessment to display the new "other user" files.
|
||||
- Include files from .local/bin on each container in artifacts. Intended to make these available to instructor via web assesment.
|
||||
- In the ACL lab, include th /shared\_data/bob/fun file in the results for reference by the instructor.
|
||||
- Catch use of "sh" or "bash" from command line and skip when parsing for given command, e.g., as done with "time" or "sudo".
|
||||
- In the tcpip lab, could not ssh into the server during subsequent lab sessions, the /run/sshd directory was not being remade.
|
||||
November 16, 2022
|
||||
- Fix path to Snort Manual in snort lab.
|
||||
- In ossec manual,fix path to manage\_agents
|
||||
October 12, 2022
|
||||
- Google cloud remove background operator from gnome-terminal command, still crashes on right click
|
||||
but seems stable after running a newterm.sh.
|
||||
October 10, 2022
|
||||
- Fix Google cloud newterm.sh; expand that boot disk to 30G.
|
||||
September 20, 2022
|
||||
- Note user id and password for TCP/IP lab in the lab manual.
|
||||
August 30, 2022
|
||||
- Use the X11 socket name when setting DISPLAY from a container's .profile
|
||||
August 9, 2022
|
||||
- Fix name of processValueMax function in grader. Issue #63
|
||||
|
||||
August 4, 2022
|
||||
- The labedit program was rebuilt with the wrong JDK, preventing older JREs from running labedit
|
||||
|
||||
July 18, 2022
|
||||
- Creation of Ubuntu20-based containers was failing within IModules. Issue #61.
|
||||
|
||||
March 23, 2022
|
||||
- Fix path to tap lock directory; was causing failure of labs using network taps
|
||||
- Update plc-traffic netmon computer to have openjfx needed for new grassmarlin in java environment
|
||||
- Speed up lab startup by avoiding chown -R, which is very slow in docker.
|
||||
- Another shot at avoiding deletion of the X11 link in container /tmp directory.
|
||||
- Fix webtrack counting of sites visited and remove live-headers goal, that tool is no longer available.
|
||||
Clarified some lab manual steps.
|
||||
|
||||
March 2, 2022
|
||||
- Add new ssh-tunnel lab (thanks GWD!)
|
||||
- Fix labedit failure to reflect X11 value set by new\_lab\_setup
|
||||
- Add option to not parameterize a container
|
||||
|
||||
February 23, 2022
|
||||
- labedit was corrupting start.config after addition of new containers
|
||||
- Incorrect path to student guide in the student README file; dynamically change for cloud configs
|
||||
- Incorrect extension to update-labtainer.sh
|
||||
- Msc guide enahancements
|
||||
- Update the ghidra lab to include version 10.1.2 of Ghidra
|
||||
|
||||
February 15, 2022
|
||||
- Revert Azure cloud support to provision for each student. Azure discourages sharing resources.
|
||||
|
||||
January 24, 2022
|
||||
- Azure cloud now uses image stored in an Azure blob instead of provisioning for each student.
|
||||
- Added support for Google Cloud.
|
||||
|
||||
January 19, 2022
|
||||
- Introduce Labtainers on the Azure cloud. See the Student Guide for details on how to use this.
|
||||
|
||||
January 3, 2022
|
||||
- Revise setuid-env lab to add better assessment; simlab testing and avoid sighup in the printenv child.
|
||||
- Fix assessment goal count directive to exclude result tag values of false.
|
||||
- Do not require labname when using gradelab -a with a grader started with the debug option.
|
||||
- Revise capinout (stdin/stdout mirroring) to handle orphaning of command process children, improved documentation
|
||||
and error handling.
|
||||
- Added display of progress bars of docker images being pulled when a lab is first run.
|
||||
- User feedback on progress of container initialization.
|
||||
- The pcap-lib lab was missing a notify file needed for automated assessment; Remove extraneous step from Lab Manual.
|
||||
|
||||
November 23, 2021
|
||||
- Disable ubuntu popup errors on test VM.
|
||||
- Fix handling of different DISPLAY variable formats.
|
||||
|
||||
October 22, 2021
|
||||
- Revise the tcpip lab guide to note a successful syn-flood attack is not possible. Fix its automated assessment and add SimLab scripts.
|
||||
- Change artifact file extension from zip to lab, and add a preamble to confuse GUI file managers. Students were opening the zip and submitting its guts.
|
||||
- Make the -r option to gradelab the default, add a -c option for cumulative use of grader.
|
||||
- Modify refresh\_mirror to refer to the local release date to avoid frequent queries of DockerHub. Each such query counts as an image pull,
|
||||
and they are now trying to monetize those.
|
||||
|
||||
September 30, 2021
|
||||
- Change bufoverflow lab guide and grading to not expect success with ASLR turned on, assess whether it was run.
|
||||
- Error handling for web grader for cases where student lacks results.
|
||||
- Print warning when deprecated lab is run.
|
||||
- Change formatstring grading to remove unused "\_leaked\_secret" description and clarify value of leaked\_no\_scanf.
|
||||
- Also change formatstring grading to allow any name for the vulnerable executable.
|
||||
|
||||
September 29, 2021
|
||||
- Gradelab error handling, reduce instances of crashes due to bad zip files.
|
||||
- Limit stdout artifact files to 1MB
|
||||
|
||||
September 17, 2021
|
||||
- Ghidra lab guide had wrong IP address, was not remade from source.
|
||||
|
||||
September 14, 2021
|
||||
- Example labs for LDAP and Mariadb using SSL. Intended as templates for new labs.
|
||||
- Handle Mariadb log format
|
||||
- Add per-container parameters to limit CPU use or pin container to CPU set.
|
||||
- Labpack creation now available via a GUI (makepackui).
|
||||
- Tab completion for the labtainer, labpack and gradelab commands.
|
||||
- New parallel computing lab ``parallel'' using MPI.
|
||||
|
||||
August 3, 2021
|
||||
- Add a "WAIT\_FOR" configuration option to cause a container to delay parameterization until
|
||||
another container completes its parameterization.
|
||||
- Support for Mariadb log formats in results parsing
|
||||
- Remove support for Mac and Windows use of Docker Desktop. That product is too unstable for us to support.
|
||||
- Supress stderr messages when user uses built-in bash commands such as "which".
|
||||
- Bug fixes to makepack/labpack programs.
|
||||
|
||||
July 19, 2021
|
||||
- Add a DNS lab to introduce the DNS protocol and configuration.
|
||||
- Revised VirtualBox appliance image to start with the correct update script.
|
||||
- Split resolv.conf nameserver parameter out of the lab\_gw configuration field into its own value.
|
||||
- IModule command failed if run before any labs had been started.
|
||||
|
||||
July 5, 2021
|
||||
- Errors in DISPLAY env variable management broke GUI applications on Docker Desktop.
|
||||
|
||||
July 1, 2021
|
||||
- Support Mac package installation of headless Labtainers.
|
||||
- The routing-basics lab automated assessment failed due to lack of treataslocal files
|
||||
- Correct typos and incorrect addresses in routing-basics lab, and fix automated assessment.
|
||||
- Assessment of pcapanalysis was failing.
|
||||
|
||||
June 10, 2021
|
||||
- All lab manual PDFs are now in the github repo
|
||||
- Convert vpnlab and vpnlab2 instructions to PDF lab manuals.
|
||||
|
||||
May 25, 2021
|
||||
- Add searchable keywords to each lab. See "labtainer -h" for usage.
|
||||
- Expand routing-basics lab and lab manual
|
||||
- Remove routing-basics2 lab, it is now redundant.
|
||||
- sudo on some containers failed because hostnames remove underscores, leading to mismatch
|
||||
with the hosts file. Fix with extra entry in the hosts file with container name sans underscore.
|
||||
- New Labpack feature to package a collection of labs, and makepack tool to create Labpacks.
|
||||
- Error check for /sbin directory when using ubuntu20 -- would be silently fatal.
|
||||
- New network-basics lab
|
||||
|
||||
May 5, 2021
|
||||
- Introduce a new users lab to introduce user/group management
|
||||
- Surpress Apparmor host messages in centos container syslogs
|
||||
|
||||
April 28, 2021
|
||||
- New base2 images lacked man pages. Used unminimize to restore them in the base image.
|
||||
- Introduce a OSSEC host-based IDS lab.
|
||||
|
||||
April 13, 2021
|
||||
- CyberCIEGE lab failed because X11 socket was not relocated prior to starting Wine via fixlocal.
|
||||
|
||||
April 9, 2021
|
||||
- New gdb-cpp tutorial lab for using GDB on a simple C++ program.
|
||||
- Floating point exceptions were revealing use of exec\_wrap.sh for stdin/stdout mirroring.
|
||||
|
||||
April 7, 2021
|
||||
- ldap lab failed when moved to Ubuntu 20. Problem traced to problem with nscd cache of pwd. Move ldap to Ubuntu 20
|
||||
|
||||
March 23, 2021
|
||||
- Parameterizing with RANDOM did not include the upper bound.
|
||||
- Add optional step parameter to RANDOM, e.g., to ensure word boundaries.
|
||||
- db-access lab: add mysql-workbench to database computer.
|
||||
- New overrun lab to illustrate memory references beyond bounds of c data structures.
|
||||
- New printf lab to introduce memory references made by the printf function.
|
||||
|
||||
March 19, 2021
|
||||
- gradelab ignore makdirs error, problem with Windows rmtree on shared folders.
|
||||
- gradelab handle spaces in student zip file names.
|
||||
- gradelab handle zip file names from Moodle, including build downloads.
|
||||
|
||||
March 12, 2021
|
||||
- labedit UI: Remove old wireshark image from list of base images.
|
||||
- labedit UI: Increase some font sizes.
|
||||
- grader web interface failed to display lab manuals if the manual name does not follow naming conventions.
|
||||
|
||||
March 11, 2021
|
||||
- labedit UI add registry setting in new global lab configuration panel.
|
||||
|
||||
March 10, 2021
|
||||
- labedit UI fixes to not build if syntax error in lab
|
||||
- labedit UI "Lab running" indicator fix to reflect current lab.
|
||||
|
||||
March 8, 2021
|
||||
- Deprecate use of HOST\_HOME\_XFER, all labs use directory per the labtainer.config file.
|
||||
- Add documentation comment to start.config for REGISTRY and BASE\_REGISTRY
|
||||
|
||||
March 5, 2021
|
||||
- Error handling on gradelab web interface when missing results.
|
||||
- labedit addition of precheck, msc bug fixes.
|
||||
|
||||
February 26, 2021
|
||||
- The dmz-example lab had errors in routing and setup of dnsmasq on some components.
|
||||
|
||||
February 18, 2021
|
||||
- UI was rebuilding images because it was updating file times without cause
|
||||
- Clean up UI code to remove some redundant data copies.
|
||||
|
||||
February 14, 2021
|
||||
- Add local build option to UI
|
||||
- Create empty faux\_init for centos6 bases.
|
||||
|
||||
February 11, 2021
|
||||
- Fix UI handling of editing files. Revise layout and eliminate unused fields.
|
||||
- Add ubuntu20 base2 base configuration along with ssh2, network2 and wireshark2
|
||||
- The new wireshark solves the prolem of black/noise windows.
|
||||
- Map /tmp/.X11-unix to /var/tmp and create a link. Needed for ubuntu20 (was deleting /tmp?) and may fix others.
|
||||
|
||||
February 4, 2021
|
||||
- Add SIZE option to results artifacts
|
||||
- Simplify wireshark-intro assessment and parameterization and add PDF lab manual.
|
||||
- Provide parameter list values to pregrade.sh script as environment variables
|
||||
- enable X11 on the grader
|
||||
- put update-designer.sh into users path.
|
||||
|
||||
January 19, 2021
|
||||
- Change management of README date/rev to update file in source repo.
|
||||
- Introduce GUI for creating/editing labs -- see labedit command.
|
||||
|
||||
December 21, 2020
|
||||
- The gradelab function failed when zip files were copied from a VirtualBox shared folder.
|
||||
- Update Instructor Guide to describe management of student zip files on host computers.
|
||||
|
||||
December 4, 2020
|
||||
- Transition distribution of tar to GitHub releaese artifacts
|
||||
- Eliminate seperate designer tar file, use git repo tarball.
|
||||
- Testing of grader web functions for analysis of student lab artifacts
|
||||
- Clear logs from full smoketest and delete grader container in removelab command.
|
||||
|
||||
December 1, 2020
|
||||
- The iptables2 lab assessment relied on random ports being "unknown" to nmap.
|
||||
- Use a sync diretory to delay smoketests from starting prior to lab startup.
|
||||
- Begin integrating Lab designer UI elements.
|
||||
|
||||
October 13, 2020
|
||||
- Headless configuraions for running on Docker Desktop on Macs & Windows
|
||||
- Headless server support, cloud-config file for cloud deployments
|
||||
- Testing support for headless configurations
|
||||
- Force mynotify to wait until rc.local runs on boot
|
||||
- Improve mynotify service ability to merge output into single timestamp
|
||||
- Python3 for stopgrade script
|
||||
- SimLab now uses docker top rather than system ps
|
||||
|
||||
September 26, 2020
|
||||
- Clean up the stoplab scripts to ignore non-lab containers
|
||||
- Add db-access database access control lab for controlles sharing of a mysql db.
|
||||
|
||||
September 17, 2020
|
||||
- The macs-hash lab was unable to run Leafpad due to the X11 setting.
|
||||
- Grader logging was being redirected to the wrong log file, now captures errors from instructor.py
|
||||
- Copy instructor.log from grader to the host logs directory if there is an error.
|
||||
|
||||
August 28, 2020
|
||||
- Fix install script to use python3-pip and fix broken scripts: getinfo.py and pull-all.py
|
||||
- Registry logic was broken, test systems were not using the test registry, add development documentation.
|
||||
- Add juiceshop and owasp base files for OWASP-based web security labs
|
||||
- Remove unnecessary sudos from check\_nets
|
||||
- Add CHECK\_OK documentation directive for automated assessment
|
||||
- Change check\_nets to fix iptables and routing issues if so directed.
|
||||
|
||||
August 12, 2020
|
||||
- Add timeout to prestop scripts
|
||||
- Add quiz and checkwork to dmz-lab
|
||||
- Restarting the dmz-lab without -r option broke routing out of the ISP.
|
||||
- Allow multiple files for time\_delim results.
|
||||
|
||||
August 6, 2020
|
||||
- Bug in error handling when X11 socket is missing
|
||||
- Commas in quiz questions led to parse errors
|
||||
- Add quiz and checkwork to iptables2 lab
|
||||
|
||||
July 28, 2020
|
||||
- Add quiz support -- these are guidance quizzes, not assessment quizzes. See the designer guide.
|
||||
- Add current-state assessment for use with the checkwork command.
|
||||
|
||||
July 21, 2020
|
||||
- Add testsets/bin to designer's path
|
||||
- Designer guide corrections and explainations for IModule steps.
|
||||
- Add RANGE\_REGEX result type for defining time ranges using regular expressions on log entries.
|
||||
- Check that X11 socket exists if it is needed when starting a lab.
|
||||
- Add base image for mysql
|
||||
- Handle mysql log timestamp formats in results parsing.
|
||||
|
||||
June 15, 2020
|
||||
- New base image contianing the Bird open source router
|
||||
- Add bird-bgp Border Gateway Protocol lab.
|
||||
- Add bird-ospf Open Shortest Path First routing protocol.
|
||||
- Improve handling of DNS changes, external access from some containers was blocked in some sites.
|
||||
- Add section to Instructor Guide on using Labtainers in environments lacking Internet access.
|
||||
|
||||
May 21, 2020
|
||||
- Move all repositories to the Docker Hub labtainers registry
|
||||
- Support mounts defined in the start.config to allow persistent software installs
|
||||
- Change ida lab to use persistent installation of IDA -- new name is ida2
|
||||
- Add cgc lab for exploration of over 200 vulnerable services from the DARPA Cyber Grand Challenge
|
||||
- Add type\_string command to SimLab
|
||||
- Add netflow lab for use of NetFlow network traffic analysis
|
||||
- Add 64-bit versions of the bufoverflow and the formatstring labs
|
||||
|
||||
April 9, 2020
|
||||
- Grader failed assessment of CONTAINS and FILE\_REGX conditions when wildcards were used for file selection.
|
||||
- Include hints for using hexedit in the symlab lab.
|
||||
- Add hash\_equal operator and hash-goals.py to automated assessment to avoid publishing expected answers in configuration files.
|
||||
- Automated assessment for the pcap-lib lab.
|
||||
|
||||
April 7, 2020
|
||||
- Logs have been moved to $LABTAINER\_DIR/logs
|
||||
- Other cleanup to permit rebuilds and tests using Jenkins, including use of unique temporary directories for builds
|
||||
- Move build support functions out of labutils into build.py
|
||||
- Add pcap-lib lab for PCAP library based development of traffic analysis programs
|
||||
|
||||
March 13, 2020
|
||||
- Add plc-traffic lab for use of GrassMarlin with traffic generated during the lab.
|
||||
- Introduce ability to add "tap" containers to collect PCAPs from selected networks.
|
||||
- Update GNS3 documentation for external access to containers, and use of dummy\_hcd to
|
||||
simulate USB drives.
|
||||
- Change kali template to use faux\_init rather than attempting to use systemd.
|
||||
- Moving distributions (tar files) to box.com
|
||||
- Change SimLab use of netstat to not do a dns lookup.
|
||||
|
||||
February 26, 2020
|
||||
- If labtainer command does not find lab, suggest that user run update-labtainer.sh
|
||||
- Add support preliminary support for a network tap component to view all network traffic.
|
||||
- Script to fetch lab images to prep VMs that will be used without internet.
|
||||
- Provide username and password for nmap-discovery lab.
|
||||
|
||||
February 18, 2020
|
||||
- Inherit the DISPLAY environment variable from the host (e.g., VM) instead of assuming :0
|
||||
|
||||
February 14, 2020
|
||||
- Add Ghidra software reverse engineering introduction exercise.
|
||||
|
||||
February 11, 2020
|
||||
- Update guides to describe remote access to containers withing GNS3 environments
|
||||
- Hide selected components and links within GNS3.
|
||||
- Figures in the webtrack lab guide were not visible; typos in this and nmap-ssh
|
||||
|
||||
February 6, 2020
|
||||
- Introduce function to remotely manage containers, e.g., push files.
|
||||
- Add GNS3 environment function to simulate insertion of a USB drive.
|
||||
- Improve handling of Docker build errors.
|
||||
|
||||
February 3, 2020
|
||||
- On the metasploit lab, the postgresql service was not running on the victim.
|
||||
- Merge the IModule manual content into the Lab Designer guide.
|
||||
- More IModule support.
|
||||
|
||||
January 27, 2020
|
||||
- Introduce initial support for IModules (instructor-developed labs). See docs/imodules.pdf.
|
||||
- Fix broken LABTAINER\_DIR env variable within update-labtainer
|
||||
- Fix access mode on accounting.txt file in ACL lab (had become rw-r-r). Use explicit chmod in fixlocal.sh.
|
||||
|
||||
January 14, 2020
|
||||
- Port framework and gradelab to Python3 (existing Python2 labs will not change)
|
||||
- Use backward compatible random.seed options
|
||||
- Hack non-compatable randint to return old values
|
||||
- Continue to support python2 for platforms that lack python3 (or those such as the
|
||||
older VM appliance that include python 3.5.2, which breaks random.seed compatability).
|
||||
- Add rebuild alias for rebuild.py that will select python2 if needed.
|
||||
- Centos-based labs manpages were failing; use mandb within base docker file
|
||||
- dmz-lab netmask for DMZ network was wrong (caught by python3); as was IP address of inner gateway in lab manual
|
||||
- ghex removed from centos labs -- no longer easily supported by centos 7
|
||||
- file-deletion lab must be completed without rebooting the VM, note this in the Lab Manual.
|
||||
- Add NO\_GW switch to start.config to disable default gateways on containers.
|
||||
- Metasploit lab, crashes host VM if runs as privileged; long delays on su if systemd enabled; so run without systemd.
|
||||
Remove use of database from lab manual, configure to use new no\_gw switch
|
||||
- Update file headers for licensing/terms; add consolidated license file.
|
||||
- Modify publish.py to default to use of test registry, use -d to force use of default\_registry
|
||||
- Revise source control procedures to use different test registry for each branch, and use a premaster
|
||||
branch for final testing of a release.
|
||||
|
||||
October 9, 2019
|
||||
- Remove dnsmasq from dns component in the dmz-lab. Was causing bind to fail on some installations.
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="GoalsUI_Sep13" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project GoalsUI_Sep13.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="GoalsUI_Sep13-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
@@ -1,3 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
||||
build.xml.data.CRC32=eec53d04
|
||||
build.xml.script.CRC32=e676bb1d
|
||||
build.xml.stylesheet.CRC32=8064a381@1.80.1.48
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=eec53d04
|
||||
nbproject/build-impl.xml.script.CRC32=4d702800
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
|
||||
@@ -1,2 +0,0 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Users\\Dan\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
|
||||
@@ -1,75 +0,0 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/GoalsUI_Sep13.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${libs.absolutelayout.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.8
|
||||
javac.target=1.8
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=GoalsUI.GoalsUI
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>GoalsUI_Sep13</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -1,316 +0,0 @@
|
||||
package GoalsUI;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class GoalsUI extends javax.swing.JFrame {
|
||||
GoalsData dataUI;
|
||||
|
||||
public GoalsUI() {
|
||||
initComponents();
|
||||
LabNotExist.setVisible(false);
|
||||
dataUI = new GoalsData();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
ScrollPaneOfGoals = new javax.swing.JScrollPane();
|
||||
PanelofGoals = new javax.swing.JPanel();
|
||||
UpdateButton = new javax.swing.JButton();
|
||||
RemoveAllButton = new javax.swing.JButton();
|
||||
jLabel9 = new javax.swing.JLabel();
|
||||
CreateButton = new javax.swing.JButton();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
LabNameTextField = new javax.swing.JTextField();
|
||||
LabNotExist = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setBackground(new java.awt.Color(255, 255, 255));
|
||||
setMinimumSize(new java.awt.Dimension(1590, 500));
|
||||
setPreferredSize(new java.awt.Dimension(1110, 389));
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
public void windowClosing(java.awt.event.WindowEvent evt) {
|
||||
formWindowClosing(evt);
|
||||
}
|
||||
});
|
||||
|
||||
ScrollPaneOfGoals.setAutoscrolls(true);
|
||||
ScrollPaneOfGoals.setMaximumSize(new java.awt.Dimension(1300, 800));
|
||||
|
||||
PanelofGoals.setLayout(new javax.swing.BoxLayout(PanelofGoals, javax.swing.BoxLayout.PAGE_AXIS));
|
||||
ScrollPaneOfGoals.setViewportView(PanelofGoals);
|
||||
|
||||
UpdateButton.setText("Update");
|
||||
UpdateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
UpdateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
RemoveAllButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N
|
||||
RemoveAllButton.setText("Remove All");
|
||||
RemoveAllButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
RemoveAllButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel9.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N
|
||||
jLabel9.setText("Lab Name: ");
|
||||
|
||||
CreateButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N
|
||||
CreateButton.setText("Create");
|
||||
CreateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CreateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel3.setText("Goal Type");
|
||||
jLabel3.setToolTipText("The mode in which a value is found.");
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel1.setText("Goal ID");
|
||||
jLabel1.setToolTipText("The symbolic name of the result, which will be referenced in the goals configuration file. \n\n(It must be alphanumeric, underscores permitted) ");
|
||||
|
||||
LabNameTextField.setPreferredSize(new java.awt.Dimension(6, 25));
|
||||
LabNameTextField.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
LabNameTextFieldActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
LabNotExist.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
|
||||
LabNotExist.setText("Lab does not exist!");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(ScrollPaneOfGoals, javax.swing.GroupLayout.DEFAULT_SIZE, 1300, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(CreateButton)
|
||||
.addGap(10, 10, 10)
|
||||
.addComponent(RemoveAllButton)
|
||||
.addGap(98, 98, 98)
|
||||
.addComponent(jLabel9)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(LabNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(LabNotExist)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 344, Short.MAX_VALUE)
|
||||
.addComponent(UpdateButton))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(50, 50, 50)
|
||||
.addComponent(jLabel1)
|
||||
.addGap(89, 89, 89)
|
||||
.addComponent(jLabel3)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(CreateButton)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(RemoveAllButton)
|
||||
.addComponent(jLabel9)
|
||||
.addComponent(LabNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(UpdateButton)
|
||||
.addComponent(LabNotExist)))
|
||||
.addGap(14, 14, 14)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jLabel3))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(ScrollPaneOfGoals, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed
|
||||
update();
|
||||
}//GEN-LAST:event_UpdateButtonActionPerformed
|
||||
private void update(){
|
||||
if(dataUI.isLoaded())
|
||||
dataUI.writeGoalsConfig(PanelofGoals);
|
||||
}
|
||||
|
||||
private void LabNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LabNameTextFieldActionPerformed
|
||||
loadLab();
|
||||
}//GEN-LAST:event_LabNameTextFieldActionPerformed
|
||||
//Checks if the lab exists and will load lab's goals config if it does
|
||||
private void loadLab(){
|
||||
dataUI = new GoalsData(getLabName());
|
||||
|
||||
if(dataUI.isLoaded()){
|
||||
LabNotExist.setVisible(false);
|
||||
goalsPanelRedraw();
|
||||
}
|
||||
else
|
||||
LabNotExist.setVisible(true);
|
||||
}
|
||||
|
||||
private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed
|
||||
createFreshGoal();
|
||||
}//GEN-LAST:event_CreateButtonActionPerformed
|
||||
//Creates and loads a new goal row *Note: creating a new row does not automatically save the new row into the GoalsData(acti)
|
||||
private void createFreshGoal(){
|
||||
if(dataUI.isLoaded()){
|
||||
dataUI.increaseRowCount();
|
||||
GoalPanels newGoal = new GoalPanels(this, dataUI);
|
||||
PanelofGoals.add(newGoal);
|
||||
PanelofGoals.revalidate();
|
||||
PanelofGoals.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed
|
||||
removeAllButton();
|
||||
}//GEN-LAST:event_RemoveAllButtonActionPerformed
|
||||
private void removeAllButton(){
|
||||
if(dataUI.isLoaded()){
|
||||
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){
|
||||
removeAllGoals();
|
||||
dataUI.resetData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
|
||||
checkUnsavedChangesMade();
|
||||
}//GEN-LAST:event_formWindowClosing
|
||||
//Check if the the current state of the UI matches with what's saved in the goals.config
|
||||
void checkUnsavedChangesMade(){
|
||||
if(dataUI.isLoaded()){
|
||||
dataUI.updateListofGoals(PanelofGoals);
|
||||
|
||||
if(GoalsData.goalValuesDiffer(dataUI.getListofGoals(), dataUI.getGoalValuesOfConfigFile())){
|
||||
int confirmed = JOptionPane.showConfirmDialog(null,
|
||||
"There are Unsaved Changes. Are you sure you want to exit the program?", "Unsaved Changes",
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
|
||||
if (confirmed == JOptionPane.YES_OPTION)
|
||||
dispose();
|
||||
else
|
||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
}
|
||||
else
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
||||
//General Methods
|
||||
//Updates the list of goals and redraws them on screen
|
||||
void refresh(){
|
||||
dataUI.updateListofGoals(PanelofGoals);
|
||||
goalsPanelRedraw();
|
||||
}
|
||||
|
||||
//Redraws the goals Panel
|
||||
void goalsPanelRedraw(){
|
||||
removeAllGoals();
|
||||
for(int i=0; i < dataUI.getListofGoals().size(); i++)
|
||||
loadGoal(dataUI.getListofGoals().get(i), i+1);
|
||||
}
|
||||
|
||||
//Removes all the goal lines for the lab *note: this doesn't update results.config until the user hits the update button
|
||||
private void removeAllGoals(){
|
||||
Component[] componentList = PanelofGoals.getComponents();
|
||||
for(Component c: componentList)
|
||||
PanelofGoals.remove(c);
|
||||
PanelofGoals.revalidate();
|
||||
PanelofGoals.repaint();
|
||||
}
|
||||
|
||||
//Load's the goals into GUI
|
||||
private void loadGoal(GoalValues goalVal, int rowNum){
|
||||
GoalPanels newGoal = new GoalPanels(this, dataUI, goalVal, rowNum);
|
||||
PanelofGoals.add(newGoal);
|
||||
PanelofGoals.revalidate();
|
||||
PanelofGoals.repaint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Gets the labname
|
||||
private String getLabName(){
|
||||
return LabNameTextField.getText();
|
||||
}
|
||||
|
||||
//Gets the panel holding the goals
|
||||
protected JPanel getPanelofGoals(){
|
||||
return PanelofGoals;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(() -> {
|
||||
GoalsUI newGoalsUI = new GoalsUI();
|
||||
newGoalsUI.setSize(1000, 1000);
|
||||
newGoalsUI.setVisible(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton CreateButton;
|
||||
private javax.swing.JTextField LabNameTextField;
|
||||
private javax.swing.JLabel LabNotExist;
|
||||
private javax.swing.JPanel PanelofGoals;
|
||||
private javax.swing.JButton RemoveAllButton;
|
||||
private javax.swing.JScrollPane ScrollPaneOfGoals;
|
||||
private javax.swing.JButton UpdateButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>MainUI</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.apt.aptEnabled=false
|
||||
@@ -0,0 +1,9 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=14
|
||||
org.eclipse.jdt.core.compiler.compliance=14
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.processAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=14
|
||||
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $1
|
||||
cd $2
|
||||
new_lab_setup.py -a $3 -b $4
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
#1.4
|
||||
|
||||
export ANT_HOME=/PDFdata/library/apache_ant/
|
||||
|
||||
export PATH=$ANT_HOME/bin:$PATH
|
||||
|
||||
ant -buildfile buildMainUI.xml main
|
||||
if [ $? -eq 1]; then
|
||||
echo "Failed on Build"
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
To change this license header, choose License Headers in Project Properties.
|
||||
To change this template file, choose Tools | Templates
|
||||
and open the template in the editor.
|
||||
-->
|
||||
|
||||
|
||||
<project name="MainUI" default="main" basedir=".">
|
||||
<description>
|
||||
Main UI to the Labtainers Framework that makes the labs and edits the start configs
|
||||
</description>
|
||||
|
||||
<property name="projectName" value="labtainers.mainui"/>
|
||||
|
||||
|
||||
<property name="staging.dir" location="staging" />
|
||||
|
||||
<property name="src.dir" location="src" />
|
||||
|
||||
<property name="build.dir" location="${staging.dir}/bin" />
|
||||
|
||||
<property name="dist.dir" location="${staging.dir}/dist" />
|
||||
|
||||
<target name="main" depends="init, dist" />
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="${staging.dir}" />
|
||||
<mkdir dir="${build.dir}" />
|
||||
</target>
|
||||
|
||||
<target name="clean" description="Flush staging directory">
|
||||
<delete dir="${staging.dir}" />
|
||||
</target>
|
||||
|
||||
<target name="dist" description="package, output to JAR">
|
||||
|
||||
<mkdir dir="${dist.dir}"/>
|
||||
|
||||
<jar jarfile="${dist.dir}/${projectName}.jar" basedir="${build.dir}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${projectName}/MainWindow" />
|
||||
</manifest>
|
||||
</jar>
|
||||
|
||||
</target>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo Current Directory:
|
||||
pwd
|
||||
cd $1
|
||||
echo Changed Directroy to:
|
||||
pwd
|
||||
echo Making lab:
|
||||
echo $2
|
||||
mkdir $2
|
||||
cd $2
|
||||
new_lab_setup.py -b $3
|
||||
echo Made new lab:
|
||||
pwd
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $1
|
||||
cd $2
|
||||
new_lab_setup.py -c $3
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
gnome-terminal -- $1 $2
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-shared-configuration>
|
||||
<!--
|
||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||
The configuration is intended to be shared among all the users of project and
|
||||
therefore it is assumed to be part of version control checkout.
|
||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||
-->
|
||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||
<!--
|
||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||
-->
|
||||
<netbeans.hint.jdkPlatform>JDK_14</netbeans.hint.jdkPlatform>
|
||||
<netbeans.hint.licensePath>${project.basedir}/licenseheader.txt</netbeans.hint.licensePath>
|
||||
</properties>
|
||||
</project-shared-configuration>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Labtainers</groupId>
|
||||
<artifactId>MainUI</artifactId>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>unknown-jars-temp-repo</id>
|
||||
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
|
||||
<url>file:${project.basedir}/lib</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>unknown.binary</groupId>
|
||||
<artifactId>AbsoluteLayout</artifactId>
|
||||
<version>SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>14</maven.compiler.source>
|
||||
<maven.compiler.target>14</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<mainClass>labtainers.mainui.MainWindow</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $1
|
||||
cd $2
|
||||
new_lab_setup.py -d $3
|
||||
cd dockerfiles
|
||||
#delete the dockerfile associated with this container
|
||||
rm Dockerfile.$2.$3.student
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $1
|
||||
cd $2
|
||||
new_lab_setup.py -r $3 $4
|
||||
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="296" max="-2" attributes="0"/>
|
||||
<Component id="okButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="104" max="-2" attributes="0"/>
|
||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="852" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" pref="264" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="okButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextArea" name="text">
|
||||
<Properties>
|
||||
<Property name="columns" type="int" value="20"/>
|
||||
<Property name="rows" type="int" value="5"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="okButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="OK"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="cancelButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.goalsui;
|
||||
/**
|
||||
*
|
||||
* @author mike
|
||||
*/
|
||||
public class DocPanel extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form DocPanel
|
||||
*/
|
||||
javax.swing.JDialog dialog;
|
||||
boolean ok = false;
|
||||
public DocPanel() {
|
||||
initComponents();
|
||||
}
|
||||
public void setDoc(String text){
|
||||
this.text.setText(text);
|
||||
}
|
||||
public String getDoc(){
|
||||
return this.text.getText()+"\n";
|
||||
}
|
||||
public void setDialog(javax.swing.JDialog dialog){
|
||||
this.dialog = dialog;
|
||||
}
|
||||
public boolean isOK(){
|
||||
return this.ok;
|
||||
}
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
text = new javax.swing.JTextArea();
|
||||
okButton = new javax.swing.JButton();
|
||||
cancelButton = new javax.swing.JButton();
|
||||
|
||||
text.setColumns(20);
|
||||
text.setRows(5);
|
||||
jScrollPane1.setViewportView(text);
|
||||
|
||||
okButton.setText("OK");
|
||||
okButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
okButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
cancelButton.setText("Cancel");
|
||||
cancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(296, 296, 296)
|
||||
.addComponent(okButton)
|
||||
.addGap(104, 104, 104)
|
||||
.addComponent(cancelButton))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 852, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(okButton)
|
||||
.addComponent(cancelButton)))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||
this.ok = true;
|
||||
this.dialog.setVisible(false);
|
||||
}//GEN-LAST:event_okButtonActionPerformed
|
||||
|
||||
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
||||
this.dialog.setVisible(false);
|
||||
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton cancelButton;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JButton okButton;
|
||||
private javax.swing.JTextArea text;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1110, 69]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
@@ -28,32 +28,39 @@
|
||||
<Component id="ArtifactPanel" min="-2" pref="1390" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="UpButton" max="32767" attributes="0"/>
|
||||
<Component id="DownButton" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
<Component id="UpButton" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="DownButton" alignment="0" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="DeleteButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="73" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="DocButton" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="DeleteButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="51" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="ArtifactPanel" alignment="0" min="-2" pref="80" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" alignment="0" groupAlignment="1" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="UpButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="DownButton" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="UpButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="DeleteButton" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="DownButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="DocButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="DeleteButton" min="-2" pref="58" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="rowLabel" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="rowLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="14" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="ArtifactPanel" alignment="0" pref="92" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
@@ -76,8 +83,8 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="GoalIDTextField" min="-2" pref="125" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="GoalTypeComboBox" min="-2" pref="147" max="-2" attributes="0"/>
|
||||
@@ -93,10 +100,10 @@
|
||||
<Component id="AnswerTypeComboBox" min="-2" pref="150" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="AnswerTagTextField" min="-2" pref="193" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="52" max="-2" attributes="0"/>
|
||||
<Component id="ResultTag2ComboBox" min="-2" pref="155" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ResultTag2ComboBox" linkSize="11" min="-2" pref="155" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ParameterComboBox" linkSize="11" pref="150" max="32767" attributes="0"/>
|
||||
<Component id="ParameterComboBox" min="-2" pref="153" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="BooleanTextField" min="-2" pref="404" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@@ -104,51 +111,51 @@
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="SubgoalTextField" min="-2" pref="643" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="Goal1TextField" linkSize="9" min="-2" pref="185" max="-2" attributes="0"/>
|
||||
<Component id="Goal1TextField" min="-2" pref="185" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="Goal2TextField" linkSize="9" min="-2" pref="126" max="-2" attributes="0"/>
|
||||
<Component id="Goal2TextField" min="-2" pref="126" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="BooleanResultTagsComboBox" linkSize="13" min="-2" pref="162" max="-2" attributes="0"/>
|
||||
<Component id="BooleanResultTagsComboBox" min="-2" pref="162" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="PreviousMatchanyComboBox" linkSize="13" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="PreviousMatchanyComboBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="ValueTextField" linkSize="8" alignment="3" min="-2" pref="44" max="-2" attributes="0"/>
|
||||
<Component id="SubgoalTextField" linkSize="8" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="Goal2TextField" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="GoalIDTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="GoalTypeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="BooleanTextField" linkSize="10" alignment="3" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
<Component id="Goal1TextField" linkSize="8" alignment="3" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="OperatorComboBox" linkSize="10" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="ExecutableFileTextField" linkSize="10" alignment="3" min="-2" pref="44" max="-2" attributes="0"/>
|
||||
<Component id="ResultTagComboBox" linkSize="10" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="ArithmeticResultTagTextField" linkSize="10" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="AnswerTypeComboBox" linkSize="10" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="AnswerTagTextField" linkSize="10" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="ResultTag2ComboBox" linkSize="10" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="ParameterComboBox" linkSize="10" alignment="1" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="GoalTypeComboBox" alignment="3" max="-2" attributes="0"/>
|
||||
<Component id="OperatorComboBox" alignment="3" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="ParameterComboBox" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="ValueTextField" alignment="3" min="-2" pref="44" max="-2" attributes="0"/>
|
||||
<Component id="SubgoalTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="Goal2TextField" alignment="1" max="32767" attributes="0"/>
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="BooleanTextField" alignment="3" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
<Component id="Goal1TextField" alignment="3" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="ExecutableFileTextField" alignment="3" min="-2" pref="44" max="-2" attributes="0"/>
|
||||
<Component id="ResultTagComboBox" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="ArithmeticResultTagTextField" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="AnswerTypeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="AnswerTagTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="ResultTag2ComboBox" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="BooleanResultTagsComboBox" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="PreviousMatchanyComboBox" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="GoalIDTextField" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="BooleanResultTagsComboBox" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="PreviousMatchanyComboBox" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="83" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -161,9 +168,19 @@
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Hover over pulldown items for information about each goal type."/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Goal Type">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="goalTypeItemChanged"/>
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="GoalTypeComboBoxgoalTypeItemChanged"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<ToolTipWrapper>"/>
|
||||
@@ -318,6 +335,7 @@
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Hover over pulldown values for information about different answer types."/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Answer Type">
|
||||
@@ -332,7 +350,7 @@
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="AnswerTypeComboBoxItemStateChanged"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<ToolTipWrapper>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="ResultTag2ComboBox">
|
||||
@@ -350,6 +368,16 @@
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Parameter whose value is to be compared."/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Parameter">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
@@ -418,5 +446,13 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DownButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="DocButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Doc"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DocButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -1,50 +1,75 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package GoalsUI;
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.goalsui;
|
||||
|
||||
import static GoalsUI.ParamReferenceStorage.GoalType_ITEMS;
|
||||
import static GoalsUI.ParamReferenceStorage.Operator_ITEMS;
|
||||
import static GoalsUI.ParamReferenceStorage.answerTypes;
|
||||
import static GoalsUI.ParamReferenceStorage.goalInput;
|
||||
import static GoalsUI.ParamReferenceStorage.opInput;
|
||||
import static GoalsUI.ParamReferenceStorage.resultTagInput;
|
||||
import GoalsUI.ToolTipHandlers.ToolTipWrapper;
|
||||
import static GoalsUI.ToolTipHandlers.setComboItems;
|
||||
import java.awt.Dimension;
|
||||
import java.util.List;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JDialog;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.GoalType_ITEMS;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.Operator_ITEMS;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.Answer_ITEMS;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.goalInput;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.opInput;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.resultTagInput;
|
||||
import labtainers.goalsui.ParamReferenceStorage;
|
||||
import labtainers.mainui.ToolTipHandlers.ToolTipWrapper;
|
||||
import static labtainers.mainui.ToolTipHandlers.setComboItems;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dan
|
||||
* @author student
|
||||
*/
|
||||
|
||||
//NOTE: Previous Matchany ComboBox has not been implemented at all- 9/13/17
|
||||
|
||||
|
||||
|
||||
public class GoalPanels extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form GoalPanels
|
||||
*/
|
||||
static Dimension dim = new Dimension(975, 100);
|
||||
private GoalsUI goalsUI;
|
||||
private GoalsData dataUI;
|
||||
private int rowNum;
|
||||
|
||||
private List<String> resultTags;
|
||||
private List<String> parameterIDs;
|
||||
private List<String> booleanResultTags;
|
||||
|
||||
private String comments;
|
||||
|
||||
//Creating fresh goal line
|
||||
public GoalPanels(GoalsUI ui, GoalsData dataUI) {
|
||||
initiateGoalPanel(ui, dataUI, dataUI.getRowCount());
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
|
||||
//Loading goal line
|
||||
public GoalPanels(GoalsUI ui, GoalsData dataUI, GoalValues goalVal, int rowNum) {
|
||||
initiateGoalPanel(ui, dataUI, rowNum);
|
||||
@@ -63,13 +88,18 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
setArithmeticResultTagTextField(goalVal.resultTag);
|
||||
|
||||
setAnswerTypeComboBox(goalVal.answerType);
|
||||
|
||||
if(goalVal.answerType.equals(answerTypes[0])) //Literal
|
||||
|
||||
if(goalVal.answerType.equals(Answer_ITEMS[0].getItem())){
|
||||
//Literal
|
||||
//System.out.println("literal set "+goalVal.answerTag);
|
||||
setAnswerTagTextField(goalVal.answerTag);
|
||||
else if(goalVal.answerType.equals(answerTypes[1])) //Result Tag
|
||||
}else if(goalVal.answerType.equals(Answer_ITEMS[1].getItem())){
|
||||
//Result Tag
|
||||
setResultTag2ComboBox(goalVal.answerTag);
|
||||
else //Parameter & Parameter_ASCII
|
||||
}else{
|
||||
//Parameter & Parameter_ASCII
|
||||
setParameterComboBox(goalVal.answerTag);
|
||||
}
|
||||
|
||||
setBooleanTextField(goalVal.booleanExp);
|
||||
|
||||
@@ -81,15 +111,18 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
|
||||
setSubgoalTextField(goalVal.subgoalList);
|
||||
|
||||
this.comments = goalVal.comments;
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
|
||||
}
|
||||
|
||||
//Use for loading a line
|
||||
//Use for loading a line
|
||||
private void initiateGoalPanel(GoalsUI ui, GoalsData dataUI, int rowNum){
|
||||
initComponents();
|
||||
this.goalsUI = ui;
|
||||
this.dataUI = dataUI;
|
||||
this.rowNum = rowNum;
|
||||
|
||||
resultTags = dataUI.getResultTagList();
|
||||
@@ -117,14 +150,13 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
//Load ComboBox Items
|
||||
setComboItems(GoalTypeComboBox, GoalType_ITEMS);
|
||||
setComboItems(OperatorComboBox, Operator_ITEMS);
|
||||
|
||||
|
||||
|
||||
ResultTagComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(resultTags.toArray(new String[resultTags.size()])));
|
||||
AnswerTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(answerTypes));
|
||||
AnswerTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(Answer_ITEMS));
|
||||
if(parameterIDs.isEmpty()){
|
||||
AnswerTypeComboBox.removeItem(answerTypes[2]);
|
||||
AnswerTypeComboBox.removeItem(answerTypes[3]);
|
||||
AnswerTypeComboBox.removeItem(Answer_ITEMS[2]);
|
||||
AnswerTypeComboBox.removeItem(Answer_ITEMS[3]);
|
||||
}
|
||||
else
|
||||
ParameterComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(parameterIDs.toArray(new String[parameterIDs.size()])));
|
||||
@@ -165,16 +197,19 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
rowLabel = new javax.swing.JLabel();
|
||||
UpButton = new javax.swing.JButton();
|
||||
DownButton = new javax.swing.JButton();
|
||||
DocButton = new javax.swing.JButton();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(1110, 69));
|
||||
setMinimumSize(new java.awt.Dimension(1110, 69));
|
||||
|
||||
ArtifactPanel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
ArtifactPanel.setMinimumSize(new java.awt.Dimension(1400, 0));
|
||||
ArtifactPanel.setPreferredSize(new java.awt.Dimension(1300, 34));
|
||||
|
||||
GoalTypeComboBox.setToolTipText("Hover over pulldown items for information about each goal type.");
|
||||
GoalTypeComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Goal Type"));
|
||||
GoalTypeComboBox.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
goalTypeItemChanged(evt);
|
||||
GoalTypeComboBoxgoalTypeItemChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -200,6 +235,7 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
|
||||
ArithmeticResultTagTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Arithmetic Result Tag"));
|
||||
|
||||
AnswerTypeComboBox.setToolTipText("Hover over pulldown values for information about different answer types.");
|
||||
AnswerTypeComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Answer Type"));
|
||||
AnswerTypeComboBox.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
@@ -207,6 +243,9 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
ParameterComboBox.setToolTipText("Parameter whose value is to be compared.");
|
||||
ParameterComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Parameter"));
|
||||
|
||||
BooleanResultTagsComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Boolean Result Tags"));
|
||||
|
||||
javax.swing.GroupLayout ArtifactPanelLayout = new javax.swing.GroupLayout(ArtifactPanel);
|
||||
@@ -230,10 +269,10 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
.addComponent(AnswerTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(AnswerTagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGap(52, 52, 52)
|
||||
.addComponent(ResultTag2ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(ParameterComboBox, 0, 150, Short.MAX_VALUE)
|
||||
.addComponent(ParameterComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(BooleanTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 404, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
@@ -250,47 +289,36 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
.addComponent(PreviousMatchanyComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {Goal1TextField, Goal2TextField});
|
||||
|
||||
ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {ParameterComboBox, ResultTag2ComboBox});
|
||||
|
||||
ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {BooleanResultTagsComboBox, PreviousMatchanyComboBox});
|
||||
|
||||
ArtifactPanelLayout.setVerticalGroup(
|
||||
ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ArtifactPanelLayout.createSequentialGroup()
|
||||
.addGroup(ArtifactPanelLayout.createSequentialGroup()
|
||||
.addGap(14, 14, 14)
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(GoalTypeComboBox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(OperatorComboBox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(ParameterComboBox)
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(ValueTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(SubgoalTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(Goal2TextField, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(GoalIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(GoalTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(BooleanTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(Goal1TextField, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(OperatorComboBox)
|
||||
.addComponent(ExecutableFileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(ResultTagComboBox)
|
||||
.addComponent(ArithmeticResultTagTextField)
|
||||
.addComponent(AnswerTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(AnswerTagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(ResultTag2ComboBox, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(ParameterComboBox, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addComponent(BooleanResultTagsComboBox)
|
||||
.addComponent(PreviousMatchanyComboBox))
|
||||
.addGap(83, 83, 83))
|
||||
.addComponent(ResultTag2ComboBox, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(BooleanResultTagsComboBox, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(PreviousMatchanyComboBox, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(GoalIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {Goal1TextField, Goal2TextField, SubgoalTextField, ValueTextField});
|
||||
|
||||
ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {AnswerTagTextField, AnswerTypeComboBox, ArithmeticResultTagTextField, BooleanTextField, ExecutableFileTextField, OperatorComboBox, ParameterComboBox, ResultTag2ComboBox, ResultTagComboBox});
|
||||
|
||||
DeleteButton.setText("Delete");
|
||||
DeleteButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@@ -315,6 +343,13 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
DocButton.setText("Doc");
|
||||
DocButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
DocButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -328,37 +363,43 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(UpButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(DownButton, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(DeleteButton)
|
||||
.addGap(73, 73, 73))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(DocButton)
|
||||
.addComponent(DeleteButton))
|
||||
.addGap(51, 51, 51))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(UpButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(DownButton))
|
||||
.addComponent(DeleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(rowLabel)))
|
||||
.addComponent(DeleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(DownButton)
|
||||
.addComponent(DocButton)))
|
||||
.addComponent(rowLabel))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(ArtifactPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void GoalTypeComboBoxgoalTypeItemChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_GoalTypeComboBoxgoalTypeItemChanged
|
||||
goalTypeListener();
|
||||
}//GEN-LAST:event_GoalTypeComboBoxgoalTypeItemChanged
|
||||
|
||||
private void AnswerTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_AnswerTypeComboBoxItemStateChanged
|
||||
answerTypeListener();
|
||||
}//GEN-LAST:event_AnswerTypeComboBoxItemStateChanged
|
||||
|
||||
private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed
|
||||
deleteButton();
|
||||
deleteButton();
|
||||
}//GEN-LAST:event_DeleteButtonActionPerformed
|
||||
|
||||
private void deleteButton(){
|
||||
JPanel container = (JPanel)this.getParent();
|
||||
container.remove(this);
|
||||
goalsUI.dataUI.decreaseRowCount();
|
||||
goalsUI.refresh();
|
||||
}
|
||||
|
||||
private void UpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpButtonActionPerformed
|
||||
swapUpdate("UP", rowNum-1); //Subtract rowNum by one to get the proper index number
|
||||
}//GEN-LAST:event_UpButtonActionPerformed
|
||||
@@ -367,15 +408,42 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
swapUpdate("DOWN", rowNum-1); //Subtract rowNum by one to get the proper index number
|
||||
}//GEN-LAST:event_DownButtonActionPerformed
|
||||
|
||||
private void goalTypeItemChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_goalTypeItemChanged
|
||||
goalTypeListener();
|
||||
}//GEN-LAST:event_goalTypeItemChanged
|
||||
private void DocButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DocButtonActionPerformed
|
||||
DocPanel panel = new DocPanel();
|
||||
|
||||
private void AnswerTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_AnswerTypeComboBoxItemStateChanged
|
||||
answerTypeListener();
|
||||
}//GEN-LAST:event_AnswerTypeComboBoxItemStateChanged
|
||||
panel.setDoc(this.comments);
|
||||
//panel.setVisible(true);
|
||||
JDialog dialog = new JDialog();
|
||||
panel.setDialog(dialog);
|
||||
//dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
dialog.setModal(true);
|
||||
dialog.add(panel);
|
||||
dialog.pack();
|
||||
dialog.setLocation(200, 200);
|
||||
dialog.setTitle("Documentation for "+GoalIDTextField.getText());
|
||||
dialog.setVisible(true);
|
||||
if(panel.isOK()){
|
||||
this.comments = panel.getDoc();
|
||||
}
|
||||
dialog.dispose();
|
||||
|
||||
}//GEN-LAST:event_DocButtonActionPerformed
|
||||
|
||||
// BUTTONS and LISTENERS //
|
||||
|
||||
private void deleteButton(){
|
||||
JPanel container = (JPanel)this.getParent();
|
||||
container.remove(this);
|
||||
goalsUI.data.decreaseRowCount();
|
||||
goalsUI.refresh();
|
||||
}
|
||||
|
||||
private void goalTypeListener(){
|
||||
Object item = GoalTypeComboBox.getSelectedItem();
|
||||
if(item == null){
|
||||
System.out.println("Goal type item "+item);
|
||||
return;
|
||||
}
|
||||
String goalType = ((ToolTipWrapper)GoalTypeComboBox.getSelectedItem()).getItem();
|
||||
|
||||
if(opInput.contains(goalType))
|
||||
@@ -398,6 +466,8 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
|
||||
private void visibilityHandler(String type){
|
||||
OperatorComboBox.setVisible(false);
|
||||
if(((DefaultComboBoxModel)OperatorComboBox.getModel()).getIndexOf(Operator_ITEMS[5]) == -1)
|
||||
OperatorComboBox.insertItemAt(Operator_ITEMS[5], 0);
|
||||
if(((DefaultComboBoxModel)OperatorComboBox.getModel()).getIndexOf(Operator_ITEMS[4]) == -1)
|
||||
OperatorComboBox.insertItemAt(Operator_ITEMS[4], 0);
|
||||
if(((DefaultComboBoxModel)OperatorComboBox.getModel()).getIndexOf(Operator_ITEMS[2]) == -1)
|
||||
@@ -424,10 +494,10 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
ArithmeticResultTagTextField.setText("");
|
||||
|
||||
AnswerTypeComboBox.setVisible(false);
|
||||
AnswerTypeComboBox.setSelectedItem(answerTypes[0]);
|
||||
AnswerTypeComboBox.setSelectedItem(Answer_ITEMS[0]);
|
||||
//"Result Tag" may have been removed by the execute goaltype so readd it to the combo box to reset it back to default
|
||||
if(((DefaultComboBoxModel)AnswerTypeComboBox.getModel()).getIndexOf("Result Tag") == -1)
|
||||
AnswerTypeComboBox.addItem("Result Tag");
|
||||
AnswerTypeComboBox.addItem(Answer_ITEMS[1]);
|
||||
AnswerTagTextField.setVisible(false);
|
||||
AnswerTagTextField.setText("");
|
||||
|
||||
@@ -492,7 +562,7 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
ResultTagComboBox.setVisible(true);
|
||||
AnswerTypeComboBox.setVisible(true);
|
||||
//Answertag is expected to be a literal value or a symbolic name from parameters.config (pg. 26 in labtainers manual)
|
||||
AnswerTypeComboBox.removeItem("Result Tag");
|
||||
AnswerTypeComboBox.removeItem(Answer_ITEMS[1]); // Result Tag
|
||||
AnswerTagTextField.setVisible(true);
|
||||
break;
|
||||
case "matche":
|
||||
@@ -515,9 +585,9 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
private void answerTypeListener(){
|
||||
String answerType = (String)(AnswerTypeComboBox.getSelectedItem());
|
||||
ToolTipWrapper answerType = (ToolTipWrapper)(AnswerTypeComboBox.getSelectedItem());
|
||||
|
||||
if(answerType.equals(answerTypes[0])){ //Literal
|
||||
if(answerType.equals(Answer_ITEMS[0])){ //Literal
|
||||
AnswerTagTextField.setVisible(true);
|
||||
|
||||
ResultTag2ComboBox.setVisible(false);
|
||||
@@ -528,7 +598,7 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
if(parameterIDs != null && !parameterIDs.isEmpty())
|
||||
ParameterComboBox.setSelectedItem(parameterIDs.get(0));
|
||||
}
|
||||
else if(answerType.equals(answerTypes[1])){ //Result Tag
|
||||
else if(answerType.equals(Answer_ITEMS[1])){ //Result Tag
|
||||
AnswerTagTextField.setVisible(false);
|
||||
AnswerTagTextField.setText("");
|
||||
|
||||
@@ -538,7 +608,7 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
if(parameterIDs != null && !parameterIDs.isEmpty())
|
||||
ParameterComboBox.setSelectedItem(parameterIDs.get(0));
|
||||
}
|
||||
else if(answerType.equals(answerTypes[2]) || answerType.equals(answerTypes[3])){
|
||||
else if(answerType.equals(Answer_ITEMS[2]) || answerType.equals(Answer_ITEMS[3])){
|
||||
AnswerTagTextField.setVisible(false);
|
||||
AnswerTagTextField.setText("");
|
||||
|
||||
@@ -555,11 +625,22 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
|
||||
//Swaps goal order in the list of goals and then redraws them
|
||||
protected void swapUpdate(String type, int rowIndex){
|
||||
goalsUI.dataUI.updateListofGoals(goalsUI.getPanelofGoals());
|
||||
goalsUI.dataUI.swapGoals(type, rowIndex);
|
||||
goalsUI.goalsPanelRedraw();
|
||||
goalsUI.data.updateListofGoals(goalsUI.getPanelofGoals());
|
||||
goalsUI.data.swapGoals(type, rowIndex);
|
||||
goalsUI.loadUI();
|
||||
}
|
||||
|
||||
|
||||
public void updateParameters(){
|
||||
String current = (String) ParameterComboBox.getSelectedItem();
|
||||
parameterIDs = dataUI.getParameters();
|
||||
ParameterComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(parameterIDs.toArray(new String[parameterIDs.size()])));
|
||||
if(parameterIDs.contains(current)){
|
||||
ParameterComboBox.setSelectedItem(current);
|
||||
}else{
|
||||
String id = getGoalIDTextField().getText();
|
||||
System.out.println("ERROR, goal "+id+" parameter of "+current+" was removed from parameters.");
|
||||
}
|
||||
}
|
||||
|
||||
//Field Getters
|
||||
public JTextField getGoalIDTextField(){
|
||||
@@ -622,6 +703,9 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
return SubgoalTextField;
|
||||
}
|
||||
|
||||
public String getComments(){
|
||||
return this.comments;
|
||||
}
|
||||
|
||||
|
||||
//Field SETTERS
|
||||
@@ -650,7 +734,8 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
private void setAnswerTypeComboBox(String v){
|
||||
AnswerTypeComboBox.setSelectedItem(v);
|
||||
ToolTipWrapper tip = ParamReferenceStorage.getWrapper(Answer_ITEMS, v);
|
||||
AnswerTypeComboBox.setSelectedItem(tip);
|
||||
}
|
||||
|
||||
private void setAnswerTagTextField(String v){
|
||||
@@ -686,14 +771,17 @@ public class GoalPanels extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JTextField AnswerTagTextField;
|
||||
private javax.swing.JComboBox<String> AnswerTypeComboBox;
|
||||
private javax.swing.JComboBox<ToolTipWrapper> AnswerTypeComboBox;
|
||||
private javax.swing.JTextField ArithmeticResultTagTextField;
|
||||
private javax.swing.JPanel ArtifactPanel;
|
||||
private javax.swing.JComboBox<String> BooleanResultTagsComboBox;
|
||||
private javax.swing.JTextField BooleanTextField;
|
||||
private javax.swing.JButton DeleteButton;
|
||||
private javax.swing.JButton DocButton;
|
||||
private javax.swing.JButton DownButton;
|
||||
private javax.swing.JTextField ExecutableFileTextField;
|
||||
private javax.swing.JTextField Goal1TextField;
|
||||
@@ -1,158 +1,215 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package GoalsUI;
|
||||
|
||||
import static GoalsUI.ParamReferenceStorage.GoalType_ITEMS;
|
||||
import static GoalsUI.ParamReferenceStorage.Operator_ITEMS;
|
||||
import static GoalsUI.ParamReferenceStorage.answerTypes;
|
||||
import static GoalsUI.ParamReferenceStorage.goalInput;
|
||||
import static GoalsUI.ParamReferenceStorage.opInput;
|
||||
import static GoalsUI.ParamReferenceStorage.resultTagInput;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dan
|
||||
*/
|
||||
|
||||
//****The param parsing in this class is limited to where the param value's corresponding index is on the goal line.
|
||||
//If at any point this alignment is modified with less or more params, this code will need to be revised
|
||||
public class GoalValues {
|
||||
//Values to be obtained
|
||||
String goalID, resultTag, answerTag, answerType, booleanExp, goal1, goal2, value, subgoalList, executableFile;
|
||||
|
||||
ToolTipHandlers.ToolTipWrapper goalType, operator;
|
||||
|
||||
//Constructor for loading goals into the UI
|
||||
GoalValues(String goalLine, List<String> resultTags){
|
||||
goalID = resultTag = answerType = answerTag = booleanExp = goal1 = goal2 = value = subgoalList = executableFile = "";
|
||||
goalType = null;
|
||||
operator = Operator_ITEMS[0];
|
||||
//by default set the result tag to the first result tag in the resultTags list (Warning: an error will occur if there is nothing the results tags list)
|
||||
resultTag = resultTags.get(0);
|
||||
answerType = answerTypes[0];
|
||||
|
||||
String[] paramParsedLine = goalLine.split(" : ");
|
||||
|
||||
//Get goal ID
|
||||
goalID = paramParsedLine[0].split(" = ")[0].trim();
|
||||
|
||||
//System.out.println(paramParsedLine[0].split(" = ")[1]);
|
||||
|
||||
|
||||
|
||||
//Get goal type
|
||||
if(paramParsedLine[0].split(" = ")[1].trim().equals("count")){
|
||||
if(paramParsedLine.length > 2)
|
||||
goalType = GoalType_ITEMS[10]; //count_matches
|
||||
else
|
||||
goalType = GoalType_ITEMS[9]; //count_value
|
||||
}
|
||||
else
|
||||
goalType = itemFinder(GoalType_ITEMS, paramParsedLine[0].split(" = ")[1].trim());
|
||||
|
||||
if(opInput.contains(goalType.getItem())){
|
||||
operator = itemFinder(Operator_ITEMS, paramParsedLine[1]);
|
||||
resultTag = paramParsedLine[2];
|
||||
|
||||
//Overwrite the goaltype to "matchExpression" if the result tag has a parenthesis (this indicates an arithmetic expression)
|
||||
if(resultTag.contains("(")){
|
||||
goalType = GoalType_ITEMS[12];
|
||||
//take out outer parens in resultTag
|
||||
if(resultTag.startsWith("(") && resultTag.endsWith(")"))
|
||||
resultTag = resultTag.substring(1, resultTag.length() -1);
|
||||
}
|
||||
|
||||
answerTagModifier(paramParsedLine[3], resultTags);
|
||||
}
|
||||
else if(goalInput.contains(goalType.getItem())){
|
||||
goal1 = paramParsedLine[1].trim();
|
||||
goal2 = paramParsedLine[2].trim();
|
||||
}
|
||||
else if(resultTagInput.contains(goalType.getItem())){
|
||||
resultTag = paramParsedLine[1].trim();
|
||||
}
|
||||
else if("boolean".equals(goalType.getItem())){
|
||||
booleanExp = paramParsedLine[1];
|
||||
}
|
||||
else if("count_greater".equals(goalType.getItem())){
|
||||
value = paramParsedLine[1].trim();
|
||||
subgoalList = paramParsedLine[2].trim();
|
||||
//Chop off the surrounding parens since this will be readded when written
|
||||
if(subgoalList.startsWith("(") && subgoalList.endsWith(")"))
|
||||
subgoalList = subgoalList.substring(1, subgoalList.length() -1);
|
||||
}
|
||||
else if("execute".equals(goalType.getItem())){
|
||||
executableFile = paramParsedLine[1];
|
||||
resultTag = paramParsedLine[2];
|
||||
answerTagModifier(paramParsedLine[3], resultTags);
|
||||
}
|
||||
else
|
||||
System.out.println("Goal Type doesn't match any");
|
||||
}
|
||||
|
||||
//Constructor for temporarily storing values of artifacts in the UI
|
||||
GoalValues(String goalID, ToolTipHandlers.ToolTipWrapper goalType, ToolTipHandlers.ToolTipWrapper operator, String resultTag, String answerType, String answerTag, String booleanExp, String goal1, String goal2, String value, String subgoalList, String executableFile){
|
||||
this.goalID = goalID;
|
||||
this.goalType = goalType;
|
||||
this.operator = operator;
|
||||
this.resultTag = resultTag;
|
||||
this.answerType = answerType;
|
||||
this.answerTag = answerTag;
|
||||
this.booleanExp = booleanExp;
|
||||
this.goal1 = goal1;
|
||||
this.goal2 = goal2;
|
||||
this.value = value;
|
||||
this.subgoalList = subgoalList;
|
||||
this.executableFile = executableFile;
|
||||
}
|
||||
|
||||
//set the answertype & answertag to be displayed on the gui based on the config's answer tag
|
||||
private void answerTagModifier(String aT, List<String> resultTags){
|
||||
if(aT.contains("answer=")){
|
||||
answerTag = aT.split("answer=")[1];
|
||||
}
|
||||
else if(resultTags.contains(aT)){
|
||||
answerTag = aT;
|
||||
answerType = answerTypes[1]; //Result Tags
|
||||
}
|
||||
else if(aT.contains("result.")){
|
||||
answerTag = aT.split("result.")[1];
|
||||
answerType = answerTypes[1]; //Result Tags
|
||||
}
|
||||
else if(aT.contains("parameter.")){
|
||||
answerTag = aT.split("parameter.")[1];
|
||||
answerType = answerTypes[2]; //Parameter
|
||||
}
|
||||
else if(aT.contains("parameter_ascii.")){
|
||||
answerTag = aT.split("parameter_ascii.")[1];
|
||||
answerType = answerTypes[3]; //Parameter_ASCII
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){
|
||||
for(ToolTipHandlers.ToolTipWrapper item : list){
|
||||
if(item.getItem().equals(desired)){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isInteger(String s){
|
||||
try{
|
||||
Integer.parseInt(s);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.goalsui;
|
||||
|
||||
import java.util.List;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.GoalType_ITEMS;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.Operator_ITEMS;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.answerTypes;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.goalInput;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.opInput;
|
||||
import static labtainers.goalsui.ParamReferenceStorage.resultTagInput;
|
||||
import labtainers.mainui.ToolTipHandlers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class GoalValues {
|
||||
//Values to be obtained
|
||||
String goalID, resultTag, answerTag, answerType, booleanExp, goal1, goal2, value, subgoalList, executableFile, comments;
|
||||
|
||||
ToolTipHandlers.ToolTipWrapper goalType, operator;
|
||||
|
||||
//Constructor for loading goals into the UI
|
||||
GoalValues(String inputLine, List<String> resultTags){
|
||||
goalID = resultTag = answerType = answerTag = booleanExp = goal1 = goal2 = value = subgoalList = executableFile = comments = "";
|
||||
goalType = null;
|
||||
operator = Operator_ITEMS[0];
|
||||
//by default set the result tag to the first result tag in the resultTags list (Warning: an error will occur if there is nothing the results tags list)
|
||||
resultTag = resultTags.get(0);
|
||||
answerType = answerTypes[0];
|
||||
|
||||
String goalLine;
|
||||
if(inputLine.contains("\n")){
|
||||
String[] the_lines = inputLine.split("\n");
|
||||
goalLine = the_lines[the_lines.length-1];
|
||||
for(int i=0; i<the_lines.length-1; i++){
|
||||
comments = comments+the_lines[i]+"\n";
|
||||
}
|
||||
}else{
|
||||
goalLine = inputLine;
|
||||
}
|
||||
String[] paramParsedLine = goalLine.split(" : ");
|
||||
|
||||
//Get goal ID
|
||||
goalID = paramParsedLine[0].split(" = ")[0].trim();
|
||||
|
||||
//System.out.println(paramParsedLine[0].split(" = ")[1]);
|
||||
|
||||
|
||||
|
||||
//Get goal type
|
||||
if(paramParsedLine[0].split(" = ")[1].trim().equals("count")){
|
||||
if(paramParsedLine.length > 2)
|
||||
goalType = GoalType_ITEMS[10]; //count_matches
|
||||
else
|
||||
goalType = GoalType_ITEMS[9]; //count_value
|
||||
}
|
||||
else
|
||||
goalType = itemFinder(GoalType_ITEMS, paramParsedLine[0].split(" = ")[1].trim());
|
||||
|
||||
if(opInput.contains(goalType.getItem())){
|
||||
operator = itemFinder(Operator_ITEMS, paramParsedLine[1]);
|
||||
if(operator == null){
|
||||
System.out.println("Operator unknown in "+inputLine);
|
||||
}
|
||||
resultTag = paramParsedLine[2];
|
||||
|
||||
//Overwrite the goaltype to "matchExpression" if the result tag has a parenthesis (this indicates an arithmetic expression)
|
||||
if(resultTag.contains("(")){
|
||||
goalType = GoalType_ITEMS[12];
|
||||
//take out outer parens in resultTag
|
||||
if(resultTag.startsWith("(") && resultTag.endsWith(")"))
|
||||
resultTag = resultTag.substring(1, resultTag.length() -1);
|
||||
}
|
||||
|
||||
answerTagModifier(paramParsedLine[3], resultTags);
|
||||
}
|
||||
else if(goalInput.contains(goalType.getItem())){
|
||||
goal1 = paramParsedLine[1].trim();
|
||||
goal2 = paramParsedLine[2].trim();
|
||||
}
|
||||
else if(resultTagInput.contains(goalType.getItem())){
|
||||
resultTag = paramParsedLine[1].trim();
|
||||
}
|
||||
else if("boolean".equals(goalType.getItem())){
|
||||
booleanExp = paramParsedLine[1];
|
||||
}
|
||||
else if("count_greater".equals(goalType.getItem())){
|
||||
value = paramParsedLine[1].trim();
|
||||
subgoalList = paramParsedLine[2].trim();
|
||||
//Chop off the surrounding parens since this will be readded when written
|
||||
if(subgoalList.startsWith("(") && subgoalList.endsWith(")"))
|
||||
subgoalList = subgoalList.substring(1, subgoalList.length() -1);
|
||||
}
|
||||
else if("execute".equals(goalType.getItem())){
|
||||
executableFile = paramParsedLine[1];
|
||||
resultTag = paramParsedLine[2];
|
||||
answerTagModifier(paramParsedLine[3], resultTags);
|
||||
}
|
||||
else
|
||||
System.out.println("Goal Type doesn't match any");
|
||||
}
|
||||
|
||||
//Constructor for temporarily storing values of artifacts in the UI
|
||||
GoalValues(String goalID, ToolTipHandlers.ToolTipWrapper goalType, ToolTipHandlers.ToolTipWrapper operator, String resultTag, String answerType, String answerTag, String booleanExp, String goal1, String goal2, String value, String subgoalList, String executableFile, String comments){
|
||||
this.goalID = goalID;
|
||||
this.goalType = goalType;
|
||||
this.operator = operator;
|
||||
this.resultTag = resultTag;
|
||||
this.answerType = answerType;
|
||||
this.answerTag = answerTag;
|
||||
this.booleanExp = booleanExp;
|
||||
this.goal1 = goal1;
|
||||
this.goal2 = goal2;
|
||||
this.value = value;
|
||||
this.subgoalList = subgoalList;
|
||||
this.executableFile = executableFile;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
//Deep copy
|
||||
GoalValues(GoalValues original){
|
||||
goalID = original.goalID;
|
||||
goalType = original.goalType;
|
||||
operator = original.operator;
|
||||
resultTag = original.resultTag;
|
||||
answerTag = original.answerTag;
|
||||
answerType = original.answerType;
|
||||
booleanExp = original.booleanExp;
|
||||
goal1 = original.goal1;
|
||||
goal2 = original.goal2;
|
||||
value = original.value;
|
||||
subgoalList = original.subgoalList;
|
||||
executableFile = original.executableFile;
|
||||
comments = original.comments;
|
||||
}
|
||||
|
||||
//set the answertype & answertag to be displayed on the gui based on the config's answer tag
|
||||
private void answerTagModifier(String aT, List<String> resultTags){
|
||||
answerTag = "";
|
||||
try{
|
||||
if(aT.contains("answer=")){
|
||||
answerTag = aT.split("answer=")[1];
|
||||
//System.out.println("answer tag set to "+answerTag);
|
||||
}
|
||||
else if(resultTags.contains(aT)){
|
||||
answerTag = aT;
|
||||
answerType = answerTypes[1]; //Result Tags
|
||||
}
|
||||
else if(aT.contains("result.")){
|
||||
answerTag = aT.split("result.")[1];
|
||||
answerType = answerTypes[1]; //Result Tags
|
||||
}
|
||||
else if(aT.contains("parameter.")){
|
||||
answerTag = aT.split("parameter.")[1];
|
||||
answerType = answerTypes[2]; //Parameter
|
||||
}
|
||||
else if(aT.contains("parameter_ascii.")){
|
||||
answerTag = aT.split("parameter_ascii.")[1];
|
||||
answerType = answerTypes[3]; //Parameter_ASCII
|
||||
}
|
||||
}catch(java.lang.ArrayIndexOutOfBoundsException ex){
|
||||
System.out.println("Error in goal value "+aT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){
|
||||
for(ToolTipHandlers.ToolTipWrapper item : list){
|
||||
if(item.getItem().equals(desired)){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isInteger(String s){
|
||||
try{
|
||||
Integer.parseInt(s);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="ff" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1590, 500]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1110, 389]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
@@ -37,26 +31,31 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="ScrollPaneOfGoals" alignment="0" pref="1300" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="CreateButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
||||
<Component id="RemoveAllButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="98" max="-2" attributes="0"/>
|
||||
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="LabNameTextField" min="-2" pref="378" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="LabNotExist" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="344" max="32767" attributes="0"/>
|
||||
<Component id="UpdateButton" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="ScrollPaneOfGoals" alignment="0" pref="1566" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="CreateButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="RemoveAllButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="89" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="140" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="434" max="-2" attributes="0"/>
|
||||
<Component id="UpdateButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="62" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -66,54 +65,36 @@
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="CreateButton" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="RemoveAllButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="LabNameTextField" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="UpdateButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="LabNotExist" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="CreateButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="RemoveAllButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ScrollPaneOfGoals" pref="317" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="ScrollPaneOfGoals" min="-2" pref="380" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="UpdateButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="ScrollPaneOfGoals">
|
||||
<Component class="javax.swing.JButton" name="CreateButton">
|
||||
<Properties>
|
||||
<Property name="autoscrolls" type="boolean" value="true"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1300, 800]"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="12" style="1"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="PanelofGoals">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="3"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="UpdateButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Update"/>
|
||||
<Property name="text" type="java.lang.String" value="Create"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="UpdateButtonActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CreateButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="RemoveAllButton">
|
||||
@@ -127,60 +108,48 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="RemoveAllButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel9">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial Black" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Lab Name: "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="CreateButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Create"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CreateButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Goal Type"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="The mode in which a value is found."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Goal ID"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="The symbolic name of the result, which will be referenced in the goals configuration file. 

(It must be alphanumeric, underscores permitted) "/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="The goal identifier displayed in lab grading output. Use an underscore prefix to supress inclusion in that output, e.g., to use the goal within a boolean expression."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="LabNameTextField">
|
||||
<Component class="javax.swing.JButton" name="UpdateButton">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[6, 25]"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="OK"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="LabNameTextFieldActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="UpdateButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="LabNotExist">
|
||||
<Container class="javax.swing.JScrollPane" name="ScrollPaneOfGoals">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="14" style="1"/>
|
||||
<Property name="autoscrolls" type="boolean" value="true"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1300, 800]"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Lab does not exist!"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="PanelofGoals">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="CancelButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,349 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.goalsui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollBar;
|
||||
import labtainers.mainui.MainWindow;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author student
|
||||
*/
|
||||
|
||||
|
||||
public class GoalsUI extends javax.swing.JFrame {
|
||||
|
||||
/**
|
||||
* Creates new form GoalsUI
|
||||
*/
|
||||
GoalsData data;
|
||||
GoalsData saved;
|
||||
MainWindow mainUI;
|
||||
|
||||
public GoalsUI(java.awt.Frame parent, boolean modal) {
|
||||
//super(parent, modal);
|
||||
initComponents();
|
||||
this.setVisible(true);
|
||||
goalsScrollPaneBar = ScrollPaneOfGoals.getVerticalScrollBar();
|
||||
this.mainUI = (MainWindow)parent;
|
||||
this.data = this.mainUI.getCurrentData().getGoalsData();
|
||||
this.saved = new GoalsData(this.data);
|
||||
loadUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
CreateButton = new javax.swing.JButton();
|
||||
RemoveAllButton = new javax.swing.JButton();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
UpdateButton = new javax.swing.JButton();
|
||||
ScrollPaneOfGoals = new javax.swing.JScrollPane();
|
||||
PanelofGoals = new javax.swing.JPanel();
|
||||
CancelButton = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setMinimumSize(new java.awt.Dimension(1590, 500));
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
public void windowClosing(java.awt.event.WindowEvent evt) {
|
||||
formWindowClosing(evt);
|
||||
}
|
||||
});
|
||||
|
||||
CreateButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N
|
||||
CreateButton.setText("Create");
|
||||
CreateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CreateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
RemoveAllButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N
|
||||
RemoveAllButton.setText("Remove All");
|
||||
RemoveAllButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
RemoveAllButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel1.setText("Goal ID");
|
||||
jLabel1.setToolTipText("The goal identifier displayed in lab grading output. Use an underscore prefix to supress inclusion in that output, e.g., to use the goal within a boolean expression.");
|
||||
|
||||
UpdateButton.setText("OK");
|
||||
UpdateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
UpdateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
ScrollPaneOfGoals.setAutoscrolls(true);
|
||||
ScrollPaneOfGoals.setMaximumSize(new java.awt.Dimension(1300, 800));
|
||||
|
||||
PanelofGoals.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
||||
ScrollPaneOfGoals.setViewportView(PanelofGoals);
|
||||
|
||||
CancelButton.setText("Cancel");
|
||||
CancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(ScrollPaneOfGoals, javax.swing.GroupLayout.DEFAULT_SIZE, 1566, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(CreateButton)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(RemoveAllButton)
|
||||
.addGap(0, 0, Short.MAX_VALUE))))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(140, 140, 140)
|
||||
.addComponent(jLabel1))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(434, 434, 434)
|
||||
.addComponent(UpdateButton)
|
||||
.addGap(62, 62, 62)
|
||||
.addComponent(CancelButton)))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(CreateButton)
|
||||
.addComponent(RemoveAllButton))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jLabel1)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(ScrollPaneOfGoals, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(UpdateButton)
|
||||
.addComponent(CancelButton))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed
|
||||
createButton();
|
||||
}//GEN-LAST:event_CreateButtonActionPerformed
|
||||
|
||||
private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed
|
||||
removeAllButton();
|
||||
}//GEN-LAST:event_RemoveAllButtonActionPerformed
|
||||
|
||||
private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed
|
||||
if(updateButton()){
|
||||
mainUI.setGoalsClosed();
|
||||
setVisible(false);
|
||||
dispose();
|
||||
}
|
||||
}//GEN-LAST:event_UpdateButtonActionPerformed
|
||||
|
||||
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
|
||||
mainUI.setGoalsClosed();
|
||||
}//GEN-LAST:event_formWindowClosing
|
||||
|
||||
private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed
|
||||
mainUI.setGoalsClosed();
|
||||
setVisible(false);
|
||||
}//GEN-LAST:event_CancelButtonActionPerformed
|
||||
|
||||
// BUTTONS //
|
||||
|
||||
private void createButton(){
|
||||
addGoalsPanel(new GoalPanels(this, data));
|
||||
goalsScrollPaneBar.setValue(goalsScrollPaneBar.getMaximum());
|
||||
}
|
||||
|
||||
private void removeAllButton(){
|
||||
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){
|
||||
removeAllGoals();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean updateButton(){
|
||||
boolean retval = true;
|
||||
data.updateListofGoals(PanelofGoals);
|
||||
saved = new GoalsData(data);
|
||||
String fname = saved.writeGoalsConfig(true);
|
||||
if(fname == null){
|
||||
retval = false;
|
||||
}else{
|
||||
this.mainUI.getCurrentData().setGoalsData(saved);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
public void updateParameters(){
|
||||
data.updateParameters(PanelofGoals);
|
||||
}
|
||||
|
||||
|
||||
// CORE FUNCTIONS//
|
||||
|
||||
//Removes all the goal lines for the lab *note: this doesn't update results.config until the user hits the update button
|
||||
private void removeAllGoals(){
|
||||
data.resetRowCount();
|
||||
goalsPanePanelLength = 0;
|
||||
PanelofGoals.setPreferredSize(new Dimension(0,goalsPanePanelLength));
|
||||
|
||||
Component[] componentList = PanelofGoals.getComponents();
|
||||
for(Component c: componentList)
|
||||
PanelofGoals.remove(c);
|
||||
|
||||
|
||||
PanelofGoals.revalidate();
|
||||
PanelofGoals.repaint();
|
||||
}
|
||||
|
||||
|
||||
// Loads all goals into GUI
|
||||
protected void loadUI(){
|
||||
removeAllGoals();
|
||||
for(int i=0; i < data.getListofGoals().size(); i++){
|
||||
loadGoal(data.getListofGoals().get(i), i+1);
|
||||
}
|
||||
}
|
||||
|
||||
//Loads the goal into GUI
|
||||
private void loadGoal(GoalValues goalVal, int rowNum){
|
||||
GoalPanels newGoal = new GoalPanels(this, data, goalVal, rowNum);
|
||||
addGoalsPanel(newGoal);
|
||||
}
|
||||
|
||||
|
||||
// Add the goals panel into GUI
|
||||
public int goalsPanePanelLength = 0;
|
||||
private JScrollBar goalsScrollPaneBar;
|
||||
private void addGoalsPanel(GoalPanels panel){
|
||||
//Resize the JPanel Holding all the Goal Panels to fit another one (makes the scroll bar resize and should show all objects listed)
|
||||
//as of 8/24/2020 the PanelofArtifacts uses a flow layout with a horizontal gap of 5, that's where the 5 comes from in the line below
|
||||
goalsPanePanelLength+=panel.getPreferredSize().height+5;
|
||||
PanelofGoals.setPreferredSize(new Dimension(0,goalsPanePanelLength));
|
||||
|
||||
// Create the Goal Panel and add it
|
||||
data.increaseRowCount();
|
||||
PanelofGoals.add(panel); //takes in parent(this), containerlist, rowcount
|
||||
|
||||
// Redraw GUI with the new Panel
|
||||
PanelofGoals.revalidate();
|
||||
PanelofGoals.repaint();
|
||||
}
|
||||
|
||||
//Updates the list of goals and redraws them on screen
|
||||
void refresh(){
|
||||
data.updateListofGoals(PanelofGoals);
|
||||
loadUI();
|
||||
}
|
||||
|
||||
//Gets the panel holding the goals
|
||||
protected JPanel getPanelofGoals(){
|
||||
return PanelofGoals;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the dialog */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
GoalsUI dialog = new GoalsUI(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton CancelButton;
|
||||
private javax.swing.JButton CreateButton;
|
||||
private javax.swing.JPanel PanelofGoals;
|
||||
private javax.swing.JButton RemoveAllButton;
|
||||
private javax.swing.JScrollPane ScrollPaneOfGoals;
|
||||
private javax.swing.JButton UpdateButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -1,190 +1,244 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package GoalsUI;
|
||||
|
||||
import GoalsUI.ToolTipHandlers.ToolTipWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dan
|
||||
*/
|
||||
public class ParamReferenceStorage {
|
||||
|
||||
public static final ToolTipWrapper[] GoalType_ITEMS = new ToolTipWrapper[] {
|
||||
//0
|
||||
new ToolTipWrapper("matchany", "<html>Results from all timestamped sets are evaluated.<br>" +
|
||||
"If the answertag names a result, then both that<br>" +
|
||||
"result and the resulttag must occur in the same<br>" +
|
||||
"timestamped set. The ’matchany’ goals are treated<br>" +
|
||||
"as a set of values, each timestamped based on the<br>" +
|
||||
"timestamp of the reference resulttag.</html>"),
|
||||
// 1
|
||||
new ToolTipWrapper("matchlast", "<html>only results from the latest timestamped set are<br>" +
|
||||
"evaluated.</html>"),
|
||||
// 2
|
||||
new ToolTipWrapper("matchacross", "<html>The resulttag and answertag name results. The<br>" +
|
||||
"operator is applied against values in different<br>" +
|
||||
"timestamped sets. For example, a \"string_diff\"<br>" +
|
||||
"operator would require the named results to have<br>" +
|
||||
"at least two distinct values in different<br>" +
|
||||
"timestamped sets.</html>"),
|
||||
// 3
|
||||
new ToolTipWrapper("boolean", "<html>The goal value is computed from a boolean expression<br>" +
|
||||
"consisting of goal_id’s and boolean operators, (\"and\",<br>" +
|
||||
"\"or\", \"and_not\", \"or_not\", and \"not\"), and parenthisis<br>" +
|
||||
"for precedence. The goal_id’s must be from goals defined<br>" +
|
||||
"earlier in the goals.config file, or boolean results<br>" +
|
||||
"from results.config. The goal evalutes to<br>" +
|
||||
"TRUE if the boolen expression evaluates to TRUE for any<br>" +
|
||||
"of the timestamped sets of goal_ids, (see the ’matchany’<br>" +
|
||||
"discussion above). The goal_id’s cannot include any<br>" +
|
||||
"\"matchacross\" goals. NOTE: evaluation is within<br>" +
|
||||
"timestamped sets. If you want to evaluate across<br>" +
|
||||
"timestamps, use the count_greater_operator below.</html>"),
|
||||
// 4
|
||||
new ToolTipWrapper("count_greater", "<html>The goal is TRUE if the count of TRUE subgoals in the<br>" +
|
||||
"list exceeds the given value. The subgoals are<br>" +
|
||||
"summed across all timestamps. The subgoal list is<br>" +
|
||||
"comma-separated within parenthesis.</html>"),
|
||||
// 5
|
||||
new ToolTipWrapper("time_before", "<html>Both goal1 and goal2 must be goal_ids from previous<br>" +
|
||||
"matchany, or boolean values from results.config<br>" +
|
||||
"A timestamped goal is created for each goal2<br>" +
|
||||
"timestamped instance whose timestamp is proceeded<br>" +
|
||||
"by a goal1 timestamped instance. The goal for that<br>" +
|
||||
"timestamp will be TRUE if the goal2<br>" +
|
||||
"instance is TRUE, and at least one of the goal1<br>" +
|
||||
"instances is TRUE. These timestamped goals can<br>" +
|
||||
"then be evaluated within boolean goals.</html>"),
|
||||
// 6
|
||||
new ToolTipWrapper("time_during", "<html>Both goal1 and goal2 must be goal_ids from previous<br>" +
|
||||
"matchany goal types, or boolean values from<br>" +
|
||||
"results.config. Timestamps include a start and end<br>" +
|
||||
"time, reflecting when the program starts and when it<br>" +
|
||||
"terminates. A timestamped goal is created for each<br>" +
|
||||
"goal2 range that encompasses a goal1 timestamp.<br>" +
|
||||
"The goal for that timestamp will be TRUE if the<br>" +
|
||||
"goal2 instance is TRUE, and at least one goal1 instance<br>" +
|
||||
"is TRUE. These timestamped goals can then be<br>" +
|
||||
"evaluated within boolean goals.</html>"),
|
||||
// 7
|
||||
new ToolTipWrapper("time_not_during", "<html>Similar to time_during, but timestamped goals are<br>" +
|
||||
"always created for each goal2. Each such goal is True<br>" +
|
||||
"unless one or more goal1 times occur within a True goal2<br>" +
|
||||
"range.</html>"),
|
||||
// 8
|
||||
new ToolTipWrapper("execute", "<html>The <operator> is treated as a file name of a script to<br>" +
|
||||
"execute, with the resulttag and answertag passed to the<br>" +
|
||||
"script as arguments. The resulttag is expected to be<br>" +
|
||||
"one of the symbolic names defined in the results.config<br>" +
|
||||
"file, while the answertag is expected to be a literal<br>" +
|
||||
"value or the symbolic name in the parameters.config file<br>" +
|
||||
"Note: the answertag cannot be a symbolic name from<br>" +
|
||||
"results.config</html>"),
|
||||
// 9
|
||||
new ToolTipWrapper("count_value", "<html>If the remainder of the line only includes a resulttag,<br>" +
|
||||
"then the goal value is assigned the quanity of<br>" +
|
||||
"timestamped files containing the given resulttag.<br>" +
|
||||
"Otherwise the goal value is assigned the<br>" +
|
||||
"quantity of timestamped files having results<br>" +
|
||||
"that satisfy the given operator and arguments.</html>"),
|
||||
// 10
|
||||
new ToolTipWrapper("count_matches", "<html>If the remainder of the line only includes a resulttag,<br>" +
|
||||
"then the goal value is assigned the quanity of<br>" +
|
||||
"timestamped files containing the given resulttag.<br>" +
|
||||
"Otherwise the goal value is assigned the<br>" +
|
||||
"quantity of timestamped files having results<br>" +
|
||||
"that satisfy the given operator and arguments.</html>"),
|
||||
// 11
|
||||
new ToolTipWrapper("value", "<html>The goal value is assigned the given resulttag value from<br>" +
|
||||
"the most recent timestamped file that contains the resulttag.</html>"),
|
||||
|
||||
// 12
|
||||
new ToolTipWrapper("matchExpression", "<html>The resultTag is an arithmetic expression</html>")};
|
||||
|
||||
|
||||
public static final ToolTipWrapper[] Operator_ITEMS = new ToolTipWrapper[] {
|
||||
// 0
|
||||
new ToolTipWrapper("string_equal", "<html>The strings derived from answertag and resulttag<br>" +
|
||||
"are equal.</html>"),
|
||||
// 1
|
||||
new ToolTipWrapper("string_diff", "<html>The line_id is an integer line number<br>" +
|
||||
"(starting at one). Use of this to identify<br>" +
|
||||
"lines is discouraged since minor lab changes<br>" +
|
||||
"might alter the count.</html>"),
|
||||
// 2
|
||||
new ToolTipWrapper("string_start", "<html>the line_id is a string. This names the<br>" +
|
||||
"first occurrence of a line that starts with<br>" +
|
||||
"this string.</html>" ),
|
||||
// 3
|
||||
new ToolTipWrapper("string_end", "<html>The line_id is a string. This names the<br>" +
|
||||
"first occurrence of a line that contains the<br>" +
|
||||
"string.</html>" ),
|
||||
// 4
|
||||
new ToolTipWrapper("string_contains", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" ),
|
||||
|
||||
// 5
|
||||
new ToolTipWrapper("integer_equal", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" ),
|
||||
|
||||
// 6
|
||||
new ToolTipWrapper("integer_greater", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" ),
|
||||
|
||||
// 7
|
||||
new ToolTipWrapper("integer_lessthan", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" )};
|
||||
|
||||
|
||||
//Answer Types
|
||||
public static final String[] answerTypes = new String[] {
|
||||
"Literal",
|
||||
"Result Tag",
|
||||
"Parameter",
|
||||
"Parameter ASCII"
|
||||
};
|
||||
|
||||
//Boolean Result Types
|
||||
public static final ArrayList<String> booleanResultTypes = new ArrayList<String>(Arrays.asList(
|
||||
"CONTAINS",
|
||||
"FILE_REGEX",
|
||||
"LOG_TS",
|
||||
"FILE_REGEX_TS",
|
||||
"LOG_RANGE",
|
||||
"TIME_DELIM"
|
||||
));
|
||||
|
||||
//Input format 1: [operator : resultTag : answerTag]
|
||||
public static final ArrayList<String> opInput = new ArrayList<String>(Arrays.asList(
|
||||
"matchany",
|
||||
"matchlast",
|
||||
"matchacross",
|
||||
"count_matches"
|
||||
));
|
||||
|
||||
//Input format 2: [goal1 : goal2]
|
||||
public static final ArrayList<String> goalInput = new ArrayList<String>(Arrays.asList(
|
||||
"time_before",
|
||||
"time_during",
|
||||
"time_not_during"
|
||||
));
|
||||
|
||||
//Input format 2: [resultTag]
|
||||
public static final ArrayList<String> resultTagInput = new ArrayList<String>(Arrays.asList(
|
||||
"count_value",
|
||||
"value"
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.goalsui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import labtainers.mainui.ToolTipHandlers.ToolTipWrapper;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ParamReferenceStorage {
|
||||
public static ToolTipWrapper getWrapper(ToolTipWrapper[] tipList, String item){
|
||||
ToolTipWrapper retval = null;
|
||||
|
||||
for(ToolTipWrapper tool_tip : tipList){
|
||||
if(tool_tip.getItem().equals(item)){
|
||||
retval = tool_tip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
public static final ToolTipWrapper[] GoalType_ITEMS = new ToolTipWrapper[] {
|
||||
//0
|
||||
new ToolTipWrapper("matchany", "<html>Results from all timestamped sets are evaluated.<br>" +
|
||||
"If the answertag names a result, then both that<br>" +
|
||||
"result and the resulttag must occur in the same<br>" +
|
||||
"timestamped set. The ’matchany’ goals are treated<br>" +
|
||||
"as a set of values, each timestamped based on the<br>" +
|
||||
"timestamp of the reference resulttag.</html>"),
|
||||
// 1
|
||||
new ToolTipWrapper("matchlast", "<html>only results from the latest timestamped set are<br>" +
|
||||
"evaluated.</html>"),
|
||||
// 2
|
||||
new ToolTipWrapper("matchacross", "<html>The resulttag and answertag name results. The<br>" +
|
||||
"operator is applied against values in different<br>" +
|
||||
"timestamped sets. For example, a \"string_diff\"<br>" +
|
||||
"operator would require the named results to have<br>" +
|
||||
"at least two distinct values in different<br>" +
|
||||
"timestamped sets.</html>"),
|
||||
// 3
|
||||
new ToolTipWrapper("boolean", "<html>The goal value is computed from a boolean expression<br>" +
|
||||
"consisting of goal_id’s and boolean operators, (\"and\",<br>" +
|
||||
"\"or\", \"and_not\", \"or_not\", and \"not\"), and parenthisis<br>" +
|
||||
"for precedence. The goal_id’s must be from goals defined<br>" +
|
||||
"earlier in the goals.config file, or boolean results<br>" +
|
||||
"from results.config. The goal evalutes to<br>" +
|
||||
"TRUE if the boolen expression evaluates to TRUE for any<br>" +
|
||||
"of the timestamped sets of goal_ids, (see the ’matchany’<br>" +
|
||||
"discussion above). The goal_id’s cannot include any<br>" +
|
||||
"\"matchacross\" goals. NOTE: evaluation is within<br>" +
|
||||
"timestamped sets. If you want to evaluate across<br>" +
|
||||
"timestamps, use the count_greater_operator below.</html>"),
|
||||
// 4
|
||||
new ToolTipWrapper("count_greater", "<html>The goal is TRUE if the count of TRUE subgoals in the<br>" +
|
||||
"list exceeds the given value. The subgoals are<br>" +
|
||||
"summed across all timestamps. The subgoal list is<br>" +
|
||||
"comma-separated within parenthesis.</html>"),
|
||||
// 5
|
||||
new ToolTipWrapper("time_before", "<html>Both goal1 and goal2 must be goal_ids from previous<br>" +
|
||||
"matchany, or boolean values from results.config<br>" +
|
||||
"A timestamped goal is created for each goal2<br>" +
|
||||
"timestamped instance whose timestamp is proceeded<br>" +
|
||||
"by a goal1 timestamped instance. The goal for that<br>" +
|
||||
"timestamp will be TRUE if the goal2<br>" +
|
||||
"instance is TRUE, and at least one of the goal1<br>" +
|
||||
"instances is TRUE. These timestamped goals can<br>" +
|
||||
"then be evaluated within boolean goals.</html>"),
|
||||
// 6
|
||||
new ToolTipWrapper("time_during", "<html>Both goal1 and goal2 must be goal_ids from previous<br>" +
|
||||
"matchany goal types, or boolean values from<br>" +
|
||||
"results.config. Timestamps include a start and end<br>" +
|
||||
"time, reflecting when the program starts and when it<br>" +
|
||||
"terminates. A timestamped goal is created for each<br>" +
|
||||
"goal2 range that encompasses a goal1 timestamp.<br>" +
|
||||
"The goal for that timestamp will be TRUE if the<br>" +
|
||||
"goal2 instance is TRUE, and at least one goal1 instance<br>" +
|
||||
"is TRUE. These timestamped goals can then be<br>" +
|
||||
"evaluated within boolean goals.</html>"),
|
||||
// 7
|
||||
new ToolTipWrapper("time_not_during", "<html>Similar to time_during, but timestamped goals are<br>" +
|
||||
"always created for each goal2. Each such goal is True<br>" +
|
||||
"unless one or more goal1 times occur within a True goal2<br>" +
|
||||
"range.</html>"),
|
||||
// 8
|
||||
new ToolTipWrapper("execute", "<html>The <operator> is treated as a file name of a script to<br>" +
|
||||
"execute, with the resulttag and answertag passed to the<br>" +
|
||||
"script as arguments. The resulttag is expected to be<br>" +
|
||||
"one of the symbolic names defined in the results.config<br>" +
|
||||
"file, while the answertag is expected to be a literal<br>" +
|
||||
"value or the symbolic name in the parameters.config file<br>" +
|
||||
"Note: the answertag cannot be a symbolic name from<br>" +
|
||||
"results.config</html>"),
|
||||
// 9
|
||||
new ToolTipWrapper("count_value", "<html>If the remainder of the line only includes a resulttag,<br>" +
|
||||
"then the goal value is assigned the quanity of<br>" +
|
||||
"timestamped files containing the given resulttag.<br>" +
|
||||
"Otherwise the goal value is assigned the<br>" +
|
||||
"quantity of timestamped files having results<br>" +
|
||||
"that satisfy the given operator and arguments.</html>"),
|
||||
// 10
|
||||
new ToolTipWrapper("count_matches", "<html>If the remainder of the line only includes a resulttag,<br>" +
|
||||
"then the goal value is assigned the quanity of<br>" +
|
||||
"timestamped files containing the given resulttag.<br>" +
|
||||
"Otherwise the goal value is assigned the<br>" +
|
||||
"quantity of timestamped files having results<br>" +
|
||||
"that satisfy the given operator and arguments.</html>"),
|
||||
// 11
|
||||
new ToolTipWrapper("value", "<html>The goal value is assigned the given resulttag value from<br>" +
|
||||
"the most recent timestamped file that contains the resulttag.</html>"),
|
||||
// 12
|
||||
new ToolTipWrapper("value_sum", "<html>The goal value is assigned the sum of all the given<br>" +
|
||||
"resulttag values.</html>"),
|
||||
// 13
|
||||
new ToolTipWrapper("value_max", "<html>The goal value is assigned the maximum resulttag value<br>" +
|
||||
"</html>"),
|
||||
|
||||
// 14
|
||||
new ToolTipWrapper("matchExpression", "<html>The resultTag is an arithmetic expression</html>")};
|
||||
|
||||
|
||||
public static final ToolTipWrapper[] Operator_ITEMS = new ToolTipWrapper[] {
|
||||
// 0
|
||||
new ToolTipWrapper("string_equal", "<html>The strings derived from answertag and resulttag<br>" +
|
||||
"are equal.</html>"),
|
||||
// 1
|
||||
new ToolTipWrapper("string_diff", "<html>The line_id is an integer line number<br>" +
|
||||
"(starting at one). Use of this to identify<br>" +
|
||||
"lines is discouraged since minor lab changes<br>" +
|
||||
"might alter the count.</html>"),
|
||||
// 2
|
||||
new ToolTipWrapper("string_start", "<html>the line_id is a string. This names the<br>" +
|
||||
"first occurrence of a line that starts with<br>" +
|
||||
"this string.</html>" ),
|
||||
// 3
|
||||
new ToolTipWrapper("string_end", "<html>The line_id is a string. This names the<br>" +
|
||||
"first occurrence of a line that contains the<br>" +
|
||||
"string.</html>" ),
|
||||
// 4
|
||||
new ToolTipWrapper("string_contains", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" ),
|
||||
|
||||
// 5
|
||||
new ToolTipWrapper("integer_equal", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" ),
|
||||
|
||||
// 6
|
||||
new ToolTipWrapper("integer_greater", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" ),
|
||||
|
||||
// 7
|
||||
new ToolTipWrapper("integer_lessthan", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" ),
|
||||
|
||||
// 8
|
||||
new ToolTipWrapper("hash_equal", "<html>The resulttag value is hashed using the Lab Master Seed<br>"+
|
||||
"defined in the start.config. That is compared with<br>"+
|
||||
"the answertag, which should have been generated by<br>"+
|
||||
"the hash-goals.py utility</html>")};
|
||||
|
||||
public static final ToolTipWrapper[] Answer_ITEMS = new ToolTipWrapper[] {
|
||||
//0
|
||||
new ToolTipWrapper("Literal", "<html>blah</html"),
|
||||
new ToolTipWrapper("Result Tag", "<html>blah</html"),
|
||||
new ToolTipWrapper("Parameter", "<html>blah</html"),
|
||||
new ToolTipWrapper("Parameter ASCII", "<html>blah</html")
|
||||
};
|
||||
|
||||
//Answer Types
|
||||
public static final String[] answerTypes = new String[] {
|
||||
"Literal",
|
||||
"Result Tag",
|
||||
"Parameter",
|
||||
"Parameter ASCII"
|
||||
};
|
||||
|
||||
//Boolean Result Types
|
||||
public static final ArrayList<String> booleanResultTypes = new ArrayList<String>(Arrays.asList(
|
||||
"CONTAINS",
|
||||
"FILE_REGEX",
|
||||
"LOG_TS",
|
||||
"FILE_REGEX_TS",
|
||||
"LOG_RANGE",
|
||||
"RANGE_REGEX",
|
||||
"TIME_DELIM"
|
||||
));
|
||||
|
||||
//Input format 1: [operator : resultTag : answerTag]
|
||||
public static final ArrayList<String> opInput = new ArrayList<String>(Arrays.asList(
|
||||
"matchany",
|
||||
"matchlast",
|
||||
"matchacross",
|
||||
"count_matches"
|
||||
));
|
||||
|
||||
//Input format 2: [goal1 : goal2]
|
||||
public static final ArrayList<String> goalInput = new ArrayList<String>(Arrays.asList(
|
||||
"time_before",
|
||||
"time_during",
|
||||
"time_not_during"
|
||||
));
|
||||
|
||||
//Input format 2: [resultTag]
|
||||
public static final ArrayList<String> resultTagInput = new ArrayList<String>(Arrays.asList(
|
||||
"count_value",
|
||||
"value",
|
||||
"value_sum",
|
||||
"value_max"
|
||||
));
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.mainui;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
public class CompareTextFiles
|
||||
{
|
||||
private static boolean plainComment(String line){
|
||||
boolean retval = false;
|
||||
if(line.trim().startsWith("#") && !line.contains("DOC:")){
|
||||
retval = true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
private static String nextLine(BufferedReader br) throws IOException{
|
||||
String line = br.readLine();
|
||||
//System.out.println("nextLine line: "+line);
|
||||
// when did java lose its evaluation precidence?
|
||||
if(line != null){
|
||||
line = line.trim().replaceAll(" +", " ");
|
||||
while(line != null && (plainComment(line) || line.trim().length() == 0)){
|
||||
line = br.readLine();
|
||||
if(line == null)
|
||||
break;
|
||||
line = line.trim().replaceAll(" +", " ");
|
||||
}
|
||||
}
|
||||
return line;
|
||||
}
|
||||
public static boolean compare(String path1, String path2) throws IOException
|
||||
{
|
||||
if(path1 == null || path2 == null){
|
||||
return false;
|
||||
}
|
||||
BufferedReader reader1 = new BufferedReader(new FileReader(path1));
|
||||
BufferedReader reader2 = new BufferedReader(new FileReader(path2));
|
||||
String line1 = nextLine(reader1);
|
||||
String line2 = nextLine(reader2);
|
||||
boolean areEqual = true;
|
||||
int lineNum = 1;
|
||||
|
||||
while (line1 != null || line2 != null)
|
||||
{
|
||||
if((line1 == null && line2.trim().length()>0) || (line2 == null && line1.trim().length()>0))
|
||||
{
|
||||
areEqual = false;
|
||||
break;
|
||||
}
|
||||
else if((line1 != null && line2 != null) && (! line1.trim().equalsIgnoreCase(line2.trim())))
|
||||
{
|
||||
/*
|
||||
System.out.println("DIFFERENT");
|
||||
System.out.println("\t"+line1);
|
||||
System.out.println("\t"+line2);
|
||||
*/
|
||||
areEqual = false;
|
||||
break;
|
||||
}
|
||||
line1 = nextLine(reader1);
|
||||
line2 = nextLine(reader2);
|
||||
lineNum++;
|
||||
}
|
||||
|
||||
if(areEqual)
|
||||
{
|
||||
//System.out.println("Two files have same content.");
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
System.out.println("Two files have different content. They differ at line "+lineNum);
|
||||
System.out.println("File1 has "+line1+" and File2 has "+line2+" at line "+lineNum);
|
||||
System.out.println("file1 "+path1+" file2: "+path2);
|
||||
*/
|
||||
}
|
||||
|
||||
reader1.close();
|
||||
reader2.close();
|
||||
return areEqual;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[545, 58]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[545, 58]"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="" noResource="true"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[545, 58]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="AddHostNetworkCombobox" min="-2" pref="188" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="AddHostHostTF" min="-2" pref="213" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="AddHostIpTF" min="-2" pref="213" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="AddHostDeleteButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="AddHostNetworkCombobox" alignment="3" pref="34" max="32767" attributes="0"/>
|
||||
<Component id="AddHostHostTF" alignment="3" min="-2" pref="32" max="-2" attributes="0"/>
|
||||
<Component id="AddHostDeleteButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="AddHostIpTF" alignment="3" min="-2" pref="32" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextField" name="AddHostIpTF">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="AddHostNetworkCombobox">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="AddHostHostTF">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="AddHostDeleteButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="AddHostDeleteButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.mainui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ContainerConfigAddHosts extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form ContainerConfigAddHosts
|
||||
*/
|
||||
private final ContainerObjPanel parent;
|
||||
public ContainerConfigAddHosts(ContainerObjPanel parent, LabData data, String type, String host, String ip, String network) {
|
||||
initComponents();
|
||||
this.parent = parent;
|
||||
|
||||
// IP MODE
|
||||
if(type.equals("ip")){
|
||||
this.AddHostHostTF.setText(host);
|
||||
this.AddHostIpTF.setText(ip);
|
||||
this.AddHostNetworkCombobox.setVisible(false);
|
||||
}
|
||||
// NETWORK MODE
|
||||
else {
|
||||
//Fill the combobox with the current list of Networks
|
||||
for(int i = 0;i<data.getNetworks().size();i++)
|
||||
this.AddHostNetworkCombobox.addItem(data.getNetworks().get(i).name);
|
||||
|
||||
this.AddHostNetworkCombobox.setSelectedItem(network);
|
||||
this.AddHostHostTF.setVisible(false);
|
||||
this.AddHostIpTF.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
AddHostIpTF = new javax.swing.JTextField();
|
||||
AddHostNetworkCombobox = new javax.swing.JComboBox<>();
|
||||
AddHostHostTF = new javax.swing.JTextField();
|
||||
AddHostDeleteButton = new javax.swing.JButton();
|
||||
|
||||
setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
setMaximumSize(new java.awt.Dimension(545, 58));
|
||||
setMinimumSize(new java.awt.Dimension(545, 58));
|
||||
setName(""); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(545, 58));
|
||||
|
||||
AddHostIpTF.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
|
||||
AddHostHostTF.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
|
||||
AddHostDeleteButton.setText("Delete");
|
||||
AddHostDeleteButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
AddHostDeleteButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(AddHostNetworkCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(AddHostHostTF, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(AddHostIpTF, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(AddHostDeleteButton)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(AddHostNetworkCombobox, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE)
|
||||
.addComponent(AddHostHostTF, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(AddHostDeleteButton)
|
||||
.addComponent(AddHostIpTF, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void AddHostDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddHostDeleteButtonActionPerformed
|
||||
remove();
|
||||
}//GEN-LAST:event_AddHostDeleteButtonActionPerformed
|
||||
|
||||
// MANIPULATION //
|
||||
|
||||
// Deletes this object
|
||||
protected void remove(){
|
||||
JPanel containerAddhostPanel = (JPanel)this.getParent();
|
||||
|
||||
// delete the container from the list
|
||||
containerAddhostPanel.remove(this);
|
||||
|
||||
// Shorten the panel height holding all the containers and resize it.
|
||||
parent.containerAddHostPanelLength-=63;
|
||||
containerAddhostPanel.setPreferredSize(new Dimension(0,parent.containerAddHostPanelLength));
|
||||
|
||||
// Redraw the panel containing the list of containers
|
||||
containerAddhostPanel.revalidate();
|
||||
containerAddhostPanel.repaint();
|
||||
}
|
||||
|
||||
// Adds network to combobox
|
||||
protected void addNetworkToComboBox(String newNetworkName){
|
||||
AddHostNetworkCombobox.addItem(newNetworkName);
|
||||
}
|
||||
|
||||
// Deletes network from combobox
|
||||
protected void deleteNetworkInComboBox(String deletedNetwork){
|
||||
AddHostNetworkCombobox.removeItem(deletedNetwork);
|
||||
}
|
||||
|
||||
// Updates the combobox list with the renamed network
|
||||
protected void renameNetworkToComboBox(String oldNetwork, String newNetwork){
|
||||
boolean updateSelectedItem = AddHostNetworkCombobox.getSelectedItem().equals(oldNetwork);
|
||||
ArrayList<String> tmp = new ArrayList<String>();
|
||||
|
||||
//Create new list to set as the combobox items
|
||||
for(int i=0;i<AddHostNetworkCombobox.getItemCount();i++){
|
||||
if(AddHostNetworkCombobox.getItemAt(i).equals(oldNetwork))
|
||||
tmp.add(newNetwork);
|
||||
else
|
||||
tmp.add(AddHostNetworkCombobox.getItemAt(i));
|
||||
}
|
||||
|
||||
// Empty the combobox items
|
||||
AddHostNetworkCombobox.removeAllItems();
|
||||
|
||||
// Fill the combobox with updated list of items
|
||||
for(int i=0;i<tmp.size();i++)
|
||||
AddHostNetworkCombobox.addItem(tmp.get(i));
|
||||
|
||||
// Set the selected item if the selected network was renamed
|
||||
if(updateSelectedItem)
|
||||
AddHostNetworkCombobox.setSelectedItem(newNetwork);
|
||||
}
|
||||
|
||||
// GETTERS //
|
||||
|
||||
public String getNetwork(){
|
||||
return (String)(AddHostNetworkCombobox.getSelectedItem());
|
||||
}
|
||||
|
||||
public String getHost(){
|
||||
return AddHostHostTF.getText();
|
||||
}
|
||||
|
||||
public String getIp(){
|
||||
return AddHostIpTF.getText();
|
||||
}
|
||||
|
||||
public javax.swing.JComboBox<String> getNetworkCombobox(){
|
||||
return AddHostNetworkCombobox;
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton AddHostDeleteButton;
|
||||
private javax.swing.JTextField AddHostHostTF;
|
||||
private javax.swing.JTextField AddHostIpTF;
|
||||
private javax.swing.JComboBox<String> AddHostNetworkCombobox;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[543, 53]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[543, 53]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[543, 53]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
|
||||
<Component id="ContainerConfigNetworksNameCombobox" min="-2" pref="169" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ContainerConfigNetworksIPTextfield" min="-2" pref="250" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ContainerConfigNetworksDeleteButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="ContainerConfigNetworksDeleteButton" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="1" pref="1" max="-2" attributes="0"/>
|
||||
<Component id="ContainerConfigNetworksIPTextfield" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="ContainerConfigNetworksNameCombobox" min="-2" pref="31" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JComboBox" name="ContainerConfigNetworksNameCombobox">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ContainerConfigNetworksNameComboboxActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="ContainerConfigNetworksIPTextfield">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="ContainerConfigNetworksDeleteButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ContainerConfigNetworksDeleteButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.mainui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ContainerConfigNetworksSubpanel extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form ContainerConfigNetworksSubpanel
|
||||
*/
|
||||
private final ContainerObjPanel parent;
|
||||
private LabData data;
|
||||
public ContainerConfigNetworksSubpanel(ContainerObjPanel parent, LabData data, String network, String ip) {
|
||||
initComponents();
|
||||
this.parent = parent;
|
||||
this.data = data;
|
||||
//Fill the combobox with the current list of Networks
|
||||
for(int i = 0;i<data.getNetworks().size();i++){
|
||||
this.ContainerConfigNetworksNameCombobox.addItem(data.getNetworks().get(i).name);
|
||||
}
|
||||
// Set fields
|
||||
this.ContainerConfigNetworksNameCombobox.setSelectedItem(network);
|
||||
if (ip.trim().length() == 0){
|
||||
int index = 0;
|
||||
if(network.trim().length() != 0 && ip.trim().length() == 0){
|
||||
index = ContainerConfigNetworksNameCombobox.getSelectedIndex();
|
||||
}
|
||||
String subnet = data.getNetworks().get(index).mask;
|
||||
String ip_part = subnet.split("/")[0];
|
||||
ip = ip_part;
|
||||
}
|
||||
this.ContainerConfigNetworksIPTextfield.setText(ip);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
ContainerConfigNetworksNameCombobox = new javax.swing.JComboBox<>();
|
||||
ContainerConfigNetworksIPTextfield = new javax.swing.JTextField();
|
||||
ContainerConfigNetworksDeleteButton = new javax.swing.JButton();
|
||||
|
||||
setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
setMaximumSize(new java.awt.Dimension(543, 53));
|
||||
setMinimumSize(new java.awt.Dimension(543, 53));
|
||||
setPreferredSize(new java.awt.Dimension(543, 53));
|
||||
|
||||
ContainerConfigNetworksNameCombobox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
ContainerConfigNetworksNameCombobox.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
ContainerConfigNetworksNameComboboxActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
ContainerConfigNetworksIPTextfield.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
|
||||
ContainerConfigNetworksDeleteButton.setText("Delete");
|
||||
ContainerConfigNetworksDeleteButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
ContainerConfigNetworksDeleteButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(27, 27, 27)
|
||||
.addComponent(ContainerConfigNetworksNameCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(ContainerConfigNetworksIPTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(ContainerConfigNetworksDeleteButton)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(ContainerConfigNetworksDeleteButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||
.addGap(1, 1, 1)
|
||||
.addComponent(ContainerConfigNetworksIPTextfield))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||
.addComponent(ContainerConfigNetworksNameCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void ContainerConfigNetworksDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerConfigNetworksDeleteButtonActionPerformed
|
||||
remove();
|
||||
}//GEN-LAST:event_ContainerConfigNetworksDeleteButtonActionPerformed
|
||||
|
||||
private void ContainerConfigNetworksNameComboboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerConfigNetworksNameComboboxActionPerformed
|
||||
int index = ContainerConfigNetworksNameCombobox.getSelectedIndex();
|
||||
String subnet = this.data.getNetworks().get(index).mask;
|
||||
String ip_part = subnet.split("/")[0];
|
||||
this.ContainerConfigNetworksIPTextfield.setText(ip_part);
|
||||
}//GEN-LAST:event_ContainerConfigNetworksNameComboboxActionPerformed
|
||||
|
||||
// MANIPULATION //
|
||||
|
||||
// Deletes this object
|
||||
protected void remove(){
|
||||
JPanel containerConfigNetworksPanel = (JPanel)this.getParent();
|
||||
// Delete the container from the list
|
||||
containerConfigNetworksPanel.remove(this);
|
||||
|
||||
// Shorten the panel height holding all the containers and resize it.
|
||||
parent.containerConfigNetworksPanelLength-=53;
|
||||
containerConfigNetworksPanel.setPreferredSize(new Dimension(0,parent.containerConfigNetworksPanelLength));
|
||||
|
||||
// Redraw the panel containing the list of containers
|
||||
containerConfigNetworksPanel.revalidate();
|
||||
containerConfigNetworksPanel.repaint();
|
||||
}
|
||||
|
||||
// Adds a network into the combobox
|
||||
protected void addNetworkToComboBox(String newNetworkName){
|
||||
ContainerConfigNetworksNameCombobox.addItem(newNetworkName);
|
||||
}
|
||||
|
||||
// Deletes a network from the combobox
|
||||
protected void deleteNetworkInComboBox(String deletedNetwork){
|
||||
ContainerConfigNetworksNameCombobox.removeItem(deletedNetwork);
|
||||
}
|
||||
|
||||
// Updates the combobox list with the renamed network
|
||||
protected void renameNetworkToComboBox(String oldNetwork, String newNetwork){
|
||||
boolean updateSelectedItem = ContainerConfigNetworksNameCombobox.getSelectedItem().equals(oldNetwork);
|
||||
ArrayList<String> tmp = new ArrayList<String>();
|
||||
|
||||
//Create new list to set as the combobox items
|
||||
for(int i=0;i<ContainerConfigNetworksNameCombobox.getItemCount();i++){
|
||||
if(ContainerConfigNetworksNameCombobox.getItemAt(i).equals(oldNetwork))
|
||||
tmp.add(newNetwork);
|
||||
else
|
||||
tmp.add(ContainerConfigNetworksNameCombobox.getItemAt(i));
|
||||
}
|
||||
|
||||
// Empty the combobox items
|
||||
ContainerConfigNetworksNameCombobox.removeAllItems();
|
||||
|
||||
// Fill the combobox with updated list of items
|
||||
for(int i=0;i<tmp.size();i++)
|
||||
ContainerConfigNetworksNameCombobox.addItem(tmp.get(i));
|
||||
|
||||
// Set the selected item if the selected network was renamed
|
||||
if(updateSelectedItem)
|
||||
ContainerConfigNetworksNameCombobox.setSelectedItem(newNetwork);
|
||||
}
|
||||
|
||||
// GETTERS //
|
||||
|
||||
public String getNetwork(){
|
||||
return (String)(ContainerConfigNetworksNameCombobox.getSelectedItem());
|
||||
}
|
||||
|
||||
public String getIP(){
|
||||
return ContainerConfigNetworksIPTextfield.getText();
|
||||
}
|
||||
|
||||
public javax.swing.JComboBox<String> getNetworkComboBox(){
|
||||
return ContainerConfigNetworksNameCombobox;
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton ContainerConfigNetworksDeleteButton;
|
||||
private javax.swing.JTextField ContainerConfigNetworksIPTextfield;
|
||||
private javax.swing.JComboBox<String> ContainerConfigNetworksNameCombobox;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,803 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.mainui;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import labtainers.goalsui.GoalsData;
|
||||
import labtainers.resultsui.ResultsData;
|
||||
import labtainers.paramsui.ParamsData;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
|
||||
public class LabData {
|
||||
private String name;
|
||||
private File path;
|
||||
private ArrayList<String> global_settings_params;
|
||||
private ArrayList<ContainerData> listOfContainers;
|
||||
private ArrayList<NetworkData> listOfNetworks;
|
||||
|
||||
private ResultsData resultsData;
|
||||
private GoalsData goalsData;
|
||||
private ParamsData paramsData;
|
||||
|
||||
static protected class NetworkData {
|
||||
public String name = "";
|
||||
public String mask = "";
|
||||
public String gateway = "";
|
||||
public int macvlan_ext;
|
||||
public int macvlan;
|
||||
public boolean tap = false;
|
||||
|
||||
public ArrayList<String> unknownNetworkParams;
|
||||
|
||||
NetworkData(String name){
|
||||
this.name = name;
|
||||
this.unknownNetworkParams = new ArrayList<String>();
|
||||
}
|
||||
|
||||
NetworkData(String name, String mask, String gateway, int macvlan_ext, int macvlan, boolean tap){
|
||||
this.name = name;
|
||||
this.mask = mask;
|
||||
this.gateway = gateway;
|
||||
this.macvlan_ext = macvlan_ext;
|
||||
this.macvlan = macvlan;
|
||||
this.tap = tap;
|
||||
this.unknownNetworkParams = new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
|
||||
static protected class ContainerData{
|
||||
public String name;
|
||||
public int terminal_count = 1;
|
||||
public String terminal_group = "";
|
||||
public String xterm_title = "";
|
||||
public String xterm_script = "";
|
||||
public String user = "";
|
||||
public String password = "";
|
||||
public ArrayList<ContainerNetworkSubData> listOfContainerNetworks;
|
||||
public ArrayList<ContainerAddHostSubData> listOfContainerAddHost;
|
||||
public boolean x11;
|
||||
public boolean no_param;
|
||||
public int clone;
|
||||
public boolean no_pull;
|
||||
public String lab_gateway = "";
|
||||
public String name_server = "";
|
||||
public boolean no_gw;
|
||||
public boolean no_resolve;
|
||||
public String registry = "";
|
||||
public String base_registry = "";
|
||||
public String thumb_volume = "";
|
||||
public String thumb_command = "";
|
||||
public String thumb_stop = "";
|
||||
public String publish = "";
|
||||
public boolean hide;
|
||||
public boolean no_privilege;
|
||||
public boolean mystuff;
|
||||
public boolean tap;
|
||||
public String mount1 = "";
|
||||
public String mount2 = "";
|
||||
public String wait_for = "";
|
||||
public String num_cpus = "";
|
||||
public String cpu_set = "";
|
||||
|
||||
public ArrayList<String> unknownContainerParams;
|
||||
|
||||
ContainerData(String name){
|
||||
this.name = name;
|
||||
this.listOfContainerNetworks = new ArrayList<ContainerNetworkSubData>();
|
||||
this.listOfContainerAddHost = new ArrayList<ContainerAddHostSubData>();
|
||||
this.unknownContainerParams = new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
|
||||
static protected class ContainerNetworkSubData{
|
||||
public String network_name;
|
||||
public String network_ipaddress;
|
||||
|
||||
ContainerNetworkSubData(String name, String ipaddress){
|
||||
this.network_name = name;
|
||||
this.network_ipaddress = ipaddress;
|
||||
}
|
||||
}
|
||||
|
||||
static protected class ContainerAddHostSubData{
|
||||
public String type = "";
|
||||
public String add_host_host = "";
|
||||
public String add_host_ip = "";
|
||||
public String add_host_network = "";
|
||||
|
||||
ContainerAddHostSubData(String type, String host, String ip, String network){
|
||||
this.type = type;
|
||||
this.add_host_host = host;
|
||||
this.add_host_ip = ip;
|
||||
this.add_host_network = network;
|
||||
}
|
||||
}
|
||||
|
||||
LabData(MainWindow main, File labPath, String labName) throws IOException{
|
||||
this.path = labPath;
|
||||
this.name = labName;
|
||||
this.global_settings_params = new ArrayList<String>();
|
||||
this.listOfContainers = new ArrayList<ContainerData>();
|
||||
this.listOfNetworks = new ArrayList<NetworkData>();
|
||||
this.resultsData = new ResultsData(main,labPath);
|
||||
this.goalsData = new GoalsData(main, labPath);
|
||||
this.paramsData = new ParamsData(main, labPath);
|
||||
|
||||
retrieveData(main);
|
||||
}
|
||||
public void retrieveResultsGoalsParams(){
|
||||
//Set the list of containers the results UI will references, then parse the results.config file
|
||||
ResultsData.setContainerList(getContainerNames());
|
||||
ParamsData.setContainerList(getContainerNames());
|
||||
resultsData.retrieveData();
|
||||
|
||||
//Parse the goals.config
|
||||
goalsData.retrieveData();
|
||||
|
||||
paramsData.retrieveData();
|
||||
}
|
||||
|
||||
// Parse the start.config and parse the goasl.config and results.config if the start.config exists
|
||||
private void retrieveData(MainWindow main) throws FileNotFoundException, IOException{
|
||||
File startConfig = new File(this.path+"/config/start.config");
|
||||
|
||||
if(startConfig.exists()){
|
||||
FileReader fileReader = new FileReader(startConfig);
|
||||
String parseType = "GLOBAL_SETTINGS";
|
||||
|
||||
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||
String line = bufferedReader.readLine();
|
||||
while (line != null) {
|
||||
line = line.trim();
|
||||
// Check if we need to switch to Network or Container Parsing mode
|
||||
try{
|
||||
if(line.startsWith("NETWORK ")){
|
||||
parseType = "NETWORK";
|
||||
listOfNetworks.add(new NetworkData(line.split("NETWORK ")[1].trim().toUpperCase()));
|
||||
line = bufferedReader.readLine();
|
||||
continue;
|
||||
}
|
||||
else if(line.startsWith("CONTAINER ")){
|
||||
parseType = "CONTAINER";
|
||||
listOfContainers.add(new ContainerData(line.split("CONTAINER ")[1].trim()));
|
||||
line = bufferedReader.readLine();
|
||||
continue;
|
||||
}
|
||||
}catch(java.lang.ArrayIndexOutOfBoundsException ex){
|
||||
System.out.println("Error in line "+line);
|
||||
line = bufferedReader.readLine();
|
||||
continue;
|
||||
}
|
||||
// Check if not a comment or empty space
|
||||
if(!line.startsWith("#") && !line.isEmpty()){
|
||||
try{
|
||||
// Check if we're looking for gloabl_settings params,
|
||||
// which should be at the start before container and network info;
|
||||
// otherwise parse the specified accepted params in the lab designer manual.
|
||||
if(parseType.equals("GLOBAL_SETTINGS"))
|
||||
global_settings_params.add(line);
|
||||
else {
|
||||
String parameter = line.split("\\s+")[0];
|
||||
if(parseType.equals("NETWORK")){
|
||||
NetworkData currNetwork = listOfNetworks.get(listOfNetworks .size()-1);
|
||||
switch(parameter){
|
||||
case "MASK":
|
||||
currNetwork.mask = line.split("MASK ")[1].trim();
|
||||
break;
|
||||
case "GATEWAY":
|
||||
if(line.contains("GATEWAY ")){
|
||||
currNetwork.gateway = line.split("GATEWAY ")[1].trim();
|
||||
}
|
||||
break;
|
||||
case "MACVLAN_EXT":
|
||||
currNetwork.macvlan_ext = Integer.parseInt(line.split("MACVLAN_EXT ")[1].trim());
|
||||
break;
|
||||
case "MACVLAN":
|
||||
currNetwork.macvlan = Integer.parseInt(line.split("MACVLAN ")[1].trim());
|
||||
break;
|
||||
case "TAP":
|
||||
currNetwork.tap = (line.split("TAP ")[1].trim()).equals("YES");
|
||||
break;
|
||||
default:
|
||||
currNetwork.unknownNetworkParams.add(line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(parseType.equals("CONTAINER")){
|
||||
ContainerData currContainer = listOfContainers.get(listOfContainers.size()-1);
|
||||
switch(parameter){
|
||||
case "TERMINALS":
|
||||
currContainer.terminal_count = Integer.parseInt(line.split("TERMINALS ")[1].trim());
|
||||
break;
|
||||
case "TERMINAL_GROUP":
|
||||
currContainer.terminal_group = line.split("TERMINAL_GROUP ")[1].trim();
|
||||
break;
|
||||
case "XTERM":
|
||||
currContainer.xterm_title = line.split("\\s+")[1].trim();
|
||||
|
||||
if(!currContainer.xterm_title.equals("INSTRUCTIONS"))
|
||||
currContainer.xterm_script = line.split("\\s+")[2].trim();
|
||||
break;
|
||||
case "USER":
|
||||
currContainer.user = line.split("USER ")[1].trim();
|
||||
break;
|
||||
case "PASSWORD":
|
||||
currContainer.password = line.split("PASSWORD ")[1].trim();
|
||||
break;
|
||||
case "ADD-HOST":
|
||||
String addhostParams = line.split("ADD-HOST ")[1].trim();
|
||||
if(addhostParams.contains(":")) //host:ip
|
||||
currContainer.listOfContainerAddHost.add(new ContainerAddHostSubData("ip",addhostParams.split(":")[0].trim(), addhostParams.split(":")[1].trim(), ""));
|
||||
else //network
|
||||
currContainer.listOfContainerAddHost.add(new ContainerAddHostSubData("network","", "", addhostParams));
|
||||
break;
|
||||
case "X11":
|
||||
currContainer.x11 = (line.split("X11 ")[1].trim()).equals("YES");
|
||||
break;
|
||||
case "NO_PARAM":
|
||||
currContainer.no_param = (line.split("NO_PARAM ")[1].trim()).equals("YES");
|
||||
break;
|
||||
case "CLONE":
|
||||
currContainer.clone = Integer.parseInt(line.split("CLONE ")[1].trim());
|
||||
break;
|
||||
case "NO_PULL":
|
||||
currContainer.no_pull = (line.split("NO_PULL ")[1].trim()).equals("YES");
|
||||
break;
|
||||
case "LAB_GATEWAY":
|
||||
currContainer.lab_gateway = line.split("LAB_GATEWAY ")[1].trim();
|
||||
break;
|
||||
case "NAME_SERVER":
|
||||
currContainer.name_server = line.split("NAME_SERVER ")[1].trim();
|
||||
break;
|
||||
case "NO_GW":
|
||||
currContainer.no_gw = (line.split("NO_GW ")[1].trim()).equals("YES");
|
||||
break;
|
||||
case "NO_RESOLVE":
|
||||
currContainer.no_resolve = (line.split("NO_RESOLVE ")[1].trim()).equals("YES");
|
||||
break;
|
||||
case "REGISTRY":
|
||||
currContainer.registry = line.split("REGISTRY ")[1].trim();
|
||||
break;
|
||||
case "BASE_REGISTRY":
|
||||
currContainer.base_registry = line.split("BASE_REGISTRY ")[1].trim();
|
||||
break;
|
||||
case "THUMB_VOLUME":
|
||||
currContainer.thumb_volume = line.split("THUMB_VOLUME\\s+")[1].trim();
|
||||
break;
|
||||
case "THUMB_COMMAND":
|
||||
currContainer.thumb_command = line.split("THUMB_COMMAND\\s+")[1].trim();
|
||||
break;
|
||||
case "THUMB_STOP":
|
||||
currContainer.thumb_stop = line.split("THUMB_STOP\\s+")[1].trim();
|
||||
break;
|
||||
case "PUBLISH":
|
||||
currContainer.publish = line.split("PUBLISH\\s+")[1].trim();
|
||||
break;
|
||||
case "HIDE":
|
||||
currContainer.hide = (line.split("HIDE\\s+")[1].trim()).equals("YES");
|
||||
break;
|
||||
case "NO_PRIVILEGE":
|
||||
currContainer.no_privilege = (line.split("NO_PRIVILEGE\\s+")[1].trim()).equals("YES");
|
||||
break;
|
||||
case "MYSTUFF":
|
||||
currContainer.mystuff = (line.split("MYSTUFF\\s+")[1].trim()).equals("YES");
|
||||
break;
|
||||
case "TAP":
|
||||
currContainer.tap = (line.split("TAP ")[1].trim()).equals("YES");
|
||||
break;
|
||||
case "MOUNT":
|
||||
String mountParam = line.split("MOUNT ")[1].trim();
|
||||
currContainer.mount1 = mountParam.split(":")[0].trim();
|
||||
currContainer.mount2 = mountParam.split(":")[1].trim();
|
||||
break;
|
||||
case "WAIT_FOR":
|
||||
currContainer.wait_for = (line.split("WAIT_FOR\\s+")[1].trim());
|
||||
break;
|
||||
case "NUM_CPUS":
|
||||
currContainer.num_cpus = (line.split("NUM_CPUS\\s+")[1].trim());
|
||||
break;
|
||||
case "CPU_SET":
|
||||
currContainer.cpu_set = (line.split("CPU_SET\\s+")[1].trim());
|
||||
break;
|
||||
default:
|
||||
boolean foundMatchingNetwork = false;
|
||||
String networkName = line.split("\\s+")[0].toUpperCase();
|
||||
String ipAddrName = line.split("\\s+")[1].toUpperCase();
|
||||
//Check the array of network names to to see if it matches it
|
||||
for(int i = 0;i <listOfNetworks.size();i++){
|
||||
if(listOfNetworks.get(i).name.equals(networkName)){
|
||||
currContainer.listOfContainerNetworks.add(new ContainerNetworkSubData(networkName, ipAddrName));
|
||||
foundMatchingNetwork = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//if doesn't find a matching network name then this param is unknown
|
||||
if(!foundMatchingNetwork) {currContainer.unknownContainerParams.add(line);}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(java.lang.ArrayIndexOutOfBoundsException exb){
|
||||
System.out.println("Error parseType: "+parseType+" line "+line+"\n"+exb+"\n");
|
||||
main.output("Error parseType: "+parseType+" line "+line+"\n"+exb+"\n");
|
||||
}
|
||||
}
|
||||
|
||||
//go to next line
|
||||
line = bufferedReader.readLine();
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
System.out.println("start.config is missing");
|
||||
}
|
||||
}
|
||||
|
||||
// GETTERS //
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ArrayList<ContainerData> getContainers(){
|
||||
return listOfContainers;
|
||||
}
|
||||
|
||||
public ArrayList<String> getContainerNames(){
|
||||
ArrayList<String> names = new ArrayList<String>();
|
||||
for (ContainerData container : listOfContainers)
|
||||
names.add(container.name);
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
public int getNetworkCount(){
|
||||
return listOfNetworks.size();
|
||||
}
|
||||
public ArrayList<NetworkData> getNetworks(){
|
||||
return listOfNetworks;
|
||||
}
|
||||
|
||||
public ArrayList<String> getNetworkNames(){
|
||||
ArrayList<String> names = new ArrayList<String>();
|
||||
for (NetworkData network : listOfNetworks)
|
||||
names.add(network.name);
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
public ArrayList<String> getGlobals(){
|
||||
return global_settings_params;
|
||||
}
|
||||
|
||||
public String getGlobalValue(String tag){
|
||||
String retval = null;
|
||||
for(String line : global_settings_params){
|
||||
if(line.trim().startsWith(tag)){
|
||||
retval = line.trim().split(" ")[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
public ResultsData getResultsData(){
|
||||
return resultsData;
|
||||
}
|
||||
|
||||
public GoalsData getGoalsData(){
|
||||
return goalsData;
|
||||
}
|
||||
|
||||
public ParamsData getParamsData(){
|
||||
return paramsData;
|
||||
}
|
||||
|
||||
|
||||
// SETTERS //
|
||||
|
||||
public void setName(String newName){
|
||||
name = newName;
|
||||
}
|
||||
|
||||
public void setPath(File newPath){
|
||||
path = newPath;
|
||||
}
|
||||
|
||||
public void setResultsData(ResultsData data){
|
||||
resultsData = new ResultsData(data);
|
||||
}
|
||||
|
||||
public void setGoalsData(GoalsData data){
|
||||
//goalsData = new GoalsData(data);
|
||||
// eh?
|
||||
goalsData = data;
|
||||
}
|
||||
|
||||
public void setParamsData(ParamsData data){
|
||||
paramsData = new ParamsData(data);
|
||||
}
|
||||
|
||||
public void resetContainers(){
|
||||
listOfContainers = new ArrayList<ContainerData>();
|
||||
}
|
||||
|
||||
public void resetNetworks(){
|
||||
listOfNetworks = new ArrayList<NetworkData>();
|
||||
}
|
||||
public void setGlobalValue(String tag, String value){
|
||||
boolean gotit = false;
|
||||
int index = 0;
|
||||
for(String line : global_settings_params){
|
||||
if(line.trim().startsWith(tag)){
|
||||
global_settings_params.set(index, tag+" "+value);
|
||||
gotit = true;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if(!gotit){
|
||||
String entry = tag+" "+value;
|
||||
global_settings_params.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// DATA MANIPULATION //
|
||||
|
||||
//Called when a user renames a network.
|
||||
//The function will overwrite any instances of the old Network Name with the new Network Name in this state object
|
||||
public void refactorNetworkName(String oldName, String newName){
|
||||
//Rename the network in the list of networks
|
||||
for(NetworkData network : listOfNetworks){
|
||||
if(network.name.equals(oldName)){
|
||||
network.name = newName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Rename the network in list of Networks and list of addHosts for each container
|
||||
for(ContainerData container : listOfContainers){
|
||||
// check list of networks
|
||||
for(ContainerNetworkSubData networkSubData: container.listOfContainerNetworks){
|
||||
if(networkSubData.network_name.equals(oldName))
|
||||
networkSubData.network_name = newName;
|
||||
}
|
||||
//check list of add-hosts
|
||||
for(ContainerAddHostSubData addHostSubData: container.listOfContainerAddHost){
|
||||
if(addHostSubData.add_host_network.equals(oldName))
|
||||
addHostSubData.add_host_network = newName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called when a user deletes a network
|
||||
// The function deletes any instances of the Network name being referenced in the Lab data
|
||||
public void deleteReferenceToNetwork(String networkName){
|
||||
// Delete the network in the list of networks
|
||||
for(NetworkData network : listOfNetworks){
|
||||
if(network.name.equals(networkName)){
|
||||
listOfNetworks.remove(network);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the network in list of Networks and list of addHosts for each container
|
||||
for(ContainerData container : listOfContainers){
|
||||
// Check list of networks
|
||||
ArrayList<ContainerNetworkSubData> networksToRemove = new ArrayList<ContainerNetworkSubData>();
|
||||
for(ContainerNetworkSubData networkSubData: container.listOfContainerNetworks){
|
||||
if(networkSubData.network_name.equals(networkName))
|
||||
networksToRemove.add(networkSubData);
|
||||
}
|
||||
container.listOfContainerNetworks.removeAll(networksToRemove);
|
||||
|
||||
// Check list of add-hosts
|
||||
ArrayList<ContainerAddHostSubData> addHostsToRemove = new ArrayList<ContainerAddHostSubData>();
|
||||
for(ContainerAddHostSubData addHostSubData: container.listOfContainerAddHost){
|
||||
if(addHostSubData.add_host_network.equals(networkName))
|
||||
addHostsToRemove.add(addHostSubData);
|
||||
}
|
||||
container.listOfContainerAddHost.removeAll(addHostsToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
// Called when a user deletes a conainer
|
||||
// The function deletes any instances of the Container name being referenced in the Lab data
|
||||
public void deleteReferenceToContainer(String containerName){
|
||||
// Delete the network in the list of networks
|
||||
for(ContainerData container : listOfContainers){
|
||||
if(container.name.equals(containerName)){
|
||||
listOfContainers.remove(container);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the results data to not include the container reference
|
||||
resultsData.removeContainerReference(containerName);
|
||||
}
|
||||
|
||||
|
||||
// PRINT //
|
||||
|
||||
public void printNetworkData(NetworkData data) {
|
||||
System.out.println("NETWORK----------------------");
|
||||
System.out.println("name: " + data.name);
|
||||
System.out.println("mask: " + data.mask);
|
||||
System.out.println("gateway: " + data.gateway);
|
||||
System.out.println("macvlan_ext: " + data.macvlan_ext);
|
||||
System.out.println("macvlan: " + data.macvlan);
|
||||
|
||||
if(!data.unknownNetworkParams.isEmpty()){
|
||||
System.out.println("UNKNOWN PARAMS: ");
|
||||
for(int i = 0;i<data.unknownNetworkParams.size();i++){
|
||||
System.out.println(data.unknownNetworkParams.get(i));
|
||||
}
|
||||
System.out.println("------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void printContainerData(ContainerData data) {
|
||||
System.out.println("CONTAINER----------------------");
|
||||
System.out.println("name: " + data.name);
|
||||
System.out.println("terminal_count: " + data.terminal_count);
|
||||
System.out.println("terminal_group: " + data.terminal_group);
|
||||
System.out.println("xterm_title: " + data.xterm_title);
|
||||
System.out.println("xterm_script: " + data.xterm_script);
|
||||
System.out.println("user: " + data.user);
|
||||
|
||||
System.out.println("password: " + data.password);
|
||||
|
||||
if(data.listOfContainerAddHost != null){
|
||||
for(int i = 0;i<data.listOfContainerAddHost.size();i++){
|
||||
if(data.listOfContainerAddHost.get(i).type.equals("ip")){
|
||||
System.out.println("ADD-HOST: " + data.listOfContainerAddHost.get(i).add_host_host + " " + data.listOfContainerAddHost.get(i).add_host_ip);
|
||||
}
|
||||
else{
|
||||
System.out.println("ADD-HOST: " + data.listOfContainerAddHost.get(i).add_host_network);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("x11: " + data.x11);
|
||||
System.out.println("no_param: " + data.no_param);
|
||||
System.out.println("clone: " + data.clone);
|
||||
System.out.println("no_pull: " + data.no_pull);
|
||||
System.out.println("lab_gateway: " + data.lab_gateway);
|
||||
System.out.println("name_server: " + data.name_server);
|
||||
System.out.println("no_gw: " + data.no_gw);
|
||||
System.out.println("no_resolve: " + data.no_resolve);
|
||||
System.out.println("registry: " + data.registry);
|
||||
System.out.println("base_registry: " + data.base_registry);
|
||||
System.out.println("thumb_volume: " + data.thumb_volume);
|
||||
System.out.println("thumb_command: " + data.thumb_command);
|
||||
System.out.println("thumb_stop: " + data.thumb_stop);
|
||||
System.out.println("publish: " + data.publish);
|
||||
System.out.println("hide: " + data.hide);
|
||||
System.out.println("no_privilege: " + data.no_privilege);
|
||||
System.out.println("mystuff: " + data.mystuff);
|
||||
if(data.listOfContainerNetworks != null){
|
||||
for(int i = 0;i<data.listOfContainerNetworks.size();i++){
|
||||
System.out.println(data.listOfContainerNetworks.get(i).network_name + " " + data.listOfContainerNetworks.get(i).network_ipaddress);
|
||||
}
|
||||
}
|
||||
if(!data.unknownContainerParams.isEmpty()){
|
||||
System.out.println("UNKNOWN PARAMS: ");
|
||||
for(int i = 0;i<data.unknownContainerParams.size();i++){
|
||||
System.out.println(data.unknownContainerParams.get(i));
|
||||
}
|
||||
System.out.println("------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
public void printData(){
|
||||
for(String line : global_settings_params)
|
||||
System.out.println(line);
|
||||
|
||||
for(int i = 0;i < listOfNetworks.size();i++)
|
||||
printNetworkData(listOfNetworks.get(i));
|
||||
|
||||
for(int i = 0;i < listOfContainers.size();i++)
|
||||
printContainerData(listOfContainers.get(i));
|
||||
|
||||
}
|
||||
public String writeStartConfig(boolean usetmp) throws FileNotFoundException{
|
||||
// If usetmp, save to temporary diretory and compare to current. If they differ,
|
||||
// prompts the user to save or discard changes.
|
||||
// Return false if user cancels (does not want to exit).
|
||||
//Get path to start.config
|
||||
String startConfigPath;
|
||||
Path tempDir=null;
|
||||
if(!usetmp){
|
||||
startConfigPath = this.path+File.separator+"config"+File.separator+"start.config";
|
||||
}else{
|
||||
try{
|
||||
tempDir = Files.createTempDirectory(this.name);
|
||||
}catch(IOException ex){
|
||||
System.out.println("failed creating temporary directory" + ex);
|
||||
System.exit(1);
|
||||
}
|
||||
String dir_s = tempDir.getFileName().toString();
|
||||
//System.out.println("dir_s is "+dir_s);
|
||||
|
||||
startConfigPath = File.separator+"tmp"+File.separator+dir_s+File.separator+"start.config";
|
||||
}
|
||||
PrintWriter writer = new PrintWriter(startConfigPath);
|
||||
String startConfigText = "";
|
||||
|
||||
// Write Global Params
|
||||
for(String line : getGlobals()){
|
||||
startConfigText += " "+line+"\n";
|
||||
}
|
||||
|
||||
// Cycle through network objects and write
|
||||
for(NetworkData data : listOfNetworks){
|
||||
startConfigText += "NETWORK "+data.name+"\n";
|
||||
startConfigText += " MASK "+data.mask+"\n";
|
||||
startConfigText += " GATEWAY "+data.gateway+"\n";
|
||||
|
||||
if(data.macvlan > 0){
|
||||
startConfigText += " MACVLAN "+data.macvlan+"\n";
|
||||
}
|
||||
if(data.macvlan_ext > 0){
|
||||
startConfigText += " MACVLAN_EXT " +data.macvlan_ext+"\n";
|
||||
}
|
||||
|
||||
if(data.tap){
|
||||
startConfigText += " TAP YES"+"\n";
|
||||
}
|
||||
for(String unknownParam : data.unknownNetworkParams){
|
||||
startConfigText += " "+unknownParam+"\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Cycle through container objects and write
|
||||
for(ContainerData data : listOfContainers){
|
||||
startConfigText += "CONTAINER "+data.name+"\n";
|
||||
startConfigText += " USER "+data.user+"\n";
|
||||
|
||||
if(data.x11){
|
||||
startConfigText += " X11 YES\n";
|
||||
}
|
||||
else{
|
||||
startConfigText += " X11 NO\n";
|
||||
}
|
||||
// Not default
|
||||
if(data.terminal_count != 1)
|
||||
startConfigText += " TERMINALS "+data.terminal_count+"\n";
|
||||
if(!data.terminal_group.isEmpty())
|
||||
startConfigText += " TERMINAL_GROUP "+data.terminal_group+"\n";
|
||||
if(!data.xterm_title.isEmpty())
|
||||
startConfigText += " XTERM "+data.xterm_title+" "+data.xterm_script+"\n";
|
||||
if(!data.password.isEmpty())
|
||||
startConfigText += " PASSWORD "+data.password+"\n";
|
||||
for(ContainerAddHostSubData addHost : data.listOfContainerAddHost){
|
||||
if(addHost.type.equals("network"))
|
||||
startConfigText += " ADD-HOST "+addHost.add_host_network+"\n";
|
||||
else if(addHost.type.equals("ip"))
|
||||
startConfigText += " ADD-HOST "+addHost.add_host_host+":"+addHost.add_host_ip+"\n";
|
||||
}
|
||||
for(ContainerNetworkSubData network : data.listOfContainerNetworks){
|
||||
startConfigText += " "+network.network_name+" "+network.network_ipaddress+"\n";
|
||||
}
|
||||
if(data.clone > 0){
|
||||
startConfigText += " CLONE "+data.clone+"\n";
|
||||
}
|
||||
if(!data.lab_gateway.isEmpty()){
|
||||
startConfigText += " LAB_GATEWAY "+data.lab_gateway+"\n";
|
||||
}
|
||||
if(!data.name_server.isEmpty()){
|
||||
startConfigText += " NAME_SERVER "+data.name_server+"\n";
|
||||
}
|
||||
if(data.no_gw){
|
||||
startConfigText += " NO_GW YES\n";
|
||||
}
|
||||
if(data.no_param){
|
||||
startConfigText += " NO_PARAM YES\n";
|
||||
}
|
||||
if(data.no_resolve){
|
||||
startConfigText += " NO_RESOLVE YES\n";
|
||||
}
|
||||
if(!data.base_registry.isEmpty()){
|
||||
startConfigText += " BASE_REGISTRY "+data.base_registry+"\n";
|
||||
}
|
||||
if(!data.thumb_volume.isEmpty()){
|
||||
startConfigText += " THUMB_VOLUME "+data.thumb_volume+"\n";
|
||||
}
|
||||
if(!data.thumb_command.isEmpty()){
|
||||
startConfigText += " THUMB_COMMAND "+data.thumb_command+"\n";
|
||||
}
|
||||
if(!data.thumb_stop.isEmpty()){
|
||||
startConfigText += " THUMB_STOP "+data.thumb_stop+"\n";
|
||||
}
|
||||
if(!data.publish.isEmpty()){
|
||||
startConfigText += " PUBLISH "+data.publish+"\n";
|
||||
}
|
||||
if(data.hide){
|
||||
startConfigText += " HIDE YES\n";
|
||||
}
|
||||
if(data.no_privilege){
|
||||
startConfigText += " NO_PRIVILEGE YES\n";
|
||||
}
|
||||
if(data.no_pull){
|
||||
startConfigText += " NO_PULL YES\n";
|
||||
}
|
||||
if(data.mystuff){
|
||||
startConfigText += " MYSTUFF YES\n";
|
||||
}
|
||||
if(data.tap){
|
||||
startConfigText += " TAP YES\n";
|
||||
}
|
||||
if(!data.mount1.isEmpty() && !data.mount2.isEmpty()){
|
||||
startConfigText += " MOUNT "+data.mount1+":"+data.mount2+"\n";
|
||||
}
|
||||
if(!data.wait_for.isEmpty()){
|
||||
startConfigText += " WAIT_FOR "+data.wait_for+"\n";
|
||||
}
|
||||
if(!data.num_cpus.isEmpty()){
|
||||
startConfigText += " NUM_CPUS "+data.num_cpus+"\n";
|
||||
}
|
||||
if(!data.cpu_set.isEmpty()){
|
||||
startConfigText += " CPU_SET "+data.cpu_set+"\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Write to File
|
||||
writer.print(startConfigText);
|
||||
writer.close();
|
||||
return startConfigPath;
|
||||
/*
|
||||
boolean something_changed = false;
|
||||
if(usetmp){
|
||||
String old_file = this.path+File.separator+"config"+File.separator+"start.config";
|
||||
String new_file = startConfigPath;
|
||||
try{
|
||||
something_changed = ! CompareTextFiles.compare(old_file, new_file);
|
||||
}catch(IOException ex){
|
||||
System.out.println("Error comparing text files "+ex);
|
||||
}
|
||||
}
|
||||
return something_changed;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="128" max="-2" attributes="0"/>
|
||||
<Component id="OKButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="147" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
|
||||
<Component id="registryTextField" min="-2" pref="357" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="22" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="51" max="-2" attributes="0"/>
|
||||
<Component id="registryTextField" min="-2" pref="68" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="59" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="OKButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="62" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextField" name="registryTextField">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Registry">
|
||||
<Font PropertyName="font" name="Dialog" size="14" style="0"/>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="OKButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="OK"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="OKButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="CancelButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Lab properties"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package labtainers.mainui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mike
|
||||
*/
|
||||
public class LabPanel extends javax.swing.JPanel {
|
||||
javax.swing.JDialog dialog;
|
||||
LabData labData = null;
|
||||
|
||||
/**
|
||||
* Creates new form LabPanel
|
||||
*/
|
||||
public LabPanel() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
registryTextField = new javax.swing.JTextField();
|
||||
OKButton = new javax.swing.JButton();
|
||||
CancelButton = new javax.swing.JButton();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
|
||||
registryTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Registry", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 14))); // NOI18N
|
||||
|
||||
OKButton.setText("OK");
|
||||
OKButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
OKButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
CancelButton.setText("Cancel");
|
||||
CancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel1.setText("Lab properties");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(128, 128, 128)
|
||||
.addComponent(OKButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(CancelButton))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(147, 147, 147)
|
||||
.addComponent(jLabel1))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(21, 21, 21)
|
||||
.addComponent(registryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 357, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap(22, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1)
|
||||
.addGap(51, 51, 51)
|
||||
.addComponent(registryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(OKButton)
|
||||
.addComponent(CancelButton))
|
||||
.addGap(62, 62, 62))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void OKButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OKButtonActionPerformed
|
||||
String registry = registryTextField.getText().trim();
|
||||
if(registry.length() > 0){
|
||||
this.labData.setGlobalValue("REGISTRY", registry);
|
||||
}
|
||||
this.dialog.setVisible(false);
|
||||
}//GEN-LAST:event_OKButtonActionPerformed
|
||||
|
||||
private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed
|
||||
this.dialog.setVisible(false);
|
||||
}//GEN-LAST:event_CancelButtonActionPerformed
|
||||
public void setDialog(javax.swing.JDialog dialog){
|
||||
this.dialog = dialog;
|
||||
}
|
||||
public void setData(LabData labData){
|
||||
this.labData = labData;
|
||||
String registry = labData.getGlobalValue("REGISTRY");
|
||||
if(registry != null){
|
||||
this.registryTextField.setText(registry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton CancelButton;
|
||||
private javax.swing.JButton OKButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JTextField registryTextField;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,274 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Container class="javax.swing.JDialog" name="NetworkConfigWindow">
|
||||
<Properties>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[377, 335]"/>
|
||||
</Property>
|
||||
<Property name="resizable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="NetworkConfigWindowWindowClosing"/>
|
||||
</Events>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="NetworkConfigUpdateButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="NetworkConfigCancelButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
|
||||
<Component id="TapRadioButton" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="NetworkConfigMacVLanSpinner" alignment="0" min="-2" pref="45" max="-2" attributes="0"/>
|
||||
<Component id="NetworkConfigMacVLanExtSpinner" min="-2" pref="45" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="184" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="22" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="NetworkConfigMaskTextfield" alignment="0" min="-2" pref="229" max="-2" attributes="0"/>
|
||||
<Component id="NetworkConfigGatewayTextField" alignment="0" min="-2" pref="229" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="NetworkConfigMaskTextfield" min="-2" pref="61" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="NetworkConfigGatewayTextField" min="-2" pref="58" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="NetworkConfigMacVLanExtSpinner" alignment="3" min="-2" pref="33" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="NetworkConfigMacVLanSpinner" min="-2" pref="33" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
|
||||
<Component id="TapRadioButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="9" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="NetworkConfigUpdateButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="NetworkConfigCancelButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="MACVLAN_EXT:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="MACVLAN:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="NetworkConfigMaskTextfield">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu" size="18" style="0"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Subnet">
|
||||
<Font PropertyName="font" name="Dialog" size="14" style="1"/>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="NetworkConfigGatewayTextField">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu" size="18" style="0"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="IP used as the default gateway on containers connected to this network. Used to communicate with the host computer and the outside world. This should not be the IP address of any of the containers."/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="External gateway">
|
||||
<Font PropertyName="font" name="Dialog" size="14" style="1"/>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="NetworkConfigCancelButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="NetworkConfigCancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="NetworkConfigUpdateButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="OK"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="NetworkConfigUpdateButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="NetworkConfigMacVLanExtSpinner">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="18" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="NetworkConfigMacVLanSpinner">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="18" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="TapRadioButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu" size="15" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="TAP"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPopupMenu" name="NetworkRightClick">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="renameNetworkOption">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Rename"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="renameNetworkOptionActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<Component class="javax.swing.JPopupMenu$Separator" name="jSeparator1">
|
||||
</Component>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="deleteNetworkOption">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteNetworkOptionActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</NonVisualComponents>
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[340, 51]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[340, 51]"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="" noResource="true"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[340, 51]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMouseClicked"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextField" name="RenameNetworkTextfield">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="18" style="1"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 35]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 35]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="RenameNetworkTextfieldFocusLost"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="RenameNetworkTextfieldActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="NetworkLabelName">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="18" style="1"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="network_name"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="NetworkMaskLabel">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu" size="18" style="0"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="000.00.0.000/00"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,425 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.mainui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class NetworkObjPanel extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form NetworkObjPanel
|
||||
*/
|
||||
private final MainWindow mainWindow;
|
||||
private final LabData.NetworkData data;
|
||||
|
||||
// Constructor for loading a network object panel based on a network data object
|
||||
NetworkObjPanel(MainWindow mainWindow, LabData.NetworkData data) {
|
||||
initComponents();
|
||||
this.mainWindow = mainWindow;
|
||||
this.data = data;
|
||||
|
||||
this.NetworkLabelName.setText(this.data.name);
|
||||
this.NetworkMaskLabel.setText(this.data.mask);
|
||||
this.RenameNetworkTextfield.setVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
NetworkConfigWindow = new javax.swing.JDialog();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
NetworkConfigMaskTextfield = new javax.swing.JTextField();
|
||||
NetworkConfigGatewayTextField = new javax.swing.JTextField();
|
||||
NetworkConfigCancelButton = new javax.swing.JButton();
|
||||
NetworkConfigUpdateButton = new javax.swing.JButton();
|
||||
NetworkConfigMacVLanExtSpinner = new javax.swing.JSpinner();
|
||||
NetworkConfigMacVLanSpinner = new javax.swing.JSpinner();
|
||||
TapRadioButton = new javax.swing.JRadioButton();
|
||||
NetworkRightClick = new javax.swing.JPopupMenu();
|
||||
renameNetworkOption = new javax.swing.JMenuItem();
|
||||
jSeparator1 = new javax.swing.JPopupMenu.Separator();
|
||||
deleteNetworkOption = new javax.swing.JMenuItem();
|
||||
RenameNetworkTextfield = new javax.swing.JTextField();
|
||||
NetworkLabelName = new javax.swing.JLabel();
|
||||
NetworkMaskLabel = new javax.swing.JLabel();
|
||||
|
||||
NetworkConfigWindow.setMinimumSize(new java.awt.Dimension(377, 335));
|
||||
NetworkConfigWindow.setResizable(false);
|
||||
NetworkConfigWindow.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
public void windowClosing(java.awt.event.WindowEvent evt) {
|
||||
NetworkConfigWindowWindowClosing(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel4.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
|
||||
jLabel4.setText("MACVLAN_EXT:");
|
||||
|
||||
jLabel5.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
|
||||
jLabel5.setText("MACVLAN:");
|
||||
|
||||
NetworkConfigMaskTextfield.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N
|
||||
NetworkConfigMaskTextfield.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Subnet", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N
|
||||
|
||||
NetworkConfigGatewayTextField.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N
|
||||
NetworkConfigGatewayTextField.setToolTipText("IP used as the default gateway on containers connected to this network. Used to communicate with the host computer and the outside world. This should not be the IP address of any of the containers.");
|
||||
NetworkConfigGatewayTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "External gateway", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N
|
||||
|
||||
NetworkConfigCancelButton.setText("Cancel");
|
||||
NetworkConfigCancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
NetworkConfigCancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
NetworkConfigUpdateButton.setText("OK");
|
||||
NetworkConfigUpdateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
NetworkConfigUpdateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
NetworkConfigMacVLanExtSpinner.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
|
||||
|
||||
NetworkConfigMacVLanSpinner.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
|
||||
|
||||
TapRadioButton.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
|
||||
TapRadioButton.setText("TAP");
|
||||
|
||||
javax.swing.GroupLayout NetworkConfigWindowLayout = new javax.swing.GroupLayout(NetworkConfigWindow.getContentPane());
|
||||
NetworkConfigWindow.getContentPane().setLayout(NetworkConfigWindowLayout);
|
||||
NetworkConfigWindowLayout.setHorizontalGroup(
|
||||
NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(NetworkConfigWindowLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(NetworkConfigWindowLayout.createSequentialGroup()
|
||||
.addComponent(NetworkConfigUpdateButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(NetworkConfigCancelButton))
|
||||
.addGroup(NetworkConfigWindowLayout.createSequentialGroup()
|
||||
.addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(TapRadioButton)
|
||||
.addComponent(jLabel5)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(NetworkConfigMacVLanSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(NetworkConfigMacVLanExtSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(184, 184, 184)))
|
||||
.addContainerGap(22, Short.MAX_VALUE))
|
||||
.addGroup(NetworkConfigWindowLayout.createSequentialGroup()
|
||||
.addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(NetworkConfigMaskTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(NetworkConfigGatewayTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
);
|
||||
NetworkConfigWindowLayout.setVerticalGroup(
|
||||
NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(NetworkConfigWindowLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(NetworkConfigMaskTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(NetworkConfigGatewayTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(NetworkConfigMacVLanExtSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(NetworkConfigWindowLayout.createSequentialGroup()
|
||||
.addGap(25, 25, 25)
|
||||
.addComponent(jLabel5))
|
||||
.addGroup(NetworkConfigWindowLayout.createSequentialGroup()
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(NetworkConfigMacVLanSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(27, 27, 27)
|
||||
.addComponent(TapRadioButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
|
||||
.addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(NetworkConfigUpdateButton)
|
||||
.addComponent(NetworkConfigCancelButton))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
renameNetworkOption.setText("Rename");
|
||||
renameNetworkOption.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
renameNetworkOptionActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
NetworkRightClick.add(renameNetworkOption);
|
||||
NetworkRightClick.add(jSeparator1);
|
||||
|
||||
deleteNetworkOption.setText("Delete");
|
||||
deleteNetworkOption.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
deleteNetworkOptionActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
NetworkRightClick.add(deleteNetworkOption);
|
||||
|
||||
setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
setMaximumSize(new java.awt.Dimension(340, 51));
|
||||
setMinimumSize(new java.awt.Dimension(340, 51));
|
||||
setName(""); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(340, 51));
|
||||
addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||
formMouseClicked(evt);
|
||||
}
|
||||
});
|
||||
|
||||
RenameNetworkTextfield.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
|
||||
RenameNetworkTextfield.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
RenameNetworkTextfield.setMinimumSize(new java.awt.Dimension(300, 35));
|
||||
RenameNetworkTextfield.setPreferredSize(new java.awt.Dimension(300, 35));
|
||||
RenameNetworkTextfield.setRequestFocusEnabled(false);
|
||||
RenameNetworkTextfield.addFocusListener(new java.awt.event.FocusAdapter() {
|
||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
||||
RenameNetworkTextfieldFocusLost(evt);
|
||||
}
|
||||
});
|
||||
RenameNetworkTextfield.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
RenameNetworkTextfieldActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
add(RenameNetworkTextfield);
|
||||
|
||||
NetworkLabelName.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
|
||||
NetworkLabelName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
NetworkLabelName.setText("network_name");
|
||||
add(NetworkLabelName);
|
||||
|
||||
NetworkMaskLabel.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N
|
||||
NetworkMaskLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
NetworkMaskLabel.setText("000.00.0.000/00");
|
||||
add(NetworkMaskLabel);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private boolean clicked = false;
|
||||
private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
|
||||
clickPanelHandler(evt);
|
||||
}//GEN-LAST:event_formMouseClicked
|
||||
|
||||
private void renameNetworkOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renameNetworkOptionActionPerformed
|
||||
renameNetworkOptionActionPerformed();
|
||||
}//GEN-LAST:event_renameNetworkOptionActionPerformed
|
||||
|
||||
private void deleteNetworkOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteNetworkOptionActionPerformed
|
||||
deleteNetworkAction();
|
||||
}//GEN-LAST:event_deleteNetworkOptionActionPerformed
|
||||
|
||||
private void RenameNetworkTextfieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RenameNetworkTextfieldActionPerformed
|
||||
renameNetworkTextfieldActionPerformed();
|
||||
}//GEN-LAST:event_RenameNetworkTextfieldActionPerformed
|
||||
|
||||
private void RenameNetworkTextfieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_RenameNetworkTextfieldFocusLost
|
||||
renameNetworkTextfieldFocusLost();
|
||||
}//GEN-LAST:event_RenameNetworkTextfieldFocusLost
|
||||
|
||||
private void NetworkConfigWindowWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_NetworkConfigWindowWindowClosing
|
||||
clicked = false;
|
||||
}//GEN-LAST:event_NetworkConfigWindowWindowClosing
|
||||
|
||||
private void NetworkConfigUpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NetworkConfigUpdateButtonActionPerformed
|
||||
networkConfigUpdateButton();
|
||||
}//GEN-LAST:event_NetworkConfigUpdateButtonActionPerformed
|
||||
|
||||
private void NetworkConfigCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NetworkConfigCancelButtonActionPerformed
|
||||
clicked = false;
|
||||
NetworkConfigWindow.setVisible(false);
|
||||
}//GEN-LAST:event_NetworkConfigCancelButtonActionPerformed
|
||||
|
||||
// BUTTONS and HANDLERS //
|
||||
|
||||
// Handles whether or not to open Network Configuration Window or prompt rename/delete options
|
||||
private void clickPanelHandler(java.awt.event.MouseEvent evt){
|
||||
if(!clicked){
|
||||
if(SwingUtilities.isLeftMouseButton(evt)){
|
||||
clicked = true;
|
||||
loadDataIntoNetworkPanel();
|
||||
NetworkConfigWindow.setVisible(true);
|
||||
}
|
||||
else if(SwingUtilities.isRightMouseButton(evt))
|
||||
NetworkRightClick.show(this, evt.getX(), evt.getY());
|
||||
}
|
||||
}
|
||||
|
||||
// Deletes the network and removes all references to it at the UI and data layer
|
||||
private void deleteNetworkAction(){
|
||||
int confirm = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete the network '"+data.name+"'?\n"
|
||||
+ "Deleting this network will delete all references \n"
|
||||
+ "to this network in the Container Configurations as well.",
|
||||
"Delete Network", JOptionPane.YES_NO_OPTION);
|
||||
if (confirm == JOptionPane.YES_OPTION){
|
||||
mainWindow.getCurrentData().deleteReferenceToNetwork(data.name); //Delete the network in data object
|
||||
mainWindow.updateNetworkReferenceInContainerConfigDialogs("Delete",data.name, null); //Delete the network on the immediate UI interface
|
||||
JPanel networkPanel = (JPanel)this.getParent();
|
||||
|
||||
// delete the network from the list
|
||||
networkPanel.remove(this);
|
||||
|
||||
// Shorten the panel height holding all the containers and resize it.
|
||||
mainWindow.networkPanePanelLength-=51;
|
||||
networkPanel.setPreferredSize(new Dimension(0,mainWindow.networkPanePanelLength));
|
||||
|
||||
// Redraw the panel containing the list of networks
|
||||
networkPanel.revalidate();
|
||||
networkPanel.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
// Prompts renaming fields
|
||||
private void renameNetworkOptionActionPerformed(){
|
||||
// Make the rename textfield visible, active, and all text inside preselected
|
||||
RenameNetworkTextfield.setText(data.name);
|
||||
RenameNetworkTextfield.setVisible(true);
|
||||
RenameNetworkTextfield.requestFocusInWindow();
|
||||
RenameNetworkTextfield.selectAll();
|
||||
|
||||
// Hide the original network label
|
||||
NetworkLabelName.setVisible(false);
|
||||
NetworkMaskLabel.setVisible(false);
|
||||
}
|
||||
|
||||
// Renames the network and refactors the name at the UI and data layer
|
||||
private void renameNetworkTextfieldActionPerformed(){
|
||||
// Prompt user to confirm their changes
|
||||
String newNetworkName = RenameNetworkTextfield.getText().toUpperCase();
|
||||
String oldName = data.name;
|
||||
|
||||
int confirm = JOptionPane.showConfirmDialog(null, "Are you sure you want to rename the network '"+oldName+"' to '"+newNetworkName+"'?",
|
||||
"Rename Network", JOptionPane.YES_NO_OPTION);
|
||||
if (confirm == JOptionPane.YES_OPTION){
|
||||
// Rename the network on the data level
|
||||
mainWindow.getCurrentData().refactorNetworkName(oldName,newNetworkName);
|
||||
|
||||
//Rename the network on the immediate Container Dialog UI
|
||||
mainWindow.updateNetworkReferenceInContainerConfigDialogs("Rename",oldName, newNetworkName);
|
||||
|
||||
// Rename the network
|
||||
NetworkLabelName.setText(newNetworkName);
|
||||
data.name = newNetworkName;
|
||||
//System.out.println("Renamed network to: "+data.name);
|
||||
}
|
||||
|
||||
// Hide the textfield and show the network label
|
||||
RenameNetworkTextfield.setVisible(false);
|
||||
NetworkLabelName.setVisible(true);
|
||||
NetworkMaskLabel.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
// When User clicks off of the rename textfield
|
||||
private void renameNetworkTextfieldFocusLost(){
|
||||
// Hide the textfield and show the network label
|
||||
RenameNetworkTextfield.setVisible(false);
|
||||
NetworkLabelName.setVisible(true);
|
||||
NetworkMaskLabel.setVisible(true);
|
||||
}
|
||||
|
||||
// Updates the data object based on whats in the fields, closes the network configuration window,
|
||||
// (and sets the mask label on the network panel)
|
||||
public void networkConfigUpdateButton(){
|
||||
// Set the textfield and spinner values into the data Objects
|
||||
this.data.mask = this.NetworkConfigMaskTextfield.getText();
|
||||
this.data.gateway = this.NetworkConfigGatewayTextField.getText();
|
||||
this.data.macvlan_ext = (int) this.NetworkConfigMacVLanExtSpinner.getValue();
|
||||
this.data.macvlan = (int) this.NetworkConfigMacVLanSpinner.getValue();
|
||||
this.data.tap = this.TapRadioButton.isSelected();
|
||||
|
||||
clicked = false;
|
||||
NetworkConfigWindow.setVisible(false);
|
||||
NetworkMaskLabel.setText(this.data.mask);
|
||||
}
|
||||
|
||||
|
||||
// CORE //
|
||||
|
||||
// Set the fields of the Network Dialog Window with the data
|
||||
private void loadDataIntoNetworkPanel(){
|
||||
this.NetworkConfigWindow.setTitle("NetworkConfig: "+this.data.name);
|
||||
this.NetworkConfigMaskTextfield.setText(this.data.mask);
|
||||
this.NetworkConfigGatewayTextField.setText(this.data.gateway);
|
||||
this.NetworkConfigMacVLanExtSpinner.setValue(this.data.macvlan_ext);
|
||||
this.NetworkConfigMacVLanSpinner.setValue(this.data.macvlan);
|
||||
this.TapRadioButton.setSelected(this.data.tap);
|
||||
}
|
||||
|
||||
|
||||
// GETTERS //
|
||||
|
||||
public LabData.NetworkData getConfigData(){
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public JDialog getNetworkConfigDialog(){
|
||||
return NetworkConfigWindow;
|
||||
}
|
||||
public boolean configShowing(){
|
||||
return NetworkConfigWindow.isShowing();
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton NetworkConfigCancelButton;
|
||||
private javax.swing.JTextField NetworkConfigGatewayTextField;
|
||||
private javax.swing.JSpinner NetworkConfigMacVLanExtSpinner;
|
||||
private javax.swing.JSpinner NetworkConfigMacVLanSpinner;
|
||||
private javax.swing.JTextField NetworkConfigMaskTextfield;
|
||||
private javax.swing.JButton NetworkConfigUpdateButton;
|
||||
private javax.swing.JDialog NetworkConfigWindow;
|
||||
private javax.swing.JLabel NetworkLabelName;
|
||||
private javax.swing.JLabel NetworkMaskLabel;
|
||||
private javax.swing.JPopupMenu NetworkRightClick;
|
||||
private javax.swing.JTextField RenameNetworkTextfield;
|
||||
private javax.swing.JRadioButton TapRadioButton;
|
||||
private javax.swing.JMenuItem deleteNetworkOption;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JPopupMenu.Separator jSeparator1;
|
||||
private javax.swing.JMenuItem renameNetworkOption;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="241" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="73" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="labtainersPathTextField" pref="483" max="32767" attributes="0"/>
|
||||
<Component id="editorTextField" min="-2" pref="472" max="-2" attributes="0"/>
|
||||
<Component id="registryTextField" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="157" max="-2" attributes="0"/>
|
||||
<Component id="OKButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="64" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="58" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
|
||||
<Component id="editorTextField" min="-2" pref="54" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="labtainersPathTextField" min="-2" pref="65" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="registryTextField" pref="53" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="OKButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="41" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Preferences"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="editorTextField">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Text editor"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="labtainersPathTextField">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="LABTAINERS_DIR path"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="OKButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="OK"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="OKButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="CancelButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="registryTextField">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Registry">
|
||||
<Font PropertyName="font" name="Dialog" size="14" style="0"/>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package labtainers.mainui;
|
||||
import java.util.Properties;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.io.FileReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mike
|
||||
*/
|
||||
public class PreferencesPanel extends javax.swing.JPanel {
|
||||
javax.swing.JDialog dialog;
|
||||
private File iniFile=null;
|
||||
private Properties prefProperties = null;
|
||||
/**
|
||||
* Creates new form PreferencesPanel
|
||||
*/
|
||||
public PreferencesPanel() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
editorTextField = new javax.swing.JTextField();
|
||||
labtainersPathTextField = new javax.swing.JTextField();
|
||||
OKButton = new javax.swing.JButton();
|
||||
CancelButton = new javax.swing.JButton();
|
||||
registryTextField = new javax.swing.JTextField();
|
||||
|
||||
jLabel1.setText("Preferences");
|
||||
|
||||
editorTextField.setBorder(javax.swing.BorderFactory.createTitledBorder("Text editor"));
|
||||
|
||||
labtainersPathTextField.setBorder(javax.swing.BorderFactory.createTitledBorder("LABTAINERS_DIR path"));
|
||||
|
||||
OKButton.setText("OK");
|
||||
OKButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
OKButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
CancelButton.setText("Cancel");
|
||||
CancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
registryTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Registry", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 14))); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(241, 241, 241)
|
||||
.addComponent(jLabel1))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(73, 73, 73)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(labtainersPathTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 483, Short.MAX_VALUE)
|
||||
.addComponent(editorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(registryTextField)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(157, 157, 157)
|
||||
.addComponent(OKButton)
|
||||
.addGap(64, 64, 64)
|
||||
.addComponent(CancelButton)))
|
||||
.addContainerGap(58, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1)
|
||||
.addGap(39, 39, 39)
|
||||
.addComponent(editorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(labtainersPathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(registryTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(OKButton)
|
||||
.addComponent(CancelButton))
|
||||
.addGap(41, 41, 41))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed
|
||||
this.dialog.setVisible(false);
|
||||
}//GEN-LAST:event_CancelButtonActionPerformed
|
||||
public void setDialog(javax.swing.JDialog dialog){
|
||||
this.dialog = dialog;
|
||||
}
|
||||
|
||||
private void OKButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OKButtonActionPerformed
|
||||
savePrefs();
|
||||
this.dialog.setVisible(false);
|
||||
}//GEN-LAST:event_OKButtonActionPerformed
|
||||
void setPrefs(File iniFile, Properties prefProperties){
|
||||
this.iniFile = iniFile;
|
||||
this.prefProperties = prefProperties;
|
||||
String textEditorPref = prefProperties.getProperty("textEditor");
|
||||
String labtainerPath = prefProperties.getProperty("labtainerPath");
|
||||
System.out.println("labtainerPath "+labtainerPath);
|
||||
this.editorTextField.setText(textEditorPref);
|
||||
this.labtainersPathTextField.setText(labtainerPath);
|
||||
}
|
||||
void savePrefs(){
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
prefProperties.put("textEditor", this.editorTextField.getText());
|
||||
String path = this.labtainersPathTextField.getText();
|
||||
if(new File(path).isDirectory()){
|
||||
prefProperties.put("labtainerPath", this.labtainersPathTextField.getText());
|
||||
}else{
|
||||
System.out.println("Error path does not exist, ignored: "+path);
|
||||
}
|
||||
// write update to the ini File
|
||||
Date date = new Date();
|
||||
try{
|
||||
FileOutputStream out = new FileOutputStream(this.iniFile);
|
||||
prefProperties.store(out, "Updated: "+ formatter.format(date));
|
||||
out.close();
|
||||
}catch(java.io.FileNotFoundException ex){
|
||||
System.out.println(ex);
|
||||
}catch(java.io.IOException ex){
|
||||
System.out.println(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton CancelButton;
|
||||
private javax.swing.JButton OKButton;
|
||||
private javax.swing.JTextField editorTextField;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JTextField labtainersPathTextField;
|
||||
private javax.swing.JTextField registryTextField;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Report on status of Docker containers using given labels and messages.
|
||||
Running containers are named via strings matched to the output of "docker ps".
|
||||
*/
|
||||
package labtainers.mainui;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class Status implements Runnable {
|
||||
private class StatusInfo{
|
||||
protected javax.swing.JLabel label;
|
||||
protected String message;
|
||||
protected String look_for;
|
||||
protected boolean was_running;
|
||||
protected boolean now_running;
|
||||
protected StatusInfo(javax.swing.JLabel label, String message, String look_for){
|
||||
this.label = label;
|
||||
this.message = message;
|
||||
this.look_for = look_for;
|
||||
this.was_running = false;
|
||||
this.now_running = false;
|
||||
}
|
||||
}
|
||||
private javax.swing.JLabel label;
|
||||
private String message;
|
||||
private ArrayList<String> look_for;
|
||||
private boolean was_running = false;
|
||||
private ArrayList<StatusInfo> status_info;
|
||||
|
||||
public Status(javax.swing.JLabel label, String message, String look_for) {
|
||||
this.status_info = new ArrayList<StatusInfo>();
|
||||
StatusInfo stat = new StatusInfo(label, message, look_for);
|
||||
stat.label.setText(stat.message+" No");
|
||||
this.status_info.add(stat);
|
||||
}
|
||||
public void addLabel(javax.swing.JLabel label, String message, String look_for) {
|
||||
StatusInfo stat = new StatusInfo(label, message, look_for);
|
||||
stat.label.setText(stat.message+" No");
|
||||
this.status_info.add(stat);
|
||||
}
|
||||
public void changeLook(javax.swing.JLabel label, String look_for){
|
||||
for(StatusInfo stat : this.status_info){
|
||||
if(stat.label == label){
|
||||
stat.look_for = look_for;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
Set<String> running_set;
|
||||
boolean now_running;
|
||||
while(true) {
|
||||
isRunning();
|
||||
for(StatusInfo stat : this.status_info){
|
||||
if(stat.now_running &! stat.was_running){
|
||||
stat.label.setText(stat.message+" Yes");
|
||||
}else if(!stat.now_running && stat.was_running){
|
||||
stat.label.setText(stat.message+" No");
|
||||
}
|
||||
stat.was_running = stat.now_running;
|
||||
}
|
||||
try{
|
||||
Thread.sleep(2000);
|
||||
}catch(InterruptedException ex){
|
||||
System.out.println(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void isRunning(){
|
||||
String line;
|
||||
//Executable file name of the application to check.
|
||||
|
||||
try{
|
||||
Process proc = Runtime.getRuntime().exec("docker ps");
|
||||
InputStream stream = proc.getInputStream();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
|
||||
for(StatusInfo stat : this.status_info){
|
||||
stat.now_running = false;
|
||||
}
|
||||
while ((line = reader.readLine()) != null) {
|
||||
for(StatusInfo stat : this.status_info){
|
||||
Pattern pattern = Pattern.compile(stat.look_for);
|
||||
Matcher matcher = pattern.matcher(line);
|
||||
if (matcher.find()) {
|
||||
stat.now_running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(IOException ex){
|
||||
System.out.println("Status error getting ps "+ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +1,99 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package GoalsUI;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ToolTipHandlers {
|
||||
public static interface ToolTipProvider{
|
||||
public String getToolTip();
|
||||
}
|
||||
|
||||
//Stores an item and its correspoinding tool tip. (Items put into a combobox)
|
||||
public static class ToolTipWrapper implements ToolTipProvider{
|
||||
final String item;
|
||||
final String toolTip;
|
||||
|
||||
public ToolTipWrapper(String item, String toolTip){
|
||||
this.item = item;
|
||||
this.toolTip = toolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolTip(){
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return item;
|
||||
}
|
||||
|
||||
public String getItem(){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
//custom combobox renderer to handle ToolTipWrapper objects that contain an string item and string tool tip
|
||||
public static class ComboBoxRenderer extends DefaultListCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
JComponent component = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
String tip = null;
|
||||
if (value instanceof ToolTipProvider) {
|
||||
ToolTipProvider ttp = (ToolTipProvider) value;
|
||||
tip = ttp.getToolTip();
|
||||
}
|
||||
list.setToolTipText(tip);
|
||||
return component;
|
||||
}
|
||||
}
|
||||
|
||||
//Sets the combo items with associated tool tips (called in the constructors)
|
||||
public static void setComboItems(JComboBox combobox, ToolTipWrapper[] items){
|
||||
ComboBoxRenderer renderer = new ComboBoxRenderer();
|
||||
combobox.setRenderer(renderer);
|
||||
|
||||
for (ToolTipWrapper item : items) {
|
||||
if(((DefaultComboBoxModel)combobox.getModel()).getIndexOf(item) == -1)
|
||||
combobox.addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.mainui;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author student
|
||||
*/
|
||||
public class ToolTipHandlers {
|
||||
public static interface ToolTipProvider{
|
||||
public String getToolTip();
|
||||
}
|
||||
|
||||
//Stores an item and its correspoinding tool tip. (Items put into a combobox)
|
||||
public static class ToolTipWrapper implements ToolTipProvider{
|
||||
final String item;
|
||||
final String toolTip;
|
||||
|
||||
public ToolTipWrapper(String item, String toolTip){
|
||||
this.item = item;
|
||||
this.toolTip = toolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolTip(){
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return item;
|
||||
}
|
||||
|
||||
public String getItem(){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
//custom combobox renderer to handle ToolTipWrapper objects that contain an string item and string tool tip
|
||||
public static class ComboBoxRenderer extends DefaultListCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
JComponent component = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
String tip = null;
|
||||
if (value instanceof ToolTipProvider) {
|
||||
ToolTipProvider ttp = (ToolTipProvider) value;
|
||||
tip = ttp.getToolTip();
|
||||
}
|
||||
list.setToolTipText(tip);
|
||||
return component;
|
||||
}
|
||||
}
|
||||
|
||||
//Sets the combo items with associated tool tips (called in the constructors)
|
||||
public static void setComboItems(JComboBox <ToolTipWrapper>combobox, ToolTipWrapper[] items){
|
||||
ComboBoxRenderer renderer = new ComboBoxRenderer();
|
||||
combobox.setRenderer(renderer);
|
||||
|
||||
for (ToolTipWrapper item : items) {
|
||||
if(((DefaultComboBoxModel)combobox.getModel()).getIndexOf(item) == -1)
|
||||
combobox.addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="TablePanel" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="326" max="-2" attributes="0"/>
|
||||
<Component id="okButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="76" max="-2" attributes="0"/>
|
||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="264" max="-2" attributes="0"/>
|
||||
<Component id="AddButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="159" max="-2" attributes="0"/>
|
||||
<Component id="DeleteButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="428" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="AddButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="DeleteButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="TablePanel" pref="413" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="okButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="okButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="OK"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="TablePanel">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="0"/>
|
||||
<Property name="rows" type="int" value="1"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="cancelButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="AddButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Add"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="AddButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="DeleteButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DeleteButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.paramsui;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JDialog;
|
||||
/**
|
||||
*
|
||||
* @author mike
|
||||
*/
|
||||
public class ContainerFileDialog extends javax.swing.JPanel {
|
||||
boolean is_ok = false;
|
||||
JDialog dialog = null;
|
||||
ContainerFileTable container_file_table = null;
|
||||
/**
|
||||
* Creates new form ContainerFileDialog
|
||||
*/
|
||||
public ContainerFileDialog(ArrayList<String> containers, ArrayList<String> fileList) {
|
||||
initComponents();
|
||||
container_file_table = new ContainerFileTable(containers, fileList);
|
||||
TablePanel.add(container_file_table);
|
||||
}
|
||||
public boolean isOK(){
|
||||
return this.is_ok;
|
||||
}
|
||||
public void setDialog(JDialog dialog){
|
||||
this.dialog = dialog;
|
||||
}
|
||||
public ArrayList<String> getFileList(){
|
||||
return container_file_table.getFileList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
okButton = new javax.swing.JButton();
|
||||
TablePanel = new javax.swing.JPanel();
|
||||
cancelButton = new javax.swing.JButton();
|
||||
AddButton = new javax.swing.JButton();
|
||||
DeleteButton = new javax.swing.JButton();
|
||||
|
||||
okButton.setText("OK");
|
||||
okButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
okButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
TablePanel.setLayout(new java.awt.GridLayout(1, 0));
|
||||
|
||||
cancelButton.setText("Cancel");
|
||||
cancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
AddButton.setText("Add");
|
||||
AddButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
AddButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
DeleteButton.setText("Delete");
|
||||
DeleteButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
DeleteButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(TablePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(326, 326, 326)
|
||||
.addComponent(okButton)
|
||||
.addGap(76, 76, 76)
|
||||
.addComponent(cancelButton))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(264, 264, 264)
|
||||
.addComponent(AddButton)
|
||||
.addGap(159, 159, 159)
|
||||
.addComponent(DeleteButton)))
|
||||
.addGap(0, 428, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(9, 9, 9)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(AddButton)
|
||||
.addComponent(DeleteButton))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(TablePanel, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cancelButton)
|
||||
.addComponent(okButton))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||
this.is_ok = true;
|
||||
this.dialog.setVisible(false);
|
||||
}//GEN-LAST:event_okButtonActionPerformed
|
||||
|
||||
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
||||
this.dialog.setVisible(false);
|
||||
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||
|
||||
private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed
|
||||
this.container_file_table.deleteRow();
|
||||
}//GEN-LAST:event_DeleteButtonActionPerformed
|
||||
|
||||
private void AddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddButtonActionPerformed
|
||||
this.container_file_table.addRow();
|
||||
}//GEN-LAST:event_AddButtonActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton AddButton;
|
||||
private javax.swing.JButton DeleteButton;
|
||||
private javax.swing.JPanel TablePanel;
|
||||
private javax.swing.JButton cancelButton;
|
||||
private javax.swing.JButton okButton;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
package labtainers.paramsui;
|
||||
|
||||
/*
|
||||
* TableRenderDemo.java requires no other files.
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.DefaultCellEditor;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableColumn;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
/**
|
||||
|
||||
*/
|
||||
public class ContainerFileTable extends JPanel {
|
||||
private boolean DEBUG = true;
|
||||
private boolean multipleContainers = false;
|
||||
private JTable table;
|
||||
private ArrayList<String> containers;
|
||||
public ContainerFileTable(ArrayList<String> containers, ArrayList<String> fileList) {
|
||||
super(new GridLayout(1,0));
|
||||
|
||||
this.table = new JTable(new MyTableModel());
|
||||
this.containers = containers;
|
||||
addList(fileList);
|
||||
this.table.setRowSelectionInterval(0, 0);
|
||||
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
|
||||
table.setFillsViewportHeight(true);
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane(table);
|
||||
|
||||
initColumnSizes(table);
|
||||
|
||||
setUpContainersColumn(table, table.getColumnModel().getColumn(0), containers);
|
||||
|
||||
add(scrollPane);
|
||||
if(containers.size() > 1){
|
||||
multipleContainers = true;
|
||||
}
|
||||
|
||||
|
||||
JTableHeader header = table.getTableHeader();
|
||||
|
||||
ColumnHeaderToolTips tips = new ColumnHeaderToolTips();
|
||||
TableColumn container_col = this.table.getColumnModel().getColumn(0);
|
||||
tips.setToolTip(container_col, "<html>Click for combo box, select container whose file is to be modified or start.config<br> or select start.config to modify configuration values, e.g., IP addresses.");
|
||||
TableColumn file_col = this.table.getColumnModel().getColumn(1);
|
||||
tips.setToolTip(file_col, "<html>Absolute path of the file to be modifed on the container.");
|
||||
header.addMouseMotionListener(tips);
|
||||
}
|
||||
public ArrayList<String> getFileList(){
|
||||
MyTableModel model = (MyTableModel)this.table.getModel();
|
||||
return model.getFileList(this.multipleContainers);
|
||||
}
|
||||
private void addList(ArrayList<String> fileList){
|
||||
MyTableModel model = (MyTableModel)this.table.getModel();
|
||||
if(fileList != null && fileList.size() > 0){
|
||||
for(String item : fileList){
|
||||
System.out.println("addList item "+item);
|
||||
String container = "";
|
||||
String file = "";
|
||||
if(item.contains(":")){
|
||||
String[] parts = item.split(":");
|
||||
container = parts[0];
|
||||
if(parts.length > 1){
|
||||
file = parts[1];
|
||||
}
|
||||
}else if(item.equals("start.config")){
|
||||
container = item;
|
||||
}else{
|
||||
file = item;
|
||||
container = this.containers.get(0);
|
||||
}
|
||||
model.addRow(container, file);
|
||||
}
|
||||
}else{
|
||||
String container = this.containers.get(0);
|
||||
model.addRow(container, "");
|
||||
}
|
||||
}
|
||||
public void addRow(){
|
||||
MyTableModel model = (MyTableModel)this.table.getModel();
|
||||
String container = this.containers.get(0);
|
||||
model.addRow(container, "");
|
||||
int last = model.getRowCount()-1;
|
||||
this.table.setRowSelectionInterval(last, last);
|
||||
}
|
||||
public void deleteRow(){
|
||||
int selected = this.table.getSelectedRow();
|
||||
if(selected >=0){
|
||||
MyTableModel model = (MyTableModel)this.table.getModel();
|
||||
model.deleteRow(selected);
|
||||
this.table.setRowSelectionInterval(0, 0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This method picks good column sizes.
|
||||
* If all column heads are wider than the column's cells'
|
||||
* contents, then you can just use column.sizeWidthToFit().
|
||||
*/
|
||||
private void initColumnSizes(JTable table) {
|
||||
MyTableModel model = (MyTableModel)table.getModel();
|
||||
TableColumn column = null;
|
||||
Component comp = null;
|
||||
int headerWidth = 0;
|
||||
int cellWidth = 0;
|
||||
Object[] longValues = model.longValues;
|
||||
TableCellRenderer headerRenderer =
|
||||
table.getTableHeader().getDefaultRenderer();
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
column = table.getColumnModel().getColumn(i);
|
||||
|
||||
comp = headerRenderer.getTableCellRendererComponent(
|
||||
null, column.getHeaderValue(),
|
||||
false, false, 0, 0);
|
||||
headerWidth = comp.getPreferredSize().width;
|
||||
|
||||
comp = table.getDefaultRenderer(model.getColumnClass(i)).
|
||||
getTableCellRendererComponent(
|
||||
table, longValues[i],
|
||||
false, false, 0, i);
|
||||
cellWidth = comp.getPreferredSize().width;
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("Initializing width of column "
|
||||
+ i + ". "
|
||||
+ "headerWidth = " + headerWidth
|
||||
+ "; cellWidth = " + cellWidth);
|
||||
}
|
||||
|
||||
column.setPreferredWidth(Math.max(headerWidth, cellWidth));
|
||||
}
|
||||
}
|
||||
|
||||
public void setUpContainersColumn(JTable table,
|
||||
TableColumn containerColumn, ArrayList<String> containers) {
|
||||
//Set up the editor for the container column.
|
||||
JComboBox<String> comboBox = new JComboBox<String>();
|
||||
for(String c : containers){
|
||||
comboBox.addItem(c);
|
||||
}
|
||||
comboBox.addItem("start.config");
|
||||
|
||||
containerColumn.setCellEditor(new DefaultCellEditor(comboBox));
|
||||
|
||||
//Set up tool tips for the container cells.
|
||||
DefaultTableCellRenderer renderer =
|
||||
new DefaultTableCellRenderer();
|
||||
renderer.setToolTipText("Click for combo box");
|
||||
containerColumn.setCellRenderer(renderer);
|
||||
}
|
||||
|
||||
class ColumnHeaderToolTips extends MouseMotionAdapter {
|
||||
TableColumn curCol;
|
||||
Map<TableColumn, String> tips = new HashMap<TableColumn, String>();
|
||||
public void setToolTip(TableColumn col, String tooltip) {
|
||||
if (tooltip == null) {
|
||||
tips.remove(col);
|
||||
} else {
|
||||
tips.put(col, tooltip);
|
||||
}
|
||||
}
|
||||
public void mouseMoved(MouseEvent evt) {
|
||||
JTableHeader header = (JTableHeader) evt.getSource();
|
||||
JTable table = header.getTable();
|
||||
TableColumnModel colModel = table.getColumnModel();
|
||||
int vColIndex = colModel.getColumnIndexAtX(evt.getX());
|
||||
TableColumn col = null;
|
||||
if (vColIndex >= 0) {
|
||||
col = colModel.getColumn(vColIndex);
|
||||
}
|
||||
if (col != curCol) {
|
||||
header.setToolTipText((String) tips.get(col));
|
||||
curCol = col;
|
||||
}
|
||||
}
|
||||
}
|
||||
class MyTableModel extends AbstractTableModel {
|
||||
private String[] columnNames = {"Container",
|
||||
"File"};
|
||||
//private Object[][] data = {
|
||||
//};
|
||||
private ArrayList<String[]> data = new ArrayList<String[]>();
|
||||
public void addRow(String container, String file){
|
||||
System.out.println("addRow "+container+":"+file);
|
||||
String[] entry = {container, file};
|
||||
data.add(entry);
|
||||
}
|
||||
public void deleteRow(int row){
|
||||
data.remove(row);
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
public final Object[] longValues = {"some container", "some file"};
|
||||
|
||||
public int getColumnCount() {
|
||||
return columnNames.length;
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
public String getColumnName(int col) {
|
||||
return columnNames[col];
|
||||
}
|
||||
|
||||
public Object getValueAt(int row, int col) {
|
||||
String[] r = data.get(row);
|
||||
return r[col];
|
||||
}
|
||||
|
||||
/*
|
||||
* JTable uses this method to determine the default renderer/
|
||||
* editor for each cell. If we didn't implement this method,
|
||||
* then the last column would contain text ("true"/"false"),
|
||||
* rather than a check box.
|
||||
*/
|
||||
public Class getColumnClass(int c) {
|
||||
return getValueAt(0, c).getClass();
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't need to implement this method unless your table's
|
||||
* editable.
|
||||
*/
|
||||
public boolean isCellEditable(int row, int col) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't need to implement this method unless your table's
|
||||
* data can change.
|
||||
*/
|
||||
public void setValueAt(Object value, int row, int col) {
|
||||
if(row < getRowCount()){
|
||||
if (DEBUG) {
|
||||
System.out.println("Setting value at " + row + "," + col
|
||||
+ " to " + value
|
||||
+ " (an instance of "
|
||||
+ value.getClass() + ")");
|
||||
}
|
||||
String[] r = data.get(row);
|
||||
r[col] = (String) value;
|
||||
fireTableCellUpdated(row, col);
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("New value of data:");
|
||||
printDebugData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void printDebugData() {
|
||||
int numRows = getRowCount();
|
||||
int numCols = getColumnCount();
|
||||
|
||||
for (int i=0; i < numRows; i++) {
|
||||
System.out.print(" row " + i + ":");
|
||||
for (int j=0; j < numCols; j++) {
|
||||
//System.out.print(" " + data[i][j]);
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
System.out.println("--------------------------");
|
||||
}
|
||||
public ArrayList<String> getFileList(boolean multipleContainers){
|
||||
ArrayList<String> retval = new ArrayList<String>();
|
||||
String containerFile = "";
|
||||
for(String[] row : this.data){
|
||||
String container = row[0];
|
||||
String file = row[1];
|
||||
if(container.equals("start.config")){
|
||||
containerFile = container;
|
||||
}else{
|
||||
if(!multipleContainers){
|
||||
containerFile = file;
|
||||
}else{
|
||||
containerFile = container+":"+file;
|
||||
}
|
||||
}
|
||||
retval.add(containerFile);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1560, 86]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1560, 86]"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="" noResource="true"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1580, 86]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="72" max="-2" attributes="0"/>
|
||||
<Component id="ParamPanel" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="DownButton" min="-2" pref="33" max="-2" attributes="0"/>
|
||||
<Component id="UpButton" alignment="1" min="-2" pref="33" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="DeleteButton" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="DocButton" min="-2" pref="61" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ParamPanel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="UpButton" alignment="3" min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<Component id="DeleteButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="DownButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="DocButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu" size="48" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="10"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="DeleteButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DeleteButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="UpButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu Condensed" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="^"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[19, 50]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[19, 31]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[19, 31]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="UpButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="DownButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu Condensed" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="v"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DownButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="ParamPanel">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||
<EmptyBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ParamIDTextField" min="-2" pref="138" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
|
||||
<Component id="OperationComboBox" min="-2" pref="160" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="FileNameTextField" min="-2" pref="234" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="ShowListButton" min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
|
||||
<Component id="SymbolTextField" min="-2" pref="142" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="LowerBoundTextField" min="-2" pref="109" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="UpperBoundTextField" min="-2" pref="108" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="stepTextField" min="-2" pref="111" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="HashedStringTextField" min="-2" pref="223" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="ParamIDTextField" alignment="3" min="-2" pref="40" max="-2" attributes="0"/>
|
||||
<Component id="OperationComboBox" alignment="3" min="-2" pref="40" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="LowerBoundTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="SymbolTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="UpperBoundTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="stepTextField" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="HashedStringTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="ShowListButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="FileNameTextField" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="23" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextField" name="ParamIDTextField">
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="OperationComboBox">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="OperationComboBoxItemStateChanged"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="OperationComboBoxActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<ToolTipWrapper>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="FileNameTextField">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value="<html>Name of the file containing parameterized data.</html>"/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="File name">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="SymbolTextField">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="<html>Symbol within the file that is to be replaced, e.g., with a hash or a random value.</html>"/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Symbol">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="LowerBoundTextField">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Lower bound of random value."/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Lower bound">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 100]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="UpperBoundTextField">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Upper bound of random value."/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Upper bound">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[20, 100]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="HashedStringTextField">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value="String to be hashed."/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Hashed string">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="ShowListButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jButton1"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ShowListButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="stepTextField">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Step">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="stepTextFieldActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="DocButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Doc"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Document this parameter."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DocButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,494 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.paramsui;
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JDialog;
|
||||
import labtainers.mainui.ToolTipHandlers.ToolTipWrapper;
|
||||
import labtainers.mainui.ToolTipHandlers.ToolTipWrapper;
|
||||
import static labtainers.mainui.ToolTipHandlers.setComboItems;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.Operator_ITEMS;
|
||||
import labtainers.resultsui.ParamReferenceStorage;
|
||||
import labtainers.goalsui.DocPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ParamPanels extends javax.swing.JPanel {
|
||||
|
||||
static Dimension dim = new Dimension(975, 100);
|
||||
ParamsUI uiParam;
|
||||
ParamsData dataUI;
|
||||
int rowNum;
|
||||
String comments="";
|
||||
|
||||
/**
|
||||
* Creates new form ParamsPanel
|
||||
*/
|
||||
//Creating fresh params line
|
||||
public ParamPanels(ParamsUI ui, int rowNum) {
|
||||
initComponents();
|
||||
this.uiParam = ui;
|
||||
this.dataUI = ui.data;
|
||||
this.rowNum = rowNum;
|
||||
|
||||
jLabel3.setText(Integer.toString(rowNum));
|
||||
LowerBoundTextField.setVisible(false);
|
||||
|
||||
setComboItems(OperationComboBox, Operator_ITEMS);
|
||||
}
|
||||
|
||||
//Loading params line
|
||||
public ParamPanels(ParamsUI ui, int rowNum, String paramID, ArrayList<String> fileList,
|
||||
String operator, String symbol,
|
||||
String hashedString, String upperBound, String lowerBound, String step, String comments){
|
||||
initComponents();
|
||||
this.uiParam = ui;
|
||||
this.dataUI = ui.data;
|
||||
this.rowNum = rowNum;
|
||||
this.comments = comments;
|
||||
jLabel3.setText(Integer.toString(rowNum));
|
||||
|
||||
setComboItems(OperationComboBox, Operator_ITEMS);
|
||||
|
||||
//Set Values
|
||||
setOperatorComboBox(operator);
|
||||
setParamIDTextField(paramID);
|
||||
String file_list = String.join(";", fileList);
|
||||
setFileTextField(file_list);
|
||||
setSymbolTextField(symbol);
|
||||
setHashedStringTextField(hashedString);
|
||||
setUpperBoundTextField(upperBound);
|
||||
setLowerBoundTextField(lowerBound);
|
||||
setStepTextField(step);
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
DeleteButton = new javax.swing.JButton();
|
||||
UpButton = new javax.swing.JButton();
|
||||
DownButton = new javax.swing.JButton();
|
||||
ParamPanel = new javax.swing.JPanel();
|
||||
ParamIDTextField = new javax.swing.JTextField();
|
||||
OperationComboBox = new javax.swing.JComboBox<>();
|
||||
FileNameTextField = new javax.swing.JTextField();
|
||||
SymbolTextField = new javax.swing.JTextField();
|
||||
LowerBoundTextField = new javax.swing.JTextField();
|
||||
UpperBoundTextField = new javax.swing.JTextField();
|
||||
HashedStringTextField = new javax.swing.JTextField();
|
||||
ShowListButton = new javax.swing.JButton();
|
||||
stepTextField = new javax.swing.JTextField();
|
||||
DocButton = new javax.swing.JButton();
|
||||
|
||||
setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
setMaximumSize(new java.awt.Dimension(1560, 86));
|
||||
setMinimumSize(new java.awt.Dimension(1560, 86));
|
||||
setName(""); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(1580, 86));
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Ubuntu", 1, 48)); // NOI18N
|
||||
jLabel3.setText("10");
|
||||
|
||||
DeleteButton.setText("Delete");
|
||||
DeleteButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
DeleteButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
UpButton.setFont(new java.awt.Font("Ubuntu Condensed", 0, 12)); // NOI18N
|
||||
UpButton.setText("^");
|
||||
UpButton.setMaximumSize(new java.awt.Dimension(19, 50));
|
||||
UpButton.setMinimumSize(new java.awt.Dimension(19, 31));
|
||||
UpButton.setPreferredSize(new java.awt.Dimension(19, 31));
|
||||
UpButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
UpButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
DownButton.setFont(new java.awt.Font("Ubuntu Condensed", 0, 12)); // NOI18N
|
||||
DownButton.setText("v");
|
||||
DownButton.setToolTipText("");
|
||||
DownButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
DownButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
ParamPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
||||
OperationComboBox.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
OperationComboBoxItemStateChanged(evt);
|
||||
}
|
||||
});
|
||||
OperationComboBox.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
OperationComboBoxActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
FileNameTextField.setToolTipText("<html>Name of the file containing parameterized data.</html>");
|
||||
FileNameTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "File name"));
|
||||
|
||||
SymbolTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
|
||||
SymbolTextField.setToolTipText("<html>Symbol within the file that is to be replaced, e.g., with a hash or a random value.</html>");
|
||||
SymbolTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Symbol"));
|
||||
|
||||
LowerBoundTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
|
||||
LowerBoundTextField.setToolTipText("Lower bound of random value.");
|
||||
LowerBoundTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Lower bound"));
|
||||
LowerBoundTextField.setMinimumSize(new java.awt.Dimension(20, 100));
|
||||
|
||||
UpperBoundTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
|
||||
UpperBoundTextField.setToolTipText("Upper bound of random value.");
|
||||
UpperBoundTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Upper bound"));
|
||||
UpperBoundTextField.setMinimumSize(new java.awt.Dimension(20, 100));
|
||||
|
||||
HashedStringTextField.setToolTipText("String to be hashed.");
|
||||
HashedStringTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Hashed string"));
|
||||
|
||||
ShowListButton.setText("jButton1");
|
||||
ShowListButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
ShowListButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
stepTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
|
||||
stepTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Step"));
|
||||
stepTextField.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
stepTextFieldActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout ParamPanelLayout = new javax.swing.GroupLayout(ParamPanel);
|
||||
ParamPanel.setLayout(ParamPanelLayout);
|
||||
ParamPanelLayout.setHorizontalGroup(
|
||||
ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(ParamPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(ParamIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(35, 35, 35)
|
||||
.addComponent(OperationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(FileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(ShowListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(38, 38, 38)
|
||||
.addComponent(SymbolTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(LowerBoundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(UpperBoundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(stepTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(HashedStringTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
ParamPanelLayout.setVerticalGroup(
|
||||
ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(ParamPanelLayout.createSequentialGroup()
|
||||
.addGroup(ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(ParamPanelLayout.createSequentialGroup()
|
||||
.addGap(1, 1, 1)
|
||||
.addGroup(ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(ParamIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(OperationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(LowerBoundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(SymbolTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(UpperBoundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(stepTextField)
|
||||
.addComponent(HashedStringTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(ShowListButton)
|
||||
.addComponent(FileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(0, 23, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
DocButton.setText("Doc");
|
||||
DocButton.setToolTipText("Document this parameter.");
|
||||
DocButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
DocButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(72, 72, 72)
|
||||
.addComponent(ParamPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(DownButton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(UpButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(DeleteButton)
|
||||
.addComponent(DocButton, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(22, 22, 22))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(ParamPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(38, 38, 38)
|
||||
.addComponent(jLabel3))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(3, 3, 3)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(UpButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(DeleteButton))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(DownButton)
|
||||
.addComponent(DocButton)))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void UpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpButtonActionPerformed
|
||||
swapUpdate("UP", rowNum-1); //Subtract rowNum by one to get the proper index number
|
||||
}//GEN-LAST:event_UpButtonActionPerformed
|
||||
|
||||
private void DownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DownButtonActionPerformed
|
||||
swapUpdate("DOWN", rowNum-1); //Subtract rowNum by one to get the proper index number
|
||||
}//GEN-LAST:event_DownButtonActionPerformed
|
||||
|
||||
private void OperationComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_OperationComboBoxItemStateChanged
|
||||
operatorListener();
|
||||
}//GEN-LAST:event_OperationComboBoxItemStateChanged
|
||||
|
||||
private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed
|
||||
deleteButton();
|
||||
}//GEN-LAST:event_DeleteButtonActionPerformed
|
||||
|
||||
private void OperationComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OperationComboBoxActionPerformed
|
||||
//operatorListener();
|
||||
}//GEN-LAST:event_OperationComboBoxActionPerformed
|
||||
|
||||
private void DocButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DocButtonActionPerformed
|
||||
DocPanel panel = new DocPanel();
|
||||
|
||||
panel.setDoc(this.comments);
|
||||
//panel.setVisible(true);
|
||||
JDialog dialog = new JDialog();
|
||||
panel.setDialog(dialog);
|
||||
//dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
dialog.setModal(true);
|
||||
dialog.add(panel);
|
||||
dialog.pack();
|
||||
dialog.setLocation(200, 200);
|
||||
dialog.setTitle("Documentation for "+ParamIDTextField.getText());
|
||||
dialog.setVisible(true);
|
||||
if(panel.isOK()){
|
||||
this.comments = panel.getDoc();
|
||||
}
|
||||
}//GEN-LAST:event_DocButtonActionPerformed
|
||||
|
||||
private void ShowListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ShowListButtonActionPerformed
|
||||
String file_list = getFileTextField().getText();
|
||||
String fileArray[] = file_list.split(";");
|
||||
List<String> list = new ArrayList<String>();
|
||||
list = Arrays.asList(fileArray);
|
||||
ArrayList<String> fileList = new ArrayList<String>(list);
|
||||
ContainerFileDialog panel = new ContainerFileDialog(this.dataUI.getContainerList(), fileList);
|
||||
|
||||
//panel.tableSetup();
|
||||
panel.setOpaque(true);
|
||||
JDialog dialog = new JDialog();
|
||||
panel.setDialog(dialog);
|
||||
//dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
dialog.setModal(true);
|
||||
dialog.add(panel);
|
||||
dialog.pack();
|
||||
dialog.setLocation(200, 200);
|
||||
dialog.setTitle("Files to modify");
|
||||
dialog.setVisible(true);
|
||||
if(panel.isOK()){
|
||||
System.out.println("is ok ");
|
||||
fileList = panel.getFileList();
|
||||
file_list = String.join(";", fileList);
|
||||
setFileTextField(file_list);
|
||||
}
|
||||
dialog.dispose();
|
||||
}//GEN-LAST:event_ShowListButtonActionPerformed
|
||||
|
||||
private void stepTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stepTextFieldActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_stepTextFieldActionPerformed
|
||||
|
||||
private void deleteButton(){
|
||||
JPanel panelOfParams = (JPanel)this.getParent();
|
||||
panelOfParams.remove(this);
|
||||
uiParam.data.rowCount--;
|
||||
uiParam.refresh();
|
||||
}
|
||||
private void operatorListener(){
|
||||
ToolTipWrapper operator = (ToolTipWrapper)OperationComboBox.getSelectedItem();
|
||||
if(operator == null){
|
||||
return;
|
||||
}
|
||||
//adjustToolTip(operator.getItem());
|
||||
String op_string = operator.getItem();
|
||||
if(op_string.contains("RAND")){
|
||||
LowerBoundTextField.setVisible(true);
|
||||
UpperBoundTextField.setVisible(true);
|
||||
stepTextField.setVisible(true);
|
||||
}else{
|
||||
LowerBoundTextField.setVisible(false);
|
||||
UpperBoundTextField.setVisible(false);
|
||||
}
|
||||
if(op_string.contains("REPLACE")){
|
||||
SymbolTextField.setVisible(true);
|
||||
}else{
|
||||
SymbolTextField.setVisible(false);
|
||||
}
|
||||
if(op_string.contains("HASH")){
|
||||
HashedStringTextField.setVisible(true);
|
||||
}else{
|
||||
HashedStringTextField.setVisible(false);
|
||||
}
|
||||
ParamPanel.revalidate();
|
||||
ParamPanel.repaint();
|
||||
}
|
||||
|
||||
|
||||
//Swaps artifact order in the list of artifacts and then redraws them
|
||||
void swapUpdate(String type, int rowIndex){
|
||||
//System.out.println("RowCOUNT(swap): " +dataUI.rowCount);
|
||||
dataUI.updateListofParams(uiParam.getPanelofParams());
|
||||
dataUI.swapParams(type, rowIndex);
|
||||
uiParam.loadUI();
|
||||
}
|
||||
|
||||
//Field Getters
|
||||
public JTextField getParamIDTextField(){
|
||||
return ParamIDTextField;
|
||||
}
|
||||
public JTextField getFileTextField(){
|
||||
return FileNameTextField;
|
||||
}
|
||||
public JComboBox<ToolTipWrapper> getOperatorComboBox(){
|
||||
return OperationComboBox;
|
||||
}
|
||||
public JTextField getSymbolTextField(){
|
||||
return SymbolTextField;
|
||||
}
|
||||
public JTextField getHashedStringTextField(){
|
||||
return HashedStringTextField;
|
||||
}
|
||||
public JTextField getLowerBoundTextField(){
|
||||
return LowerBoundTextField;
|
||||
}
|
||||
public JTextField getUpperBoundTextField(){
|
||||
return UpperBoundTextField;
|
||||
}
|
||||
public JTextField getStepTextField(){
|
||||
return stepTextField;
|
||||
}
|
||||
public String getComments(){
|
||||
return this.comments;
|
||||
}
|
||||
//Field SETTERS
|
||||
private void setParamIDTextField(String v){
|
||||
ParamIDTextField.setText(v);
|
||||
}
|
||||
private void setFileTextField(String v){
|
||||
FileNameTextField.setText(v);
|
||||
}
|
||||
private void setSymbolTextField(String v){
|
||||
SymbolTextField.setText(v);
|
||||
}
|
||||
private void setHashedStringTextField(String v){
|
||||
HashedStringTextField.setText(v);
|
||||
}
|
||||
private void setLowerBoundTextField(String v){
|
||||
LowerBoundTextField.setText(v);
|
||||
}
|
||||
private void setUpperBoundTextField(String v){
|
||||
UpperBoundTextField.setText(v);
|
||||
}
|
||||
private void setStepTextField(String v){
|
||||
stepTextField.setText(v);
|
||||
}
|
||||
private void setOperatorComboBox(String v){
|
||||
ToolTipWrapper tip = ParamReferenceStorage.getWrapper(Operator_ITEMS, v);
|
||||
OperationComboBox.setSelectedItem(tip);
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton DeleteButton;
|
||||
private javax.swing.JButton DocButton;
|
||||
private javax.swing.JButton DownButton;
|
||||
private javax.swing.JTextField FileNameTextField;
|
||||
private javax.swing.JTextField HashedStringTextField;
|
||||
private javax.swing.JTextField LowerBoundTextField;
|
||||
private javax.swing.JComboBox<ToolTipWrapper> OperationComboBox;
|
||||
private javax.swing.JTextField ParamIDTextField;
|
||||
private javax.swing.JPanel ParamPanel;
|
||||
private javax.swing.JButton ShowListButton;
|
||||
private javax.swing.JTextField SymbolTextField;
|
||||
private javax.swing.JButton UpButton;
|
||||
private javax.swing.JTextField UpperBoundTextField;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JTextField stepTextField;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.paramsui;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import labtainers.mainui.ToolTipHandlers;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.FieldType_ITEMS;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.LineType_ITEMS;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.SpecialTimeStampType;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.TimestampType_ITEMS;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.justFieldType;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.lineParamAccessible;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author MFT
|
||||
*/
|
||||
public class ParamValues {
|
||||
//Values to be obtained
|
||||
String paramID, symbol, hashedString;
|
||||
ArrayList<String> fileList = new ArrayList<String>();
|
||||
String upperBound, lowerBound, step;
|
||||
String comments = "";
|
||||
String operator;
|
||||
String inputLine = "";
|
||||
//Stores the values of an parameter fed into it (NO real value validation happening here)
|
||||
ParamValues(String inputLine) {
|
||||
this.inputLine = inputLine;
|
||||
}
|
||||
void load() throws java.lang.ArrayIndexOutOfBoundsException {
|
||||
String paramLine;
|
||||
if(this.inputLine.contains("\n")){
|
||||
String[] the_lines = this.inputLine.split("\n");
|
||||
paramLine = the_lines[the_lines.length-1];
|
||||
for(int i=0; i<the_lines.length-1; i++){
|
||||
comments = comments+the_lines[i]+"\n";
|
||||
}
|
||||
}else{
|
||||
paramLine = this.inputLine;
|
||||
}
|
||||
String operator_string;
|
||||
paramID = symbol = hashedString = "";
|
||||
upperBound = lowerBound = "0";
|
||||
step = "1";
|
||||
operator = null;
|
||||
|
||||
//Parsing the paramLine
|
||||
String[] paramParsedLine = paramLine.split(": ");
|
||||
|
||||
paramID = paramParsedLine[0].trim();
|
||||
//System.out.println("paramID found "+paramID);
|
||||
operator_string = paramParsedLine[1];
|
||||
//operator = itemFinder(Operator_ITEMS, operator_string);
|
||||
operator = operator_string.trim();
|
||||
String [] farray = paramParsedLine[2].trim().split(";");
|
||||
for(String f : farray){
|
||||
fileList.add(f);
|
||||
}
|
||||
if(operator_string.contains("REPLACE")){
|
||||
symbol = paramParsedLine[3].trim();
|
||||
if(operator_string.contains("RAND")){
|
||||
lowerBound = paramParsedLine[4].trim();
|
||||
upperBound = paramParsedLine[5].trim();
|
||||
if(paramParsedLine.length > 6){
|
||||
step = paramParsedLine[6].trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(operator.equals("HASH_CREATE")){
|
||||
hashedString = paramParsedLine[3].trim();
|
||||
}else if(operator.equals("HASH_REPLACE")){
|
||||
hashedString = paramParsedLine[4].trim();
|
||||
}
|
||||
}
|
||||
|
||||
//Constructor for temporarily storing values of artifacts in the UI
|
||||
ParamValues(String paramID, ArrayList<String> fileList, String operator,
|
||||
String symbol, String hashedString,
|
||||
String lowerBound, String upperBound, String step, String comments){
|
||||
this.paramID = paramID;
|
||||
this.fileList = fileList;
|
||||
this.operator = operator;
|
||||
this.symbol = symbol;
|
||||
this.hashedString = hashedString;
|
||||
this.lowerBound = lowerBound;
|
||||
this.upperBound = upperBound;
|
||||
this.step = step;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
//Clones the original Params Values
|
||||
ParamValues(ParamValues original){
|
||||
this.paramID = original.paramID;
|
||||
for(String containerFile : original.fileList){
|
||||
this.fileList.add(containerFile);
|
||||
}
|
||||
this.operator = original.operator;
|
||||
this.symbol = original.symbol;
|
||||
this.hashedString = original.hashedString;
|
||||
this.lowerBound = original.lowerBound;
|
||||
this.upperBound = original.upperBound;
|
||||
this.step = original.step;
|
||||
this.comments = original.comments;
|
||||
}
|
||||
|
||||
private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){
|
||||
for(ToolTipHandlers.ToolTipWrapper item : list){
|
||||
if(item.getItem().equals(desired)){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean itemExistCheck(ToolTipHandlers.ToolTipWrapper[] list,String desired){
|
||||
for(ToolTipHandlers.ToolTipWrapper item : list){
|
||||
if(item.getItem().equals(desired)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isInteger(String s){
|
||||
try{
|
||||
Integer.parseInt(s);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,638 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.paramsui;
|
||||
|
||||
import labtainers.resultsui.*;
|
||||
import labtainers.mainui.ToolTipHandlers;
|
||||
import labtainers.mainui.CompareTextFiles;
|
||||
import java.awt.Component;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import labtainers.mainui.MainWindow;
|
||||
import labtainers.mainui.ToolTipHandlers.ToolTipWrapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ParamsData {
|
||||
protected List<ParamValues> listofParams;
|
||||
static public ArrayList<String> containerList = new ArrayList<String>();
|
||||
protected int rowCount;
|
||||
MainWindow mainUI;
|
||||
public int test = 0;
|
||||
|
||||
public ParamsData(MainWindow main, File labPath){
|
||||
listofParams = new ArrayList<ParamValues>();
|
||||
rowCount = 0;
|
||||
|
||||
this.mainUI = main;
|
||||
}
|
||||
|
||||
// Creates a deep copy of the original (shallow with containerList and mainUI)
|
||||
public ParamsData(ParamsData original){
|
||||
listofParams = new ArrayList<ParamValues>();
|
||||
//Deep copy the list of params
|
||||
for(ParamValues param : original.listofParams){
|
||||
ParamValues pv = new ParamValues(param);
|
||||
listofParams.add(pv);
|
||||
}
|
||||
|
||||
this.rowCount = original.getRowCount();
|
||||
|
||||
this.mainUI = original.getMainWindow();
|
||||
}
|
||||
//Retrieving and Setting Data~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//Parses the parameter.config to obtain all the relevant param lines,
|
||||
//extracts the values of each param line
|
||||
//and then loads each param line's value into the list of Params
|
||||
public void retrieveData(){
|
||||
ArrayList<String> params = getParamLines();
|
||||
|
||||
if(params != null){
|
||||
//Fill the list of params
|
||||
for(String paramLine : params){
|
||||
ParamValues pv = new ParamValues(paramLine);
|
||||
try{
|
||||
//System.out.println("add parsed paramLine "+paramLine);
|
||||
pv.load();
|
||||
listofParams.add(pv);
|
||||
rowCount++;
|
||||
}catch(java.lang.ArrayIndexOutOfBoundsException exa){
|
||||
System.out.println("ERROR: "+exa);
|
||||
System.out.println("Error retrieveData parsing parameter line: "+paramLine+"\n");
|
||||
mainUI.output("Error parsing parameter line: "+paramLine+"\n");
|
||||
mainUI.output(exa.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Updates the containerlist (all parameter panels refer to this list to fill in the container combobox)
|
||||
static public void setContainerList(ArrayList<String> newContainerList){
|
||||
containerList = newContainerList;
|
||||
}
|
||||
|
||||
|
||||
//WRITING~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//Update the parameter.config file with the user's input
|
||||
// If usetmp return the path the temporary configuration file.
|
||||
public String writeParamsConfig(boolean usetmp){
|
||||
File paramsConfigFile = null;
|
||||
try {
|
||||
String paramID,
|
||||
containerFile,
|
||||
symbol,
|
||||
hashedString;
|
||||
String upperBound, lowerBound, step;
|
||||
String comments;
|
||||
String paramsConfigText = "";
|
||||
|
||||
ErrorHandler error = new ErrorHandler();
|
||||
ArrayList<String> paramTagList = new ArrayList<String>(); //Used for duplication checking
|
||||
|
||||
//Iterate through each param
|
||||
for(int i=0;i < listofParams.size();i++){
|
||||
error.checkReset(); //Reset the error statuses for a new param line
|
||||
|
||||
String paramConfigLine = listofParams.get(i).comments;
|
||||
|
||||
paramID = listofParams.get(i).paramID;
|
||||
paramTagList.add(paramID);
|
||||
|
||||
//Checks if paramID is valid or inputted
|
||||
if(paramID.matches("^[a-zA-Z0-9_]+$"))
|
||||
paramConfigLine += (paramID + " : "); //add to param Config line
|
||||
else if(paramID.isEmpty() || paramID.equals(""))
|
||||
error.paramIDMissing = true;
|
||||
else{
|
||||
System.out.println("Bad characters in Param ID"+ paramID);
|
||||
System.out.println(paramConfigLine);
|
||||
error.paramError = true;
|
||||
}
|
||||
String operator = listofParams.get(i).operator;
|
||||
paramConfigLine += operator + " : ";
|
||||
|
||||
|
||||
//FILEID CONFIG
|
||||
containerFile = String.join(";", listofParams.get(i).fileList);
|
||||
if(containerFile.length() == 0){
|
||||
System.out.println("Bad file for param ID "+ paramID);
|
||||
error.fileIDMissing = true;
|
||||
}
|
||||
paramConfigLine += containerFile+" : ";
|
||||
|
||||
if(operator.contains("REPLACE")){
|
||||
symbol = listofParams.get(i).symbol.trim();
|
||||
if(symbol.length() == 0){
|
||||
error.badSymbol = true;
|
||||
System.out.println("Bad symbol: "+symbol);
|
||||
}
|
||||
paramConfigLine += symbol;
|
||||
}
|
||||
if(operator.contains("RAND")){
|
||||
String upper = listofParams.get(i).upperBound.trim();
|
||||
String lower = listofParams.get(i).lowerBound.trim();
|
||||
String step_str = listofParams.get(i).step.trim();
|
||||
if(upper.length() == 0 || lower.length() == 0){
|
||||
error.badRange = true;
|
||||
System.out.println("Bad range for random values: "+lower+":"+upper);
|
||||
}
|
||||
if(step_str == "1"){
|
||||
paramConfigLine += " : "+lower+" : "+upper;
|
||||
}else{
|
||||
paramConfigLine += " : "+lower+" : "+upper+" : "+step_str;
|
||||
}
|
||||
}
|
||||
if(operator.contains("HASH")){
|
||||
paramConfigLine += " : "+listofParams.get(i).hashedString;
|
||||
}
|
||||
|
||||
//If there's no error, put the paramConfigLine in the paramsConfigText string,
|
||||
//Otherwise the overallPass of the user input is false
|
||||
if(error.userInputCheck(i+1)){
|
||||
if(i < listofParams.size()-1)
|
||||
paramConfigLine+= "\n";
|
||||
//Add the param config line to the Params Config text
|
||||
paramsConfigText += paramConfigLine;
|
||||
}
|
||||
else
|
||||
error.fail();
|
||||
} // end for each param
|
||||
|
||||
//Check for duplicate param IDs
|
||||
error.checkDuplicateParamID(paramTagList);
|
||||
/*
|
||||
for(String rt : paramID)
|
||||
System.out.println(rt);
|
||||
*/
|
||||
|
||||
if(error.passStatus()){
|
||||
//Resets the parameter.config file
|
||||
paramsConfigFile = initializeParamConfig(usetmp);
|
||||
|
||||
try ( //Write the paramConfigText to the params.config
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(paramsConfigFile, true))) {
|
||||
writer.write(paramsConfigText+"\n");
|
||||
writer.close();
|
||||
}
|
||||
/*
|
||||
if(usetmp){
|
||||
String new_file = paramsConfigFile.getAbsolutePath();
|
||||
String old_file = getParamFileName();
|
||||
boolean same = CompareTextFiles.compare(old_file, new_file);
|
||||
if(!same){
|
||||
retval = false;
|
||||
System.out.println("files differ");
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
JOptionPane.showMessageDialog(null, error.toString(), "INPUT ERROR", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
Logger.getLogger(ParamsUI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
if(paramsConfigFile != null){
|
||||
return paramsConfigFile.getAbsolutePath();
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private String getParamFileName(){
|
||||
String retval = mainUI.getCurrentLab() + File.separator + "config" + File.separator + "parameter.config";
|
||||
return retval;
|
||||
}
|
||||
//Checks if the parameter.config file exists and prepares the parameter.config file for the lab
|
||||
private File initializeParamConfig(boolean usetmp) throws IOException{
|
||||
//Get the filepath for the lab's parameter.config
|
||||
File paramsConfigFile=null;
|
||||
if(!usetmp){
|
||||
paramsConfigFile = new File(getParamFileName());
|
||||
}else{
|
||||
Path tempDir=null;
|
||||
try{
|
||||
tempDir = Files.createTempDirectory(mainUI.getLabName());
|
||||
}catch(IOException ex){
|
||||
System.out.println("failed creating temporary directory" + ex);
|
||||
System.exit(1);
|
||||
}
|
||||
String dir_s = tempDir.getFileName().toString();
|
||||
paramsConfigFile = new File(File.separator+"tmp"+File.separator+dir_s + File.separator + "parameter.config");
|
||||
}
|
||||
if(paramsConfigFile.exists()){
|
||||
//Overwrite parameter.config file if it already exists
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(paramsConfigFile, false))) {
|
||||
// writer.write(baseText);
|
||||
}
|
||||
return paramsConfigFile;
|
||||
}
|
||||
else if(paramsConfigFile.createNewFile()){
|
||||
//Create new parameter.config file otherwise(if it does not already exist)
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(paramsConfigFile))) {
|
||||
//writer.write(baseText);
|
||||
}
|
||||
return paramsConfigFile;
|
||||
}
|
||||
else{ //File could not be created so return error message
|
||||
System.out.println("Parameter Config File couldn't be initialzed.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Handles all the error data and error checking before writing the parameter.config
|
||||
private class ErrorHandler{
|
||||
private boolean overallPass;
|
||||
private String errorMsg;
|
||||
private boolean
|
||||
paramError,
|
||||
fileError,
|
||||
|
||||
paramIDMissing,
|
||||
fileIDMissing,
|
||||
badRange,
|
||||
badSymbol;
|
||||
|
||||
|
||||
ErrorHandler(){
|
||||
overallPass = true;
|
||||
errorMsg = "";
|
||||
checkReset();
|
||||
}
|
||||
|
||||
void fail(){
|
||||
overallPass = false;
|
||||
}
|
||||
|
||||
//Resets the error status(used right before looking at new param line)
|
||||
private void checkReset(){
|
||||
paramError = false;
|
||||
fileError = false;
|
||||
|
||||
paramIDMissing = false;
|
||||
fileIDMissing = false;
|
||||
badRange = false;
|
||||
badSymbol = false;
|
||||
|
||||
}
|
||||
|
||||
//Builds error message detailing the errors that appear in the user input
|
||||
boolean userInputCheck(int paramIndex){
|
||||
boolean rowPassed = true;
|
||||
String infoMsg = "Parameter Line: " + paramIndex + System.lineSeparator();
|
||||
|
||||
if(paramIDMissing){
|
||||
rowPassed = false;
|
||||
infoMsg+= "-Param ID input is missing." + System.lineSeparator();
|
||||
}
|
||||
if(fileIDMissing){
|
||||
rowPassed = false;
|
||||
infoMsg+= "-File ID input is missing." + System.lineSeparator();
|
||||
}
|
||||
if(paramError){
|
||||
rowPassed = false;
|
||||
infoMsg+= "-Make sure your Param ID has only alphanumeric characters or underscores." + System.lineSeparator();
|
||||
}
|
||||
if(badRange){
|
||||
rowPassed = false;
|
||||
infoMsg+= "-Make sure your random range values are set." + System.lineSeparator();
|
||||
}
|
||||
if(badSymbol){
|
||||
rowPassed = false;
|
||||
infoMsg+= "-Make sure your symbol to be replaced is set." + System.lineSeparator();
|
||||
}
|
||||
//if(fileError){
|
||||
// rowPassed = false;
|
||||
// infoMsg+= "-Make sure your File ID file's extentsion ends in \".stdin\", \".stdout\", or \".prgout\"." + System.lineSeparator() + " Or is a file path." + System.lineSeparator();
|
||||
//}
|
||||
|
||||
|
||||
if(!rowPassed)
|
||||
errorMsg += (infoMsg + System.lineSeparator());
|
||||
|
||||
return rowPassed;
|
||||
}
|
||||
|
||||
//Check for duplicate param ID
|
||||
void checkDuplicateParamID(ArrayList<String> paramIDs){
|
||||
ArrayList<ParamIDIndices> markedParamIDs = new ArrayList<ParamIDIndices>();
|
||||
|
||||
//Store all the indices for each unique param ID
|
||||
for(int i=0;i<paramIDs.size();i++){
|
||||
String paramID = paramIDs.get(i);
|
||||
//Is the paramID a duplicate?
|
||||
//If so, add the the index number of the duplicate param ID to the corresponding param ID's list of indices
|
||||
if(isDuplicate(markedParamIDs, paramID)){
|
||||
getDuplicate(markedParamIDs, paramID).addIndex(i);
|
||||
}
|
||||
//If not, add it to the markedParamIDs fresh
|
||||
else
|
||||
markedParamIDs.add(new ParamIDIndices(paramID, i));
|
||||
}
|
||||
|
||||
//Go through every param ID and see if any of them have more than 1 index, if they do then create a custom error message for the duplicate param ID
|
||||
String duplicateErrorMsg = "";
|
||||
for(ParamIDIndices rt : markedParamIDs){
|
||||
if(rt.indices.size() > 1){
|
||||
duplicateErrorMsg+= "Duplicate Param ID: \"" + rt.paramID + "\" on rows ";
|
||||
|
||||
for(int i=0;i<rt.indices.size();i++){
|
||||
duplicateErrorMsg+=(rt.indices.get(i)+1); //The plus 1 offset to get the 1-based row num
|
||||
|
||||
if(rt.indices.size() == 2 && i == 0)
|
||||
duplicateErrorMsg+=" and ";
|
||||
else if(i == rt.indices.size()-1)
|
||||
duplicateErrorMsg+=".";
|
||||
else{
|
||||
duplicateErrorMsg+=", ";
|
||||
if(i == rt.indices.size()-2)
|
||||
duplicateErrorMsg+="and ";
|
||||
}
|
||||
}
|
||||
duplicateErrorMsg+=System.lineSeparator();
|
||||
overallPass = false;
|
||||
}
|
||||
}
|
||||
errorMsg+=duplicateErrorMsg;
|
||||
|
||||
}
|
||||
|
||||
//Stores a param ID's name and the row index they appear on
|
||||
class ParamIDIndices{
|
||||
protected String paramID;
|
||||
protected ArrayList<Integer> indices;
|
||||
|
||||
ParamIDIndices(String paramID, int index){
|
||||
this.paramID = paramID;
|
||||
indices = new ArrayList<Integer>();
|
||||
indices.add(index);
|
||||
}
|
||||
|
||||
void addIndex(int index){
|
||||
indices.add(index);
|
||||
}
|
||||
}
|
||||
|
||||
//Is the param ID already in the duplicate list?
|
||||
boolean isDuplicate(ArrayList<ParamIDIndices> markedParamIDs, String paramID){
|
||||
for(ParamIDIndices rtIndices : markedParamIDs){
|
||||
if(rtIndices.paramID.equals(paramID))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Get the duplicate object based on the duplicate string
|
||||
ParamIDIndices getDuplicate(ArrayList<ParamIDIndices> markedParamIDs, String paramID){
|
||||
for(ParamIDIndices rtIndices : markedParamIDs){
|
||||
if(rtIndices.paramID.equals(paramID))
|
||||
return rtIndices;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
boolean passStatus(){
|
||||
return overallPass;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//GENERAL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//Gets the param lines in the parameter.config
|
||||
protected ArrayList<String> getParamLines(){
|
||||
ArrayList<String> params = new ArrayList<String>();
|
||||
|
||||
try {
|
||||
File paramsConfig = new File(mainUI.getCurrentLab()+File.separator+"config"+File.separator+"parameter.config");
|
||||
|
||||
//Get the param lines
|
||||
if(paramsConfig.exists()){
|
||||
try (FileReader fileReader = new FileReader(paramsConfig)) {
|
||||
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||
String line = bufferedReader.readLine().trim();
|
||||
String param_line = "";
|
||||
while (line != null) {
|
||||
param_line = param_line + line;
|
||||
//if(!line.isEmpty() && line.charAt(0) != '#' && !Character.isWhitespace(line.charAt(0))){
|
||||
if(line.length() > 0 && line.charAt(0) != '#'){
|
||||
params.add(param_line);
|
||||
param_line = "";
|
||||
}else{
|
||||
param_line=param_line+"\n";
|
||||
}
|
||||
line = bufferedReader.readLine();
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
else{
|
||||
System.out.println("No parameter.config file in the loaded lab!");
|
||||
//Create the missing parameter.config file
|
||||
paramsConfig.createNewFile();
|
||||
return params;
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println("Issue with getting parameter.config params");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Updates the list of params
|
||||
protected void updateListofParams(JPanel PanelofParams){
|
||||
Component[] params = PanelofParams.getComponents(); //Access the list of params
|
||||
|
||||
List<ParamValues> listofParamsTMP = new ArrayList<ParamValues>();
|
||||
|
||||
//Iterate through each param and add it to the temp list of param values
|
||||
for (Component param : params) {
|
||||
//RESULTS TAG
|
||||
String paramID = ((ParamPanels) param).getParamIDTextField().getText();
|
||||
String file = ((ParamPanels) param).getFileTextField().getText();
|
||||
ArrayList<String> fileList = new ArrayList<String>();
|
||||
String [] farray = file.split(";");
|
||||
for(String f : farray){
|
||||
fileList.add(f);
|
||||
}
|
||||
//String container = (String) (((ParamPanels) param).getContainerComboBox().getSelectedItem());
|
||||
ToolTipHandlers.ToolTipWrapper operatorTT = (ToolTipHandlers.ToolTipWrapper) (((ParamPanels) param).getOperatorComboBox().getSelectedItem());
|
||||
String operator = operatorTT.getItem();
|
||||
String symbol = ((ParamPanels) param).getSymbolTextField().getText();
|
||||
String hashedString = ((ParamPanels) param).getHashedStringTextField().getText();
|
||||
String lowerBound = ((ParamPanels) param).getLowerBoundTextField().getText();
|
||||
String upperBound = ((ParamPanels) param).getUpperBoundTextField().getText();
|
||||
String step = ((ParamPanels) param).getStepTextField().getText();
|
||||
String comments = ((ParamPanels) param).getComments();
|
||||
|
||||
listofParamsTMP.add(new ParamValues(paramID, fileList, operator, symbol, hashedString, lowerBound, upperBound, step, comments));
|
||||
}
|
||||
|
||||
listofParams = listofParamsTMP; //overwrite the old listofParams with the temp listofParams
|
||||
}
|
||||
|
||||
//Swaps the position of params in a list
|
||||
protected void swapParams(String type, int rowIndex){
|
||||
|
||||
switch(type){
|
||||
case "UP":
|
||||
if(rowIndex > 0){
|
||||
//System.out.println("UP: "+listofParams.get(rowIndex).paramID+" Index: "+rowIndex);
|
||||
Collections.swap(listofParams, rowIndex, rowIndex-1);
|
||||
}
|
||||
break;
|
||||
case "DOWN":
|
||||
//System.out.println(rowCount);
|
||||
//System.out.println("RowINdex: " + rowIndex + " RowCount-1: "+ (rowCount-1));
|
||||
if(rowIndex < rowCount-1){
|
||||
//System.out.println("DOWN: "+listofParams.get(rowIndex).paramID);
|
||||
Collections.swap(listofParams, rowIndex, rowIndex+1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
System.out.println("swap case no register");
|
||||
}
|
||||
}
|
||||
|
||||
//Gets a list of ParamValues from the the current state of the parameter.config file
|
||||
protected List<ParamValues> getParamValuesOfConfigFile(){
|
||||
List<ParamValues> officialListofParams = new ArrayList<ParamValues>();
|
||||
|
||||
ArrayList<String> paramLines = getParamLines();
|
||||
|
||||
if(paramLines != null){
|
||||
|
||||
for(String paramLine : paramLines){
|
||||
ParamValues pv = new ParamValues(paramLine);
|
||||
try{
|
||||
pv.load();
|
||||
officialListofParams.add(pv);
|
||||
}catch(java.lang.ArrayIndexOutOfBoundsException exa){
|
||||
System.out.println("ERROR: "+exa);
|
||||
System.out.println("Error getParamValuesOfConfigFile parsing parameter line: "+paramLine+"\n");
|
||||
mainUI.output("Error parsing parameter line: "+paramLine+"\n");
|
||||
mainUI.output(exa.toString());
|
||||
}
|
||||
}
|
||||
return officialListofParams;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Param Value objects that reference the old Container to the new Container name
|
||||
// TBD fix this
|
||||
public void refactorContainerReference(String oldContainer, String newContainer){
|
||||
//Updates the listOfValues to reflect a change of a conainer name to a new name
|
||||
for(ParamValues param : listofParams){
|
||||
//System.out.println(param.container + " " + oldContainer);
|
||||
//if(param.container.equals(oldContainer)){
|
||||
// param.container = newContainer;
|
||||
// System.out.println(param.container);
|
||||
//}
|
||||
}
|
||||
|
||||
//Update the container list with the renamed container
|
||||
ArrayList<String> tmp = new ArrayList<String>();
|
||||
for(String container : containerList){
|
||||
if(container.equals(oldContainer))
|
||||
tmp.add(newContainer);
|
||||
else
|
||||
tmp.add(container);
|
||||
}
|
||||
containerList = tmp;
|
||||
}
|
||||
|
||||
//Updates container list and removes Param Value objects that reference the container
|
||||
public void removeContainerReference(String container){
|
||||
// Deletes all param lines that include the container
|
||||
// TBD fix this
|
||||
ArrayList<ParamValues> toRemove = new ArrayList<ParamValues>();
|
||||
for(ParamValues param : listofParams){
|
||||
//if(param.container.equals(container))
|
||||
// toRemove.add(param);
|
||||
}
|
||||
listofParams.removeAll(toRemove);
|
||||
|
||||
//Update delete the container in the container list
|
||||
containerList.remove(container);
|
||||
}
|
||||
|
||||
|
||||
//GETTERS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
protected List<ParamValues> getListofParams(){
|
||||
return listofParams;
|
||||
}
|
||||
|
||||
protected ArrayList<String> getContainerList(){
|
||||
return containerList;
|
||||
}
|
||||
|
||||
protected int getRowCount(){
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
protected MainWindow getMainWindow(){
|
||||
return mainUI;
|
||||
}
|
||||
public ArrayList<String> getParamNames(){
|
||||
ArrayList<String> paramTagList = new ArrayList<String>(); //Used for duplication checking
|
||||
|
||||
for(int i=0;i < listofParams.size();i++){
|
||||
String paramID = listofParams.get(i).paramID;
|
||||
paramTagList.add(paramID);
|
||||
}
|
||||
return paramTagList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="title" type="java.lang.String" value="Results Configuration"/>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1590, 500]"/>
|
||||
</Property>
|
||||
<Property name="resizable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<Events>
|
||||
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosing"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="12" max="32767" attributes="0"/>
|
||||
<Component id="ScrollPaneOfParams" min="-2" pref="1566" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="CreateButton" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="RemoveAllButton" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="91" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="104" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="542" max="-2" attributes="0"/>
|
||||
<Component id="UpdateButton" min="-2" pref="113" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="CreateButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="RemoveAllButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ScrollPaneOfParams" min="-2" pref="397" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="UpdateButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="39" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="ScrollPaneOfParams">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="PanelofParams">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="CreateButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Create"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CreateButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="RemoveAllButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Remove All"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="RemoveAllButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="UpdateButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="OK"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="UpdateButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Operator"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="File should either be a file path or a program/utility name with the ".stdin", ".stdout", or ".prgout" extension.

 Ex. "test.stdin", ".local/result/sniff.txt" "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Param ID"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="The symbolic name of the result, which will be referenced in the goals configuration file. 

(It must be alphanumeric, underscores permitted) "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="CancelButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,377 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.paramsui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollBar;
|
||||
import labtainers.mainui.MainWindow;
|
||||
import labtainers.goalsui.GoalsData;
|
||||
import labtainers.goalsui.GoalsUI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ParamsUI extends javax.swing.JFrame {
|
||||
|
||||
/**
|
||||
* Creates new form NewJDialog
|
||||
*/
|
||||
ParamsData data;
|
||||
ParamsData saved;
|
||||
MainWindow mainUI;
|
||||
|
||||
public ParamsUI(java.awt.Frame parent, boolean modal) {
|
||||
//super(parent);
|
||||
initComponents();
|
||||
this.setVisible(true);
|
||||
paramsScrollPaneBar = ScrollPaneOfParams.getVerticalScrollBar();
|
||||
|
||||
this.mainUI = (MainWindow)parent;
|
||||
this.data = new ParamsData(this.mainUI.getCurrentData().getParamsData());
|
||||
this.saved = new ParamsData(this.data);
|
||||
|
||||
loadUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
ScrollPaneOfParams = new javax.swing.JScrollPane();
|
||||
PanelofParams = new javax.swing.JPanel();
|
||||
CreateButton = new javax.swing.JButton();
|
||||
RemoveAllButton = new javax.swing.JButton();
|
||||
UpdateButton = new javax.swing.JButton();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
CancelButton = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("Results Configuration");
|
||||
setMinimumSize(new java.awt.Dimension(1590, 500));
|
||||
setResizable(false);
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
public void windowClosing(java.awt.event.WindowEvent evt) {
|
||||
formWindowClosing(evt);
|
||||
}
|
||||
});
|
||||
|
||||
PanelofParams.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
||||
ScrollPaneOfParams.setViewportView(PanelofParams);
|
||||
|
||||
CreateButton.setText("Create");
|
||||
CreateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CreateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
RemoveAllButton.setText("Remove All");
|
||||
RemoveAllButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
RemoveAllButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
UpdateButton.setText("OK");
|
||||
UpdateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
UpdateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel5.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel5.setText("Operator");
|
||||
jLabel5.setToolTipText("File should either be a file path or a program/utility name with the \".stdin\", \".stdout\", or \".prgout\" extension.\n\n Ex. \"test.stdin\", \".local/result/sniff.txt\" ");
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel1.setText("Param ID");
|
||||
jLabel1.setToolTipText("The symbolic name of the result, which will be referenced in the goals configuration file. \n\n(It must be alphanumeric, underscores permitted) ");
|
||||
|
||||
CancelButton.setText("Cancel");
|
||||
CancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 12, Short.MAX_VALUE)
|
||||
.addComponent(ScrollPaneOfParams, javax.swing.GroupLayout.PREFERRED_SIZE, 1566, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(CreateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(RemoveAllButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(91, 91, 91)
|
||||
.addComponent(jLabel1)
|
||||
.addGap(104, 104, 104)
|
||||
.addComponent(jLabel5)))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(542, 542, 542)
|
||||
.addComponent(UpdateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(CancelButton)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(CreateButton)
|
||||
.addComponent(RemoveAllButton))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jLabel5))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(ScrollPaneOfParams, javax.swing.GroupLayout.PREFERRED_SIZE, 397, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(UpdateButton)
|
||||
.addComponent(CancelButton))
|
||||
.addContainerGap(39, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed
|
||||
createButton();
|
||||
}//GEN-LAST:event_CreateButtonActionPerformed
|
||||
|
||||
private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed
|
||||
removeAllButton();
|
||||
}//GEN-LAST:event_RemoveAllButtonActionPerformed
|
||||
|
||||
private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed
|
||||
updateButton();
|
||||
}//GEN-LAST:event_UpdateButtonActionPerformed
|
||||
|
||||
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
|
||||
mainUI.setParamsClosed();
|
||||
}//GEN-LAST:event_formWindowClosing
|
||||
|
||||
private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed
|
||||
mainUI.setParamsClosed();
|
||||
setVisible(false);
|
||||
dispose();
|
||||
}//GEN-LAST:event_CancelButtonActionPerformed
|
||||
|
||||
// BUTTONS //
|
||||
|
||||
// Adds a new param panel
|
||||
private void createButton(){
|
||||
addParamsPanel(new ParamPanels(this, data.rowCount+1));
|
||||
paramsScrollPaneBar.setValue(paramsScrollPaneBar.getMaximum());
|
||||
}
|
||||
|
||||
// Updates the param data object basd on the current param configuration UI state
|
||||
private void updateButton(){
|
||||
System.out.println("Update button");
|
||||
data.updateListofParams(PanelofParams);
|
||||
if(data.writeParamsConfig(true) != null){
|
||||
saved = new ParamsData(data);
|
||||
this.mainUI.getCurrentData().setParamsData(saved);
|
||||
this.mainUI.updateParameters();
|
||||
}
|
||||
mainUI.setParamsClosed();
|
||||
setVisible(false);
|
||||
dispose();
|
||||
}
|
||||
|
||||
// Removes all the param panels
|
||||
private void removeAllButton(){
|
||||
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){
|
||||
removeAllParams();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CORE FUNCTIONS//
|
||||
|
||||
// Adds param panel
|
||||
public int paramsPanePanelLength = 0;
|
||||
private JScrollBar paramsScrollPaneBar;
|
||||
private void addParamsPanel(ParamPanels panel){
|
||||
//Resize the JPanel Holding all the ParamsPanels to fit another one (makes the scroll bar resize and should show all objects listed)
|
||||
paramsPanePanelLength+=panel.getPreferredSize().height+5;
|
||||
PanelofParams.setPreferredSize(new Dimension(0,paramsPanePanelLength));
|
||||
|
||||
// Create the Param Panel and add it
|
||||
data.rowCount++;
|
||||
PanelofParams.add(panel); //takes in parent(this), containerlist, rowcount
|
||||
|
||||
// Redraw GUI with the new Panel
|
||||
PanelofParams.revalidate();
|
||||
PanelofParams.repaint();
|
||||
}
|
||||
|
||||
// Removes all the param lines for the lab *note: this doesn't update parameter.config or the paramsData until the user hits the update button
|
||||
private void removeAllParams(){
|
||||
data.rowCount = 0;
|
||||
paramsPanePanelLength = 0;
|
||||
PanelofParams.setPreferredSize(new Dimension(0,paramsPanePanelLength));
|
||||
Component[] componentList = PanelofParams.getComponents();
|
||||
for(Component c: componentList){
|
||||
PanelofParams.remove(c);
|
||||
}
|
||||
|
||||
PanelofParams.revalidate();
|
||||
PanelofParams.repaint();
|
||||
}
|
||||
|
||||
// loads the param panels based on the current data
|
||||
protected void loadUI(){
|
||||
removeAllParams();
|
||||
//redraw the param
|
||||
for(int i=0; i < data.listofParams.size(); i++)
|
||||
loadParam(data.listofParams.get(i), i+1);
|
||||
}
|
||||
|
||||
// Load the param panel into GUI
|
||||
private void loadParam(ParamValues paramVal, int rowNum){
|
||||
ParamPanels newParam = new ParamPanels(this, rowNum,
|
||||
paramVal.paramID,
|
||||
paramVal.fileList,
|
||||
paramVal.operator,
|
||||
paramVal.symbol,
|
||||
paramVal.hashedString,
|
||||
paramVal.upperBound,
|
||||
paramVal.lowerBound,
|
||||
paramVal.step,
|
||||
paramVal.comments);
|
||||
addParamsPanel(newParam);
|
||||
}
|
||||
|
||||
//Updates the list of params and redraws them on screen
|
||||
public void refresh(){
|
||||
data.updateListofParams(PanelofParams);
|
||||
loadUI();
|
||||
}
|
||||
|
||||
|
||||
// OTHER //
|
||||
|
||||
public void refactorContainerReferenceInUI(String oldName, String newName){
|
||||
data.updateListofParams(PanelofParams);
|
||||
data.refactorContainerReference(oldName, newName);
|
||||
saved.refactorContainerReference(oldName, newName);
|
||||
loadUI();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// GETTERS //
|
||||
|
||||
//Gets the panel holding the params
|
||||
protected JPanel getPanelofParams(){
|
||||
return PanelofParams;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(ParamsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(ParamsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(ParamsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(ParamsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the dialog */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ParamsUI dialog = new ParamsUI(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton CancelButton;
|
||||
private javax.swing.JButton CreateButton;
|
||||
private javax.swing.JPanel PanelofParams;
|
||||
private javax.swing.JButton RemoveAllButton;
|
||||
private javax.swing.JScrollPane ScrollPaneOfParams;
|
||||
private javax.swing.JButton UpdateButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -2,8 +2,20 @@
|
||||
|
||||
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1560, 86]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1560, 86]"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="" noResource="true"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1110, 69]"/>
|
||||
<Dimension value="[1580, 86]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
@@ -23,107 +35,157 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="rowLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="ArtifactPanel" min="-2" pref="1390" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="UpButton" max="32767" attributes="0"/>
|
||||
<Component id="DownButton" max="32767" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
<Component id="ArtifactPanel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="DownButton" min="-2" pref="33" max="-2" attributes="0"/>
|
||||
<Component id="UpButton" alignment="1" min="-2" pref="33" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="DeleteButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="DocButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="ArtifactPanel" min="-2" pref="69" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="rowLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="UpButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="DownButton" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="ArtifactPanel" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="UpButton" min="-2" pref="31" max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="DownButton" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="DocButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="DeleteButton" min="-2" pref="58" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu" size="48" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="10"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="UpButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu Condensed" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="^"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[19, 50]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[19, 31]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[19, 31]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="UpButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="DownButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Ubuntu Condensed" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="v"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DownButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="ArtifactPanel">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||
<EmptyBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1400, 0]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1300, 34]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="TagTextField" min="-2" pref="125" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ContainerComboBox" min="-2" pref="116" max="-2" attributes="0"/>
|
||||
<EmptySpace min="6" pref="6" max="-2" attributes="0"/>
|
||||
<Component id="FileTextField" min="-2" pref="150" max="-2" attributes="0"/>
|
||||
<Component id="TagTextField" min="-2" pref="138" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ContainerComboBox" min="-2" pref="134" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="FileTextField" min="-2" pref="138" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="FieldTypeComboBox" min="-2" pref="160" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="FieldIDTextField" min="-2" pref="188" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
|
||||
<Component id="FieldIDTextField" min="-2" pref="146" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="LineTypeComboBox" min="-2" pref="165" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="LineIDTextField" min="-2" pref="135" max="-2" attributes="0"/>
|
||||
<Component id="LineIDTextField" min="-2" pref="142" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="TimeStampComboBox" min="-2" pref="137" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="TimeDelimiterTextField" min="-2" pref="125" max="-2" attributes="0"/>
|
||||
<Component id="TimeStampComboBox" min="-2" pref="143" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="TimeDelimiterTextField" min="-2" pref="124" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="TimeDelimiterTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="TimeStampComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="LineIDTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="LineTypeComboBox" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="FieldIDTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="TagTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="ContainerComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="FileTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="FieldTypeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="FileTextField" alignment="3" min="-2" pref="40" max="-2" attributes="0"/>
|
||||
<Component id="FieldTypeComboBox" alignment="3" min="-2" pref="40" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" max="-2" attributes="0">
|
||||
<Component id="LineTypeComboBox" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="LineIDTextField" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="TimeStampComboBox" linkSize="2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="FieldIDTextField" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="TimeDelimiterTextField" linkSize="2" alignment="3" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="TagTextField" alignment="3" min="-2" pref="40" max="-2" attributes="0"/>
|
||||
<Component id="ContainerComboBox" alignment="3" min="-2" pref="40" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="12" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -156,12 +218,25 @@
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<ToolTipWrapper>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="FieldIDTextField">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Field ID">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="LineTypeComboBox">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Identifies how the line is to be identified"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Identifies how the line is to be located."/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Line Type">
|
||||
@@ -179,19 +254,6 @@
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<ToolTipWrapper>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="FieldIDTextField">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Field ID">
|
||||
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="LineIDTextField">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Parameter based on Line Type"/>
|
||||
@@ -211,6 +273,7 @@
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="<html>Source of time stamps, e.g., from the file<br>or from log entries</html>"/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Timestamp Type">
|
||||
@@ -247,36 +310,12 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="DeleteButton">
|
||||
<Component class="javax.swing.JButton" name="DocButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
<Property name="text" type="java.lang.String" value="Doc"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DeleteButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="rowLabel">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="24" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="10"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="UpButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="^"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="UpButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="DownButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="v"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DownButtonActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DocButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
@@ -1,31 +1,58 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package ResultsUI;
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.resultsui;
|
||||
|
||||
import static ResultsUI.ParamReferenceStorage.FieldType_ITEMS;
|
||||
import static ResultsUI.ParamReferenceStorage.LOG_ACCESIBLE_FieldType;
|
||||
import static ResultsUI.ParamReferenceStorage.LOG_TS_ACCESSIBLE_LineType;
|
||||
import static ResultsUI.ParamReferenceStorage.LineType_ITEMS;
|
||||
import static ResultsUI.ParamReferenceStorage.SpecialTimeStampType;
|
||||
import static ResultsUI.ParamReferenceStorage.TimestampType_ITEMS;
|
||||
import static ResultsUI.ParamReferenceStorage.justFieldType;
|
||||
import static ResultsUI.ParamReferenceStorage.lineParamAccessible;
|
||||
import static ResultsUI.ParamReferenceStorage.timeStampDelimiterAccessible;
|
||||
import ResultsUI.ToolTipHandlers.ToolTipWrapper;
|
||||
import static ResultsUI.ToolTipHandlers.setComboItems;
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JDialog;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.FieldType_ITEMS;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.LOG_ACCESIBLE_FieldType;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.LOG_TS_ACCESSIBLE_LineType;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.LineType_ITEMS;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.SpecialTimeStampType;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.TimestampType_ITEMS;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.justFieldType;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.lineParamAccessible;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.timeStampDelimiterAccessible;
|
||||
import labtainers.mainui.ToolTipHandlers.ToolTipWrapper;
|
||||
import labtainers.mainui.ToolTipHandlers.ToolTipWrapper;
|
||||
import labtainers.goalsui.DocPanel;
|
||||
import static labtainers.mainui.ToolTipHandlers.setComboItems;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dan
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ArtifactPanels extends javax.swing.JPanel {
|
||||
|
||||
@@ -33,37 +60,46 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
ResultsUI uiResult;
|
||||
ResultsData dataUI;
|
||||
int rowNum;
|
||||
|
||||
String comments="";
|
||||
|
||||
/**
|
||||
* Creates new form ArtifactsPanel
|
||||
*/
|
||||
//Creating fresh artifact line
|
||||
public ArtifactPanels(ResultsUI ui, ArrayList<String> containers, int rowNum) {
|
||||
initComponents();
|
||||
this.uiResult = ui;
|
||||
this.dataUI = ui.dataUI;
|
||||
this.dataUI = ui.data;
|
||||
this.rowNum = rowNum;
|
||||
rowLabel.setText(Integer.toString(rowNum));
|
||||
|
||||
jLabel3.setText(Integer.toString(rowNum));
|
||||
TimeDelimiterTextField.setVisible(false);
|
||||
|
||||
//Load ComboBox Items
|
||||
if(containers.size() > 1 && !containers.contains("ALL"))
|
||||
containers.add(0, "ALL");
|
||||
ContainerComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(containers.toArray(new String[containers.size()])));
|
||||
setComboItems(FieldTypeComboBox, FieldType_ITEMS);
|
||||
setComboItems(LineTypeComboBox, LineType_ITEMS);
|
||||
setComboItems(TimeStampComboBox, TimestampType_ITEMS);
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
|
||||
//Loading artifact line
|
||||
public ArtifactPanels(ResultsUI ui, ArrayList<String> containers, int rowNum, String resultTag, String container, String fileID, ToolTipWrapper fieldType, String fieldID, ToolTipWrapper lineType, String lineID, ToolTipWrapper timeStampType, String timeStampDelimiter) {
|
||||
public ArtifactPanels(ResultsUI ui, ArrayList<String> containers, int rowNum, String resultTag, String container, String fileID, ToolTipWrapper fieldType, String fieldID, ToolTipWrapper lineType, String lineID, ToolTipWrapper timeStampType, String timeStampDelimiter, String comments) {
|
||||
initComponents();
|
||||
this.uiResult = ui;
|
||||
this.dataUI = ui.dataUI;
|
||||
this.dataUI = ui.data;
|
||||
this.rowNum = rowNum;
|
||||
rowLabel.setText(Integer.toString(rowNum));
|
||||
this.comments = comments;
|
||||
jLabel3.setText(Integer.toString(rowNum));
|
||||
if(!timeStampDelimiterAccessible.contains(timeStampType.getItem()))
|
||||
TimeDelimiterTextField.setVisible(false);
|
||||
|
||||
//Load ComboBox Items
|
||||
if(containers.size() > 1 && !containers.contains("ALL"))
|
||||
containers.add(0, "ALL");
|
||||
else if(containers.size() == 2 && containers.contains("ALL"))
|
||||
containers.remove("ALL");
|
||||
ContainerComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(containers.toArray(new String[containers.size()])));
|
||||
setComboItems(FieldTypeComboBox, FieldType_ITEMS);
|
||||
setComboItems(LineTypeComboBox, LineType_ITEMS);
|
||||
@@ -79,7 +115,7 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
setLineTypeComboBox(lineType);
|
||||
setTimeStampComboBox(timeStampType);
|
||||
setTimeDelimiterTextField(timeStampDelimiter);
|
||||
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
@@ -93,26 +129,59 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
UpButton = new javax.swing.JButton();
|
||||
DownButton = new javax.swing.JButton();
|
||||
ArtifactPanel = new javax.swing.JPanel();
|
||||
TagTextField = new javax.swing.JTextField();
|
||||
ContainerComboBox = new javax.swing.JComboBox<>();
|
||||
FileTextField = new javax.swing.JTextField();
|
||||
FieldTypeComboBox = new javax.swing.JComboBox<>();
|
||||
LineTypeComboBox = new javax.swing.JComboBox<>();
|
||||
FieldIDTextField = new javax.swing.JTextField();
|
||||
LineTypeComboBox = new javax.swing.JComboBox<>();
|
||||
LineIDTextField = new javax.swing.JTextField();
|
||||
TimeStampComboBox = new javax.swing.JComboBox<>();
|
||||
TimeDelimiterTextField = new javax.swing.JTextField();
|
||||
DeleteButton = new javax.swing.JButton();
|
||||
rowLabel = new javax.swing.JLabel();
|
||||
UpButton = new javax.swing.JButton();
|
||||
DownButton = new javax.swing.JButton();
|
||||
DocButton = new javax.swing.JButton();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(1110, 69));
|
||||
setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
setMaximumSize(new java.awt.Dimension(1560, 86));
|
||||
setMinimumSize(new java.awt.Dimension(1560, 86));
|
||||
setName(""); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(1580, 86));
|
||||
|
||||
ArtifactPanel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
ArtifactPanel.setMinimumSize(new java.awt.Dimension(1400, 0));
|
||||
ArtifactPanel.setPreferredSize(new java.awt.Dimension(1300, 34));
|
||||
jLabel3.setFont(new java.awt.Font("Ubuntu", 1, 48)); // NOI18N
|
||||
jLabel3.setText("10");
|
||||
|
||||
jButton1.setText("Delete");
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
UpButton.setFont(new java.awt.Font("Ubuntu Condensed", 0, 12)); // NOI18N
|
||||
UpButton.setText("^");
|
||||
UpButton.setMaximumSize(new java.awt.Dimension(19, 50));
|
||||
UpButton.setMinimumSize(new java.awt.Dimension(19, 31));
|
||||
UpButton.setPreferredSize(new java.awt.Dimension(19, 31));
|
||||
UpButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
UpButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
DownButton.setFont(new java.awt.Font("Ubuntu Condensed", 0, 12)); // NOI18N
|
||||
DownButton.setText("v");
|
||||
DownButton.setToolTipText("");
|
||||
DownButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
DownButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
ArtifactPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
||||
FieldTypeComboBox.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
@@ -120,7 +189,9 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
LineTypeComboBox.setToolTipText("Identifies how the line is to be identified");
|
||||
FieldIDTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Field ID"));
|
||||
|
||||
LineTypeComboBox.setToolTipText("Identifies how the line is to be located.");
|
||||
LineTypeComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Line Type"));
|
||||
LineTypeComboBox.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
@@ -128,11 +199,10 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
FieldIDTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Field ID"));
|
||||
|
||||
LineIDTextField.setToolTipText("Parameter based on Line Type");
|
||||
LineIDTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Line ID"));
|
||||
|
||||
TimeStampComboBox.setToolTipText("<html>Source of time stamps, e.g., from the file<br>or from log entries</html>");
|
||||
TimeStampComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Timestamp Type"));
|
||||
TimeStampComboBox.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
@@ -150,70 +220,48 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(ArtifactPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(TagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(TagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(ContainerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(FileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(ContainerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(FileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(FieldTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(FieldIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(14, 14, 14)
|
||||
.addComponent(FieldIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(LineTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(LineIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(LineIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(TimeStampComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(TimeDelimiterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(TimeStampComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(TimeDelimiterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
ArtifactPanelLayout.setVerticalGroup(
|
||||
ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(TimeDelimiterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(TimeStampComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(LineIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(LineTypeComboBox)
|
||||
.addComponent(FieldIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(ArtifactPanelLayout.createSequentialGroup()
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(ArtifactPanelLayout.createSequentialGroup()
|
||||
.addGap(12, 12, 12)
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(TagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(ContainerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(FileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(FieldTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(ArtifactPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE, false)
|
||||
.addComponent(LineTypeComboBox)
|
||||
.addComponent(LineIDTextField)
|
||||
.addComponent(TimeStampComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(FieldIDTextField)
|
||||
.addComponent(TimeDelimiterTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
.addContainerGap(12, Short.MAX_VALUE))
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(FileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(FieldTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(TagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(ContainerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {TimeDelimiterTextField, TimeStampComboBox});
|
||||
|
||||
DeleteButton.setText("Delete");
|
||||
DeleteButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
DocButton.setText("Doc");
|
||||
DocButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
DeleteButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
rowLabel.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N
|
||||
rowLabel.setText("10");
|
||||
|
||||
UpButton.setText("^");
|
||||
UpButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
UpButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
DownButton.setText("v");
|
||||
DownButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
DownButtonActionPerformed(evt);
|
||||
DocButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -223,61 +271,107 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(rowLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 1390, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel3)
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(DownButton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(UpButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(UpButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(DownButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(DeleteButton)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jButton1)
|
||||
.addComponent(DocButton))
|
||||
.addGap(23, 23, 23))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(rowLabel)
|
||||
.addGap(19, 19, 19))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(UpButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(DownButton))
|
||||
.addComponent(DeleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel3)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(6, 6, 6)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(UpButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jButton1))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(DownButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(DocButton))))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed
|
||||
JPanel container = (JPanel)this.getParent();
|
||||
container.remove(this);
|
||||
uiResult.dataUI.rowCount--;
|
||||
uiResult.refresh();
|
||||
}//GEN-LAST:event_DeleteButtonActionPerformed
|
||||
private void UpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpButtonActionPerformed
|
||||
swapUpdate("UP", rowNum-1); //Subtract rowNum by one to get the proper index number
|
||||
}//GEN-LAST:event_UpButtonActionPerformed
|
||||
|
||||
private void TimeStampComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_TimeStampComboBoxItemStateChanged
|
||||
timeStampListener();
|
||||
}//GEN-LAST:event_TimeStampComboBoxItemStateChanged
|
||||
|
||||
private void LineTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_LineTypeComboBoxItemStateChanged
|
||||
lineTypeListener();
|
||||
}//GEN-LAST:event_LineTypeComboBoxItemStateChanged
|
||||
private void DownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DownButtonActionPerformed
|
||||
swapUpdate("DOWN", rowNum-1); //Subtract rowNum by one to get the proper index number
|
||||
}//GEN-LAST:event_DownButtonActionPerformed
|
||||
|
||||
private void FieldTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_FieldTypeComboBoxItemStateChanged
|
||||
fieldTypeListener();
|
||||
}//GEN-LAST:event_FieldTypeComboBoxItemStateChanged
|
||||
|
||||
private void UpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpButtonActionPerformed
|
||||
swapUpdate("UP", rowNum-1); //Subtract rowNum by one to get the proper index number
|
||||
}//GEN-LAST:event_UpButtonActionPerformed
|
||||
private void LineTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_LineTypeComboBoxItemStateChanged
|
||||
lineTypeListener();
|
||||
}//GEN-LAST:event_LineTypeComboBoxItemStateChanged
|
||||
|
||||
private void DownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DownButtonActionPerformed
|
||||
swapUpdate("DOWN", rowNum-1); //Subtract rowNum by one to get the proper index number
|
||||
}//GEN-LAST:event_DownButtonActionPerformed
|
||||
private void TimeStampComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_TimeStampComboBoxItemStateChanged
|
||||
timeStampListener();
|
||||
}//GEN-LAST:event_TimeStampComboBoxItemStateChanged
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
deleteButton();
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
private void DocButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DocButtonActionPerformed
|
||||
DocPanel panel = new DocPanel();
|
||||
|
||||
panel.setDoc(this.comments);
|
||||
//panel.setVisible(true);
|
||||
JDialog dialog = new JDialog();
|
||||
panel.setDialog(dialog);
|
||||
//dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
dialog.setModal(true);
|
||||
dialog.add(panel);
|
||||
dialog.pack();
|
||||
dialog.setLocation(200, 200);
|
||||
dialog.setTitle("Documentation for "+TagTextField.getText());
|
||||
dialog.setVisible(true);
|
||||
if(panel.isOK()){
|
||||
this.comments = panel.getDoc();
|
||||
}
|
||||
}//GEN-LAST:event_DocButtonActionPerformed
|
||||
|
||||
private void deleteButton(){
|
||||
JPanel panelOfArtifacts = (JPanel)this.getParent();
|
||||
panelOfArtifacts.remove(this);
|
||||
uiResult.data.rowCount--;
|
||||
uiResult.refresh();
|
||||
}
|
||||
private void lineTypeTimeStamp(ToolTipWrapper lineType){
|
||||
if(LOG_TS_ACCESSIBLE_LineType.contains(lineType.getItem())){
|
||||
//Add "LOG_TS" to the timestampComboBox if it's not already
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) == -1) {
|
||||
TimeStampComboBox.addItem(SpecialTimeStampType[0]);
|
||||
}
|
||||
TimeStampComboBox.setVisible(true);
|
||||
}else{
|
||||
ToolTipWrapper fieldTypeTTW = (ToolTipWrapper)FieldTypeComboBox.getSelectedItem();
|
||||
//Remove "LOG_TS" from the timestampComboBox if it's not already
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) != -1 && !LOG_ACCESIBLE_FieldType.contains(fieldTypeTTW.getItem())) {
|
||||
TimeStampComboBox.removeItem(SpecialTimeStampType[0]);
|
||||
}
|
||||
TimeStampComboBox.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
//The listeners sees what values are present in their respective fields and then changes the interface based on that(remove or adding other fields)
|
||||
private void lineTypeListener(){
|
||||
ToolTipWrapper lineType = (ToolTipWrapper)LineTypeComboBox.getSelectedItem();
|
||||
@@ -287,28 +381,69 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
}
|
||||
else
|
||||
LineIDTextField.setVisible(true);
|
||||
|
||||
|
||||
|
||||
//Does the line type allow for LOG_TS option in the TimeStampComboBox?
|
||||
if(LOG_TS_ACCESSIBLE_LineType.contains(lineType.getItem())){
|
||||
//Add "LOG_TS" to the timestampComboBox if it's not already
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) == -1)
|
||||
TimeStampComboBox.addItem(SpecialTimeStampType[0]);
|
||||
}
|
||||
else{
|
||||
ToolTipWrapper fieldTypeTTW = (ToolTipWrapper)FieldTypeComboBox.getSelectedItem();
|
||||
//Remove "LOG_TS" from the timestampComboBox if it's not already
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) != -1 && !LOG_ACCESIBLE_FieldType.contains(fieldTypeTTW.getItem()))
|
||||
TimeStampComboBox.removeItem(SpecialTimeStampType[0]);
|
||||
}
|
||||
lineTypeTimeStamp(lineType);
|
||||
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
|
||||
private void adjustFieldIDToolTip(String fieldType){
|
||||
//System.out.println("field type "+fieldType);
|
||||
String tip = FieldIDTextField.getToolTipText();
|
||||
switch(fieldType){
|
||||
case "TOKEN":
|
||||
tip = "Result is the Nth space-delimited token, where N is this integer.";
|
||||
break;
|
||||
case "QUOTES":
|
||||
tip = "Result is the Nth quoted string, where N is this integer.";
|
||||
break;
|
||||
case "PARENS":
|
||||
tip = "Result is the Nth string in parenthesis, where N is this integer.";
|
||||
break;
|
||||
case "SLASH":
|
||||
tip = "Result is the Nth slash-delimited token, where N is this integer.";
|
||||
break;
|
||||
case "CONTAINS":
|
||||
tip = "Result is true if the file contains this string.";
|
||||
break;
|
||||
case "FILE_REGEX":
|
||||
tip = "Result is true if the file contains this regular expression.";
|
||||
break;
|
||||
case "LOG_TS":
|
||||
tip = "Used with timestamped log files, results in a timestamped set of boolean results with a value of TRUE for each log line that contains this string.";
|
||||
break;
|
||||
case "FILE_REGEX_TS":
|
||||
tip = "Used with timestamped log files, results in a timestamped set of boolean results with a value of TRUE for each log line that contains this regular expression.";
|
||||
break;
|
||||
case "LOG_RANGE":
|
||||
tip = "Used with timestamped log files, results in a timestamped set of boolean results with a value of TRUE for each log line that contains this string, with timestamp ranges delimited by the matching log entries.";
|
||||
break;
|
||||
case "STRING_COUNT":
|
||||
tip = "The result value is set to the quantity of occurances of this string in the file.";
|
||||
break;
|
||||
case "COMMAND_COUNT":
|
||||
tip = "Intended for use with bash_history files, counts the occurances of this command. Commands are evaluated considering use of sudo, time, etc.";
|
||||
break;
|
||||
case "SEARCH":
|
||||
tip = "Result is assigned the value of string, which is treated as an expression having the syntax of pythons parse.search function. E.g., 'frame.number=={:d}' would yield the frame number.";
|
||||
break;
|
||||
case "GROUP":
|
||||
tip = "Intended for use with 'REGEX' line types, the result is set to the value of the regex group number named by this value. Regular expressions and their groups are processed using the python re.search semantics.";
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
//System.out.println("adjustFieldIDToolTip no match");
|
||||
}
|
||||
FieldIDTextField.setToolTipText(tip);
|
||||
}
|
||||
private void fieldTypeListener(){
|
||||
ToolTipWrapper fieldType = (ToolTipWrapper)FieldTypeComboBox.getSelectedItem();
|
||||
|
||||
adjustFieldIDToolTip(fieldType.getItem());
|
||||
//Does the fieldType allow for certain user inputs
|
||||
if(!justFieldType.contains(fieldType.getItem())){
|
||||
FieldIDTextField.setVisible(true);
|
||||
@@ -338,11 +473,14 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
*/
|
||||
if(LOG_ACCESIBLE_FieldType.contains(fieldType.getItem())){
|
||||
//Add "LOG_TS" to the timestampComboBox if it's not already
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) == -1)
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) == -1){
|
||||
TimeStampComboBox.addItem(SpecialTimeStampType[0]);
|
||||
}
|
||||
//Add "LOG_RANGE" to the timestampComboBox if it's not already
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[1]) == -1)
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[1]) == -1){
|
||||
TimeStampComboBox.addItem(SpecialTimeStampType[1]);
|
||||
}
|
||||
TimeStampComboBox.setVisible(true);
|
||||
}
|
||||
/*
|
||||
If the selcted Field Type doesn't allow for "LOG_TS" and "LOG_RANGE" in the timeStampComboBox,
|
||||
@@ -351,11 +489,14 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
else{
|
||||
ToolTipWrapper lineType = (ToolTipWrapper)LineTypeComboBox.getSelectedItem();
|
||||
//Remove "LOG_TS" from the timestampComboBox if it's not already
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) != -1 && !LOG_TS_ACCESSIBLE_LineType.contains(lineType.getItem()))
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) != -1 && !LOG_TS_ACCESSIBLE_LineType.contains(lineType.getItem())){
|
||||
TimeStampComboBox.removeItem(SpecialTimeStampType[0]);
|
||||
}
|
||||
//Remove "LOG_RANGE" from the timestampComboBox if it's there
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[1]) != -1)
|
||||
if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[1]) != -1){
|
||||
TimeStampComboBox.removeItem(SpecialTimeStampType[1]);
|
||||
}
|
||||
TimeStampComboBox.setVisible(false);
|
||||
}
|
||||
|
||||
ArtifactPanel.revalidate();
|
||||
@@ -380,11 +521,10 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
//System.out.println("RowCOUNT(swap): " +dataUI.rowCount);
|
||||
dataUI.updateListofArtifacts(uiResult.getPanelofArtifacts());
|
||||
dataUI.swapArtifacts(type, rowIndex);
|
||||
uiResult.artifactsPanelRedraw();
|
||||
uiResult.loadUI();
|
||||
}
|
||||
|
||||
|
||||
//Field Getters
|
||||
//Field Getters
|
||||
public JComboBox<String> getContainerComboBox(){
|
||||
return ContainerComboBox;
|
||||
}
|
||||
@@ -412,6 +552,9 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
public JTextField getTimeStampTextField(){
|
||||
return TimeDelimiterTextField;
|
||||
}
|
||||
public String getComments(){
|
||||
return this.comments;
|
||||
}
|
||||
|
||||
//Field SETTERS
|
||||
private void setContainerComboBox(String v){
|
||||
@@ -440,12 +583,12 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
}
|
||||
private void setTimeDelimiterTextField(String v){
|
||||
TimeDelimiterTextField.setText(v);
|
||||
}
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel ArtifactPanel;
|
||||
private javax.swing.JComboBox<String> ContainerComboBox;
|
||||
private javax.swing.JButton DeleteButton;
|
||||
private javax.swing.JButton DocButton;
|
||||
private javax.swing.JButton DownButton;
|
||||
private javax.swing.JTextField FieldIDTextField;
|
||||
private javax.swing.JComboBox<ToolTipWrapper> FieldTypeComboBox;
|
||||
@@ -456,6 +599,7 @@ public class ArtifactPanels extends javax.swing.JPanel {
|
||||
private javax.swing.JTextField TimeDelimiterTextField;
|
||||
private javax.swing.JComboBox<ToolTipWrapper> TimeStampComboBox;
|
||||
private javax.swing.JButton UpButton;
|
||||
private javax.swing.JLabel rowLabel;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -1,269 +1,301 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package ResultsUI;
|
||||
|
||||
import static ResultsUI.ParamReferenceStorage.FieldType_ITEMS;
|
||||
import static ResultsUI.ParamReferenceStorage.LineType_ITEMS;
|
||||
import static ResultsUI.ParamReferenceStorage.SpecialTimeStampType;
|
||||
import static ResultsUI.ParamReferenceStorage.TimestampType_ITEMS;
|
||||
import static ResultsUI.ParamReferenceStorage.justFieldType;
|
||||
import static ResultsUI.ParamReferenceStorage.lineParamAccessible;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dan
|
||||
*/
|
||||
|
||||
/*
|
||||
Errors that need to be fixed/Notes to consider:
|
||||
****The param parsing in this class is critically dependent to where the param value's corresponding index is on the artifact line.
|
||||
If at any point this alignment is modified with less or more params, this code will need to be revised
|
||||
|
||||
****If the Line ID or the Field ID input contains a " : " in it, then the code will add everything after the " : " to the "line ID, or field ID".
|
||||
For the Field ID, it adds all the " : " parsed values after the field type, until it hits a Line Type(excludes the line type value)
|
||||
|
||||
****Currently this code will allow/read weird inputs like "CONTAINS : LINE : STUFF" in field ID or Line ID (which breaks the parsing)
|
||||
*/
|
||||
public class ArtifactValues {
|
||||
//Values to be obtained
|
||||
String resultTag, container, fileID, fieldID, lineID, timeStampDelimiter;
|
||||
|
||||
ToolTipHandlers.ToolTipWrapper fieldType, lineType, timeStampType;
|
||||
|
||||
//Stores the values of an arifactline fed into it (NO real value validation happening here)
|
||||
ArtifactValues(String artifactLine){
|
||||
resultTag = container = fileID = fieldID = lineID = timeStampDelimiter = "";
|
||||
|
||||
fieldType = lineType = timeStampType = null;
|
||||
|
||||
//Parsing the artifactline
|
||||
String[] paramParsedLine = artifactLine.split(" : ");
|
||||
|
||||
//Get the resultTag
|
||||
resultTag = paramParsedLine[0].split(" = ")[0];
|
||||
|
||||
//Get the container, fieldID, timeStampType, and timeStampDelimiter
|
||||
handleFileRef(paramParsedLine[0].split(" = ")[1]);
|
||||
|
||||
//Get Field Type and Field ID (and the lineType and lineID depending on if the field type allows it):
|
||||
|
||||
//Case where "TOKEN" field Type is not explicitly stated and the paramParsedLine index is off by 1 for fieldID, lineType, lineID
|
||||
if(paramParsedLine[1].equals("ALL") || paramParsedLine[1].equals("LAST") || isInteger(paramParsedLine[1])){
|
||||
fieldType = FieldType_ITEMS[0]; //TOKEN
|
||||
fieldID = paramParsedLine[1];
|
||||
|
||||
/*
|
||||
If the paramParsedLine isn't just the fileID and the fieldID (note fieldType is assumed to be "Token"),
|
||||
then that means we need to consider the other parms which are certainly* line type and line ID.
|
||||
*if the user enters a bad config file this may cause an error.
|
||||
*/
|
||||
if(paramParsedLine.length > 2){
|
||||
lineType = itemFinder(LineType_ITEMS, paramParsedLine[2]);
|
||||
lineID = paramParsedLine[3];
|
||||
}
|
||||
else{
|
||||
lineType = LineType_ITEMS[0]; //NONE
|
||||
lineID ="";
|
||||
}
|
||||
}
|
||||
|
||||
//Case where the field type IS EXPLICITY stated
|
||||
else{
|
||||
fieldType = itemFinder(FieldType_ITEMS, paramParsedLine[1]);
|
||||
//If the field type is null after looking through the field type items, then it may be under the SpecialTimeStampType array
|
||||
if(fieldType == null)
|
||||
fieldType = itemFinder(SpecialTimeStampType, paramParsedLine[1]);
|
||||
|
||||
//Does the field type consider other fields, if so then continue parsing for these values
|
||||
if(!justFieldType.contains(fieldType.getItem())){
|
||||
//If the field Type doesn't bother with line Params then execute these details
|
||||
if(!lineParamAccessible.contains(fieldType.getItem())){
|
||||
//Everything after the field type is considered the field ID (this ensures that the fieldID potentially split by " : " will all be captured and stored)
|
||||
fieldID = artifactLine.split(fieldType + " : ")[1];
|
||||
|
||||
//If the fieldType is equal "FILE_REGEX_TS", then overwrite the fieldType to be "FILE_REGEX" and make the timeStampType to be "LOG_TS"
|
||||
//If the fieldType is equal "LOG_TS", then overwrite the fieldType to be "CONTAINS" and make the timeStampType to be "LOG_TS"
|
||||
//If the fieldType is equal "LOG_RANGE", then overwrite the fieldType to be "CONTAINS" and make the timeStampType to be "LOG_RANGE"
|
||||
switch (fieldType.getItem()) {
|
||||
case "FILE_REGEX_TS":
|
||||
fieldType = FieldType_ITEMS[7]; //FILE REGEX
|
||||
timeStampType = SpecialTimeStampType[0]; //LOG_TS
|
||||
break;
|
||||
case "LOG_TS":
|
||||
fieldType = FieldType_ITEMS[6]; //CONTAINS
|
||||
timeStampType = SpecialTimeStampType[0]; // LOG_TS
|
||||
break;
|
||||
case "LOG_RANGE":
|
||||
fieldType = FieldType_ITEMS[6]; //CONTAINS
|
||||
timeStampType = SpecialTimeStampType[1]; //LOG_RANGE
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
lineType = LineType_ITEMS[0]; //NONE
|
||||
lineID = "";
|
||||
}
|
||||
//If the field Type does bother with line Params then execute these details
|
||||
else{
|
||||
int properLineTypeIndex = 3; //This value may be changed if user's field ID includes " : ", offsetting the parsing indexes
|
||||
|
||||
/*The Field ID may include " : ". But since the line parsing breaks the line up based on " : ",
|
||||
the for block below makes sure to the include the pieces that were broken up
|
||||
*/
|
||||
for(int i=2; i<paramParsedLine.length && !itemExistCheck(LineType_ITEMS,paramParsedLine[i]); i++){
|
||||
fieldID+=paramParsedLine[i];
|
||||
if(i<(paramParsedLine.length-1) && !itemExistCheck(LineType_ITEMS,paramParsedLine[i+1])){
|
||||
properLineTypeIndex++;
|
||||
fieldID+=" : ";
|
||||
}
|
||||
}
|
||||
|
||||
//If properLineTypeIndex < paramParsedLine.length then that means the line type and line id was written in the config file
|
||||
if(properLineTypeIndex < paramParsedLine.length){
|
||||
lineType = itemFinder(LineType_ITEMS, paramParsedLine[properLineTypeIndex]);
|
||||
//If line type is null after searching though the LineType_ITEMS then the value could possibly be a special line type
|
||||
if(lineType == null)
|
||||
lineType = itemFinder(SpecialTimeStampType, paramParsedLine[properLineTypeIndex]);
|
||||
|
||||
//Special LineType cases
|
||||
if((lineType.getItem()).equals("HAVESTRING_TS")){
|
||||
lineType = LineType_ITEMS[3]; //HAVESTRING
|
||||
timeStampType = SpecialTimeStampType[0]; //LOG_TS
|
||||
}
|
||||
else if((lineType.getItem()).equals("REGEX_TS")){
|
||||
lineType = LineType_ITEMS[4]; //REGEX
|
||||
timeStampType = SpecialTimeStampType[0]; //LOG_TS
|
||||
}
|
||||
|
||||
|
||||
//accomplishes the same thing in the for-block below but more simply (Gets everything after the lineType as the lineID)
|
||||
lineID = artifactLine.split(lineType.getItem() + " : ")[1];
|
||||
|
||||
|
||||
/*The Line ID may include " : ". since the line parsing breaks the line up based on " : ",
|
||||
the for block below makes sure to the include the pieces that were broken up
|
||||
*/
|
||||
/*
|
||||
for(int i=properLineTypeIndex+1; i<paramParsedLine.length; i++){
|
||||
lineID+=paramParsedLine[i];
|
||||
if(i<(paramParsedLine.length-1)){
|
||||
lineID+=" : ";
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
else{
|
||||
lineType = LineType_ITEMS[0]; //NONE
|
||||
lineID = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
fieldID = "";
|
||||
lineType = LineType_ITEMS[0]; //NONE
|
||||
lineID = "";
|
||||
timeStampType = TimestampType_ITEMS[0]; //File
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Constructor for temporarily storing values of artifacts in the UI
|
||||
ArtifactValues(String resultTag, String container, String fileID, ToolTipHandlers.ToolTipWrapper fieldType, String fieldID, ToolTipHandlers.ToolTipWrapper lineType, String lineID, ToolTipHandlers.ToolTipWrapper timeStampType, String timeStampDelimiter){
|
||||
this.resultTag = resultTag;
|
||||
this.container = container;
|
||||
this.fileID = fileID;
|
||||
this.fieldType = fieldType;
|
||||
this.fieldID = fieldID;
|
||||
this.lineType = lineType;
|
||||
this.lineID = lineID;
|
||||
this.timeStampType = timeStampType;
|
||||
this.timeStampDelimiter = timeStampDelimiter;
|
||||
}
|
||||
|
||||
private void handleFileRef(String fileRef){
|
||||
//Case 1: <prog>.[stdin | stdout | prgout] or file_path
|
||||
if(!fileRef.contains(":")){
|
||||
container = "ALL";
|
||||
fileID = fileRef;
|
||||
timeStampType = TimestampType_ITEMS[0]; //File
|
||||
}
|
||||
//Case 2: [container_name:]<prog>.[stdin | stdout | prguot]
|
||||
else if(fileRef.contains(":") && !fileRef.contains("/")){
|
||||
container = fileRef.split(":")[0];
|
||||
fileID = fileRef.split(":")[1];
|
||||
timeStampType = TimestampType_ITEMS[0]; //File
|
||||
}
|
||||
else{
|
||||
String[] parsedFileRef = fileRef.split(":");
|
||||
|
||||
if(parsedFileRef.length == 2){
|
||||
//Case 3: [container_name:]file_path
|
||||
if(fileRef.indexOf(":") < fileRef.indexOf('/')){
|
||||
container = parsedFileRef[0];
|
||||
fileID = parsedFileRef[1];
|
||||
timeStampType = TimestampType_ITEMS[0]; //File
|
||||
}
|
||||
//Case 4: file_path[:time_delimiter]
|
||||
else{
|
||||
fileID = parsedFileRef[0];
|
||||
//Set the timeStamp Type either to be "Service" or "Program"
|
||||
if(parsedFileRef[1].contains(".service")){
|
||||
timeStampType = TimestampType_ITEMS[1]; //Service
|
||||
timeStampDelimiter = parsedFileRef[1].replace(".service", "");
|
||||
}
|
||||
else{
|
||||
timeStampType = TimestampType_ITEMS[2]; //Program
|
||||
timeStampDelimiter = parsedFileRef[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
//Case 5: [container_name:]file_path[:time_delimiter]
|
||||
else {
|
||||
container = parsedFileRef[0];
|
||||
fileID = parsedFileRef[1];
|
||||
if(parsedFileRef[2].contains(".service")){
|
||||
timeStampType = TimestampType_ITEMS[1]; //Serivce
|
||||
timeStampDelimiter = parsedFileRef[2].replace(".service", "");
|
||||
}
|
||||
else{
|
||||
timeStampType = TimestampType_ITEMS[2]; //Program
|
||||
timeStampDelimiter = parsedFileRef[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){
|
||||
for(ToolTipHandlers.ToolTipWrapper item : list){
|
||||
if(item.getItem().equals(desired)){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean itemExistCheck(ToolTipHandlers.ToolTipWrapper[] list,String desired){
|
||||
for(ToolTipHandlers.ToolTipWrapper item : list){
|
||||
if(item.getItem().equals(desired)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isInteger(String s){
|
||||
try{
|
||||
Integer.parseInt(s);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.resultsui;
|
||||
import java.util.Arrays;
|
||||
import labtainers.mainui.ToolTipHandlers;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.FieldType_ITEMS;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.LineType_ITEMS;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.SpecialTimeStampType;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.TimestampType_ITEMS;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.justFieldType;
|
||||
import static labtainers.resultsui.ParamReferenceStorage.lineParamAccessible;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ArtifactValues {
|
||||
//Values to be obtained
|
||||
String resultTag, container, fileID, fieldID, lineID, timeStampDelimiter;
|
||||
String comments = "";
|
||||
|
||||
ToolTipHandlers.ToolTipWrapper fieldType, lineType, timeStampType;
|
||||
|
||||
//Stores the values of an arifactline fed into it (NO real value validation happening here)
|
||||
ArtifactValues(String inputLine){
|
||||
String artifactLine;
|
||||
if(inputLine.contains("\n")){
|
||||
String[] the_lines = inputLine.split("\n");
|
||||
artifactLine = the_lines[the_lines.length-1];
|
||||
for(int i=0; i<the_lines.length-1; i++){
|
||||
comments = comments+the_lines[i]+"\n";
|
||||
}
|
||||
}else{
|
||||
artifactLine = inputLine;
|
||||
}
|
||||
resultTag = container = fileID = fieldID = lineID = timeStampDelimiter = "";
|
||||
|
||||
fieldType = lineType = timeStampType = null;
|
||||
|
||||
//Parsing the artifactline
|
||||
String[] paramParsedLine = artifactLine.split(" : ");
|
||||
Arrays.stream(paramParsedLine).map(String::trim).toArray(unused -> paramParsedLine);
|
||||
|
||||
//Get the resultTag
|
||||
resultTag = paramParsedLine[0].split(" = ")[0];
|
||||
|
||||
//Get the container, fieldID, timeStampType, and timeStampDelimiter
|
||||
handleFileRef(paramParsedLine[0].split(" = ")[1]);
|
||||
|
||||
//Get Field Type and Field ID (and the lineType and lineID depending on if the field type allows it):
|
||||
|
||||
//Case where "TOKEN" field Type is not explicitly stated and the paramParsedLine index is off by 1 for fieldID, lineType, lineID
|
||||
if(paramParsedLine[1].equals("ALL") || paramParsedLine[1].equals("LAST") || isInteger(paramParsedLine[1])){
|
||||
fieldType = FieldType_ITEMS[0]; //TOKEN
|
||||
fieldID = paramParsedLine[1];
|
||||
|
||||
/*
|
||||
If the paramParsedLine isn't just the fileID and the fieldID (note fieldType is assumed to be "Token"),
|
||||
then that means we need to consider the other parms which are certainly* line type and line ID.
|
||||
*if the user enters a bad config file this may cause an error.
|
||||
*/
|
||||
if(paramParsedLine.length > 2){
|
||||
lineType = itemFinder(LineType_ITEMS, paramParsedLine[2]);
|
||||
lineID = paramParsedLine[3];
|
||||
}
|
||||
else{
|
||||
lineType = LineType_ITEMS[0]; //NONE
|
||||
lineID ="";
|
||||
}
|
||||
}
|
||||
|
||||
//Case where the field type IS EXPLICITY stated
|
||||
else{
|
||||
fieldType = itemFinder(FieldType_ITEMS, paramParsedLine[1]);
|
||||
//If the field type is null after looking through the field type items, then it may be under the SpecialTimeStampType array
|
||||
if(fieldType == null)
|
||||
fieldType = itemFinder(SpecialTimeStampType, paramParsedLine[1]);
|
||||
if(fieldType == null){
|
||||
System.out.println("could not get field type for "+paramParsedLine[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
//Does the field type consider other fields, if so then continue parsing for these values
|
||||
if(!justFieldType.contains(fieldType.getItem())){
|
||||
//If the field Type doesn't bother with line Params then execute these details
|
||||
if(!lineParamAccessible.contains(fieldType.getItem())){
|
||||
//Everything after the field type is considered the field ID (this ensures that the fieldID potentially split by " : " will all be captured and stored)
|
||||
fieldID = artifactLine.split(fieldType + " : ")[1];
|
||||
|
||||
//If the fieldType is equal "FILE_REGEX_TS", then overwrite the fieldType to be "FILE_REGEX" and make the timeStampType to be "LOG_TS"
|
||||
//If the fieldType is equal "LOG_TS", then overwrite the fieldType to be "CONTAINS" and make the timeStampType to be "LOG_TS"
|
||||
//If the fieldType is equal "LOG_RANGE", then overwrite the fieldType to be "CONTAINS" and make the timeStampType to be "LOG_RANGE"
|
||||
switch (fieldType.getItem()) {
|
||||
case "FILE_REGEX_TS":
|
||||
fieldType = FieldType_ITEMS[7]; //FILE REGEX
|
||||
timeStampType = SpecialTimeStampType[0]; //LOG_TS
|
||||
break;
|
||||
case "LOG_TS":
|
||||
fieldType = FieldType_ITEMS[6]; //CONTAINS
|
||||
timeStampType = SpecialTimeStampType[0]; // LOG_TS
|
||||
break;
|
||||
case "LOG_RANGE":
|
||||
fieldType = FieldType_ITEMS[6]; //CONTAINS
|
||||
timeStampType = SpecialTimeStampType[1]; //LOG_RANGE
|
||||
break;
|
||||
case "RANGE_REGEX":
|
||||
fieldType = FieldType_ITEMS[7]; //FILE_REGEX
|
||||
timeStampType = SpecialTimeStampType[1]; //LOG_RANGE
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
lineType = LineType_ITEMS[0]; //NONE
|
||||
lineID = "";
|
||||
}
|
||||
//If the field Type does bother with line Params then execute these details
|
||||
else{
|
||||
int properLineTypeIndex = 3; //This value may be changed if user's field ID includes " : ", offsetting the parsing indexes
|
||||
|
||||
/*The Field ID may include " : ". But since the line parsing breaks the line up based on " : ",
|
||||
the for block below makes sure to the include the pieces that were broken up
|
||||
*/
|
||||
for(int i=2; i<paramParsedLine.length && !itemExistCheck(LineType_ITEMS,paramParsedLine[i]); i++){
|
||||
fieldID+=paramParsedLine[i];
|
||||
if(i<(paramParsedLine.length-1) && !itemExistCheck(LineType_ITEMS,paramParsedLine[i+1])){
|
||||
properLineTypeIndex++;
|
||||
fieldID+=" : ";
|
||||
}
|
||||
}
|
||||
|
||||
//If properLineTypeIndex < paramParsedLine.length then that means the line type and line id was written in the config file
|
||||
if(properLineTypeIndex < paramParsedLine.length){
|
||||
lineType = itemFinder(LineType_ITEMS, paramParsedLine[properLineTypeIndex]);
|
||||
//If line type is null after searching though the LineType_ITEMS then the value could possibly be a special line type
|
||||
if(lineType == null)
|
||||
lineType = itemFinder(SpecialTimeStampType, paramParsedLine[properLineTypeIndex]);
|
||||
|
||||
//Special LineType cases
|
||||
if((lineType.getItem()).equals("HAVESTRING_TS")){
|
||||
lineType = LineType_ITEMS[3]; //HAVESTRING
|
||||
timeStampType = SpecialTimeStampType[0]; //LOG_TS
|
||||
}
|
||||
else if((lineType.getItem()).equals("REGEX_TS")){
|
||||
lineType = LineType_ITEMS[4]; //REGEX
|
||||
timeStampType = SpecialTimeStampType[0]; //LOG_TS
|
||||
}
|
||||
|
||||
|
||||
//accomplishes the same thing in the for-block below but more simply (Gets everything after the lineType as the lineID)
|
||||
lineID = artifactLine.split(lineType.getItem() + " : ")[1];
|
||||
|
||||
|
||||
/*The Line ID may include " : ". since the line parsing breaks the line up based on " : ",
|
||||
the for block below makes sure to the include the pieces that were broken up
|
||||
*/
|
||||
/*
|
||||
for(int i=properLineTypeIndex+1; i<paramParsedLine.length; i++){
|
||||
lineID+=paramParsedLine[i];
|
||||
if(i<(paramParsedLine.length-1)){
|
||||
lineID+=" : ";
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
else{
|
||||
lineType = LineType_ITEMS[0]; //NONE
|
||||
lineID = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
fieldID = "";
|
||||
lineType = LineType_ITEMS[0]; //NONE
|
||||
lineID = "";
|
||||
timeStampType = TimestampType_ITEMS[0]; //File
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Constructor for temporarily storing values of artifacts in the UI
|
||||
ArtifactValues(String resultTag, String container, String fileID, ToolTipHandlers.ToolTipWrapper fieldType, String fieldID, ToolTipHandlers.ToolTipWrapper lineType, String lineID, ToolTipHandlers.ToolTipWrapper timeStampType, String timeStampDelimiter, String comments){
|
||||
this.resultTag = resultTag;
|
||||
this.container = container;
|
||||
this.fileID = fileID;
|
||||
this.fieldType = fieldType;
|
||||
this.fieldID = fieldID;
|
||||
this.lineType = lineType;
|
||||
this.lineID = lineID;
|
||||
this.timeStampType = timeStampType;
|
||||
this.timeStampDelimiter = timeStampDelimiter;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
//Clones the original Artifact Values
|
||||
ArtifactValues(ArtifactValues original){
|
||||
this.resultTag = original.resultTag;
|
||||
this.container = original.container;
|
||||
this.fileID = original.fileID;
|
||||
this.fieldType = original.fieldType;
|
||||
this.fieldID = original.fieldID;
|
||||
this.lineType = original.lineType;
|
||||
this.lineID = original.lineID;
|
||||
this.timeStampType = original.timeStampType;
|
||||
this.timeStampDelimiter = original.timeStampDelimiter;
|
||||
this.comments = original.comments;
|
||||
}
|
||||
|
||||
private void handleFileRef(String fileRef){
|
||||
//Case 1: <prog>.[stdin | stdout | prgout] or file_path
|
||||
if(!fileRef.contains(":")){
|
||||
container = "ALL";
|
||||
fileID = fileRef;
|
||||
timeStampType = TimestampType_ITEMS[0]; //File
|
||||
}
|
||||
//Case 2: [container_name:]<prog>.[stdin | stdout | prguot]
|
||||
else if(fileRef.contains(":") && !fileRef.contains("/")){
|
||||
container = fileRef.split(":")[0];
|
||||
fileID = fileRef.split(":")[1];
|
||||
timeStampType = TimestampType_ITEMS[0]; //File
|
||||
}
|
||||
else{
|
||||
String[] parsedFileRef = fileRef.split(":");
|
||||
|
||||
if(parsedFileRef.length == 2){
|
||||
//Case 3: [container_name:]file_path
|
||||
if(fileRef.indexOf(":") < fileRef.indexOf('/')){
|
||||
container = parsedFileRef[0];
|
||||
fileID = parsedFileRef[1];
|
||||
timeStampType = TimestampType_ITEMS[0]; //File
|
||||
}
|
||||
//Case 4: file_path[:time_delimiter]
|
||||
else{
|
||||
fileID = parsedFileRef[0];
|
||||
}
|
||||
}
|
||||
//Case 5: [container_name:]file_path[:time_delimiter]
|
||||
else {
|
||||
container = parsedFileRef[0];
|
||||
fileID = parsedFileRef[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){
|
||||
for(ToolTipHandlers.ToolTipWrapper item : list){
|
||||
if(item.getItem().equals(desired)){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean itemExistCheck(ToolTipHandlers.ToolTipWrapper[] list,String desired){
|
||||
for(ToolTipHandlers.ToolTipWrapper item : list){
|
||||
if(item.getItem().equals(desired)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isInteger(String s){
|
||||
try{
|
||||
Integer.parseInt(s);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,144 +1,190 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package ResultsUI;
|
||||
|
||||
import ResultsUI.ToolTipHandlers.ToolTipWrapper;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dan
|
||||
*/
|
||||
public class ParamReferenceStorage {
|
||||
|
||||
public static final ToolTipWrapper[] FieldType_ITEMS = new ToolTipWrapper[] {
|
||||
//0
|
||||
new ToolTipWrapper("TOKEN", "<html>Treat the line as space-delimited tokens.</html>"),
|
||||
// 1
|
||||
new ToolTipWrapper("PARENS", "<html>The desired value is contained in parenthesis.</html>"),
|
||||
// 2
|
||||
new ToolTipWrapper("QUOTES", "<html>The desired value is contained in quotes.</html>"),
|
||||
// 3
|
||||
new ToolTipWrapper("SLASH", "<html>The desired value is contained within slashes<br>" +
|
||||
"e.g., /foo/</html>"),
|
||||
// 4
|
||||
new ToolTipWrapper("LINE_COUNT", "<html>The quantity of lines in the file. Remaining fields<br>" +
|
||||
"are ignored.</html>"),
|
||||
// 5
|
||||
new ToolTipWrapper("CHECKSUM", "<html>The result value is set to the md5 checksum<br>" +
|
||||
"of the file.</html>"),
|
||||
// 6
|
||||
new ToolTipWrapper("CONTAINS", "<html>The result value is set to TRUE if the file<br>" +
|
||||
"contains the string represented in field_id.</html>"),
|
||||
// 7
|
||||
new ToolTipWrapper("FILE_REGEX", "<html>The result value is set to TRUE if the file<br>" +
|
||||
"contains the regular expression represented in field_id.<br>" +
|
||||
"The python findall function is used on the entire file.<br>" +
|
||||
"See the acl lab for an example of multi-line expressions.</html>"),
|
||||
// 8
|
||||
new ToolTipWrapper("STRING_COUNT", "<html>The result value is set to the quantity of<br>" +
|
||||
"occurances of the string represented in field_id.</html>"),
|
||||
// 9
|
||||
new ToolTipWrapper("COMMAND_COUNT", "<html>Intended for use with bash_history files, counts<br>" +
|
||||
"the occurances of the command given in the field_id.<br>"),
|
||||
// 10
|
||||
new ToolTipWrapper("PARAM", "<html>The result value is set to nth parameter<br>" +
|
||||
"(0 is the program name), provided in the<br>" +
|
||||
"program invocation.</html>"),
|
||||
// 11
|
||||
new ToolTipWrapper("SEARCH", "<html>The result is assigned the value of the search<br>" +
|
||||
"defined by the given field_id, which is treated as an<br>" +
|
||||
"expression having the syntax of pythons parse.search<br>" +
|
||||
"function. E.g., \"frame.number=={:d}\" would<br>" +
|
||||
"yield the frame number.</html>"),
|
||||
// 12
|
||||
new ToolTipWrapper("GROUP", "<html>Intended for use with \"REGEX\" line types, the<br>" +
|
||||
"result is set to the value of the regex group<br>" +
|
||||
"number named by the field_id. Regular expressions<br>" +
|
||||
"and their groups are processed using the python<br>" +
|
||||
"re.search semantics.</html>" ),
|
||||
// 13
|
||||
new ToolTipWrapper("TIME_DELIM", "" )};
|
||||
|
||||
|
||||
public static final ToolTipWrapper[] LineType_ITEMS = new ToolTipWrapper[] {
|
||||
// 0
|
||||
new ToolTipWrapper("NONE", ""),
|
||||
// 1
|
||||
new ToolTipWrapper("LINE", "<html>The line_id is an integer line number<br>" +
|
||||
"(starting at one). Use of this to identify<br>" +
|
||||
"lines is discouraged since minor lab changes<br>" +
|
||||
"might alter the count.</html>"),
|
||||
// 2
|
||||
new ToolTipWrapper("STARTSWITH", "<html>the line_id is a string. This names the<br>" +
|
||||
"first occurrence of a line that starts with<br>" +
|
||||
"this string.</html>" ),
|
||||
// 3
|
||||
new ToolTipWrapper("HAVESTRING", "<html>The line_id is a string. This names the<br>" +
|
||||
"first occurrence of a line that contains the<br>" +
|
||||
"string.</html>" ),
|
||||
// 4
|
||||
new ToolTipWrapper("REGEX", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" ),
|
||||
// 5
|
||||
new ToolTipWrapper("NEXT_STARTSWITH", "<html>the line_id is a string. This names the<br>" +
|
||||
"line preceeding the first occurrence of a line<br>" +
|
||||
"that starts with this string.</html>")};
|
||||
|
||||
|
||||
public static final ToolTipWrapper[] TimestampType_ITEMS = new ToolTipWrapper[] {
|
||||
// 0
|
||||
new ToolTipWrapper("File", ""),
|
||||
// 1
|
||||
new ToolTipWrapper("Service", ""),
|
||||
// 2
|
||||
new ToolTipWrapper("Program", "")} ;
|
||||
|
||||
|
||||
//****These items may need to be stored differently for better organization)
|
||||
public static final ToolTipWrapper[] SpecialTimeStampType = new ToolTipWrapper[] {
|
||||
//FIELDTYPES
|
||||
// 0
|
||||
new ToolTipWrapper("LOG_TS", "<html>Used with timestamped log files, this results in a<br>" +
|
||||
"timestamped set of boolean results with a value<br>" +
|
||||
"of TRUE for each log line that contains the string<br>" +
|
||||
"represented in the field_id.</html>"),
|
||||
// 1
|
||||
new ToolTipWrapper("LOG_RANGE", "<html>Similar to LOG_TS, except the timestamped entries<br>" +
|
||||
"are ranges delimited by the matching log entries.</html>"),
|
||||
// 2 ***These items below do not appear in the comboboxes, they're here merely for reference
|
||||
new ToolTipWrapper("FILE_REGEX_TS", ""),
|
||||
//LINETYPES
|
||||
new ToolTipWrapper("HAVESTRING_TS", ""),
|
||||
|
||||
new ToolTipWrapper("REGEX_TS", "")};
|
||||
|
||||
|
||||
public static final Set<String> LOG_ACCESIBLE_FieldType = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"CONTAINS", "FILE_REGEX", "SEARCH"}
|
||||
));
|
||||
|
||||
public static final Set<String> LOG_TS_ACCESSIBLE_LineType = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"HAVESTRING", "REGEX"}
|
||||
));
|
||||
|
||||
public static final Set<String> lineParamAccessible = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"TOKEN", "PARENS", "QUOTES", "SLASH", "GROUP", "SEARCH"}
|
||||
));
|
||||
|
||||
|
||||
public static final Set<String> justFieldType = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"LINE_COUNT", "CHECKSUM", "TIME_DELIM"}
|
||||
));
|
||||
|
||||
|
||||
public static final Set<String> timeStampDelimiterAccessible = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"Service", "Program"}
|
||||
));
|
||||
}
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.resultsui;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import labtainers.mainui.ToolTipHandlers.ToolTipWrapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ParamReferenceStorage {
|
||||
public static ToolTipWrapper getWrapper(ToolTipWrapper[] tipList, String item){
|
||||
ToolTipWrapper retval = null;
|
||||
|
||||
for(ToolTipWrapper tool_tip : tipList){
|
||||
if(tool_tip.getItem().equals(item)){
|
||||
retval = tool_tip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
public static final ToolTipWrapper[] FieldType_ITEMS = new ToolTipWrapper[] {
|
||||
//0
|
||||
new ToolTipWrapper("TOKEN", "<html>Treat the line as space-delimited tokens.</html>"),
|
||||
// 1
|
||||
new ToolTipWrapper("PARENS", "<html>The desired value is contained in parenthesis.</html>"),
|
||||
// 2
|
||||
new ToolTipWrapper("QUOTES", "<html>The desired value is contained in quotes.</html>"),
|
||||
// 3
|
||||
new ToolTipWrapper("SLASH", "<html>The desired value is contained within slashes<br>" +
|
||||
"e.g., /foo/</html>"),
|
||||
// 4
|
||||
new ToolTipWrapper("LINE_COUNT", "<html>The quantity of lines in the file. Remaining fields<br>" +
|
||||
"are ignored.</html>"),
|
||||
// 5
|
||||
new ToolTipWrapper("CHECKSUM", "<html>The result value is set to the md5 checksum<br>" +
|
||||
"of the file.</html>"),
|
||||
// 6
|
||||
new ToolTipWrapper("CONTAINS", "<html>The result value is set to TRUE if the file<br>" +
|
||||
"contains the string represented in field_id.</html>"),
|
||||
// 7
|
||||
new ToolTipWrapper("FILE_REGEX", "<html>The result value is set to TRUE if the file<br>" +
|
||||
"contains the regular expression represented in field_id.<br>" +
|
||||
"The python findall function is used on the entire file.<br>" +
|
||||
"See the acl lab for an example of multi-line expressions.</html>"),
|
||||
// 8
|
||||
new ToolTipWrapper("STRING_COUNT", "<html>The result value is set to the quantity of<br>" +
|
||||
"occurances of the string represented in field_id.</html>"),
|
||||
// 9
|
||||
new ToolTipWrapper("COMMAND_COUNT", "<html>Intended for use with bash_history files, counts<br>" +
|
||||
"the occurances of the command given in the field_id.<br>"),
|
||||
// 10
|
||||
new ToolTipWrapper("PARAM", "<html>The result value is set to nth parameter<br>" +
|
||||
"(0 is the program name), provided in the<br>" +
|
||||
"program invocation.</html>"),
|
||||
// 11
|
||||
new ToolTipWrapper("SEARCH", "<html>The result is assigned the value of the search<br>" +
|
||||
"defined by the given field_id, which is treated as an<br>" +
|
||||
"expression having the syntax of pythons parse.search<br>" +
|
||||
"function. E.g., \"frame.number=={:d}\" would<br>" +
|
||||
"yield the frame number.</html>"),
|
||||
// 12
|
||||
new ToolTipWrapper("GROUP", "<html>Intended for use with \"REGEX\" line types, the<br>" +
|
||||
"result is set to the value of the regex group<br>" +
|
||||
"number named by the field_id. Regular expressions<br>" +
|
||||
"and their groups are processed using the python<br>" +
|
||||
"re.search semantics.</html>" ),
|
||||
// 13
|
||||
new ToolTipWrapper("SIZE", "<html>The result value is set to the size of the file.</html>"),
|
||||
// 14
|
||||
new ToolTipWrapper("TIME_DELIM", "" )};
|
||||
|
||||
|
||||
public static final ToolTipWrapper[] LineType_ITEMS = new ToolTipWrapper[] {
|
||||
// 0
|
||||
new ToolTipWrapper("NONE", ""),
|
||||
// 1
|
||||
new ToolTipWrapper("LINE", "<html>The line_id is an integer line number<br>" +
|
||||
"(starting at one). Use of this to identify<br>" +
|
||||
"lines is discouraged since minor lab changes<br>" +
|
||||
"might alter the count.</html>"),
|
||||
// 2
|
||||
new ToolTipWrapper("STARTSWITH", "<html>the line_id is a string. This names the<br>" +
|
||||
"first occurrence of a line that starts with<br>" +
|
||||
"this string.</html>" ),
|
||||
// 3
|
||||
new ToolTipWrapper("HAVESTRING", "<html>The line_id is a string. This names the<br>" +
|
||||
"first occurrence of a line that contains the<br>" +
|
||||
"string.</html>" ),
|
||||
// 4
|
||||
new ToolTipWrapper("REGEX", "<html>The line_id is a regular expression. This names the<br>" +
|
||||
"first occurrence of a line that matches the regular<br>" +
|
||||
"expression. Also see the \"GROUP\" field_type.</html>" ),
|
||||
// 5
|
||||
new ToolTipWrapper("NEXT_STARTSWITH", "<html>the line_id is a string. This names the<br>" +
|
||||
"line preceeding the first occurrence of a line<br>" +
|
||||
"that starts with this string.</html>")};
|
||||
|
||||
|
||||
public static final ToolTipWrapper[] TimestampType_ITEMS = new ToolTipWrapper[] {
|
||||
// 0
|
||||
new ToolTipWrapper("File", "<html>Result time stamps are derived <br>"+"from the file time stamp.</html>"),} ;
|
||||
|
||||
|
||||
//****These items may need to be stored differently for better organization)
|
||||
public static final ToolTipWrapper[] SpecialTimeStampType = new ToolTipWrapper[] {
|
||||
//FIELDTYPES
|
||||
// 0
|
||||
new ToolTipWrapper("LOG_TS", "<html>Used with timestamped log files, this results in a<br>" +
|
||||
"timestamped set of boolean results with a value<br>" +
|
||||
"of TRUE for each log line that contains the string<br>" +
|
||||
"represented in the field_id.</html>"),
|
||||
// 1
|
||||
new ToolTipWrapper("LOG_RANGE", "<html>Similar to LOG_TS, except the timestamped entries<br>" +
|
||||
"are ranges delimited by the matching log entries.</html>"),
|
||||
new ToolTipWrapper("RANGE_REGEX", "<html>Similar to LOG_RANGE, except the matching string<br>"+
|
||||
"is a regular expression.</html>"),
|
||||
// 2 ***These items below do not appear in the comboboxes, they're here merely for reference
|
||||
new ToolTipWrapper("FILE_REGEX_TS", ""),
|
||||
//LINETYPES
|
||||
new ToolTipWrapper("HAVESTRING_TS", ""),
|
||||
|
||||
new ToolTipWrapper("REGEX_TS", "")};
|
||||
|
||||
public static final ToolTipWrapper[] Operator_ITEMS = new ToolTipWrapper[] {
|
||||
//0
|
||||
new ToolTipWrapper("RAND_REPLACE", "<html>Replace a symbol with a random integer within a range.</html>"),
|
||||
// 1
|
||||
new ToolTipWrapper("RAND_REPLACE_UNIQUE", "<html>Like RAND_REPLACE, but does not reuse value.<br> Intended for IP addressees.</html>"),
|
||||
// 2
|
||||
new ToolTipWrapper("HASH_CREATE", "<html>Hash a string and write it to a named file.</html>"),
|
||||
// 3
|
||||
new ToolTipWrapper("HASH_REPLACE", "<html>Replace a symbol with the hash of a string</html>"),
|
||||
new ToolTipWrapper("CLONE_REPLACE", "<html>Replace a symbol with a Clone Instance number.<br>Intended for use with cloned workstations</html>")
|
||||
};
|
||||
|
||||
public static final Set<String> LOG_ACCESIBLE_FieldType = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"CONTAINS", "FILE_REGEX", "SEARCH"}
|
||||
));
|
||||
|
||||
public static final Set<String> LOG_TS_ACCESSIBLE_LineType = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"HAVESTRING", "REGEX"}
|
||||
));
|
||||
|
||||
public static final Set<String> lineParamAccessible = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"TOKEN", "PARENS", "QUOTES", "SLASH", "GROUP", "SEARCH"}
|
||||
));
|
||||
|
||||
|
||||
public static final Set<String> justFieldType = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"LINE_COUNT", "CHECKSUM", "TIME_DELIM", "SIZE"}
|
||||
));
|
||||
|
||||
|
||||
public static final Set<String> timeStampDelimiterAccessible = new HashSet<String>(Arrays.asList(
|
||||
new String[] {"Service", "Program"}
|
||||
));
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="ff" red="ff" type="rgb"/>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="title" type="java.lang.String" value="Results Configuration"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1590, 10000]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1590, 500]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1585, 389]"/>
|
||||
</Property>
|
||||
<Property name="resizable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
@@ -37,52 +36,52 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="CreateButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
||||
<Component id="RemoveAllButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="98" max="-2" attributes="0"/>
|
||||
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="LabNameTextField" min="-2" pref="378" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="LabNotExist" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="344" max="32767" attributes="0"/>
|
||||
<Component id="UpdateButton" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="CreateButton" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="RemoveAllButton" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="87" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="79" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="73" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="111" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="12" max="32767" attributes="0"/>
|
||||
<Component id="ScrollPaneOfArtifacts" min="-2" pref="1566" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="ScrollPaneOfArtifacts" alignment="0" pref="1300" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="60" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="74" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="66" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="131" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="452" max="-2" attributes="0"/>
|
||||
<Component id="UpdateButton" min="-2" pref="95" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="CreateButton" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="RemoveAllButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="LabNameTextField" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="UpdateButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="LabNotExist" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="CreateButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="RemoveAllButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="37" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@@ -90,77 +89,63 @@
|
||||
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ScrollPaneOfArtifacts" pref="317" max="32767" attributes="0"/>
|
||||
<Component id="ScrollPaneOfArtifacts" min="-2" pref="397" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="UpdateButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="CancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="58" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="ScrollPaneOfArtifacts">
|
||||
<Properties>
|
||||
<Property name="autoscrolls" type="boolean" value="true"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1300, 800]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="PanelofArtifacts">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="3"/>
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="UpdateButton">
|
||||
<Component class="javax.swing.JButton" name="CreateButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Update"/>
|
||||
<Property name="text" type="java.lang.String" value="Create"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="UpdateButtonActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CreateButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Container"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Identifies the container hosting the file. 
If "ALL" is selected, then the file is across all the containers."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="RemoveAllButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Remove All"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="RemoveAllButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel9">
|
||||
<Component class="javax.swing.JButton" name="UpdateButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial Black" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Lab Name: "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="CreateButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Create"/>
|
||||
<Property name="text" type="java.lang.String" value="OK"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CreateButtonActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="UpdateButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="File"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="File should either be a file path or a program/utility name with the ".stdin", ".stdout", or ".prgout" extension.

 Ex. "test.stdin", ".local/result/sniff.txt" "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
@@ -170,13 +155,13 @@
|
||||
<Property name="toolTipText" type="java.lang.String" value="The mode in which a value is found."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="File"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="File should either be a file path or a program/utility name with the ".stdin", ".stdout", or ".prgout" extension.

 Ex. "test.stdin", ".local/result/sniff.txt" "/>
|
||||
<Property name="text" type="java.lang.String" value="Container"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Identifies the container hosting the file. 
If "ALL" is selected, then the file is across all the containers."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
@@ -188,23 +173,13 @@
|
||||
<Property name="toolTipText" type="java.lang.String" value="The symbolic name of the result, which will be referenced in the goals configuration file. 

(It must be alphanumeric, underscores permitted) "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="LabNameTextField">
|
||||
<Component class="javax.swing.JButton" name="CancelButton">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[6, 25]"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="LabNameTextFieldActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="LabNotExist">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Lab does not exist!"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,417 @@
|
||||
/*
|
||||
This software was created by United States Government employees at
|
||||
The Center for Cybersecurity and Cyber Operations (C3O)
|
||||
at the Naval Postgraduate School NPS. Please note that within the
|
||||
United States, copyright protection is not available for any works
|
||||
created by United States Government employees, pursuant to Title 17
|
||||
United States Code Section 105. This software is in the public
|
||||
domain and is not subject to copyright.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package labtainers.resultsui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollBar;
|
||||
import labtainers.mainui.MainWindow;
|
||||
import static labtainers.resultsui.ResultsData.artifactValuesDiffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Liao
|
||||
*/
|
||||
public class ResultsUI extends javax.swing.JFrame {
|
||||
|
||||
/**
|
||||
* Creates new form NewJDialog
|
||||
*/
|
||||
ResultsData data;
|
||||
ResultsData saved;
|
||||
MainWindow mainUI;
|
||||
|
||||
public ResultsUI(java.awt.Frame parent, boolean modal) {
|
||||
//super(parent, modal);
|
||||
initComponents();
|
||||
this.setVisible(true);
|
||||
resultsScrollPaneBar = ScrollPaneOfArtifacts.getVerticalScrollBar();
|
||||
|
||||
this.mainUI = (MainWindow)parent;
|
||||
this.data = new ResultsData(this.mainUI.getCurrentData().getResultsData());
|
||||
this.saved = new ResultsData(this.data);
|
||||
|
||||
loadUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
ScrollPaneOfArtifacts = new javax.swing.JScrollPane();
|
||||
PanelofArtifacts = new javax.swing.JPanel();
|
||||
CreateButton = new javax.swing.JButton();
|
||||
RemoveAllButton = new javax.swing.JButton();
|
||||
UpdateButton = new javax.swing.JButton();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
CancelButton = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("Results Configuration");
|
||||
setMaximumSize(new java.awt.Dimension(1590, 10000));
|
||||
setMinimumSize(new java.awt.Dimension(1590, 500));
|
||||
setResizable(false);
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
public void windowClosing(java.awt.event.WindowEvent evt) {
|
||||
formWindowClosing(evt);
|
||||
}
|
||||
});
|
||||
|
||||
PanelofArtifacts.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
||||
ScrollPaneOfArtifacts.setViewportView(PanelofArtifacts);
|
||||
|
||||
CreateButton.setText("Create");
|
||||
CreateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CreateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
RemoveAllButton.setText("Remove All");
|
||||
RemoveAllButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
RemoveAllButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
UpdateButton.setText("OK");
|
||||
UpdateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
UpdateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel5.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel5.setText("File");
|
||||
jLabel5.setToolTipText("File should either be a file path or a program/utility name with the \".stdin\", \".stdout\", or \".prgout\" extension.\n\n Ex. \"test.stdin\", \".local/result/sniff.txt\" ");
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel3.setText("Field Type");
|
||||
jLabel3.setToolTipText("The mode in which a value is found.");
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel2.setText("Container");
|
||||
jLabel2.setToolTipText("Identifies the container hosting the file. \nIf \"ALL\" is selected, then the file is across all the containers.");
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel1.setText("Result Tag");
|
||||
jLabel1.setToolTipText("The symbolic name of the result, which will be referenced in the goals configuration file. \n\n(It must be alphanumeric, underscores permitted) ");
|
||||
|
||||
CancelButton.setText("Cancel");
|
||||
CancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(CreateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(RemoveAllButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(87, 87, 87)
|
||||
.addComponent(jLabel1)
|
||||
.addGap(79, 79, 79)
|
||||
.addComponent(jLabel2)
|
||||
.addGap(73, 73, 73)
|
||||
.addComponent(jLabel5)
|
||||
.addGap(111, 111, 111)
|
||||
.addComponent(jLabel3)))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 12, Short.MAX_VALUE)
|
||||
.addComponent(ScrollPaneOfArtifacts, javax.swing.GroupLayout.PREFERRED_SIZE, 1566, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(452, 452, 452)
|
||||
.addComponent(UpdateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(CancelButton)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(CreateButton)
|
||||
.addComponent(RemoveAllButton))
|
||||
.addGap(37, 37, 37)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(jLabel5)
|
||||
.addComponent(jLabel3))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(ScrollPaneOfArtifacts, javax.swing.GroupLayout.PREFERRED_SIZE, 397, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(UpdateButton)
|
||||
.addComponent(CancelButton))
|
||||
.addContainerGap(58, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed
|
||||
createButton();
|
||||
}//GEN-LAST:event_CreateButtonActionPerformed
|
||||
|
||||
private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed
|
||||
removeAllButton();
|
||||
}//GEN-LAST:event_RemoveAllButtonActionPerformed
|
||||
|
||||
private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed
|
||||
if(updateButon()){
|
||||
mainUI.setResultsClosed();
|
||||
setVisible(false);
|
||||
dispose();
|
||||
}
|
||||
}//GEN-LAST:event_UpdateButtonActionPerformed
|
||||
|
||||
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
|
||||
mainUI.setResultsClosed();
|
||||
}//GEN-LAST:event_formWindowClosing
|
||||
|
||||
private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed
|
||||
mainUI.setResultsClosed();
|
||||
setVisible(false);
|
||||
}//GEN-LAST:event_CancelButtonActionPerformed
|
||||
|
||||
// BUTTONS //
|
||||
|
||||
// Adds a new artifact panel
|
||||
private void createButton(){
|
||||
addResultsPanel(new ArtifactPanels(this, ResultsData.containerList,data.rowCount+1));
|
||||
resultsScrollPaneBar.setValue(resultsScrollPaneBar.getMaximum());
|
||||
}
|
||||
|
||||
// Updates the results data object basd on the current results configuration UI state
|
||||
private boolean updateButon(){
|
||||
boolean retval = true;
|
||||
data.updateListofArtifacts(PanelofArtifacts);
|
||||
saved = new ResultsData(data);
|
||||
String fname = saved.writeResultsConfig(true);
|
||||
if(fname == null){
|
||||
retval = false;
|
||||
}else{
|
||||
this.mainUI.getCurrentData().setResultsData(saved);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Removes all the artifact panels
|
||||
private void removeAllButton(){
|
||||
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){
|
||||
removeAllArtifacts();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CORE FUNCTIONS//
|
||||
|
||||
// Adds artifact panel
|
||||
public int resultsPanePanelLength = 0;
|
||||
private JScrollBar resultsScrollPaneBar;
|
||||
private void addResultsPanel(ArtifactPanels panel){
|
||||
//Resize the JPanel Holding all the ResultArtifactsPanels to fit another one (makes the scroll bar resize and should show all objects listed)
|
||||
//as of 8/24/2020 the PanelofArtifacts uses a flow layout with a horizontal gap of 5, that's where the 5 comes from in the line below
|
||||
resultsPanePanelLength+=panel.getPreferredSize().height+5;
|
||||
PanelofArtifacts.setPreferredSize(new Dimension(0,resultsPanePanelLength));
|
||||
|
||||
// Create the Result Artifact Panel and add it
|
||||
data.rowCount++;
|
||||
PanelofArtifacts.add(panel); //takes in parent(this), containerlist, rowcount
|
||||
|
||||
// Redraw GUI with the new Panel
|
||||
PanelofArtifacts.revalidate();
|
||||
PanelofArtifacts.repaint();
|
||||
}
|
||||
|
||||
// Removes all the artifact lines for the lab *note: this doesn't update results.config or the resultsData until the user hits the update button
|
||||
private void removeAllArtifacts(){
|
||||
data.rowCount = 0;
|
||||
resultsPanePanelLength = 0;
|
||||
PanelofArtifacts.setPreferredSize(new Dimension(0,resultsPanePanelLength));
|
||||
Component[] componentList = PanelofArtifacts.getComponents();
|
||||
for(Component c: componentList){
|
||||
PanelofArtifacts.remove(c);
|
||||
}
|
||||
|
||||
PanelofArtifacts.revalidate();
|
||||
PanelofArtifacts.repaint();
|
||||
}
|
||||
|
||||
// loads the artifact panels based on the current data
|
||||
protected void loadUI(){
|
||||
removeAllArtifacts();
|
||||
//redraw the artifacts
|
||||
for(int i=0; i < data.listofArtifacts.size(); i++)
|
||||
loadArtifact(data.listofArtifacts.get(i), i+1);
|
||||
}
|
||||
|
||||
// Load the artifactlinePanel into GUI
|
||||
private void loadArtifact(ArtifactValues artifactVal, int rowNum){
|
||||
ArtifactPanels newArtifact = new ArtifactPanels(this, ResultsData.containerList, rowNum,
|
||||
artifactVal.resultTag,
|
||||
artifactVal.container,
|
||||
artifactVal.fileID,
|
||||
artifactVal.fieldType,
|
||||
artifactVal.fieldID,
|
||||
artifactVal.lineType,
|
||||
artifactVal.lineID,
|
||||
artifactVal.timeStampType,
|
||||
artifactVal.timeStampDelimiter,
|
||||
artifactVal.comments);
|
||||
addResultsPanel(newArtifact);
|
||||
}
|
||||
|
||||
//Updates the list of artifacts and redraws them on screen
|
||||
public void refresh(){
|
||||
data.updateListofArtifacts(PanelofArtifacts);
|
||||
loadUI();
|
||||
}
|
||||
|
||||
|
||||
// OTHER //
|
||||
|
||||
public void refactorContainerReferenceInUI(String oldName, String newName){
|
||||
data.updateListofArtifacts(PanelofArtifacts);
|
||||
data.refactorContainerReference(oldName, newName);
|
||||
saved.refactorContainerReference(oldName, newName);
|
||||
loadUI();
|
||||
}
|
||||
|
||||
//Check if the the current state of the UI matches with what's saved in the results.config
|
||||
/*
|
||||
void checkUnsavedChangesMade(){
|
||||
data.updateListofArtifacts(PanelofArtifacts);
|
||||
|
||||
if(artifactValuesDiffer(data.listofArtifacts, data.getArtifactValuesOfConfigFile())){
|
||||
int confirmed = JOptionPane.showConfirmDialog(null,
|
||||
"There are Unsaved Changes. Are you sure you want to exit the program?", "Unsaved Changes",
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
|
||||
if (confirmed == JOptionPane.YES_OPTION)
|
||||
dispose();
|
||||
else
|
||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
}
|
||||
else
|
||||
dispose();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// GETTERS //
|
||||
|
||||
//Gets the panel holding the artifacts
|
||||
protected JPanel getPanelofArtifacts(){
|
||||
return PanelofArtifacts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the dialog */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ResultsUI dialog = new ResultsUI(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton CancelButton;
|
||||
private javax.swing.JButton CreateButton;
|
||||
private javax.swing.JPanel PanelofArtifacts;
|
||||
private javax.swing.JButton RemoveAllButton;
|
||||
private javax.swing.JScrollPane ScrollPaneOfArtifacts;
|
||||
private javax.swing.JButton UpdateButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
labtainerPath=
|
||||
prevLab=
|
||||
textEditor=
|
||||
@@ -0,0 +1,9 @@
|
||||
base2
|
||||
network2
|
||||
network.ssh2
|
||||
firefox
|
||||
wireshark2
|
||||
java
|
||||
lamp.xtra
|
||||
centos.xtra
|
||||
bird
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
BIN
modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/staging/dist/mainui.jar
vendored
Normal file
BIN
modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/staging/dist/mainui.jar
vendored
Normal file
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
#1.4
|
||||
gnome-terminal -e 'vi example'
|
||||
@@ -0,0 +1,115 @@
|
||||
9/8/2020
|
||||
CODE WRITTEN BY: Daniel Liao
|
||||
|
||||
PROGRAM/CODE STRUCTURE:
|
||||
|
||||
- The mainUI object has a 'lab' data object inside that stores the current state of the UI.
|
||||
- This 'lab' data object includes:
|
||||
- List of 'Container' data objects
|
||||
- List of 'Network' data objects
|
||||
- 'Results' Data object
|
||||
- 'Goals' Data object
|
||||
- When a user saves the lab the program writes whatever is in the 'lab' data object
|
||||
to the lab files, namely start.config, results.config, and goals.config.
|
||||
- All Results UI/Data code are in their own package
|
||||
and all Goals UI/Data code are in their own package
|
||||
- Each Container/Network Panel Object has a Container/Network data object
|
||||
that references the same Contaienr/Network data object in the data object
|
||||
lists in the 'lab' data object.
|
||||
- So when you press confirm for each container/network configuration
|
||||
dialog box, it changes the Container/Network data object in the
|
||||
'lab' data object.
|
||||
|
||||
- The Results/Goals UI have their own results data object, NOT a reference pointing to
|
||||
the results/goals data object in the 'lab' data object.
|
||||
- When initially opening the results/goals UI the results/goals data object here is
|
||||
a copy from the main UI's 'lab' data.
|
||||
- When the user presses confirm changes in the Goals/Results UI, it makes a deep copy
|
||||
of the current data state here and sets it to the results/goals data object in the
|
||||
'lab' data object.
|
||||
|
||||
-Immediate changes to a lab's files and directories occur when the user:
|
||||
- Deletes a container
|
||||
- Renames a container
|
||||
- Adds a container
|
||||
- Edit a container's dockerfile
|
||||
|
||||
- All other changes are written to the labs files when the user
|
||||
presses save lab/save lab as.
|
||||
|
||||
|
||||
TODOS:
|
||||
|
||||
- RUN/BUILD Button
|
||||
- Validation on User Input outside of Goals and Results UI
|
||||
- Tooltips on all the fields
|
||||
- LOGS Button (Pulls up terminal window that spits program output)
|
||||
- Parameter Configuration Button/UI
|
||||
- Menu Items
|
||||
- Help
|
||||
- Help/About
|
||||
- Help/Check For Updates
|
||||
- UI Consistency in Goals UI and Results UI when a results artifact line is modified/deleted
|
||||
and container is renamed/deleted/added, respectively
|
||||
|
||||
|
||||
NOTES AND CONCERNS TO ADDRESS:
|
||||
|
||||
- The program as of now has a high potential for bugs, so
|
||||
it's imperative to do extensive testing for a series of
|
||||
actions.
|
||||
|
||||
Ex. Having the Results UI opened and deleting a container
|
||||
that an artifact line is referencing. Does the Results visual
|
||||
interface have continuity?
|
||||
|
||||
- The project was 3 main functions from 3 seperate packages,
|
||||
so the current build script may not work
|
||||
|
||||
- When user updates the LABTAINERS DIR path, what happens if the new set path is a
|
||||
place where the currently opened lab does not exist. A bug can occur if the
|
||||
user opens a lab, saves/save as a lab, renames a conainer, adds a container,
|
||||
or deletes a container. (Essentially any part of the program that references the
|
||||
lab path, since the lab path is relative to the LABTAINERS DIR)
|
||||
|
||||
- Parts of the UI that use a JPanel and JScrollPane, may make use of magic numbers when
|
||||
adding and removing subpanels from the JPanel to adjust for the exact needed height
|
||||
to fit all the subpanels visibly.
|
||||
|
||||
UI DEVELOPER NOTE:
|
||||
- To ensure you can build and run the netbeans project for the UI, follow these steps:
|
||||
Installing Netbeans:
|
||||
1) sudo apt-get update
|
||||
2) sudo snap install netbeans --classic
|
||||
3) bash
|
||||
|
||||
Installing Java JDK 14 (from method 2 of https://computingforgeeks.com/how-to-install-java-14-on-ubuntu-debian/)
|
||||
4) sudo add-apt-repository ppa:linuxuprising/java
|
||||
5) sudo apt -y install oracle-java14-installer
|
||||
6) sudo apt -y install oracle-java14-set-default
|
||||
7) sudo nano /etc/profile.d/jdk.sh
|
||||
a) Add "export PATH=$PATH:$JAVA_HOME/bin"
|
||||
8) source /etc/profile.d/jdk.sh
|
||||
|
||||
Opening Netbeans and Setting the environment
|
||||
9) netbeans
|
||||
In the netbeans program...
|
||||
10) open the netbeans project folder 'MainUI'
|
||||
11) install the plugins that pop up
|
||||
12) Right-click 'MainUI' in the 'Projects' tab and select 'Resolve Project Problems'
|
||||
13) Select Resolve
|
||||
14) If the Java Platform Manager pops up then select 'Add Platform'
|
||||
15) Make sure 'Java Standard Edition' is selected and press Next.
|
||||
15) Find the folder '/usr/lib/jvm/java-14-oracle'
|
||||
16) Press Next and then Finish
|
||||
17) Ensure that 'JDK 14' is selected (not 'JDK 14 (Default)') in the Java Platform Manager, and press Close.
|
||||
18) Select the next Project Problem which should be "Some dependency artifacts are not in..." and press Resolve.
|
||||
19) Press Close when finished.
|
||||
20) Close netbeans and reopen it by entering 'netbeans' in the terminal
|
||||
21) Press the run button and when prompted for the main class select "labtainers.mainui.MainWindow" and enter.
|
||||
|
||||
Now you should be all set to develop the labtainers UI
|
||||
|
||||
If you have any questions about the program and code, feel free to contact me at danielliao22@gmail.com
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="ResultsUIAug30" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project ResultsUIAug30.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="ResultsUIAug30-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
@@ -1,3 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
||||
build.xml.data.CRC32=06f40a7b
|
||||
build.xml.script.CRC32=dc6ed3ed
|
||||
build.xml.stylesheet.CRC32=8064a381@1.80.1.48
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=06f40a7b
|
||||
nbproject/build-impl.xml.script.CRC32=486037cd
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
|
||||
@@ -1,2 +0,0 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Users\\Dan\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
|
||||
@@ -1,75 +0,0 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/ResultsUIAug30.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${libs.absolutelayout.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.8
|
||||
javac.target=1.8
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=ResultsUI.ResultsUI
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>ResultsUIAug30</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -1,355 +0,0 @@
|
||||
package ResultsUI;
|
||||
|
||||
|
||||
import static ResultsUI.ResultsData.artifactValuesDiffer;
|
||||
import java.awt.Component;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dan
|
||||
*/
|
||||
public class ResultsUI extends javax.swing.JFrame {
|
||||
ResultsData dataUI;
|
||||
|
||||
public ResultsUI() {
|
||||
initComponents();
|
||||
LabNotExist.setVisible(false);
|
||||
|
||||
dataUI = new ResultsData();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
ScrollPaneOfArtifacts = new javax.swing.JScrollPane();
|
||||
PanelofArtifacts = new javax.swing.JPanel();
|
||||
UpdateButton = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
RemoveAllButton = new javax.swing.JButton();
|
||||
jLabel9 = new javax.swing.JLabel();
|
||||
CreateButton = new javax.swing.JButton();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
LabNameTextField = new javax.swing.JTextField();
|
||||
LabNotExist = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setBackground(new java.awt.Color(255, 255, 255));
|
||||
setMinimumSize(new java.awt.Dimension(1590, 500));
|
||||
setPreferredSize(new java.awt.Dimension(1585, 389));
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
public void windowClosing(java.awt.event.WindowEvent evt) {
|
||||
formWindowClosing(evt);
|
||||
}
|
||||
});
|
||||
|
||||
ScrollPaneOfArtifacts.setAutoscrolls(true);
|
||||
ScrollPaneOfArtifacts.setMaximumSize(new java.awt.Dimension(1300, 800));
|
||||
|
||||
PanelofArtifacts.setLayout(new javax.swing.BoxLayout(PanelofArtifacts, javax.swing.BoxLayout.PAGE_AXIS));
|
||||
ScrollPaneOfArtifacts.setViewportView(PanelofArtifacts);
|
||||
|
||||
UpdateButton.setText("Update");
|
||||
UpdateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
UpdateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel2.setText("Container");
|
||||
jLabel2.setToolTipText("Identifies the container hosting the file. \nIf \"ALL\" is selected, then the file is across all the containers.");
|
||||
|
||||
RemoveAllButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N
|
||||
RemoveAllButton.setText("Remove All");
|
||||
RemoveAllButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
RemoveAllButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel9.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N
|
||||
jLabel9.setText("Lab Name: ");
|
||||
|
||||
CreateButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N
|
||||
CreateButton.setText("Create");
|
||||
CreateButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
CreateButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel3.setText("Field Type");
|
||||
jLabel3.setToolTipText("The mode in which a value is found.");
|
||||
|
||||
jLabel5.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel5.setText("File");
|
||||
jLabel5.setToolTipText("File should either be a file path or a program/utility name with the \".stdin\", \".stdout\", or \".prgout\" extension.\n\n Ex. \"test.stdin\", \".local/result/sniff.txt\" ");
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
|
||||
jLabel1.setText("Result Tag");
|
||||
jLabel1.setToolTipText("The symbolic name of the result, which will be referenced in the goals configuration file. \n\n(It must be alphanumeric, underscores permitted) ");
|
||||
|
||||
LabNameTextField.setPreferredSize(new java.awt.Dimension(6, 25));
|
||||
LabNameTextField.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
LabNameTextFieldActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
LabNotExist.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
|
||||
LabNotExist.setText("Lab does not exist!");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(CreateButton)
|
||||
.addGap(10, 10, 10)
|
||||
.addComponent(RemoveAllButton)
|
||||
.addGap(98, 98, 98)
|
||||
.addComponent(jLabel9)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(LabNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(LabNotExist)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 344, Short.MAX_VALUE)
|
||||
.addComponent(UpdateButton))
|
||||
.addComponent(ScrollPaneOfArtifacts, javax.swing.GroupLayout.DEFAULT_SIZE, 1300, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(60, 60, 60)
|
||||
.addComponent(jLabel1)
|
||||
.addGap(74, 74, 74)
|
||||
.addComponent(jLabel2)
|
||||
.addGap(66, 66, 66)
|
||||
.addComponent(jLabel5)
|
||||
.addGap(131, 131, 131)
|
||||
.addComponent(jLabel3)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(CreateButton)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(RemoveAllButton)
|
||||
.addComponent(jLabel9)
|
||||
.addComponent(LabNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(UpdateButton)
|
||||
.addComponent(LabNotExist)))
|
||||
.addGap(14, 14, 14)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(jLabel5)
|
||||
.addComponent(jLabel3))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(ScrollPaneOfArtifacts, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed
|
||||
update();
|
||||
}//GEN-LAST:event_UpdateButtonActionPerformed
|
||||
|
||||
private void update(){
|
||||
if(dataUI.labloaded)
|
||||
dataUI.writeResultsConfig(PanelofArtifacts);
|
||||
}
|
||||
|
||||
private void LabNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LabNameTextFieldActionPerformed
|
||||
loadLab();
|
||||
}//GEN-LAST:event_LabNameTextFieldActionPerformed
|
||||
|
||||
//Checks if the lab exists and will load lab's result config if it does
|
||||
private void loadLab(){
|
||||
dataUI = new ResultsData(getLabName());
|
||||
//System.out.println("RowCount(Load): " + dataUI.rowCount);
|
||||
|
||||
if(dataUI.labloaded){
|
||||
LabNotExist.setVisible(false);
|
||||
artifactsPanelRedraw();
|
||||
}
|
||||
else
|
||||
LabNotExist.setVisible(true);
|
||||
}
|
||||
|
||||
private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed
|
||||
createFreshArtifact();
|
||||
}//GEN-LAST:event_CreateButtonActionPerformed
|
||||
|
||||
//Creates and loads a new artifact row
|
||||
private void createFreshArtifact(){
|
||||
if(dataUI.labloaded){
|
||||
dataUI.rowCount++;
|
||||
ArtifactPanels newArtifact = new ArtifactPanels(this, dataUI.containerList, dataUI.rowCount);
|
||||
PanelofArtifacts.add(newArtifact);
|
||||
PanelofArtifacts.revalidate();
|
||||
PanelofArtifacts.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed
|
||||
removeAllButton();
|
||||
}//GEN-LAST:event_RemoveAllButtonActionPerformed
|
||||
|
||||
private void removeAllButton(){
|
||||
if(dataUI.labloaded){
|
||||
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){
|
||||
removeAllArtifacts();
|
||||
dataUI.rowCount = 0;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
|
||||
checkUnsavedChangesMade();
|
||||
}//GEN-LAST:event_formWindowClosing
|
||||
|
||||
//Check if the the current state of the UI matches with what's saved in the goals.config
|
||||
void checkUnsavedChangesMade(){
|
||||
if(dataUI.labloaded){
|
||||
dataUI.updateListofArtifacts(PanelofArtifacts);
|
||||
|
||||
if(artifactValuesDiffer(dataUI.listofArtifacts, dataUI.getArtifactValuesOfConfigFile())){
|
||||
int confirmed = JOptionPane.showConfirmDialog(null,
|
||||
"There are Unsaved Changes. Are you sure you want to exit the program?", "Unsaved Changes",
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
|
||||
if (confirmed == JOptionPane.YES_OPTION)
|
||||
dispose();
|
||||
else
|
||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
}
|
||||
else
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
||||
//General Methods
|
||||
//Updates the list of artifacts and redraws them on screen
|
||||
void refresh(){
|
||||
dataUI.updateListofArtifacts(PanelofArtifacts);
|
||||
artifactsPanelRedraw();
|
||||
}
|
||||
|
||||
//Redraws the artifacts Panel
|
||||
void artifactsPanelRedraw(){
|
||||
removeAllArtifacts();
|
||||
//redraw the artifacts
|
||||
for(int i=0; i < dataUI.listofArtifacts.size(); i++){
|
||||
loadArtifact(dataUI.listofArtifacts.get(i), i+1);
|
||||
}
|
||||
}
|
||||
|
||||
//Removes all the artifact lines for the lab *note: this doesn't update results.config or the resultsData until the user hits the update button
|
||||
private void removeAllArtifacts(){
|
||||
Component[] componentList = PanelofArtifacts.getComponents();
|
||||
for(Component c: componentList)
|
||||
PanelofArtifacts.remove(c);
|
||||
|
||||
PanelofArtifacts.revalidate();
|
||||
PanelofArtifacts.repaint();
|
||||
}
|
||||
|
||||
//Load's the artifactlinePanel into GUI
|
||||
private void loadArtifact(ArtifactValues artifactVal, int rowNum){
|
||||
ArtifactPanels newArtifact = new ArtifactPanels(this, dataUI.containerList, rowNum,
|
||||
artifactVal.resultTag,
|
||||
artifactVal.container,
|
||||
artifactVal.fileID,
|
||||
artifactVal.fieldType,
|
||||
artifactVal.fieldID,
|
||||
artifactVal.lineType,
|
||||
artifactVal.lineID,
|
||||
artifactVal.timeStampType,
|
||||
artifactVal.timeStampDelimiter);
|
||||
PanelofArtifacts.add(newArtifact);
|
||||
PanelofArtifacts.revalidate();
|
||||
PanelofArtifacts.repaint();
|
||||
}
|
||||
|
||||
//Gets the labname
|
||||
private String getLabName(){
|
||||
return LabNameTextField.getText();
|
||||
}
|
||||
|
||||
//Gets the panel holding the artifacts
|
||||
protected JPanel getPanelofArtifacts(){
|
||||
return PanelofArtifacts;
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(() -> {
|
||||
ResultsUI newResultsUI = new ResultsUI();
|
||||
newResultsUI.setSize(1005, 1000);
|
||||
newResultsUI.setVisible(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton CreateButton;
|
||||
private javax.swing.JTextField LabNameTextField;
|
||||
private javax.swing.JLabel LabNotExist;
|
||||
private javax.swing.JPanel PanelofArtifacts;
|
||||
private javax.swing.JButton RemoveAllButton;
|
||||
private javax.swing.JScrollPane ScrollPaneOfArtifacts;
|
||||
private javax.swing.JButton UpdateButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package ResultsUI;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dan
|
||||
*/
|
||||
public class ToolTipHandlers {
|
||||
public static interface ToolTipProvider{
|
||||
public String getToolTip();
|
||||
}
|
||||
|
||||
//Stores an item and its correspoinding tool tip. (Items put into a combobox)
|
||||
public static class ToolTipWrapper implements ToolTipProvider{
|
||||
final String item;
|
||||
final String toolTip;
|
||||
|
||||
public ToolTipWrapper(String item, String toolTip){
|
||||
this.item = item;
|
||||
this.toolTip = toolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolTip(){
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return item;
|
||||
}
|
||||
|
||||
public String getItem(){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
//custom combobox renderer to handle ToolTipWrapper objects that contain an string item and string tool tip
|
||||
public static class ComboBoxRenderer extends DefaultListCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
JComponent component = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
String tip = null;
|
||||
if (value instanceof ToolTipProvider) {
|
||||
ToolTipProvider ttp = (ToolTipProvider) value;
|
||||
tip = ttp.getToolTip();
|
||||
}
|
||||
list.setToolTipText(tip);
|
||||
return component;
|
||||
}
|
||||
}
|
||||
|
||||
//Sets the combo items with associated tool tips (called in the constructors)
|
||||
public static void setComboItems(JComboBox combobox, ToolTipWrapper[] items){
|
||||
ComboBoxRenderer renderer = new ComboBoxRenderer();
|
||||
combobox.setRenderer(renderer);
|
||||
|
||||
for (ToolTipWrapper item : items) {
|
||||
combobox.addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/buildUI2.sh
Executable file
10
modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/buildUI2.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Rebuild the Labtianers Lab Editor UI
|
||||
# Use -n to supress running the UI after rebuild.
|
||||
#
|
||||
/usr/bin/javac ../MainUI/src/main/java/labtainers/goalsui/*.java ../MainUI/src/main/java/labtainers/resultsui/*.java ../MainUI/src/main/java/labtainers/paramsui/*.java ../MainUI/src/main/java/labtainers/mainui/*.java -d . -Xlint:unchecked || exit
|
||||
jar cmf mainUI.mf ./MainUI.jar labtainers/mainui/*.class labtainers/goalsui/*.class labtainers/resultsui/*.class labtainers/paramsui/*.class ../MainUI/src/main/resources/* || exit
|
||||
if [[ "$1" != "-n" ]]; then
|
||||
/usr/bin/java -jar MainUI.jar
|
||||
fi
|
||||
@@ -0,0 +1,3 @@
|
||||
labtainerPath=
|
||||
prevLab=
|
||||
textEditor=
|
||||
@@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: labtainers/mainui/MainWindow
|
||||
@@ -0,0 +1,12 @@
|
||||
README for creating Azure Labtainer VHD image and storing in Azure blob storage for use by Labtainers VMs
|
||||
|
||||
Use the base_create_vm.sh script to create a base VM, provide the user name "base"
|
||||
|
||||
Use generalize.sh to generalize and stop the VM
|
||||
|
||||
Delete the existing blob if it exists with delete_blob.sh
|
||||
Copy the base disk image to the blob using copy_to_blob.sh (after sourcing account_env.sh)
|
||||
Remove the vm using delete_vm.sh
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user