0 Replies Latest reply on Feb 10, 2014 10:08 PM by Yernar Adilbekov

    Create single Presenter with some Views and realization switching between Views

    Yernar Adilbekov Newbie

      I have single Presenter

      @Page(path = "/configuration/system")
      @Dependent
      public class SystemConfigurationPagePresenter implements Presenter {
          private static final Logger logger = LoggerFactory.getLogger(SystemConfigurationPagePresenter.class);
          public interface EventLogView {
              EventLogParams getModel();
              void setModel(EventLogParams eventLogParams);
              Element getPageTitle();
              FormWidget getMinTermStorage();
              FormWidget isAutoClearLog();
              HasClickHandlers getSaveButton();
              HasClickHandlers getCancelButton();
              Widget asWidget();
          }
          public interface FunctionalSubsystem {
              FunctionalSubsystemParams getModel();
              void setModel(FunctionalSubsystemParams eventLogParams);
              Element getPageTitle();
              Widget asWidget();
          }
          public interface DateExpluatation {
              DateExpluatation getModel();
              void setModel(DateExpluatation eventLogParams);
              Element getPageTitle();
              FormWidget getDateExpluatation();
              Widget asWidget();
          }
          @Inject
          private Instance<EventLogView> eventLogViews;
      
          @Inject
          private Instance<FunctionalSubsystem> functionalSubsystems;
      
          @Inject
          private Instance<DateExpluatation> dateExpluatations;
      
          @Override
          public Widget asWidget() {
              return view.asWidget();
          }
      }
      

       

      and Pages that are identical in structure :

      @Templated
      @Dependent
      public class EventLogConfigurationPage extends Composite implements SystemConfigurationPagePresenter.EventLogView{
      
          @Inject
          @AutoBound
          private DataBinder<EventLogParams> eventLogParamsDataBinder;
      
          @DataField
          private HeadingElement title = Document.get().createHElement(4);
      
          @DataField
          @Bound
          private LabeledWidget<TextBox> minTermStorage = new LabeledWidget("Срок минимального хранения информации в журнале событий(в днях)", false, new TextBox() {{
              setMaxLength(2);
          }});
      
          @Inject
          @DataField
          private Button saveButton;
      
          @Inject
          @DataField
          private Button cancelButton;
      
          @DataField
          @Bound
          private ConfigLabeledWidget<CheckBox> autoClearLog = new ConfigLabeledWidget("Автоматическая чистка журнала", new CheckBox());
      
          @Override
          public EventLogParams getModel() {
              return eventLogParamsDataBinder.getModel();
          }
      
          @Override
          public void setModel(EventLogParams eventLogParams) {
              eventLogParamsDataBinder.setModel(eventLogParams);
          }
      
          @Override
          public Element getPageTitle() {
              return title;
          }
      
          @Override
          public FormWidget getMinTermStorage() {
              return minTermStorage;
          }
      
          @Override
          public FormWidget isAutoClearLog() {
              return autoClearLog;
          }
      
          @Override
          public HasClickHandlers getSaveButton() {
              return saveButton;
          }
      
          @Override
          public HasClickHandlers getCancelButton() {
              return cancelButton;
          }
      
      }
      

       

      I want to boot when switching tabs in TabLayoutPabel another View?!