List of usage examples for javax.swing JDialog JDialog
public JDialog(Window owner, String title, Dialog.ModalityType modalityType)
From source file:ui.panel.UILicenseAdd.java
public JPanel createButtonPanel() { JPanel panel = p.createPanel(Layouts.flow); panel.setLayout(new FlowLayout(FlowLayout.CENTER)); btnSubmit = b.createButton("Submit"); btnCancel = b.createButton("Cancel"); btnSubmit.addActionListener(new ActionListener() { @Override/*from w ww.j av a 2s . c om*/ public void actionPerformed(ActionEvent e) { SwingWorker<Void, Void> mySwingWorker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { TreePath[] path = checkTreeManager.getSelectionModel().getSelectionPaths(); ArrayList<String> featureL = new ArrayList<String>(); String[] features = new String[] {}; for (TreePath tp : path) { if (tp.getLastPathComponent().toString().equals("Features")) { Object rootNode = tree.getModel().getRoot(); int parentCount = tree.getModel().getChildCount(rootNode); for (int i = 0; i < parentCount; i++) { Object parentNode = tree.getModel().getChild(rootNode, i); int childrenCount = tree.getModel().getChildCount(parentNode); for (int x = 0; x < childrenCount; x++) { MyDataNode node = (MyDataNode) tree.getModel().getChild(parentNode, x); featureL.add(node.getValue()); } } } else if (tp.getPathCount() == 2) { Object rootNode = tree.getModel().getRoot(); int parentCount = tree.getModel().getChildCount(rootNode); for (int i = 0; i < parentCount; i++) { Object parentNode = tree.getModel().getChild(rootNode, i); if (parentNode.toString().equals(tp.getLastPathComponent().toString())) { int childrenCount = tree.getModel().getChildCount(parentNode); for (int x = 0; x < childrenCount; x++) { MyDataNode node = (MyDataNode) tree.getModel().getChild(parentNode, x); featureL.add(node.getValue()); } } } } else if (tp.getPathCount() == 3) { MyDataNode node = (MyDataNode) tp.getLastPathComponent(); featureL.add(node.getValue()); } } features = featureL.toArray(features); String duration = spnValidity.getValue().toString(); if (cbPerpetual.isSelected()) { duration = "-1"; } String storage = spnCloud.getValue().toString(); String maxVCA = spnConcurrentVCA.getValue().toString(); String response = apiCall.addNodeLicense(Data.targetURL, Data.sessionKey, Data.bucketID, features, duration, storage, maxVCA); try { JSONObject responseObject = new JSONObject(response); if (responseObject.get("result").equals("ok")) { Data.mainFrame.uiLicenseDetail.getLicenseData(); Data.mainFrame.showPanel("license"); } } catch (JSONException e1) { e1.printStackTrace(); } return null; } }; Window win = SwingUtilities.getWindowAncestor((AbstractButton) e.getSource()); final JDialog dialog = new JDialog(win, "Loading", ModalityType.APPLICATION_MODAL); mySwingWorker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("state")) { if (evt.getNewValue() == SwingWorker.StateValue.DONE) { dialog.dispose(); } } } }); mySwingWorker.execute(); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); JPanel panel = new JPanel(new BorderLayout()); panel.add(progressBar, BorderLayout.CENTER); panel.add(new JLabel("Retrieving License..."), BorderLayout.PAGE_START); dialog.add(panel); dialog.pack(); dialog.setBounds(50, 50, 300, 100); dialog.setLocationRelativeTo(Data.mainFrame); dialog.setVisible(true); } }); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); Data.mainFrame.showPanel("license"); } }); panel.add(btnSubmit); panel.add(btnCancel); return panel; }
From source file:ui.panel.UILicenseDetail.java
public JPanel createButtonPanel() { JPanel panel = p.createPanel(Layouts.flow); panel.setLayout(new FlowLayout(FlowLayout.CENTER)); btnSubmit = b.createButton("Next"); btnBack = b.createButton("Back"); btnAdd = b.createButton("Add License"); panel.add(btnBack);/*from w ww. j av a 2s .com*/ panel.add(btnAdd); panel.add(btnSubmit); btnBack.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Data.mainFrame.showPanel("bucket"); } }); btnAdd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Data.mainFrame.addPanel(Data.mainFrame.uiLicenseAdd = new UILicenseAdd(), "licenseAdd"); Data.mainFrame.showPanel("licenseAdd"); } }); btnSubmit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SwingWorker<Void, Void> mySwingWorker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { int row = tblInfo.getSelectedRow(); if (row == -1) { JOptionPane.showMessageDialog(Data.mainFrame, "Please Select a License", "Error", JOptionPane.ERROR_MESSAGE); } else { Data.licenseNumber = (String) tblInfo.getModel().getValueAt(row, 0); Data.mainFrame.uiAccessKeySelect = new UIAccessKeySelect(); Data.mainFrame.addPanel(Data.mainFrame.uiAccessKeySelect, "access"); Data.mainFrame.showPanel("access"); } return null; } }; Window win = SwingUtilities.getWindowAncestor((AbstractButton) e.getSource()); final JDialog dialog = new JDialog(win, "Loading", ModalityType.APPLICATION_MODAL); mySwingWorker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("state")) { if (evt.getNewValue() == SwingWorker.StateValue.DONE) { dialog.dispose(); } } } }); mySwingWorker.execute(); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); JPanel panel = new JPanel(new BorderLayout()); panel.add(progressBar, BorderLayout.CENTER); panel.add(new JLabel("Retrieving Access Keys"), BorderLayout.PAGE_START); dialog.add(panel); dialog.pack(); dialog.setBounds(50, 50, 300, 100); dialog.setLocationRelativeTo(Data.mainFrame); dialog.setVisible(true); } }); btnBack.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); Data.mainFrame.showPanel("bucket"); } }); btnAdd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); Data.mainFrame.addPanel(Data.mainFrame.uiLicenseAdd = new UILicenseAdd(), "licenseAdd"); Data.mainFrame.pack(); Data.mainFrame.showPanel("licenseAdd"); } }); return panel; }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.QueryAuthoringTreePanel.java
/** * Creates the query component expression dialog. *///from ww w. java 2 s. com private void createQueryComponentExpressionDialog() { // wait for applicationService to make a frame available while (applicationService == null || activeFrame == null) { // check applicationService if (applicationService != null && applicationService.getFrameView() != null) { activeFrame = applicationService.getFrameView().getActiveFrame(); } } // make dialog modal queryComponentExpressionPanel = new QueryComponentExpressionPanel(terminologySearchService, humanReadableRender, selectionService, terminologyConceptDAO, applicationService, propertyChangeTrackerService, normalFormGenerator, queryService, queryExpressionFactory); // initialise components queryComponentExpressionPanel.initComponents(); propertyChangeTrackerService.registerListener(queryComponentExpressionPanel); queryComponentExpressionDialog = new JDialog(activeFrame, "Component Expression", Dialog.ModalityType.DOCUMENT_MODAL); queryComponentExpressionDialog.setPreferredSize(new Dimension(350, 450)); queryComponentExpressionDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); queryComponentExpressionDialog.getContentPane().add(queryComponentExpressionPanel); queryComponentExpressionDialog.pack(); queryComponentExpressionDialog.setLocationRelativeTo(activeFrame); }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.QueryComponentExpressionPanel.java
/** * Creates the active constraints dialog. *///from www . ja v a2 s . c o m private synchronized void createActiveConstraintsDialog() { activeConstraintPanel = new TerminologyConstraintPanel(humanReadableRender, selectionService, terminologyConceptDAO, applicationService, propertyChangeTrackerService, normalFormGenerator, terminologySearchService, queryExpressionFactory.getConstraintFactory()); activeConstraintPanel.initComponents(); activeConstraintPanel.setName("activeConstraintPanel"); propertyChangeTrackerService.registerListener(activeConstraintPanel); // create a dialog for displaying the excludedConstraintPanel activeConstraintsDialog = new JDialog(activeFrame, "Edit Constraint", Dialog.ModalityType.DOCUMENT_MODAL); activeConstraintsDialog.getContentPane().add(activeConstraintPanel); activeConstraintsDialog.setLocationRelativeTo(activeFrame); activeConstraintsDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); activeConstraintsDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { activeConstraintsDialog.setVisible(false); // set adding new to false // addingNew = false; editingExisting = false; } }); activeConstraintsDialog.pack(); }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.SimpleCloseToUserExpressionPanel.java
/** * Creates the expression builder dialog. *///from w w w . jav a 2 s . c om private synchronized void createExpressionBuilderDialog() { // wait for applicationService to make a frame available while (applicationService == null || activeFrame == null) { // check applicationService if (applicationService != null && applicationService.getFrameView() != null) { activeFrame = applicationService.getFrameView().getActiveFrame(); } } // create expressionBuilderPanel and register with services expressionBuilderPanel = new ExpressionBuilderPanel(terminologySearchService, applicationService, selectionService, terminologyConceptDAO, propertyChangeTrackerService, humanReadableRender, normalFormGenerator); // initialise and register expressionBuilderPanel with services expressionBuilderPanel.initComponents(); expressionBuilderPanel.register(); expressionBuilderPanel.setPreferredSize(new Dimension(350, 400)); // wrap conceptHierarchyPanel in a dialog expressionBuilderDialog = new JDialog(activeFrame, "Author expression", Dialog.ModalityType.DOCUMENT_MODAL); expressionBuilderDialog.getContentPane().add(expressionBuilderPanel); expressionBuilderDialog.setLocationRelativeTo(activeFrame); expressionBuilderDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); expressionBuilderDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { propertyChangeTrackerService.firePropertyChanged(EXPRESSION_CHANGED, null, getExpression(), SimpleCloseToUserExpressionPanel.this); setActive(false); expressionBuilderDialog.setVisible(false); } }); expressionBuilderDialog.pack(); }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.queryresultspanel.QueryResultsPanel.java
/** * Creates the patient dialog.//from www . j a va 2 s.c o m */ private void createPatientDialog() { // create patientPanel and initialise components patientPanel = new PatientPanel(); patientPanel.setPatientDAO(patientDAO); patientPanel.initComponents(); patientDialog = new JDialog(activeFrame, "Patient details", Dialog.ModalityType.DOCUMENT_MODAL); patientDialog.setPreferredSize(new Dimension(500, 520)); patientDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); patientDialog.add(patientPanel); patientDialog.pack(); patientDialog.setLocationRelativeTo(activeFrame); }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.resultexplanationpanel.ResultsExplanationPanel.java
/** * Creates the collections dialog.//from ww w .ja va 2 s. co m */ private synchronized void createCollectionsDialog() { // create collectionPanel and initialise components collectionPanel = new QueryStatisticsCollectionPanel(applicationService, queryExpressionHTMLRenderer); collectionPanel.initComponents(); collectionDialog = new JDialog(activeFrame, "Explanations", Dialog.ModalityType.DOCUMENT_MODAL); collectionDialog.setPreferredSize(new Dimension(400, 550)); collectionDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); collectionDialog.getContentPane().add(collectionPanel); collectionDialog.pack(); collectionDialog.setLocationRelativeTo(activeFrame); }
From source file:uk.nhs.cfh.dsp.yasb.expression.builder.RefinedExpressionBuilderPanel.java
/** * Creates the laterality concept hierarchy dialog. *//*from www. ja v a 2 s . c o m*/ private synchronized void createLateralityConceptHierarchyDialog() { // wait for applicationService to make a frame available while (activeFrame == null) { // check applicationService and set active frame if (applicationService != null) { activeFrame = applicationService.getFrameView().getActiveFrame(); } } // create a laterality relationship that will be reused lateralityRelationship = new SnomedRelationshipImpl(); lateralityRelationship.setRelationshipType("272741003"); lateralityRelationship.setName("Laterality"); // create lateralityHierarchyPanel panel lateralityHierarchyPanel = new SnomedConceptHierarchyPanel(terminologyConceptDAO, selectionService, applicationService); lateralityHierarchyPanel.initComponents(); // wrap lateralityHierarchyPanel in a dialog conceptHierarchyDialog = new JDialog(activeFrame, "Concept Hierarchy", Dialog.ModalityType.DOCUMENT_MODAL); conceptHierarchyDialog.getContentPane().add(lateralityHierarchyPanel); conceptHierarchyDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); conceptHierarchyDialog.pack(); }
From source file:uk.nhs.cfh.dsp.yasb.expression.builder.SimpleCloseToUserExpressionPanel.java
/** * Creates the expression builder dialog. *///from www.ja v a 2 s. c o m private synchronized void createExpressionBuilderDialog() { // wait for applicationService to make a frame available while (applicationService == null || activeFrame == null) { // check applicationService if (applicationService != null && applicationService.getFrameView() != null) { activeFrame = applicationService.getFrameView().getActiveFrame(); } } // // create expressionBuilderPanel and register with services // expressionBuilderPanel = new ExpressionBuilderPanel(terminologySearchService, applicationService, // selectionService, terminologyConceptDAO, // propertyChangeTrackerService, humanReadableRender, normalFormGenerator); // // initialise and register expressionBuilderPanel with services // expressionBuilderPanel.initComponents(); // expressionBuilderPanel.register(); // create expressionBuilderPanel and register with services expressionBuilderPanel = new RefinedExpressionBuilderPanel(terminologySearchService, applicationService, selectionService, terminologyConceptDAO, propertyChangeTrackerService, humanReadableRender, normalFormGenerator); // initialise and register expressionBuilderPanel with services expressionBuilderPanel.initComponents(); // wrap conceptHierarchyPanel in a dialog expressionBuilderDialog = new JDialog(activeFrame, "Author expression", Dialog.ModalityType.DOCUMENT_MODAL); expressionBuilderDialog.getContentPane().add(expressionBuilderPanel); expressionBuilderDialog.setLocationRelativeTo(activeFrame); expressionBuilderDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); expressionBuilderDialog.pack(); }
From source file:xtrememp.update.SoftwareUpdate.java
public static void showCheckForUpdatesDialog() { checkForUpdatesDialog = new JDialog(XtremeMP.getInstance().getMainFrame(), tr("Dialog.SoftwareUpdate"), true);//from w w w.j a v a 2s. c o m JPanel panel = new JPanel(new BorderLayout(0, 10)); panel.add(new JLabel(tr("Dialog.SoftwareUpdate.CheckingForUpdates")), BorderLayout.CENTER); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setPreferredSize(new Dimension(250, 20)); panel.add(progressBar, BorderLayout.SOUTH); JButton cancelButton = new JButton(tr("Button.Cancel")); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (checkForUpdatesWorker != null && !checkForUpdatesWorker.isDone()) { checkForUpdatesWorker.cancel(true); } checkForUpdatesDialog.dispose(); } }); JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] { cancelButton }, cancelButton); checkForUpdatesDialog.setContentPane(optionPane); checkForUpdatesDialog.pack(); checkForUpdatesDialog.setResizable(false); checkForUpdatesDialog.setLocationRelativeTo(checkForUpdatesDialog.getParent()); checkForUpdatesDialog.getRootPane().setDefaultButton(cancelButton); checkForUpdatesDialog.setVisible(true); }