-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added some UX improvements, refactored the code to get rid of shared …
…myhttprequests instance and instead use events to pass the list
- Loading branch information
Showing
11 changed files
with
127 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,53 @@ | ||
package swurg.gui; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import javax.swing.JTabbedPane; | ||
|
||
import burp.api.montoya.MontoyaApi; | ||
import burp.http.MyHttpRequest; | ||
import lombok.Getter; | ||
import swurg.gui.views.AboutPanel; | ||
import swurg.gui.views.ParametersPanel; | ||
import swurg.gui.views.ParserPanel; | ||
import swurg.observers.MyObserver; | ||
import swurg.observers.TableModelObserver; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class MainTabGroup extends JTabbedPane implements MyObserver { | ||
public class MainTabGroup extends JTabbedPane implements TableModelObserver { | ||
|
||
private final MontoyaApi montoyaApi; | ||
|
||
private final List<MyHttpRequest> myHttpRequests; | ||
|
||
@Getter | ||
private ParserPanel parserPanel; | ||
@Getter | ||
private ParametersPanel parametersPanel; | ||
private AboutPanel aboutPanel; | ||
|
||
public MainTabGroup(MontoyaApi montoyaApi) { | ||
this.montoyaApi = montoyaApi; | ||
this.myHttpRequests = new ArrayList<>(); | ||
|
||
initComponents(); | ||
|
||
this.parserPanel.getParserTableModel().registerObserver(this); | ||
this.parserPanel.getParserTableModel().registerObserver(this.parserPanel); | ||
this.parserPanel.getParserTableModel().registerObserver(this.parametersPanel); | ||
} | ||
|
||
private void initComponents() { | ||
parserPanel = new ParserPanel(this.montoyaApi, this.myHttpRequests); | ||
parserPanel = new ParserPanel(this.montoyaApi); | ||
aboutPanel = new AboutPanel(this.montoyaApi); | ||
parametersPanel = new ParametersPanel(this.montoyaApi, this.myHttpRequests); | ||
parametersPanel = new ParametersPanel(this.montoyaApi); | ||
|
||
addTab("Parser", parserPanel); | ||
addTab("About", aboutPanel); | ||
this.addTab("Parser", parserPanel); | ||
this.addTab("About", aboutPanel); | ||
} | ||
|
||
@Override | ||
public void onMyHttpRequestsUpdate() { | ||
if (indexOfComponent(this.parametersPanel) == -1 && !this.myHttpRequests.isEmpty()) { | ||
removeTabAt(indexOfComponent(this.aboutPanel)); | ||
addTab("Parameters", this.parametersPanel); | ||
addTab("About", this.aboutPanel); | ||
} else if (indexOfComponent(this.parametersPanel) != -1 && this.myHttpRequests.isEmpty()) | ||
removeTabAt(indexOfComponent(this.parametersPanel)); | ||
public void onMyHttpRequestsUpdate(int event, List<MyHttpRequest> myHttpRequests) { | ||
if (indexOfComponent(this.parametersPanel) == -1 && !myHttpRequests.isEmpty()) { | ||
this.removeTabAt(indexOfComponent(this.aboutPanel)); | ||
this.addTab("Parameters", this.parametersPanel); | ||
this.addTab("About", this.aboutPanel); | ||
} else if (indexOfComponent(this.parametersPanel) != -1 && myHttpRequests.isEmpty()) | ||
this.removeTabAt(indexOfComponent(this.parametersPanel)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.