use of delta.common.ui.swing.text.dates.DateListener in project lotro-companion by dmorcellet.
the class ProfessionStatusEditionPanelController method buildValidityDatePanel.
private JPanel buildValidityDatePanel() {
_validityDate = new DateEditionController(DateFormat.getDateTimeCodec());
JPanel panel = GuiFactory.buildPanel(new FlowLayout());
panel.add(GuiFactory.buildLabel("Validity date:"));
panel.add(_validityDate.getTextField());
DateListener dateListener = new DateListener() {
@Override
public void dateChanged(DateEditionController controller, Long newDate) {
_status.setValidityDate(newDate);
triggerChartUpdateTimer();
}
};
_validityDate.addListener(dateListener);
return panel;
}
use of delta.common.ui.swing.text.dates.DateListener 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.text.dates.DateListener in project lotro-companion by dmorcellet.
the class ProfessionStatusEditionPanelController method buildStatusEditionPanel.
private JPanel buildStatusEditionPanel() {
JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
// Header row 1
GridBagConstraints c = new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0);
JLabel tier = GuiFactory.buildLabel("Tier");
panel.add(tier, c);
c.gridx = 1;
c.gridwidth = 3;
c.gridheight = 1;
JLabel proficiency = GuiFactory.buildLabel("Proficiency");
panel.add(proficiency, c);
c.gridx = 4;
c.gridwidth = 3;
c.gridheight = 1;
JLabel mastery = GuiFactory.buildLabel("Mastery");
panel.add(mastery, c);
// Header row 2
c.gridx = 1;
c.gridy = 1;
c.gridwidth = 1;
for (int i = 0; i < 2; i++) {
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
CraftingLevel[] levels = CraftingLevel.ALL_TIERS;
for (CraftingLevel level : levels) {
CraftingLevelStatus levelStatus = _status.getLevelStatus(level);
c.gridx = 0;
JLabel tierLabel = GuiFactory.buildLabel(level.toString());
panel.add(tierLabel, c);
c.gridx++;
// Proficiency
CraftingLevelTierStatus proficiencyStatus = levelStatus.getProficiency();
CraftingLevelTierEditionGadgets proficiencyGadgets = new CraftingLevelTierEditionGadgets(proficiencyStatus);
JCheckBox checkbox = proficiencyGadgets.getCompleted().getCheckbox();
panel.add(checkbox, c);
checkbox.addActionListener(l);
c.gridx++;
panel.add(proficiencyGadgets.getXp().getTextField(), c);
c.gridx++;
DateEditionController dateCompletion = proficiencyGadgets.getCompletionDate();
dateCompletion.addListener(dateListener);
panel.add(dateCompletion.getTextField(), c);
c.gridx++;
_proficiencyGadgets.add(proficiencyGadgets);
// Mastery
CraftingLevelTierStatus masteryStatus = levelStatus.getMastery();
CraftingLevelTierEditionGadgets masteryGadgets = new CraftingLevelTierEditionGadgets(masteryStatus);
checkbox = masteryGadgets.getCompleted().getCheckbox();
panel.add(checkbox, c);
checkbox.addActionListener(l);
c.gridx++;
panel.add(masteryGadgets.getXp().getTextField(), c);
c.gridx++;
dateCompletion = masteryGadgets.getCompletionDate();
dateCompletion.addListener(dateListener);
panel.add(dateCompletion.getTextField(), c);
c.gridx++;
_masteryGadgets.add(masteryGadgets);
c.gridy++;
if (level == CraftingLevel.BEGINNER) {
proficiencyGadgets.getCompleted().setState(false);
masteryGadgets.getCompleted().setState(false);
}
}
return panel;
}
Aggregations