NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Need help on using Netbean Wizard to create dynamic wizard

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
allenKCW



Joined: 07 Oct 2016
Posts: 2

PostPosted: Fri Oct 07, 2016 11:48 pm    Post subject: Need help on using Netbean Wizard to create dynamic wizard Reply with quote

Hi,

I am new to the wizard in netbean. I tried searching resources on internet but did not find much on this topic. I want to create a dynamic wizard based on user input in previous page of the wizard.

For example, lets say my wizard contains 2 pages, with first page fixed and second page fixed. User can specify x value on second page and it will create x number of pages after second page.

So far, I can add the pages to the List of panels,

Code:
public void insertPage(WizardDescriptor.Panel<WizardDescriptor> panel){
        if(panel != null){
            panels.add(panel);
            totalPageSize++;     
            String[] steps = new String[panels.size()];
            for (int i = 0; i < panels.size(); i++) {
                Component c = panels.get(i).getComponent();
                // Default step name to component name of panel.
                steps[i] = c.getName();
                if (c instanceof JComponent) { // assume Swing components
                    JComponent jc = (JComponent) c;
                    jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
                    jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
                    jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
                    jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
                    jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
                }
            }
     }
}


this function is being called from addChangeListener in page 2 wizard panel. Note that I've already designed the panel need to be added.

the problem is that the "Next" button is disabled (but the list contains the newly added page). When I click cancel, open the wizard, the Next button is enabled.

I am wondering is there any method or ways to refresh/update the wizard without canceling and re-opening the wizard?

Thanks
Back to top
geertjan



Joined: 22 Jan 2014
Posts: 978

PostPosted: Sat Oct 08, 2016 9:08 am    Post subject: Need help on using Netbean Wizard to create dynamic wizard Reply with quote

On 8-10-2016 1:48, allenKCW wrote:
Quote:
Hi,

I am new to the wizard in netbean. I tried searching resources on internet but did not find much on this topic.

https://dzone.com/articles/nb-how-to-create-dynamic-wizard

Gj

Quote:
I want to create a dynamic wizard based on user input in previous page of the wizard.

For example, lets say my wizard contains 2 pages, with first page fixed and second page fixed. User can specify x value on second page and it will create x number of pages after second page.

So far, I can add the pages to the List of panels,


Code:
public void insertPage(WizardDescriptor.Panel<WizardDescriptor> panel){
if(panel != null){
panels.add(panel);
totalPageSize++;
String[] steps = new String[panels.size()];
for (int i = 0; i < panels.size(); i++) {
Component c = panels.get(i).getComponent();
// Default step name to component name of panel.
steps[i] = c.getName();
if (c instanceof JComponent) { // assume Swing components
JComponent jc = (JComponent) c;
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
}
}
}
}



this function is being called from addChangeListener in page 2 wizard panel. Note that I've already designed the panel need to be added.

the problem is that the "Next" button is disabled (but the list contains the newly added page). When I click cancel, open the wizard, the Next button is enabled.

I am wondering is there any method or ways to refresh/update the wizard without canceling and re-opening the wizard?

Thanks



Back to top
allenKCW



Joined: 07 Oct 2016
Posts: 2

PostPosted: Wed Oct 12, 2016 4:54 pm    Post subject: Reply with quote

Thanks for the reply.

I am still confused after reading that example. That example uses two sequences of list but in my case, I only have one sequence. The changes are controlled by the very last fixed page.

I have attached the screenshot of the issue i am having now. As you can see, I have a page that ask for a number. That number determines how many pages needed after that page.

I use the insertPage method to add new panel to the list. However, from the screenshot, the next button is disabled while I was in page 4 only. If I click cancel and open the wizard again, the next button in page 4 is enable again!

I don't know what am I missing here. Please help Rolling Eyes Embarassed



add number.PNG
 Description:
Add number of pages
 Filesize:  20.37 KB
 Viewed:  3107 Time(s)

add number.PNG



unable to click next.PNG
 Description:
After adding the list, next button is disable (where the list contains all new pages).
 Filesize:  20.82 KB
 Viewed:  3107 Time(s)

unable to click next.PNG


Back to top
geertjan



Joined: 22 Jan 2014
Posts: 978

PostPosted: Wed Oct 12, 2016 9:29 pm    Post subject: Need help on using Netbean Wizard to create dynamic wizard Reply with quote

address-removed is the list where others are found who use the
NetBeans APIs.

Gj

On 12-10-2016 18:54, allenKCW wrote:
Quote:
Thanks for the reply.

I am still confused after reading that example. That example uses two sequences of list but in my case, I only have one sequence. The changes are controlled by the very last fixed page.

I have attached the screenshot of the issue i am having now. As you can see, I have a page that ask for a number. That number determines how many pages needed after that page.

I use the insertPage method to add new panel to the list. However, from the screenshot, the next button is disabled while I was in page 4 only. If I click cancel and open the wizard again, the next button in page 4 is enable again!

I don't know what am I missing here. Please help [Rolling Eyes] [Embarassed]




Attachments:
http://forums.netbeans.org//files/add_number_636.png
http://forums.netbeans.org//files/unable_to_click_next_828.png
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo