@Override public void initContent( Container container, IApplicationModel applicationModel, Resources resources) { NameGeneratorView view = new FxNameGeneratorView(); INameGeneratorModel generatorModel = new ExaltedNameGeneratorModel(); new NameGeneratorPresenter(resources, view, generatorModel).initPresentation(); container.setSwingContent(view.getComponent()); }
private void initSelectedGeneratorTypePresentation() { view.addGeneratorTypeChangeListener( new ChangeListener() { @Override public void changeOccurred() { model.setGeneratorType((Identifier) view.getSelectedGeneratorType()); } }); model.addGeneratorTypeChangeListener( new ChangeListener() { @Override public void changeOccurred() { view.setSelectedGeneratorType(model.getSelectedGeneratorType()); } }); view.setSelectedGeneratorType(model.getSelectedGeneratorType()); }
@Override public void initPresentation() { for (Identifier generatorType : model.getGeneratorTypes()) { String formattedLabel = resources.getString(generatorType.getId()); view.addNameGeneratorType(formattedLabel, generatorType); } initSelectedGeneratorTypePresentation(); initGenerationPresentation(); }
private void initGenerationPresentation() { String label = resources.getString("Namegenerator.GenerateButton.Label"); view.addGenerationAction( label, new Command() { @Override public void execute() { String[] generatedNames = model.generateNames(50); view.setResult(Joiner.on("\n").join(generatedNames)); } }); }