Add method to reset Dashboard
This commit is contained in:
parent
8cea5f006a
commit
00ac1f27e9
3 changed files with 18 additions and 4 deletions
|
@ -157,13 +157,11 @@ public class BodyTabController implements Initializable {
|
|||
public void setState(ComposerState state) {
|
||||
// Adding URL tab's tuples
|
||||
if (state.urlStringTuples != null) {
|
||||
urlTabController.clear();
|
||||
for (FieldState fieldState : state.urlStringTuples)
|
||||
urlTabController.addField(fieldState);
|
||||
}
|
||||
|
||||
// Adding Form tab's string tuples
|
||||
formDataTabController.clear();
|
||||
if (state.formStringTuples != null) {
|
||||
for (FieldState fieldState : state.formStringTuples)
|
||||
formDataTabController.addStringField(fieldState);
|
||||
|
@ -178,6 +176,14 @@ public class BodyTabController implements Initializable {
|
|||
filePathField.setText(state.binaryFilePath);
|
||||
}
|
||||
|
||||
void reset() {
|
||||
urlTabController.clear();
|
||||
formDataTabController.clear();
|
||||
rawInputArea.clear();
|
||||
rawInputTypeBox.setValue("PLAIN TEXT");
|
||||
filePathField.clear();
|
||||
}
|
||||
|
||||
private void setRawTab(ComposerState state) {
|
||||
HighlightMode mode;
|
||||
|
||||
|
|
|
@ -657,13 +657,11 @@ public class DashboardController implements Initializable {
|
|||
addressField.setText(state.composer.target);
|
||||
|
||||
if (state.composer.headers != null) {
|
||||
headerTabController.clear();
|
||||
for (FieldState fieldState : state.composer.headers)
|
||||
headerTabController.addHeader(fieldState);
|
||||
}
|
||||
|
||||
if (state.composer.params != null) {
|
||||
clearParams();
|
||||
for (FieldState fieldState : state.composer.params)
|
||||
addParamField(fieldState);
|
||||
}
|
||||
|
@ -672,6 +670,14 @@ public class DashboardController implements Initializable {
|
|||
bodyTabController.setState(state.composer);
|
||||
}
|
||||
|
||||
void reset() {
|
||||
httpMethodBox.setValue("GET");
|
||||
addressField.clear();
|
||||
headerTabController.clear();
|
||||
clearParams();
|
||||
bodyTabController.reset();
|
||||
}
|
||||
|
||||
void clearParams() {
|
||||
if (params != null)
|
||||
params.clear();
|
||||
|
|
|
@ -98,6 +98,7 @@ public class HomeWindowController implements Initializable {
|
|||
tabStateMap.replace(prevTab, dashboardState);
|
||||
|
||||
dashboardState = tabStateMap.get(newTab);
|
||||
dashboard.reset();
|
||||
dashboard.setState(dashboardState);
|
||||
}
|
||||
|
||||
|
@ -165,6 +166,7 @@ public class HomeWindowController implements Initializable {
|
|||
DashboardState dashboardState = new DashboardState();
|
||||
dashboardState.composer = composerState;
|
||||
tabStateMap.put(newTab, dashboardState);
|
||||
homeWindowTabPane.getSelectionModel().select(newTab);
|
||||
}
|
||||
|
||||
private void saveState() {
|
||||
|
|
Loading…
Reference in a new issue