use of org.beanfabrics.Path in project grafikon by jub77.
the class ProgramSettingsDialog method initComponents.
private void initComponents() {
ActionListener closeAction = e -> setVisible(false);
java.awt.GridBagConstraints gridBagConstraints;
javax.swing.JPanel dataPanel = new javax.swing.JPanel();
javax.swing.JLabel nameLabel = new javax.swing.JLabel();
BnTextField nameTextField = new BnTextField();
javax.swing.JLabel unitLabel = new javax.swing.JLabel();
javax.swing.JPanel buttonPanel = new javax.swing.JPanel();
BnButton okButton = new BnButton();
javax.swing.JButton cancelButton = new javax.swing.JButton();
// NOI18N
setTitle(ResourceLoader.getString("program.settings.title"));
setResizable(false);
GridBagLayout gbl_dataPanel = new GridBagLayout();
gbl_dataPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0 };
dataPanel.setLayout(gbl_dataPanel);
// NOI18N
nameLabel.setText(ResourceLoader.getString("program.settings.username"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
dataPanel.add(nameLabel, gridBagConstraints);
nameTextField.setColumns(25);
GridBagConstraints gridBagConstraints_1 = new java.awt.GridBagConstraints();
gridBagConstraints_1.gridwidth = 4;
gridBagConstraints_1.gridx = 1;
gridBagConstraints_1.gridy = 0;
gridBagConstraints_1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints_1.weightx = 1.0;
gridBagConstraints_1.insets = new Insets(5, 0, 5, 5);
dataPanel.add(nameTextField, gridBagConstraints_1);
FlowLayout fl_unitsPanel = new FlowLayout(FlowLayout.LEFT);
javax.swing.JPanel unitsPanel = new javax.swing.JPanel(fl_unitsPanel);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 5;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(0, 5, 0, 5);
dataPanel.add(unitsPanel, gridBagConstraints);
// NOI18N
unitLabel.setText(ResourceLoader.getString("modelinfo.unit"));
unitsPanel.add(unitLabel);
BnComboBox lengthUnitComboBox = new BnComboBox();
unitsPanel.add(lengthUnitComboBox);
// $NON-NLS-1$
JLabel speedUnitLabel = new JLabel(ResourceLoader.getString("modelinfo.speed.unit"));
unitsPanel.add(speedUnitLabel);
BnComboBox speedUnitComboBox = new BnComboBox();
unitsPanel.add(speedUnitComboBox);
getContentPane().add(dataPanel, java.awt.BorderLayout.CENTER);
buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
// NOI18N
okButton.setText(ResourceLoader.getString("button.ok"));
okButton.addActionListener(closeAction);
buttonPanel.add(okButton);
// NOI18N
cancelButton.setText(ResourceLoader.getString("button.cancel"));
cancelButton.addActionListener(closeAction);
buttonPanel.add(cancelButton);
getContentPane().add(buttonPanel, java.awt.BorderLayout.PAGE_END);
nameTextField.setModelProvider(provider);
nameTextField.setPath(new Path("user"));
speedUnitComboBox.setModelProvider(provider);
speedUnitComboBox.setPath(new Path("speed"));
lengthUnitComboBox.setModelProvider(provider);
lengthUnitComboBox.setPath(new Path("length"));
okButton.setModelProvider(provider);
okButton.setPath(new Path("ok"));
}
use of org.beanfabrics.Path in project grafikon by jub77.
the class EditCompanyDialog method initComponents.
private void initComponents() {
ActionListener closeListener = evt -> setVisible(false);
BnButton okButton = new BnButton();
javax.swing.JButton cancelButton = new javax.swing.JButton();
// NOI18N
okButton.setText(ResourceLoader.getString("button.ok"));
okButton.addActionListener(closeListener);
// NOI18N
cancelButton.setText(ResourceLoader.getString("button.cancel"));
cancelButton.addActionListener(closeListener);
JPanel panel = new JPanel();
panel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(panel, BorderLayout.CENTER);
GridBagLayout gbLayout = new GridBagLayout();
gbLayout.columnWeights = new double[] { 0.0, 1.0 };
gbLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 1.0 };
panel.setLayout(gbLayout);
// NOI18N
JLabel abbrLabel = new JLabel(ResourceLoader.getString("edit.company.abbreviation"));
GridBagConstraints nlCons = new GridBagConstraints();
nlCons.anchor = GridBagConstraints.WEST;
nlCons.insets = new Insets(0, 0, 5, 5);
nlCons.gridx = 0;
nlCons.gridy = 0;
panel.add(abbrLabel, nlCons);
BnTextField abbrTextField = new BnTextField();
GridBagConstraints gbc_nameTextField = new GridBagConstraints();
gbc_nameTextField.insets = new Insets(0, 0, 5, 0);
gbc_nameTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_nameTextField.gridx = 1;
gbc_nameTextField.gridy = 0;
panel.add(abbrTextField, gbc_nameTextField);
abbrTextField.setColumns(10);
// NOI18N
JLabel nameLabel = new JLabel(ResourceLoader.getString("edit.company.name"));
GridBagConstraints dlCons = new GridBagConstraints();
dlCons.anchor = GridBagConstraints.WEST;
dlCons.insets = new Insets(0, 0, 5, 5);
dlCons.gridx = 0;
dlCons.gridy = 1;
panel.add(nameLabel, dlCons);
BnTextField nameTextField = new BnTextField();
GridBagConstraints dtfCons = new GridBagConstraints();
dtfCons.insets = new Insets(0, 0, 5, 0);
dtfCons.anchor = GridBagConstraints.NORTH;
dtfCons.fill = GridBagConstraints.HORIZONTAL;
dtfCons.gridx = 1;
dtfCons.gridy = 1;
panel.add(nameTextField, dtfCons);
nameTextField.setColumns(30);
// NOI18N
JLabel partLabel = new JLabel(ResourceLoader.getString("edit.company.part.name"));
GridBagConstraints plCons = new GridBagConstraints();
plCons.anchor = GridBagConstraints.WEST;
plCons.insets = new Insets(0, 0, 5, 5);
plCons.gridx = 0;
plCons.gridy = 2;
panel.add(partLabel, plCons);
BnTextField partTextField = new BnTextField();
partTextField.setColumns(30);
GridBagConstraints ptfCons = new GridBagConstraints();
ptfCons.insets = new Insets(0, 0, 5, 0);
ptfCons.fill = GridBagConstraints.HORIZONTAL;
ptfCons.gridx = 1;
ptfCons.gridy = 2;
panel.add(partTextField, ptfCons);
// NOI18N
JLabel localeLabel = new JLabel(ResourceLoader.getString("edit.company.locale"));
GridBagConstraints llCons = new GridBagConstraints();
llCons.anchor = GridBagConstraints.WEST;
llCons.insets = new Insets(0, 0, 5, 5);
llCons.gridx = 0;
llCons.gridy = 3;
panel.add(localeLabel, llCons);
BnComboBox localeComboBox = new BnComboBox();
GridBagConstraints ltfCons = new GridBagConstraints();
ltfCons.insets = new Insets(0, 0, 5, 0);
ltfCons.fill = GridBagConstraints.HORIZONTAL;
ltfCons.gridx = 1;
ltfCons.gridy = 3;
panel.add(localeComboBox, ltfCons);
Component verticalGlue = Box.createVerticalGlue();
GridBagConstraints vgCons = new GridBagConstraints();
vgCons.fill = GridBagConstraints.VERTICAL;
vgCons.insets = new Insets(0, 0, 0, 5);
vgCons.gridx = 0;
vgCons.gridy = 4;
panel.add(verticalGlue, vgCons);
JPanel buttonPanel = new JPanel();
FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
flowLayout.setAlignment(FlowLayout.RIGHT);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
buttonPanel.add(okButton);
buttonPanel.add(cancelButton);
abbrTextField.setModelProvider(provider);
abbrTextField.setPath(new Path("abbr"));
nameTextField.setModelProvider(provider);
nameTextField.setPath(new Path("name"));
localeComboBox.setModelProvider(provider);
localeComboBox.setPath(new Path("locale"));
partTextField.setModelProvider(provider);
partTextField.setPath(new Path("part"));
okButton.setModelProvider(provider);
okButton.setPath(new Path("ok"));
}
use of org.beanfabrics.Path in project grafikon by jub77.
the class OutputTemplateDialog method initComponents.
private void initComponents() {
javax.swing.JPanel controlPanel = new javax.swing.JPanel();
javax.swing.JPanel buttonPanel = new javax.swing.JPanel();
((FlowLayout) buttonPanel.getLayout()).setAlignment(FlowLayout.RIGHT);
okButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
controlPanel.setLayout(new java.awt.BorderLayout());
// NOI18N
okButton.setText(ResourceLoader.getString("button.ok"));
okButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
okButtonActionPerformed(evt);
}
});
buttonPanel.add(okButton);
// NOI18N
cancelButton.setText(ResourceLoader.getString("button.cancel"));
cancelButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
}
});
buttonPanel.add(cancelButton);
controlPanel.add(buttonPanel, BorderLayout.EAST);
getContentPane().add(controlPanel, java.awt.BorderLayout.SOUTH);
JPanel leftPanel = new JPanel();
controlPanel.add(leftPanel, BorderLayout.WEST);
// NOI18N
JButton importTextsButton = new JButton(ResourceLoader.getString("ot.button.import.texts"));
importTextsButton.addActionListener(event -> {
importTextFromTemplate();
});
leftPanel.add(importTextsButton);
// NOI18N
JButton attachmentsButton = new JButton(ResourceLoader.getString("ot.button.attachments"));
leftPanel.add(attachmentsButton);
attachmentsButton.addActionListener(evt -> {
EditAttachmentsDialog dialog = EditAttachmentsDialog.newInstance(GuiComponentUtils.getWindow(this), true, attachmentChooser);
dialog.setLocationRelativeTo(this);
dialog.showDialog(template);
});
// NOI18N
JButton writeTemplateOutputButton = new JButton(ResourceLoader.getString("ot.button.output"));
leftPanel.add(writeTemplateOutputButton);
writeTemplateOutputButton.setEnabled(this.templateWriter != null);
writeTemplateOutputButton.addActionListener(evt -> {
OutputTemplate tempTemplate = this.createTempOutputTemplate();
if (tempTemplate != null) {
templateWriter.accept(tempTemplate);
}
});
tabbedPane = new javax.swing.JTabbedPane(javax.swing.JTabbedPane.TOP);
tabbedPane.addChangeListener(e -> {
if (scriptEditBox != null) {
scriptEditBox.closeSearchDialog();
}
if (textTemplateEditBox != null) {
textTemplateEditBox.closeSearchDialog();
}
});
getContentPane().add(tabbedPane, BorderLayout.CENTER);
javax.swing.JPanel templatePanel = new javax.swing.JPanel();
// NOI18N
tabbedPane.addTab(ResourceLoader.getString("ot.tab.template"), null, templatePanel, null);
templatePanel.setLayout(new BorderLayout(0, 0));
textTemplateEditBox = new net.parostroj.timetable.gui.components.TextTemplateEditBox2();
templatePanel.add(textTemplateEditBox);
// NOI18N
textTemplateEditBox.setTemplateFont(new java.awt.Font("Monospaced", 0, 12));
textTemplateEditBox.setColumns(80);
textTemplateEditBox.setRows(25);
textTemplateEditBox.setVisibleTemplateLanguageChange(false);
javax.swing.JPanel verifyPanel = new javax.swing.JPanel();
templatePanel.add(verifyPanel, BorderLayout.SOUTH);
FlowLayout flowLayout1 = (FlowLayout) verifyPanel.getLayout();
flowLayout1.setAlignment(FlowLayout.LEFT);
keyTextField = new javax.swing.JTextField(15);
outputComboBox = new javax.swing.JComboBox<>();
outputComboBox.setPrototypeDisplayValue("MMMMMM");
outputTypeComboBox = new javax.swing.JComboBox<>();
outputTypeComboBox.setPrototypeDisplayValue("MMMMMMMMMMM");
outputComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
String output = (String) e.getItem();
if (template != null) {
template.setAttribute(OutputTemplate.ATTR_OUTPUT, output);
}
outputTypeComboBox.removeAllItems();
for (String type : OutputFactory.newInstance(output).getOutputTypes()) {
outputTypeComboBox.addItem(type);
}
if (template != null) {
if (OUTPUTS_WITH_TEMPLATE.contains(output)) {
updateValues(false);
} else {
updateValues(true);
}
}
}
}
});
verifyPanel.add(keyTextField);
verifyPanel.add(outputComboBox);
verifyPanel.add(outputTypeComboBox);
verifyButton = new javax.swing.JButton();
// NOI18N
verifyButton.setText(ResourceLoader.getString("ot.button.verify"));
verifyButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
verifyButtonActionPerformed(evt);
}
});
verifyPanel.add(verifyButton);
javax.swing.JLabel suffixLabel = new javax.swing.JLabel(ResourceLoader.getString("ot.extension") + ":");
verifyPanel.add(suffixLabel);
extensionTextField = new javax.swing.JTextField();
verifyPanel.add(extensionTextField);
extensionTextField.setColumns(10);
selectionTypeComboBox = new JComboBox<>();
ModelObjectTypeWrapperDelegate motwd = new ModelObjectTypeWrapperDelegate();
selectionTypeComboBox.addItem(Wrapper.getWrapper(null, motwd));
for (ModelObjectType type : ModelObjectType.values()) {
selectionTypeComboBox.addItem(Wrapper.getWrapper(type, motwd));
}
JLabel selectionLabel = new JLabel(ResourceLoader.getString("ot.selection.type") + ":");
verifyPanel.add(selectionLabel);
verifyPanel.add(selectionTypeComboBox);
javax.swing.JPanel scriptPanel = new javax.swing.JPanel();
// NOI18N
tabbedPane.addTab(ResourceLoader.getString("ot.tab.script"), null, scriptPanel, null);
scriptPanel.setLayout(new BorderLayout(0, 0));
scriptEditBox = new ScriptEditBox();
scriptPanel.add(scriptEditBox);
scriptEditBox.setScriptFont(new Font("Monospaced", Font.PLAIN, 12));
scriptEditBox.setRows(15);
scriptEditBox.setColumns(60);
EditLocalizedStringListAddRemovePanel<AttributeReference<LocalizedString>> localizePanel = new EditLocalizedStringListAddRemovePanel<>(5, false);
localizePanel.setModelProvider(i18nProvider);
localizePanel.setPath(new Path("this"));
localizePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// NOI18N
tabbedPane.addTab(ResourceLoader.getString("ot.tab.localization"), null, localizePanel, null);
setupPanel = new AttributesPanel();
setupPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
tabbedPane.addTab(ResourceLoader.getString("ot.tab.setup"), null, setupPanel, null);
JPanel namePanel = new JPanel();
namePanel.setBorder(new EmptyBorder(5, 5, 5, 5));
namePanel.setLayout(new BorderLayout(0, 0));
// NOI18N
tabbedPane.addTab(ResourceLoader.getString("ot.name"), null, namePanel, null);
EditLocalizedStringPanel nameEditPanel = new EditLocalizedStringPanel(5);
nameEditPanel.setModelProvider(nameProvider);
nameEditPanel.setPath(new Path("this"));
namePanel.add(nameEditPanel, BorderLayout.CENTER);
JPanel descriptionPanel = new JPanel();
descriptionPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
descriptionPanel.setLayout(new BorderLayout(0, 0));
// NOI18N
tabbedPane.addTab(ResourceLoader.getString("ot.tab.description"), null, descriptionPanel, null);
descriptionTextArea = new EditLocalizedStringMultilinePanel(5, 5);
// same font as script area
descriptionTextArea.setFont(scriptEditBox.getScriptFont());
descriptionPanel.add(descriptionTextArea);
scriptCheckBox = new javax.swing.JCheckBox();
scriptCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean isScript = scriptCheckBox.isSelected();
scriptEditBox.setEnabled(isScript);
extensionTextField.setEnabled(!isScript);
if (isScript) {
extensionTextField.setText(null);
try {
scriptEditBox.setScript(Script.createScript(DEFAULT_OUTPUT_SCRIPT, Script.Language.GROOVY));
} catch (GrafikonException e1) {
log.error("Error creating script.", e);
}
} else {
scriptEditBox.setScript(null);
}
}
});
scriptEditBox.addComponentToEditBox(scriptCheckBox);
pack();
}
use of org.beanfabrics.Path in project grafikon by jub77.
the class EditInfoDialog method initComponents.
private void initComponents() {
Font font = new JTextField().getFont();
javax.swing.JPanel buttonsPanel = new javax.swing.JPanel();
buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
BnButton okButton = new BnButton();
javax.swing.JButton cancelButton = new javax.swing.JButton();
ActionListener closeListener = evt -> setVisible(false);
// NOI18N
setTitle(ResourceLoader.getString("info.title"));
getContentPane().setLayout(new BorderLayout());
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
getContentPane().add(tabbedPane, BorderLayout.CENTER);
javax.swing.JPanel dataPanel = createDataPanel();
tabbedPane.addTab(ResourceLoader.getString("info.info"), dataPanel);
JPanel routePanel = createRoutePanel(font);
tabbedPane.addTab(ResourceLoader.getString("info.routes.overwrite"), routePanel);
tabbedPane.setEnabledAt(1, false);
// NOI18N
okButton.setText(ResourceLoader.getString("button.ok"));
okButton.addActionListener(closeListener);
buttonsPanel.add(okButton);
// NOI18N
cancelButton.setText(ResourceLoader.getString("button.cancel"));
cancelButton.addActionListener(closeListener);
buttonsPanel.add(cancelButton);
getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
okButton.setModelProvider(provider);
okButton.setPath(new Path("ok"));
pack();
}
use of org.beanfabrics.Path in project grafikon by jub77.
the class EditInfoDialog method createDataPanel.
private javax.swing.JPanel createDataPanel() {
java.awt.GridBagConstraints gridBagConstraints;
javax.swing.JPanel dataPanel = new javax.swing.JPanel();
GridBagLayout gbl_dataPanel = new GridBagLayout();
dataPanel.setLayout(gbl_dataPanel);
GridBagConstraints gbc_infoLabel = new GridBagConstraints();
gbc_infoLabel.anchor = GridBagConstraints.WEST;
gbc_infoLabel.insets = new Insets(3, 3, 2, 0);
gbc_infoLabel.gridx = 0;
gbc_infoLabel.gridy = 0;
// NOI18N
dataPanel.add(new javax.swing.JLabel(ResourceLoader.getString("info.description")), gbc_infoLabel);
javax.swing.JScrollPane scrollPane = new javax.swing.JScrollPane();
BnTextArea infoTextArea = new BnTextArea();
scrollPane.setViewportView(infoTextArea);
GridBagConstraints gbc_scrollPane = new GridBagConstraints();
gbc_scrollPane.weighty = 1.0;
gbc_scrollPane.weightx = 1.0;
gbc_scrollPane.anchor = GridBagConstraints.WEST;
gbc_scrollPane.insets = new Insets(0, 5, 5, 5);
gbc_scrollPane.fill = GridBagConstraints.BOTH;
gbc_scrollPane.gridx = 0;
gbc_scrollPane.gridy = 1;
dataPanel.add(scrollPane, gbc_scrollPane);
BnCheckBox routeInfoCheckBox = new BnCheckBox();
// NOI18N
routeInfoCheckBox.setText(ResourceLoader.getString("info.route.enabled"));
GridBagConstraints gbc_routeInfoCheckBox = new GridBagConstraints();
gbc_routeInfoCheckBox.anchor = GridBagConstraints.WEST;
gbc_routeInfoCheckBox.insets = new Insets(0, 0, 3, 0);
gbc_routeInfoCheckBox.gridx = 0;
gbc_routeInfoCheckBox.gridy = 4;
dataPanel.add(routeInfoCheckBox, gbc_routeInfoCheckBox);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new Insets(0, 5, 5, 5);
dataPanel.add(new javax.swing.JLabel(ResourceLoader.getString("info.validity")), gridBagConstraints);
BnTextField validityTextField = new BnTextField();
validityTextField.setColumns(25);
java.awt.GridBagConstraints gridBagConstraints_4 = new java.awt.GridBagConstraints();
gridBagConstraints_4.weightx = 1.0;
gridBagConstraints_4.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_4.gridx = 0;
gridBagConstraints_4.gridy = 3;
gridBagConstraints_4.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints_4.insets = new Insets(0, 5, 5, 5);
dataPanel.add(validityTextField, gridBagConstraints_4);
infoTextArea.setFont(validityTextField.getFont());
java.awt.GridBagConstraints gridBagConstraints_5 = new java.awt.GridBagConstraints();
gridBagConstraints_5.weightx = 1.0;
gridBagConstraints_5.gridx = 0;
gridBagConstraints_5.gridy = 5;
gridBagConstraints_5.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints_5.insets = new Insets(0, 3, 5, 5);
BnLabel versionLabel = new BnLabel();
dataPanel.add(versionLabel, gridBagConstraints_5);
infoTextArea.setModelProvider(provider);
infoTextArea.setPath(new Path("info"));
routeInfoCheckBox.setModelProvider(provider);
routeInfoCheckBox.setPath(new Path("isRouteInfo"));
validityTextField.setModelProvider(provider);
validityTextField.setPath(new Path("validity"));
versionLabel.setModelProvider(provider);
versionLabel.setPath(new Path("version"));
return dataPanel;
}
Aggregations