| 1 | |
package org.jtheque.primary.controller.impl; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
import org.jtheque.core.managers.view.able.IView; |
| 20 | |
import org.jtheque.core.managers.view.able.controller.AbstractController; |
| 21 | |
import org.jtheque.primary.controller.able.IChoiceController; |
| 22 | |
import org.jtheque.primary.view.able.IChoiceView; |
| 23 | |
import org.jtheque.primary.view.impl.choice.ChoiceAction; |
| 24 | |
import org.jtheque.primary.view.impl.choice.ChoiceActionFactory; |
| 25 | |
|
| 26 | |
import javax.annotation.Resource; |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | 0 | public final class ChoiceController extends AbstractController implements IChoiceController { |
| 34 | |
private String action; |
| 35 | |
private String content; |
| 36 | |
|
| 37 | |
@Resource |
| 38 | |
private IChoiceView choiceView; |
| 39 | |
|
| 40 | |
@Override |
| 41 | |
public void doAction(Object selectedItem){ |
| 42 | 0 | ChoiceAction choiceAction = ChoiceActionFactory.getChoiceAction(action); |
| 43 | 0 | choiceAction.setSelectedItem(selectedItem); |
| 44 | 0 | choiceAction.setContent(content); |
| 45 | 0 | choiceAction.execute(); |
| 46 | |
|
| 47 | 0 | closeView(); |
| 48 | 0 | } |
| 49 | |
|
| 50 | |
@Override |
| 51 | |
public void setAction(String action){ |
| 52 | 0 | this.action = action; |
| 53 | 0 | } |
| 54 | |
|
| 55 | |
@Override |
| 56 | |
public void setContent(String content){ |
| 57 | 0 | this.content = content; |
| 58 | 0 | } |
| 59 | |
|
| 60 | |
@Override |
| 61 | |
public void displayView(){ |
| 62 | 0 | choiceView.display(content); |
| 63 | 0 | } |
| 64 | |
|
| 65 | |
@Override |
| 66 | |
public IView getView(){ |
| 67 | 0 | return choiceView; |
| 68 | |
} |
| 69 | |
} |