01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.client.gui.text;
19:
20: import de.finix.contelligent.client.i18n.Resources;
21:
22: /**
23: * JDialog for simple action based search in text.
24: */
25: public class FindDialog extends StringOptionPane {
26: public int showStringDialog(String searchText) {
27: return super .showStringDialog(Resources.getLocalString("find"),
28: Resources.getLocalString("search_text"), searchText);
29: }
30: }
31: /*
32: * public class FindDialog extends JDialog {
33: *
34: * final static private int BORDER = 10;
35: *
36: * private JTextField textField; private View view; private Action
37: * executeFindAction; private Action executeFindAllAction; private Action
38: * executeCloseAction; private Action executeFindFromStartAction;
39: *
40: * public static boolean dialogOpen = false;
41: *
42: * public FindDialog(String title, View view, Action executeFindAction, Action
43: * executeFindAllAction, Action executeFindFromStartAction, Action
44: * executeCloseAction) { super((JFrame)null, title, false); this.view = view;
45: * this.executeFindAction = executeFindAction; this.executeFindAllAction =
46: * executeFindAllAction; this.executeFindFromStartAction =
47: * executeFindFromStartAction; this.executeCloseAction = executeCloseAction;
48: * init(); }
49: *
50: * public String getText() { return textField.getText(); }
51: *
52: * public void setText(String text) { textField.setText(text); }
53: *
54: * private void init() { dialogOpen = true;
55: *
56: * JPanel container = new JPanel(new TableLayout(new double[][] { {BORDER, 80,
57: * TableLayout.FILL, BORDER, 100, BORDER}, {BORDER, 25, BORDER, 25, BORDER, 25,
58: * BORDER, 25, BORDER} })); container.setPreferredSize(new Dimension(400, 145));
59: *
60: * setContentPane(container);
61: *
62: * JLabel stringLabel = new JLabel("Search text: "); container.add(stringLabel,
63: * "1,1");
64: *
65: * textField = new JTextField(); container.add(textField, "2,1");
66: *
67: * Font buttonFont = (view == null ? null :
68: * view.getMenuAndToolbarComposer().getButtonFont()); AbstractButton findButton =
69: * ButtonComposer.createButton(executeFindAction, true, buttonFont, false,
70: * false); findButton.setHorizontalAlignment(SwingConstants.LEFT);
71: * container.add(findButton, "4,1");
72: *
73: * AbstractButton findAllButton =
74: * ButtonComposer.createButton(executeFindAllAction, true, buttonFont, false,
75: * false); findAllButton.setHorizontalAlignment(SwingConstants.LEFT);
76: * container.add(findAllButton, "4,3");
77: *
78: * AbstractButton fromStartButton =
79: * ButtonComposer.createButton(executeFindFromStartAction, true, buttonFont,
80: * false, false); // notity editor when this dialog is closed
81: * fromStartButton.setHorizontalAlignment(SwingConstants.LEFT);
82: * container.add(fromStartButton, "4,5");
83: *
84: * AbstractButton closeButton = ButtonComposer.createButton(executeCloseAction,
85: * true, buttonFont, false, false); // notity editor when this dialog is closed
86: * closeButton.setHorizontalAlignment(SwingConstants.LEFT);
87: * container.add(closeButton, "4,7");
88: *
89: * addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent
90: * we) { executeCloseAction.actionPerformed(null); } }); }
91: *
92: * public void dispose() { dialogOpen = false; super.dispose(); } }
93: */
|