| 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.ScheduleFrequencyDayOfWeek; |
| 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 WeeklyCard extends MossPanel implements ScheduleCard { |
| 20 | |
public static final long serialVersionUID = 0; |
| 21 | |
|
| 22 | |
private final MossScrollingComboBox weeklyDayChooser; |
| 23 | |
|
| 24 | |
public WeeklyCard() { |
| 25 | 1165 | super(true); |
| 26 | |
|
| 27 | 1165 | weeklyDayChooser = new MossScrollingComboBox(ScheduleFrequencyDayOfWeek.values()); |
| 28 | |
|
| 29 | 1165 | open(); |
| 30 | 1165 | } |
| 31 | |
|
| 32 | |
@Override |
| 33 | |
public void init() { |
| 34 | 1165 | super.init(); |
| 35 | |
|
| 36 | 1165 | this.setLayout(new FlowLayout(FlowLayout.LEFT)); |
| 37 | 1165 | this.add(new JLabel(TextFormatter.getTranslation(BuddiKeys.AND_REPEATING_EVERY))); |
| 38 | 1165 | this.add(weeklyDayChooser); |
| 39 | |
|
| 40 | 1165 | weeklyDayChooser.setRenderer(new TranslatorListCellRenderer()); |
| 41 | 1165 | } |
| 42 | |
|
| 43 | |
@Override |
| 44 | |
public void setEnabled(boolean enabled) { |
| 45 | 1165 | super.setEnabled(enabled); |
| 46 | |
|
| 47 | 1165 | weeklyDayChooser.setEnabled(enabled); |
| 48 | 1165 | } |
| 49 | |
|
| 50 | |
public int getScheduleDay() { |
| 51 | 0 | return weeklyDayChooser.getSelectedIndex(); |
| 52 | |
} |
| 53 | |
|
| 54 | |
public int getScheduleWeek() { |
| 55 | 0 | return 0; |
| 56 | |
} |
| 57 | |
|
| 58 | |
public int getScheduleMonth() { |
| 59 | 0 | return 0; |
| 60 | |
} |
| 61 | |
|
| 62 | |
public void loadSchedule(ScheduledTransaction s) { |
| 63 | 0 | weeklyDayChooser.setSelectedIndex(s.getScheduleDay()); |
| 64 | 0 | } |
| 65 | |
} |