| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
package org.homeunix.thecave.buddi.view.dialogs.schedule; |
| 5 | |
|
| 6 | |
import java.awt.FlowLayout; |
| 7 | |
|
| 8 | |
import javax.swing.JLabel; |
| 9 | |
|
| 10 | |
import org.homeunix.thecave.buddi.i18n.BuddiKeys; |
| 11 | |
import org.homeunix.thecave.buddi.i18n.keys.ScheduleFrequencyDayOfMonth; |
| 12 | |
import org.homeunix.thecave.buddi.model.ScheduledTransaction; |
| 13 | |
import org.homeunix.thecave.buddi.plugin.api.util.TextFormatter; |
| 14 | |
import org.homeunix.thecave.buddi.view.swing.TranslatorListCellRenderer; |
| 15 | |
|
| 16 | |
import ca.digitalcave.moss.swing.MossPanel; |
| 17 | |
import ca.digitalcave.moss.swing.MossScrollingComboBox; |
| 18 | |
|
| 19 | |
public class MonthlyByDateCard extends MossPanel implements ScheduleCard { |
| 20 | |
public static final long serialVersionUID = 0; |
| 21 | |
|
| 22 | |
private final MossScrollingComboBox monthlyDateChooser; |
| 23 | |
|
| 24 | |
public MonthlyByDateCard() { |
| 25 | 1165 | super(true); |
| 26 | 1165 | monthlyDateChooser = new MossScrollingComboBox(ScheduleFrequencyDayOfMonth.values()); |
| 27 | 1165 | open(); |
| 28 | 1165 | } |
| 29 | |
|
| 30 | |
@Override |
| 31 | |
public void init() { |
| 32 | 1165 | super.init(); |
| 33 | |
|
| 34 | 1165 | this.setLayout(new FlowLayout(FlowLayout.LEFT)); |
| 35 | 1165 | this.add(new JLabel(TextFormatter.getTranslation(BuddiKeys.AND_REPEATING_ON_THE))); |
| 36 | 1165 | this.add(monthlyDateChooser); |
| 37 | 1165 | this.add(new JLabel(TextFormatter.getTranslation(BuddiKeys.OF_EACH_MONTH))); |
| 38 | 1165 | monthlyDateChooser.setRenderer(new TranslatorListCellRenderer()); |
| 39 | 1165 | } |
| 40 | |
|
| 41 | |
@Override |
| 42 | |
public void setEnabled(boolean enabled) { |
| 43 | 1165 | super.setEnabled(enabled); |
| 44 | |
|
| 45 | 1165 | monthlyDateChooser.setEnabled(enabled); |
| 46 | 1165 | } |
| 47 | |
|
| 48 | |
public int getScheduleDay() { |
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | 0 | return monthlyDateChooser.getSelectedIndex() + 1; |
| 53 | |
} |
| 54 | |
|
| 55 | |
public int getScheduleWeek() { |
| 56 | 0 | return 0; |
| 57 | |
} |
| 58 | |
|
| 59 | |
public int getScheduleMonth() { |
| 60 | 0 | return 0; |
| 61 | |
} |
| 62 | |
|
| 63 | |
public void loadSchedule(ScheduledTransaction s) { |
| 64 | 0 | monthlyDateChooser.setSelectedIndex(s.getScheduleDay() - 1); |
| 65 | 0 | } |
| 66 | |
} |