@Override public void initPresentation() { IOverviewCategory category = view.addOverviewCategory(getString("Overview.Experience.Title")); for (IValueModel<Integer> model : management.getAllModels()) { IValueView<Integer> valueView = category.addIntegerValueView(getString("Overview.Experience." + model.getId()), 2); presenters.add(new ValueSubPresenter(model, valueView)); } initTotal(category); calculateXPCost(); }
private void initOverviewView() { final IOverviewCategory creationOverview = view.createOverview(resources.getString("Intimacies.Overview.BorderLabel")); final ILabelledAlotmentView freeIntimaciesView = creationOverview.addAlotmentView(resources.getString("Intimacies.Overview.Free"), 2); final ILabelledAlotmentView totalIntimaciesView = creationOverview.addAlotmentView(resources.getString("Intimacies.Overview.Maximum"), 2); final IValueView<Integer> bonusPointsView = creationOverview.addIntegerValueView( resources.getString("Intimacies.Overview.BonusPoints"), 2); final IOverviewCategory experienceOverview = view.createOverview(resources.getString("Intimacies.Overview.BorderLabel")); final ILabelledAlotmentView experienceMaximumView = experienceOverview.addAlotmentView(resources.getString("Intimacies.Overview.Maximum"), 2); model.addModelChangeListener( new IChangeListener() { @Override public void changeOccurred() { recalculateOverview( freeIntimaciesView, totalIntimaciesView, bonusPointsView, experienceMaximumView); } }); model.addModelChangeListener( new IRemovableEntryListener<IIntimacy>() { @Override public void entryAdded(IIntimacy entry) { recalculateOverview( freeIntimaciesView, totalIntimaciesView, bonusPointsView, experienceMaximumView); } @Override public void entryAllowed(boolean complete) { // Nothing to do } @Override public void entryRemoved(IIntimacy entry) { recalculateOverview( freeIntimaciesView, totalIntimaciesView, bonusPointsView, experienceMaximumView); } }); model.addCharacterChangeListener( new DedicatedCharacterChangeAdapter() { @Override public void experiencedChanged(boolean experienced) { setOverview(experienced, experienceOverview, creationOverview); } }); setOverview(model.isCharacterExperienced(), experienceOverview, creationOverview); recalculateOverview( freeIntimaciesView, totalIntimaciesView, bonusPointsView, experienceMaximumView); }
private void initTotal(IOverviewCategory category) { totalView = category.addAlotmentView(getString("Overview.Experience.Total"), 4); character .getExperiencePoints() .addExperiencePointConfigurationListener( new IExperiencePointConfigurationListener() { @Override public void entryAdded(IExperiencePointEntry entry) { calculateXPCost(); } @Override public void entryRemoved(IExperiencePointEntry entry) { calculateXPCost(); } @Override public void entryChanged(IExperiencePointEntry entry) { calculateXPCost(); } }); }
public void setOverview(IOverviewCategory overviewView) { overviewPanel.removeAll(); overviewPanel.add(overviewView.getComponent()); }