use of delta.common.ui.swing.checkbox.CheckboxController in project lotro-companion by dmorcellet.
the class FactionStatusEditionPanelController method buildStatusEditionPanel.
private JPanel buildStatusEditionPanel() {
JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
// Header row 1
GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0);
JLabel tier = GuiFactory.buildLabel("Rank");
panel.add(tier, c);
// Header row 2
c.gridx = 1;
c.gridy = 1;
c.gridwidth = 1;
panel.add(GuiFactory.buildLabel("Completed"), c);
c.gridx++;
panel.add(GuiFactory.buildLabel("XP"), c);
c.gridx++;
panel.add(GuiFactory.buildLabel("Completion date"), c);
c.gridx++;
c.gridy++;
ActionListener l = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
handleCompletionChange(e.getSource());
}
};
DateListener dateListener = new DateListener() {
@Override
public void dateChanged(DateEditionController controller, Long newDate) {
long date = (newDate != null) ? newDate.longValue() : 0;
handleDateChange(controller, date);
}
};
// Data rows
Faction faction = _status.getFaction();
for (FactionLevel level : faction.getLevels()) {
FactionLevelStatus levelStatus = _status.getStatusForLevel(level);
c.gridx = 0;
JLabel tierLabel = GuiFactory.buildLabel(level.toString());
panel.add(tierLabel, c);
c.gridx++;
FactionLevelEditionGadgets gadgets = new FactionLevelEditionGadgets(levelStatus);
CheckboxController checkboxCtrl = gadgets.getCompleted();
JCheckBox checkbox = checkboxCtrl.getCheckbox();
panel.add(checkbox, c);
checkbox.addActionListener(l);
c.gridx++;
panel.add(gadgets.getXp().getTextField(), c);
c.gridx++;
DateEditionController dateCompletion = gadgets.getCompletionDate();
dateCompletion.addListener(dateListener);
panel.add(dateCompletion.getTextField(), c);
c.gridx++;
_gadgets.add(gadgets);
c.gridy++;
if (level == faction.getInitialLevel()) {
checkboxCtrl.setState(false);
}
}
return panel;
}
use of delta.common.ui.swing.checkbox.CheckboxController in project lotro-companion by dmorcellet.
the class StatContribsPanelController method buildConfigurationPanel.
private JPanel buildConfigurationPanel() {
_merged = new CheckboxController("Merged");
_merged.setSelected(false);
ActionListener l = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setMerged(_merged.isSelected());
}
};
_merged.getCheckbox().addActionListener(l);
JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
panel.add(_merged.getCheckbox(), c);
TitledBorder border = GuiFactory.buildTitledBorder("Configuration");
panel.setBorder(border);
return panel;
}
Aggregations