Search in sources :

Example 1 with DateEditionController

use of delta.common.ui.swing.text.dates.DateEditionController in project lotro-companion by dmorcellet.

the class LevelHistoryEditionPanelController method initData.

private void initData() {
    for (int level = 1; level <= _maxLevel; level++) {
        Long date = _data.getDate(level);
        DateEditionController editor = _editors.get(Integer.valueOf(level));
        editor.setDate(date);
    }
}
Also used : DateEditionController(delta.common.ui.swing.text.dates.DateEditionController)

Example 2 with DateEditionController

use of delta.common.ui.swing.text.dates.DateEditionController 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;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) DateListener(delta.common.ui.swing.text.dates.DateListener) DateEditionController(delta.common.ui.swing.text.dates.DateEditionController)

Example 3 with DateEditionController

use of delta.common.ui.swing.text.dates.DateEditionController 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;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) CheckboxController(delta.common.ui.swing.checkbox.CheckboxController) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) FactionLevel(delta.games.lotro.lore.reputation.FactionLevel) JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) DateListener(delta.common.ui.swing.text.dates.DateListener) DateEditionController(delta.common.ui.swing.text.dates.DateEditionController) FactionLevelStatus(delta.games.lotro.character.reputation.FactionLevelStatus) Faction(delta.games.lotro.lore.reputation.Faction)

Example 4 with DateEditionController

use of delta.common.ui.swing.text.dates.DateEditionController in project lotro-companion by dmorcellet.

the class CharacterMainAttrsEditionPanelController method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
    // 1st line
    JPanel firstLinePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    panel.add(firstLinePanel, c);
    // Class icon
    _classIcon = GuiFactory.buildIconLabel(null);
    firstLinePanel.add(_classIcon);
    // Race icon
    _raceIcon = GuiFactory.buildIconLabel(null);
    firstLinePanel.add(_raceIcon);
    // Name
    _name = GuiFactory.buildTextField("");
    _name.setFont(_name.getFont().deriveFont(16f).deriveFont(Font.BOLD));
    _name.setColumns(25);
    firstLinePanel.add(_name);
    // Level
    _level = CharacterUiUtils.buildLevelCombo();
    firstLinePanel.add(_level.getComboBox());
    ItemSelectionListener<Integer> levelListener = new ItemSelectionListener<Integer>() {

        @Override
        public void itemSelected(Integer level) {
            _toon.setLevel(level.intValue());
            // Broadcast level update event...
            CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
            EventsManager.invokeEvent(event);
        }
    };
    _level.addListener(levelListener);
    // Date
    _date = new DateEditionController(DateFormat.getDateTimeCodec());
    firstLinePanel.add(_date.getTextField());
    // 2nd line
    JPanel secondLinePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
    // Short description
    secondLinePanel.add(GuiFactory.buildLabel("Description:"));
    _shortDescription = GuiFactory.buildTextField("");
    _shortDescription.setColumns(50);
    secondLinePanel.add(_shortDescription);
    c = new GridBagConstraints(0, 1, 1, 1, 0.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    panel.add(secondLinePanel, c);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) CharacterEvent(delta.games.lotro.character.events.CharacterEvent) GridBagLayout(java.awt.GridBagLayout) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) DateEditionController(delta.common.ui.swing.text.dates.DateEditionController)

Example 5 with DateEditionController

use of delta.common.ui.swing.text.dates.DateEditionController in project lotro-companion by dmorcellet.

the class LevelHistoryEditionPanelController method updateData.

/**
 * Update internal data from GUI.
 */
public void updateData() {
    for (int level = 1; level <= _maxLevel; level++) {
        DateEditionController editor = _editors.get(Integer.valueOf(level));
        Long date = editor.getDate();
        _data.setLevel(level, date);
    }
}
Also used : DateEditionController(delta.common.ui.swing.text.dates.DateEditionController)

Aggregations

DateEditionController (delta.common.ui.swing.text.dates.DateEditionController)9 JPanel (javax.swing.JPanel)6 GridBagConstraints (java.awt.GridBagConstraints)4 GridBagLayout (java.awt.GridBagLayout)4 Insets (java.awt.Insets)4 DateListener (delta.common.ui.swing.text.dates.DateListener)3 JLabel (javax.swing.JLabel)3 BorderLayout (java.awt.BorderLayout)2 FlowLayout (java.awt.FlowLayout)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 JCheckBox (javax.swing.JCheckBox)2 CheckboxController (delta.common.ui.swing.checkbox.CheckboxController)1 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 DateCodec (delta.common.ui.swing.text.dates.DateCodec)1 CraftingLevelStatus (delta.games.lotro.character.crafting.CraftingLevelStatus)1 CraftingLevelTierStatus (delta.games.lotro.character.crafting.CraftingLevelTierStatus)1 CharacterEvent (delta.games.lotro.character.events.CharacterEvent)1 FactionLevelStatus (delta.games.lotro.character.reputation.FactionLevelStatus)1 CraftingLevel (delta.games.lotro.lore.crafting.CraftingLevel)1