Search in sources :

Example 1 with WizardDescriptor

use of org.openide.WizardDescriptor in project gephi by gephi.

the class ImportExcelUIWizard method initDescriptor.

public void initDescriptor() {
    buildPanels();
    wizardDescriptor = new WizardDescriptor(panels);
}
Also used : WizardDescriptor(org.openide.WizardDescriptor)

Example 2 with WizardDescriptor

use of org.openide.WizardDescriptor in project gephi by gephi.

the class ImportCSVUIWizard method initDescriptor.

public void initDescriptor() {
    buildPanels();
    wizardDescriptor = new WizardDescriptor(panels);
}
Also used : WizardDescriptor(org.openide.WizardDescriptor)

Example 3 with WizardDescriptor

use of org.openide.WizardDescriptor in project gephi by gephi.

the class ImportCSVUIWizardAction method performAction.

@Override
public void performAction() {
    wizardDescriptor = new WizardDescriptor(getPanels());
    step1.setWizardDescriptor(wizardDescriptor);
    step2.setWizardDescriptor(wizardDescriptor);
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle(getName());
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        //General parameters:
        File file = (File) wizardDescriptor.getProperty("file");
        Character separator = (Character) wizardDescriptor.getProperty("separator");
        Charset charset = (Charset) wizardDescriptor.getProperty("charset");
        String[] columnNames = (String[]) wizardDescriptor.getProperty("columns-names");
        Class[] columnTypes = (Class[]) wizardDescriptor.getProperty("columns-types");
        //Nodes import parameters:
        Boolean assignNewNodeIds = (Boolean) wizardDescriptor.getProperty("assign-new-node-ids");
        //Edges import parameters:
        Boolean createNewNodes = (Boolean) wizardDescriptor.getProperty("create-new-nodes");
        Graph graph = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph();
        AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
        DataTablesController dtc = Lookup.getDefault().lookup(DataTablesController.class);
        dtc.setAutoRefreshEnabled(false);
        try {
            switch((Mode) wizardDescriptor.getProperty("mode")) {
                case NODES_TABLE:
                    ac.importCSVToNodesTable(graph, file, separator, charset, columnNames, columnTypes, assignNewNodeIds);
                    break;
                case EDGES_TABLE:
                    ac.importCSVToEdgesTable(graph, file, separator, charset, columnNames, columnTypes, createNewNodes);
                    break;
            }
            dtc.refreshCurrentTable();
        } catch (Exception e) {
            Logger.getLogger("").log(Level.SEVERE, null, e);
        } finally {
            dtc.setAutoRefreshEnabled(true);
        }
    }
    step1.unSetup();
    step2.unSetup();
}
Also used : MessageFormat(java.text.MessageFormat) Charset(java.nio.charset.Charset) WizardDescriptor(org.openide.WizardDescriptor) Graph(org.gephi.graph.api.Graph) Dialog(java.awt.Dialog) AttributeColumnsController(org.gephi.datalab.api.AttributeColumnsController) File(java.io.File) DataTablesController(org.gephi.datalab.api.datatables.DataTablesController)

Example 4 with WizardDescriptor

use of org.openide.WizardDescriptor in project blue by kunstmusik.

the class RenderStemsAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    WizardDescriptor wd = new WizardDescriptor(new RenderStemsWizardIterator());
    Dialog d = DialogDisplayer.getDefault().createDialog(wd);
    d.setVisible(true);
}
Also used : Dialog(java.awt.Dialog) WizardDescriptor(org.openide.WizardDescriptor)

Example 5 with WizardDescriptor

use of org.openide.WizardDescriptor in project gephi by gephi.

the class ImportWizard method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    WizardIterator wizardIterator = new WizardIterator();
    WizardDescriptor wizardDescriptor = new WizardDescriptor(wizardIterator);
    wizardDescriptor.setTitleFormat(new MessageFormat("{0} ({1})"));
    wizardDescriptor.setTitle(NbBundle.getMessage(getClass(), "ImportWizard.wizard.title"));
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        ImporterWizardUI wizardUI = wizardIterator.getCurrentWizardUI();
        // Get Importer
        WizardImporter importer = null;
        for (WizardImporterBuilder wizardBuilder : Lookup.getDefault().lookupAll(WizardImporterBuilder.class)) {
            WizardImporter im = wizardBuilder.buildImporter();
            if (wizardUI.isUIForImporter(im)) {
                importer = im;
            }
        }
        if (importer == null) {
            NotifyDescriptor.Message msg = new NotifyDescriptor.Message(NbBundle.getMessage(getClass(), "ImportWizard.error_no_matching_importer"), NotifyDescriptor.WARNING_MESSAGE);
            DialogDisplayer.getDefault().notify(msg);
            return;
        }
        // Unsetup
        wizardIterator.unsetupPanels(importer);
        ImportControllerUI importControllerUI = Lookup.getDefault().lookup(ImportControllerUI.class);
        importControllerUI.importWizard(importer);
    }
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) MessageFormat(java.text.MessageFormat) Dialog(java.awt.Dialog) WizardImporter(org.gephi.io.importer.spi.WizardImporter) ImportControllerUI(org.gephi.desktop.importer.api.ImportControllerUI) WizardDescriptor(org.openide.WizardDescriptor) ImporterWizardUI(org.gephi.io.importer.spi.ImporterWizardUI) WizardImporterBuilder(org.gephi.io.importer.spi.WizardImporterBuilder)

Aggregations

WizardDescriptor (org.openide.WizardDescriptor)9 Dialog (java.awt.Dialog)3 MessageFormat (java.text.MessageFormat)2 BorderLayout (java.awt.BorderLayout)1 Color (java.awt.Color)1 File (java.io.File)1 Charset (java.nio.charset.Charset)1 JComponent (javax.swing.JComponent)1 JPanel (javax.swing.JPanel)1 AttributeColumnsController (org.gephi.datalab.api.AttributeColumnsController)1 DataTablesController (org.gephi.datalab.api.datatables.DataTablesController)1 ImportControllerUI (org.gephi.desktop.importer.api.ImportControllerUI)1 Graph (org.gephi.graph.api.Graph)1 ImporterWizardUI (org.gephi.io.importer.spi.ImporterWizardUI)1 WizardImporter (org.gephi.io.importer.spi.WizardImporter)1 WizardImporterBuilder (org.gephi.io.importer.spi.WizardImporterBuilder)1 NotificationLineSupport (org.openide.NotificationLineSupport)1 NotifyDescriptor (org.openide.NotifyDescriptor)1