Remove CloseListener

This commit is contained in:
Chris Beams 2014-11-22 20:56:06 +01:00
parent f4b35ba48b
commit 22443900a9
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
4 changed files with 4 additions and 54 deletions

View File

@ -1,22 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui;
public interface CloseListener {
void onClosed();
}

View File

@ -177,7 +177,7 @@ public class TradeView extends ActivatableView implements TradeNavigator {
createOfferViewCB.setParent(this);
createOfferViewCB.initWithData(direction, amount, price);
final Tab tab = new Tab("Create offer");
createOfferViewCB.configCloseHandlers(this::onCreateOfferViewRemoved, tab.closableProperty());
createOfferViewCB.configCloseHandlers(tab.closableProperty());
tab.setContent(createOfferView);
tabPane.getTabs().add(tab);
tabPane.getSelectionModel().select(tab);
@ -193,7 +193,7 @@ public class TradeView extends ActivatableView implements TradeNavigator {
takeOfferViewCB.setParent(this);
takeOfferViewCB.initWithData(direction, amount, offer);
final Tab tab = new Tab("Take offer");
takeOfferViewCB.setCloseListener(this::onCreateOfferViewRemoved, tab.closableProperty());
takeOfferViewCB.configCloseHandlers(tab.closableProperty());
tab.setContent(takeOfferView);
tabPane.getTabs().add(tab);
tabPane.getSelectionModel().select(tab);

View File

@ -18,7 +18,6 @@
package io.bitsquare.gui.main.trade.createoffer;
import io.bitsquare.gui.ActivatableView;
import io.bitsquare.gui.CloseListener;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.components.AddressTextField;
@ -80,7 +79,6 @@ public class CreateOfferView extends ActivatableView<CreateOfferViewModel> {
private final Navigation navigation;
private final OverlayManager overlayManager;
private CloseListener closeListener;
private BooleanProperty tabIsClosable;
private boolean detailsVisible;
@ -145,17 +143,6 @@ public class CreateOfferView extends ActivatableView<CreateOfferViewModel> {
tabIsClosable.unbind();
}
@Override
public void terminate() {
super.terminate();
// Inform parent that we got removed.
// Needed to reset disable state of createOfferButton in OfferBookController
if (closeListener != null)
closeListener.onClosed();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods (called form other views/CB)
///////////////////////////////////////////////////////////////////////////////////////////
@ -169,8 +156,7 @@ public class CreateOfferView extends ActivatableView<CreateOfferViewModel> {
imageView.setId("image-sell-large");
}
public void configCloseHandlers(CloseListener closeListener, BooleanProperty tabIsClosable) {
this.closeListener = closeListener;
public void configCloseHandlers(BooleanProperty tabIsClosable) {
this.tabIsClosable = tabIsClosable;
tabIsClosable.bind(model.tabIsClosable);
}

View File

@ -19,7 +19,6 @@ package io.bitsquare.gui.main.trade.takeoffer;
import io.bitsquare.gui.ActivatableView;
import io.bitsquare.gui.CloseListener;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.components.AddressTextField;
@ -74,7 +73,6 @@ public class TakeOfferView extends ActivatableView<TakeOfferViewModel> {
private final Navigation navigation;
private final OverlayManager overlayManager;
private CloseListener closeListener;
private BooleanProperty tabIsClosable;
private boolean detailsVisible;
@ -133,16 +131,6 @@ public class TakeOfferView extends ActivatableView<TakeOfferViewModel> {
setupBindings();
}
@Override
public void terminate() {
super.terminate();
// Inform parent that we got removed.
if (closeListener != null)
closeListener.onClosed();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods (called form other views/CB)
///////////////////////////////////////////////////////////////////////////////////////////
@ -177,13 +165,11 @@ public class TakeOfferView extends ActivatableView<TakeOfferViewModel> {
acceptedArbitratorsTextField.setText(model.getAcceptedArbitrators());
}
public void setCloseListener(CloseListener closeListener, BooleanProperty tabIsClosable) {
this.closeListener = closeListener;
public void configCloseHandlers(BooleanProperty tabIsClosable) {
this.tabIsClosable = tabIsClosable;
tabIsClosable.bind(model.tabIsClosable);
}
///////////////////////////////////////////////////////////////////////////////////////////
// UI Handlers
///////////////////////////////////////////////////////////////////////////////////////////