예제 #1
0
 @Override
 public void initPresentation() {
   String labelText = resources.getString("Intimacies.SelectionLabel");
   BasicUi basicUi = new BasicUi();
   IStringSelectionView selectionView = view.addSelectionView(labelText, basicUi.getAddIcon());
   initSelectionViewListening(selectionView);
   initOverviewView();
   initModelListening(basicUi, selectionView);
   for (IIntimacy intimacy : model.getEntries()) {
     addSubView(basicUi, intimacy);
   }
   reset(selectionView);
 }
예제 #2
0
 @Override
 protected IRemovableTraitView<?> createSubView(BasicUi basicUi, final IIntimacy intimacy) {
   final IRemovableTraitView<IToggleButtonTraitView<?>> intimacyView =
       view.addEntryView(basicUi.getRemoveIcon(), null, intimacy.getName());
   intimacyView.setMaximum(model.getCompletionValue());
   intimacyView.setValue(intimacy.getTrait().getCurrentValue());
   new TraitPresenter(intimacy.getTrait(), intimacyView).initPresentation();
   intimacyView.addButtonListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           model.removeEntry(intimacy);
         }
       });
   intimacyView
       .getInnerView()
       .addButtonSelectedListener(
           new IBooleanValueChangedListener() {
             @Override
             public void valueChanged(boolean newValue) {
               intimacy.setComplete(newValue);
             }
           });
   intimacy.addCompletionListener(
       new IBooleanValueChangedListener() {
         @Override
         public void valueChanged(boolean newValue) {
           intimacyView.getInnerView().setButtonState(newValue, true);
         }
       });
   intimacyView.getInnerView().setButtonState(intimacy.isComplete(), true);
   return intimacyView;
 }