13 |
|
|
14 |
import javax.swing.AbstractAction; |
import javax.swing.AbstractAction; |
15 |
import javax.swing.Action; |
import javax.swing.Action; |
16 |
|
import javax.swing.BorderFactory; |
17 |
import javax.swing.Box; |
import javax.swing.Box; |
18 |
import javax.swing.JButton; |
import javax.swing.JButton; |
19 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
23 |
import javax.swing.JRootPane; |
import javax.swing.JRootPane; |
24 |
import javax.swing.KeyStroke; |
import javax.swing.KeyStroke; |
25 |
|
|
26 |
|
import schmitzm.geotools.styling.StylingUtil; |
27 |
import schmitzm.lang.LangUtil; |
import schmitzm.lang.LangUtil; |
28 |
import schmitzm.lang.ResourceProvider; |
import schmitzm.lang.ResourceProvider; |
29 |
import schmitzm.swing.SwingUtil; |
import schmitzm.swing.SwingUtil; |
31 |
|
|
32 |
public class TranslationAskJDialog extends JDialog { |
public class TranslationAskJDialog extends JDialog { |
33 |
|
|
|
/** |
|
|
* {@link ResourceProvider}, der die Lokalisation fuer GUI-Komponenten des |
|
|
* Package {@code skrueger.swing} zur Verfuegung stellt. Diese sind in |
|
|
* properties-Datein unter {@code skrueger.swing.resource.locales} |
|
|
* hinterlegt. |
|
|
*/ |
|
|
public static ResourceProvider RESOURCE = new ResourceProvider(LangUtil |
|
|
.extendPackagePath(TranslationAskJDialog.class, |
|
|
"resource.locales.SwingResourceBundle"), Locale.ENGLISH); |
|
|
|
|
34 |
private String[] backup = new String[50]; // Maximum 50 languages ;-) |
private String[] backup = new String[50]; // Maximum 50 languages ;-) |
35 |
private OkButton okButton; |
private OkButton okButton; |
36 |
private CancelButton cancelButton; |
private CancelButton cancelButton; |
85 |
*/ |
*/ |
86 |
public TranslationAskJDialog(Component owner, |
public TranslationAskJDialog(Component owner, |
87 |
final JComponent... translationEditJPanels) { |
final JComponent... translationEditJPanels) { |
88 |
super(owner instanceof Window ? (Window) owner : SwingUtil |
super(SwingUtil.getParentWindow(owner)); |
|
.getParentWindow(owner)); |
|
89 |
setComponents(translationEditJPanels); |
setComponents(translationEditJPanels); |
90 |
} |
} |
91 |
|
|
100 |
* to be set visible afterwards.<br/> |
* to be set visible afterwards.<br/> |
101 |
* Using this constructor, you have to call setComponents afterwards. |
* Using this constructor, you have to call setComponents afterwards. |
102 |
*/ |
*/ |
103 |
public TranslationAskJDialog(Window owner) { |
public TranslationAskJDialog(Component owner) { |
104 |
this(owner, new JComponent[] {}); |
this(owner, new JComponent[] {}); |
105 |
} |
} |
106 |
|
|
146 |
SwingUtil.centerFrameOnScreen(this); |
SwingUtil.centerFrameOnScreen(this); |
147 |
Box box = Box.createVerticalBox(); |
Box box = Box.createVerticalBox(); |
148 |
for (JComponent panel : translationEditJPanelsOrJustComponents) { |
for (JComponent panel : translationEditJPanelsOrJustComponents) { |
149 |
|
panel.setAlignmentX(java.awt.Component.LEFT_ALIGNMENT); |
150 |
|
panel.setBorder( BorderFactory.createEmptyBorder(5, 6, 5, 6)); |
151 |
box.add(panel); |
box.add(panel); |
152 |
|
|
153 |
} |
} |
154 |
JPanel cp = new JPanel(new BorderLayout()); |
JPanel cp = new JPanel(new BorderLayout()); |
155 |
cp.add(box, BorderLayout.CENTER); |
cp.add(box, BorderLayout.WEST); |
156 |
cp.add(getButtons(), BorderLayout.SOUTH); |
cp.add(getButtons(), BorderLayout.SOUTH); |
157 |
setContentPane(cp); |
setContentPane(cp); |
158 |
|
|
159 |
setTitle(RESOURCE.getString("translation_dialog_title")); // i8n |
setTitle(SwingUtil.R("TranslationAskJDialog.Title")); |
160 |
setModal(true); |
setModal(true); |
161 |
pack(); |
pack(); |
162 |
} |
} |
258 |
JOptionPane |
JOptionPane |
259 |
.showMessageDialog( |
.showMessageDialog( |
260 |
this, |
this, |
261 |
RESOURCE |
SwingUtil.R("TranslationAskJDialog.ErrorMsg.InvalidCharacterInTranslation")); |
|
.getString("ErrorMsg.InvalidCharacterInTranslation")); |
|
262 |
return false; |
return false; |
263 |
} |
} |
264 |
} |
} |