Example usage for java.awt Dialog toFront

List of usage examples for java.awt Dialog toFront

Introduction

In this page you can find the example usage for java.awt Dialog toFront.

Prototype

public void toFront() 

Source Link

Document

If this Window is visible, brings this Window to the front and may make it the focused Window.

Usage

From source file:it.unibas.spicygui.controllo.mapping.ActionExportTranslatedInstancesSQL.java

@Override
public void performAction() {
    insertBeanForBinding();/*from   ww  w.  ja va  2  s.c  om*/
    Scenario scenario = (Scenario) modello.getBean(Costanti.CURRENT_SCENARIO);
    MappingTask mappingTask = scenario.getMappingTask();
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Database Configuration");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        try {
            RelationalConfigurationPM conf = (RelationalConfigurationPM) modello
                    .getBean(Costanti.RELATIONAL_CONFIGURATION_SOURCE);
            String driver = conf.getDriver();
            String uri = conf.getUri();
            String userName = conf.getLogin();
            String password = conf.getPassword();
            DAOSql dao = new DAOSql();
            dao.exportTranslatedSQLInstances(mappingTask, scenario.getNumber(), driver, uri, userName,
                    password);
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
                    NbBundle.getMessage(Costanti.class, Costanti.EXPORT_COMPLETED_OK)));
        } catch (DAOException ex) {
            logger.error(ex);
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
                    NbBundle.getMessage(Costanti.class, Costanti.EXPORT_ERROR) + " : " + ex.getMessage(),
                    DialogDescriptor.ERROR_MESSAGE));
        }
    }
}

From source file:it.unibas.spicygui.controllo.addtable.ActionAddSourceTable.java

public void performAction() {
    insertBeanForBinding();/*from ww  w . j  ava  2  s  .c  o  m*/
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Choose input");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        try {
            MappingTask mappingTask = (MappingTask) this.modello.getBean(Costanti.MAPPINGTASK_SHOWED);
            NewMappingTaskPM newMappingTaskPM = (NewMappingTaskPM) this.modello
                    .getBean(Costanti.NEW_MAPPING_TASK_PM);
            IDataSourceProxy source = loadDataSource(newMappingTaskPM.getSourceElement(), true);
            mappingTask.addSource(source);
            updateScenario(mappingTask);
            enableActions();
            actionViewSchema.performAction();
            actionProjectTree.performAction();
        } catch (Exception ex) {
            logger.error(ex);
            Scenarios.releaseNumber();
            DialogDisplayer.getDefault()
                    .notify(new NotifyDescriptor.Message(
                            NbBundle.getMessage(Costanti.class, Costanti.NEW_ERROR) + " : " + ex.getMessage(),
                            DialogDescriptor.ERROR_MESSAGE));
        }
    }
}

From source file:it.unibas.spicygui.controllo.addtable.ActionAddTargetTable.java

public void performAction() {
    insertBeanForBinding();/*from  w  ww.java  2s.c om*/
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Choose input");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        try {
            MappingTask mappingTask = (MappingTask) this.modello.getBean(Costanti.MAPPINGTASK_SHOWED);
            NewMappingTaskPM newMappingTaskPM = (NewMappingTaskPM) this.modello
                    .getBean(Costanti.NEW_MAPPING_TASK_PM);
            IDataSourceProxy target = loadDataSource(newMappingTaskPM.getTargetElement(), false);
            mappingTask.addTarget(target);
            updateScenario(mappingTask);
            enableActions();
            actionViewSchema.performAction();
            actionProjectTree.performAction();
        } catch (Exception ex) {
            logger.error(ex);
            Scenarios.releaseNumber();
            DialogDisplayer.getDefault()
                    .notify(new NotifyDescriptor.Message(
                            NbBundle.getMessage(Costanti.class, Costanti.NEW_ERROR) + " : " + ex.getMessage(),
                            DialogDescriptor.ERROR_MESSAGE));
        }
    }
}

From source file:it.unibas.spicygui.controllo.file.ActionNewMappingTask.java

public void performAction() {
    insertBeanForBinding();/*ww w  . j  av a2s .  c  om*/
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Choose input");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        try {
            //giannisk
            Scenarios.getNextFreeNumber();
            NewMappingTaskPM newMappingTaskPM = (NewMappingTaskPM) this.modello
                    .getBean(Costanti.NEW_MAPPING_TASK_PM);
            IDataSourceProxy source = loadDataSource(newMappingTaskPM.getSourceElement(), true);
            IDataSourceProxy target = loadDataSource(newMappingTaskPM.getTargetElement(), false);
            MappingTask mappingTask = new MappingTask(source, target,
                    SpicyEngineConstants.LINES_BASED_MAPPING_TASK);
            mappingTask.setModified(true);

            //giannisk 
            //prompt for automatic loading of foreign keys disabled
            if (!source.getForeignKeyConstraints().isEmpty()) {
                confirmAddForeignKeyToJoin(source, true);
            }
            if (!target.getForeignKeyConstraints().isEmpty()) {
                confirmAddForeignKeyToJoin(target, false);
            }

            gestioneScenario(mappingTask);
            enableActions();
            actionViewSchema.performAction();
            //giannisk open scenarios on the tree panel when creating a new mapping task
            actionProjectTree.performAction();
        } catch (Exception ex) {
            logger.error(ex);
            Scenarios.releaseNumber();
            DialogDisplayer.getDefault()
                    .notify(new NotifyDescriptor.Message(
                            NbBundle.getMessage(Costanti.class, Costanti.NEW_ERROR) + " : " + ex.getMessage(),
                            DialogDescriptor.ERROR_MESSAGE));
        }
    }
}

From source file:uk.ac.lkl.cram.ui.ModuleFrame.java

private void addTLALineItem() {
    //Disable the menu item
    addTLALineItemMI.setEnabled(false);/*  w w  w.  java2  s . c  o m*/
    TLACreatorWizardIterator iterator = new TLACreatorWizardIterator(module);
    WizardDescriptor wizardDescriptor = new WizardDescriptor(iterator);
    iterator.initialize(wizardDescriptor);
    // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName()
    // {1} will be replaced by WizardDescriptor.Iterator.name()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0} ({1})"));
    wizardDescriptor.setTitle("TLA Creator Wizard for " + module.getModuleName() + " module");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    //Modeless within the document
    dialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    //LOGGER.info("Cancelled: " + cancelled);
    if (!cancelled) {
        //Get the newly created line item
        TLALineItem lineItem = iterator.getLineItem();
        //If the user created a new TLA, add it to their preferences
        if (iterator.isVanilla()) {
            UserTLALibrary.getDefaultLibrary().addActivity(lineItem.getActivity());
        }
        module.addTLALineItem(lineItem);
        //No undo support here--assume user will just remove the line item
    }
    //Enable the menu item
    addTLALineItemMI.setEnabled(true);
}