use of javax.swing.JDialog in project EnrichmentMapApp by BaderLab.
the class PostAnalysisPanelMediator method showDialog.
@SuppressWarnings("serial")
public void showDialog(Component parent, CyNetworkView netView) {
final EnrichmentMap map = emManager.getEnrichmentMap(netView.getModel().getSUID());
invokeOnEDT(() -> {
final PostAnalysisInputPanel panel = panelFactory.create(map);
final JDialog dialog = new JDialog(swingApplication.getJFrame(), "Add Signature Gene Sets", ModalityType.APPLICATION_MODAL);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
JButton helpButton = SwingUtil.createOnlineHelpButton(EnrichmentMapBuildProperties.USER_MANUAL_URL, "Online Manual...", serviceRegistrar);
JButton resetButton = new JButton("Reset");
resetButton.addActionListener(e -> panel.reset());
JButton closeButton = new JButton(new AbstractAction("Close") {
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
JButton runButton = new JButton(new AbstractAction("Add") {
@Override
public void actionPerformed(ActionEvent e) {
if (panel.isReady()) {
Optional<PostAnalysisParameters> params = buildPostAnalysisParameters(panel, map, dialog);
if (params.isPresent()) {
addGeneSets(netView, params.get());
dialog.dispose();
} else {
JOptionPane.showMessageDialog(panel, "Could not run post analysis.", "EnrichmentMap: Error", JOptionPane.WARNING_MESSAGE);
}
}
}
});
JPanel buttonPanel = LookAndFeelUtil.createOkCancelPanel(runButton, closeButton, helpButton, resetButton);
dialog.getContentPane().add(panel, BorderLayout.CENTER);
dialog.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
LookAndFeelUtil.setDefaultOkCancelKeyStrokes(dialog.getRootPane(), runButton.getAction(), closeButton.getAction());
dialog.getRootPane().setDefaultButton(runButton);
dialog.pack();
dialog.setLocationRelativeTo(swingApplication.getJFrame());
dialog.setVisible(true);
});
}
use of javax.swing.JDialog in project EnrichmentMapApp by BaderLab.
the class LegendPanelMediator method init.
@AfterInjection
@SuppressWarnings("serial")
private void init() {
invokeOnEDTAndWait(() -> {
dialog = new JDialog(swingApplication.getJFrame(), "EnrichmentMap Legend", ModalityType.MODELESS);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setMinimumSize(new Dimension(440, 380));
JButton closeButton = new JButton(new AbstractAction("Close") {
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
creationParamsButton.addActionListener(e -> showCreationParamsDialog());
JPanel bottomPanel = LookAndFeelUtil.createOkCancelPanel(null, closeButton, creationParamsButton);
dialog.getContentPane().add(legendPanelProvider.get(), BorderLayout.CENTER);
dialog.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
LookAndFeelUtil.setDefaultOkCancelKeyStrokes(dialog.getRootPane(), null, closeButton.getAction());
dialog.getRootPane().setDefaultButton(closeButton);
dialog.setLocationRelativeTo(swingApplication.getJFrame());
});
}
use of javax.swing.JDialog in project adempiere by adempiere.
the class ConfirmPanel method addActionListener.
// getRefreshButton
/**************************************************************************
* Add Action Listener
* <code>
* if (e.getActionCommand().equals(ConfirmPanel.A_OK))
* </code>
* @param al listener
*/
public void addActionListener(ActionListener al) {
((AppsAction) bOK.getAction()).setDelegate(al);
((AppsAction) bCancel.getAction()).setDelegate(al);
//
if (bRefresh != null)
((AppsAction) bRefresh.getAction()).setDelegate(al);
if (bReset != null)
((AppsAction) bReset.getAction()).setDelegate(al);
if (bCustomize != null)
((AppsAction) bCustomize.getAction()).setDelegate(al);
if (bHistory != null)
((AppsAction) bHistory.getAction()).setDelegate(al);
if (bZoom != null)
((AppsAction) bZoom.getAction()).setDelegate(al);
// Set OK as default Button
JRootPane rootpane = null;
if (al instanceof JDialog)
rootpane = ((JDialog) al).getRootPane();
else if (al instanceof JFrame)
rootpane = ((JFrame) al).getRootPane();
if (rootpane != null)
rootpane.setDefaultButton(bOK);
}
use of javax.swing.JDialog in project adempiere by adempiere.
the class PrintUtil method dump.
// dump
/**
* Dump Stream Print Services
* @param docFlavor flavor
*/
public static void dump(DocFlavor docFlavor) {
System.out.println();
System.out.println("DocFlavor=" + docFlavor);
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
PrintService[] pss = PrintServiceLookup.lookupPrintServices(docFlavor, pras);
for (int i = 0; i < pss.length; i++) {
PrintService ps = pss[i];
System.out.println("- " + ps);
System.out.println(" Factory=" + ps.getServiceUIFactory());
ServiceUIFactory uiF = pss[i].getServiceUIFactory();
if (uiF != null) {
System.out.println("about");
JDialog about = (JDialog) uiF.getUI(ServiceUIFactory.ABOUT_UIROLE, ServiceUIFactory.JDIALOG_UI);
about.setVisible(true);
System.out.println("admin");
JDialog admin = (JDialog) uiF.getUI(ServiceUIFactory.ADMIN_UIROLE, ServiceUIFactory.JDIALOG_UI);
admin.setVisible(true);
System.out.println("main");
JDialog main = (JDialog) uiF.getUI(ServiceUIFactory.MAIN_UIROLE, ServiceUIFactory.JDIALOG_UI);
main.setVisible(true);
System.out.println("reserved");
JDialog res = (JDialog) uiF.getUI(ServiceUIFactory.RESERVED_UIROLE, ServiceUIFactory.JDIALOG_UI);
res.setVisible(true);
}
//
DocFlavor[] dfs = pss[i].getSupportedDocFlavors();
System.out.println(" - Supported Doc Flavors");
for (int j = 0; j < dfs.length; j++) System.out.println(" -> " + dfs[j]);
// Attribute
Class[] attCat = pss[i].getSupportedAttributeCategories();
System.out.println(" - Supported Attribute Categories");
for (int j = 0; j < attCat.length; j++) System.out.println(" -> " + attCat[j].getName() + " = " + pss[i].getDefaultAttributeValue((Class<? extends Attribute>) attCat[j]));
//
}
}
use of javax.swing.JDialog in project adempiere by adempiere.
the class ADialog method error.
// warn (int, String)
/**************************************************************************
* Display error with error icon
* @param WindowNo Number of Window
* @param c Container (owner)
* @param AD_Message Message to be translated
* @param msg Additional message
*/
public static void error(int WindowNo, Container c, String AD_Message, String msg) {
log.info(AD_Message + " - " + msg);
if (CLogMgt.isLevelFinest())
Trace.printStack();
Properties ctx = Env.getCtx();
StringBuffer out = new StringBuffer();
if (AD_Message != null && !AD_Message.equals(""))
out.append(Msg.getMsg(ctx, AD_Message));
if (msg != null && msg.length() > 0)
out.append("\n").append(msg);
//
Window parent = Env.getParent(c);
if (parent == null)
parent = Env.getWindow(WindowNo);
//
if (showDialog && parent != null) {
if (parent instanceof JFrame)
new ADialogDialog((JFrame) parent, Env.getHeader(ctx, WindowNo), out.toString(), JOptionPane.ERROR_MESSAGE);
else if (parent instanceof JDialog)
new ADialogDialog((JDialog) parent, Env.getHeader(ctx, WindowNo), out.toString(), JOptionPane.ERROR_MESSAGE);
} else
JOptionPane.showMessageDialog(Env.getWindow(WindowNo), // message
out.toString() + "\n", // title
Env.getHeader(ctx, WindowNo), JOptionPane.ERROR_MESSAGE);
}
Aggregations