title: How to avoid widgets being added while moving back and on then clicking Next?
body: <p>I have created a Wizard.</p>
  
  <p>it has <code>3</code> pages-</p>
  
  <pre><code>@Override
  public void addPages() {
      super.addPages();
      addPage(firstPage);
      addPage(secondPage);   
      addPage(thirdPage);   
  }
  </code></pre>
  
  <p>For the first page, I have a simple <code>label</code> with a <code>input</code> field to collect user entered value-</p>
  
  <pre><code>    @Override
      public void createControl(Composite parent) {
          Composite page = new Composite(parent, SWT.NONE);
          setControl(page);
          setPageComplete(false);
  
          // page.setLayout(new GridLayout(2, false));
          GridLayout gridLayout = new GridLayout();
          gridLayout.numColumns = 2;
          gridLayout.makeColumnsEqualWidth = false;
          page.setLayout(gridLayout);
  
          page.setLayoutData(new GridData(GridData.FILL_BOTH));
  
          Label label = new Label(page, SWT.NONE);
          label.setText("Interface Id : ");
  
          interfaceId = new Text(page, SWT.BORDER);
          GridData interfaceIdGridData = new GridData(GridData.FILL_HORIZONTAL);
          interfaceId.setLayoutData(interfaceIdGridData);
  
  
  
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WaBjp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WaBjp.png" alt="enter image description here"></a></p>
  
  <p>When the user clicks on the Next button shown on the above wizard page, there is a call to collect some details from external system within <code>getNextPage</code> of the same wizard page.</p>
  
  <p>The user then lands on wizard page <code>2</code> and the details which were fetched in <code>step1</code> are displayed here in Wizard Page 2- </p>
  
  <pre><code>public class InterfaceDetailsPage extends WizardPage {
  
      private Composite top;
      private ScrolledComposite scrolledComposite;
      private Composite page;
  
      private Label responseCode;
      private Label responseMsg;
      private Label interfaceName;
      private Label sourceSystem;
      private Label targetSystem;
      private Label domainName;
      private Label serviceName;
  
      private SelectedServerNode iServer;
      private volatile boolean activityCancelled;
      private CreateSkeletonResponseModel model;
      private CreateSkeletonDisplayResultModel resultModel;
  
      protected InterfaceDetailsPage(SelectedServerNode iServer) {
          super("InterfaceDetailsPage");
  
          this.iServer = iServer;
          setTitle("Component Details");
          setMessage("The requested Interface details are shown below : ");
      }
  
      @Override
      public void createControl(Composite parent) {
  
          top = new Composite(parent, SWT.NONE);
          top.setLayout(new FillLayout());
          setControl(top);
          setPageComplete(false);
  
  
          scrolledComposite = new ScrolledComposite(top, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
          scrolledComposite.setExpandHorizontal(true);
          scrolledComposite.setExpandVertical(true);
  
          page = new Composite(scrolledComposite, SWT.NONE);
          //setControl(page);
  
  
          GridLayout gridLayout = new GridLayout();
          gridLayout.numColumns = 2;
          //gridLayout.makeColumnsEqualWidth = true;
          gridLayout.makeColumnsEqualWidth = false;
          page.setLayout(gridLayout);
          page.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  
  
          scrolledComposite.setContent(page);
          scrolledComposite.setSize(page.computeSize(SWT.DEFAULT, SWT.DEFAULT));
  
  
          GridData gridData = null;
  
          // Deals with the label response code and its value
          Label responseCodeLbl = new Label(page, SWT.NONE);
          //gridData = new GridData(GridData.FILL_HORIZONTAL);
          //responseCodeLbl.setLayoutData(gridData);
          responseCodeLbl.setText("Response Code : ");
  
          responseCode = new Label(page, SWT.NONE);
          gridData = new GridData(GridData.FILL_HORIZONTAL);
          responseCode.setLayoutData(gridData);
  
          // Deals with the label response message and its value
          Label responseMsgLbl = new Label(page, SWT.NONE);
          //gridData = new GridData(GridData.FILL_HORIZONTAL);
          //responseMsgLbl.setLayoutData(gridData);
          responseMsgLbl.setText("Response Message : ");
  
          responseMsg = new Label(page, SWT.NONE);
          gridData = new GridData(GridData.FILL_HORIZONTAL);
          responseMsg.setLayoutData(gridData);
  
  
  
      }
  
      @Override
      public void setVisible(boolean visible) {
          if (visible) {
  
              InterfacePage interfacePage = (InterfacePage) (getWizard().getPage("InterfacePage"));
              ModelObject model = interfacePage.getModelObject();
  
              GridData gridData = null;
  
              // Deals with the label interface name and its value
              Label interfaceNameLbl = new Label(page, SWT.NONE);
              //gridData = new GridData(GridData.FILL_HORIZONTAL);
              //interfaceNameLbl.setLayoutData(gridData);
              interfaceNameLbl.setText("Interface Id : ");
  
              interfaceName = new Label(page, SWT.NONE);
              gridData = new GridData(GridData.FILL_HORIZONTAL);
              interfaceName.setLayoutData(gridData);
  
              // Deals with the label source system and its value
              Label sourceSystemLbl = new Label(page, SWT.NONE);
              //gridData = new GridData(GridData.FILL_HORIZONTAL);
              //sourceSystemLbl.setLayoutData(gridData);
              sourceSystemLbl.setText("Source System : ");
  
              sourceSystem = new Label(page, SWT.NONE);
              gridData = new GridData(GridData.FILL_HORIZONTAL);
              sourceSystem.setLayoutData(gridData);
  
              // Deals with the label target system and its value
              Label targetSystemLbl = new Label(page, SWT.NONE);
              //gridData = new GridData(GridData.FILL_HORIZONTAL);
              //targetSystemLbl.setLayoutData(gridData);
              targetSystemLbl.setText("Target System : ");
  
              targetSystem = new Label(page, SWT.NONE);
              gridData = new GridData(GridData.FILL_HORIZONTAL);
              targetSystem.setLayoutData(gridData);
  
              // Deals with the label domain name and its value
              Label domainNameLbl = new Label(page, SWT.NONE);
              //gridData = new GridData(GridData.FILL_HORIZONTAL);
              //domainNameLbl.setLayoutData(gridData);
              domainNameLbl.setText("Domain Name : ");
  
              domainName = new Label(page, SWT.NONE);
              gridData = new GridData(GridData.FILL_HORIZONTAL);
              domainName.setLayoutData(gridData);
  
              // Deals with the label service name and its value
              Label serviceNameLbl = new Label(page, SWT.NONE);
              //gridData = new GridData(GridData.FILL_HORIZONTAL);
              //serviceNameLbl.setLayoutData(gridData);
              serviceNameLbl.setText("Service Name : ");
  
              serviceName = new Label(page, SWT.NONE);
              gridData = new GridData(GridData.FILL_HORIZONTAL);
              serviceName.setLayoutData(gridData);    
  
  
  
  
              interfaceName.setText(null != model.getInterfaceName() ? model.getInterfaceName() : "");
              // setTitle(model.getInterfaceID1() +" details");
  
              sourceSystem.setText(null != model.getSourceSystem() ? model.getSourceSystem() : "");
              targetSystem.setText(null != model.getTargetSystem() ? model.getTargetSystem() : "");
              domainName.setText(null != model.getDomainName() ? model.getDomainName() : "");
              serviceName.setText(null != model.getServiceName() ? model.getServiceName() : "");
  
              responseCode.setText(String.valueOf(model.getResponseCode()));
              responseMsg.setText(null != model.getResponseMessage() ? model.getResponseMessage() : "");
  
              page.layout();
              scrolledComposite.layout(true, true);
              scrolledComposite.setMinSize(page.computeSize(SWT.DEFAULT, SWT.DEFAULT));
              top.layout();
              setPageComplete(true);
  
  
          }
          super.setVisible(visible);
      } ...
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/8ULSi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8ULSi.png" alt="enter image description here"></a> </p>
  
  <p>As seen the last 5 labels displayed were generated inside the <code>setVisible</code> method</p>
  
  <p>If now I move back by pressing the <code>Back</code> button and then click <code>Next</code>, I see the new labels are added under the previous  rows and thus displayed twice. How can I prevent this behavior? </p>
  
  <p><a href="https://i.stack.imgur.com/hNl7H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hNl7H.png" alt="enter image description here"></a></p>