void initMain(Model model) { // 1. mainView.setCellRenderer(new SimpleListCellRenderer(model)); // 2. viewOutline.setSelected(model.displayMode == DisplayMode.OUTLINE_MODE); viewExpand.setSelected(model.displayMode == DisplayMode.EXPANDED_MODE); changeMode.setText( model.displayMode == DisplayMode.OUTLINE_MODE ? rb.getString("button.changeMode.text.outline") : rb.getString("button.changeMode.text.expand")); // 3.1. DI model -> view switch (model.getShowExpandMode()) { case left: showLeftOnly.setSelected(true); break; case right: showRightOnly.setSelected(true); break; case both: showBoth.setSelected(true); break; } switch (model.getShowNumMode()) { case left: showLeftNums.setSelected(true); break; case right: showRightNums.setSelected(true); break; case none: hideNums.setSelected(true); break; } ignoreBlanks.setSelected(model.isIgnoreBlanks()); showIdentical.setSelected(model.isShowIdentical()); showLeft.setSelected(model.isShowLeft()); showRight.setSelected(model.isShowRight()); showDifferent.setSelected(model.isShowDifferent()); hideMarked.setSelected(model.isHideMarked()); // 3.2. history for (int i = 0; i < model.patterns.size(); i++) { patternField.addItem(model.patterns.get(i)); } }
void pagePatternDialog() { patternField.requestFocus(); patternDialog.setLocationRelativeTo(top); patternDialog.setVisible(true); }