Java Code Examples for org.openide.util.Utilities#attachInitJob()

The following examples show how to use org.openide.util.Utilities#attachInitJob() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InitPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void initComponents() {        
    if (!oPanel.isPrepared()) {
        initComponent = new JLabel(NbBundle.getMessage(InitPanel.class, "LBL_computing")); // NOI18N
        initComponent.setPreferredSize(new Dimension(850, 450));
        // avoid flicking ?
        Color c = UIManager.getColor("Tree.background"); // NOI18N
        if (c == null) {
            //GTK 1.4.2 will return null for Tree.background
            c = Color.WHITE;
        }
        initComponent.setBackground(c);    // NOI18N               
        initComponent.setHorizontalAlignment(SwingConstants.CENTER);
        initComponent.setOpaque(true);
        
        CardLayout card = new CardLayout();
        setLayout(card);            
        add(initComponent, "init");    // NOI18N
        card.show(this, "init"); // NOI18N        
        Utilities.attachInitJob(this, this);
    } else {
        finished();  
    }
}
 
Example 2
Source File: BasicSettingsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void setupCombo() {
    final Cursor currentCursor = getCursor();
    setCursor(Utilities.createProgressCursor(this));

    Utilities.attachInitJob(comMode, new AsyncGUIJob() {

        Set<String> modes;

        @Override
        public void construct() {
            try {
                modes = DesignSupport.existingModes(data);
            } catch (IOException exc) {
                Logger.getLogger(BasicSettingsPanel.class.getName()).log(Level.INFO, null, exc);
            }
        }

        @Override
        public void finished() {
            comMode.setModel(new DefaultComboBoxModel(modes != null ? modes.toArray(new String[modes.size()]) : DEFAULT_MODES));
            setComModeSelectedItem();
            windowPosChanged(null);
            setCursor(currentCursor);
            loadedComboBox = true;
            checkValidity();
        }
    });
}
 
Example 3
Source File: ProjectTemplatePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized Component getComponent() {        
    if (this.panel == null) {
        TemplatesPanelGUI.Builder firer = new Builder();
        this.panel = new TemplatesPanelGUI (firer);
        panel.setWizardDescriptor(wizard);
        Utilities.attachInitJob (panel, getWarmUp());
        this.warmUpActive = true;
        this.panel.setName (NbBundle.getBundle (ProjectTemplatePanel.class).getString ("LBL_TemplatesPanel_Name")); // NOI18N
    }
    return this.panel;
}
 
Example 4
Source File: TemplateChooserPanelGUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override public void addNotify () {
    if (firstTime) {
        //77244 prevent multiple initializations..
        Utilities.attachInitJob (this, this);
        firstTime = false;
    }
    super.addNotify ();
}
 
Example 5
Source File: TemplateWizard1.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Creates new form NewFromTemplatePanel */
public TemplateWizard1 () {
    initComponents ();

    treeView = new TemplatesTreeView();
    treeView.setDefaultActionAllowed(false);
    treeView.setPopupAllowed(false);
    treeView.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    java.awt.GridBagConstraints gridBagConstraints1 = new java.awt.GridBagConstraints();
    gridBagConstraints1.gridx = 0;
    gridBagConstraints1.gridy = 1;
    gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints1.insets = new java.awt.Insets(0, 0, 11, 0);
    gridBagConstraints1.weightx = 1.0;
    gridBagConstraints1.weighty = 1.0;
    add(treeView, gridBagConstraints1);

    ResourceBundle bundle = org.openide.util.NbBundle.getBundle(TemplateWizard1.class);
    
    setName (bundle.getString("LAB_TemplateChooserPanelName"));

    putClientProperty(PROP_CONTENT_SELECTED_INDEX, 0);
    putClientProperty(PROP_CONTENT_DATA, new String[] {getName(), "..."}); // NOI18N
    
    // Fix of #19667 - those values will be retreived in addNotify
    putClientProperty("LAB_SelectTemplateBorder", // NOI18N
        bundle.getString("LAB_SelectTemplateBorder")); 
    putClientProperty("LAB_TemplateDescriptionBorder", // NOI18N
        bundle.getString("LAB_TemplateDescriptionBorder"));
    putClientProperty("ACSD_TemplatesTree", // NOI18N
        bundle.getString("ACSD_TemplatesTree"));
    putClientProperty("ACSD_TemplateWizard1", // NOI18N
        bundle.getString("ACSD_TemplateWizard1"));
    // bugfix #19667 end
    
    updateRootNode (null);
    
    templatesLabel.setLabelFor(treeView);
    
    noBrowser.setText(bundle.getString("MSG_InitDescription"));
    java.awt.CardLayout card = (java.awt.CardLayout)browserPanel.getLayout();
    card.show (browserPanel, "noBrowser"); // NOI18N
    // for asynchnonous lazy init of this component
    Utilities.attachInitJob(this, this);
}
 
Example 6
Source File: InitializrProjectWizardIterator.java    From nb-springboot with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(WizardDescriptor wiz) {
    this.wiz = wiz;
    wiz.putProperty("NewProjectWizard_Title", NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_WizardTitle")); //NOI18N
    index = 0;
    // set other defaults
    this.wiz.putProperty(WIZ_USE_SB_MVN_PLUGIN, true);
    this.wiz.putProperty(WIZ_REMOVE_MVN_WRAPPER, true);
    // create the wizard panels
    panels = new WizardDescriptor.Panel[]{
        new InitializrProjectWizardPanel1(),
        new InitializrProjectWizardPanel2(),
        new InitializrProjectWizardPanel3()
    };
    // Make sure list of steps is accurate.
    String[] steps = new String[]{
        NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_BasePropsStep"),
        NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_DependenciesStep"),
        NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_CreateProjectStep")
    };
    // create wizard steps gui components
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        if (steps[i] == null) {
            // Default step name to component name of panel.
            // Mainly useful for getting the name of the target
            // chooser to appear in the list of steps.
            steps[i] = c.getName();
        }
        if (c instanceof JComponent) {
            // assume Swing components
            JComponent jc = (JComponent) c;
            // Step #.
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
            // Step name (actually the whole list for reference).
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        }
    }
    // schedule async retrieval of initializr metadata in panel visual 1
    Utilities.attachInitJob(panels[0].getComponent(), (AsyncGUIJob) panels[0].getComponent());
}