Пример #1
1
 @Override
 public void profileSelectionChanged(final Optional<MutableProfile> profile) {
   okButton.setEnabled(model.isSaveAllowed());
   deleteProfile.setEnabled(model.getSelectedProfile().isPresent());
   if (profile.isPresent()) {
     final int index = profilesModel.indexOf(profile.get());
     selectionModel.setLeadSelectionIndex(index);
   } else {
     selectionModel.setLeadSelectionIndex(-1);
   }
   addNickname.setEnabled(model.getSelectedProfile().isPresent());
   editNickname.setEnabled(model.getSelectedProfile().isPresent());
   addHighlight.setEnabled(model.getSelectedProfile().isPresent());
   editHighlight.setEnabled(model.getSelectedProfile().isPresent());
   name.setEnabled(model.getSelectedProfile().isPresent());
   name.setText(model.getSelectedProfileName().orElse(""));
   nicknames.setEnabled(model.getSelectedProfile().isPresent());
   nicknamesModel.clear();
   nicknamesModel.addAll(model.getSelectedProfileNicknames().orElse(Lists.newArrayList()));
   highlights.setEnabled(model.getSelectedProfile().isPresent());
   highlightsModel.clear();
   highlightsModel.addAll(model.getSelectedProfileHighlights().orElse(Lists.newArrayList()));
   realname.setEnabled(model.getSelectedProfile().isPresent());
   realname.setText(model.getSelectedProfileRealname().orElse(""));
   ident.setEnabled(model.getSelectedProfile().isPresent());
   ident.setText(model.getSelectedProfileIdent().orElse(""));
 }
Пример #2
0
 @Override
 public void selectedProfileHighlightAdded(final String highlight) {
   okButton.setEnabled(model.isSaveAllowed());
   highlightsModel.add(highlight);
   deleteHighlight.setEnabled(model.isSelectedProfileHighlightsValid());
   editHighlight.setEnabled(model.isSelectedProfileHighlightsValid());
 }
Пример #3
0
 @Override
 public void selectedProfileHighlightEdited(final String oldHighlight, final String newHighlight) {
   okButton.setEnabled(model.isSaveAllowed());
   highlightsModel.set(highlightsModel.indexOf(oldHighlight), newHighlight);
   deleteHighlight.setEnabled(model.isSelectedProfileHighlightsValid());
   editHighlight.setEnabled(model.isSelectedProfileHighlightsValid());
 }
Пример #4
0
 @Override
 public void selectedProfileNicknameEdited(final String oldNickname, final String newNickname) {
   okButton.setEnabled(model.isSaveAllowed());
   nicknamesModel.set(nicknamesModel.indexOf(oldNickname), newNickname);
   addNickname.setEnabled(model.isSelectedProfileNicknamesValid());
   editNickname.setEnabled(model.isSelectedProfileNicknamesValid());
 }
Пример #5
0
 @Override
 public void profileRemoved(final MutableProfile profile) {
   addNickname.setEnabled(model.isProfileListValid());
   addHighlight.setEnabled(model.isProfileListValid());
   okButton.setEnabled(model.isSaveAllowed());
   profilesModel.remove(profile);
 }
Пример #6
0
 private void setupOKButton(final JButton okButton) {
   okButton.setEnabled(model.isSaveAllowed());
   okButton.addActionListener(
       l -> {
         model.save();
         dialog.dispose();
       });
 }
Пример #7
0
 @Override
 public void selectedProfileHighlightRemoved(final String highlight) {
   okButton.setEnabled(model.isSaveAllowed());
   highlightsModel.remove(highlight);
 }
Пример #8
0
 @Override
 public void selectedProfileNicknameRemoved(final String nickname) {
   okButton.setEnabled(model.isSaveAllowed());
   nicknamesModel.remove(nickname);
 }
Пример #9
0
 @Override
 public void selectedNicknameChanged(final Optional<String> nickname) {
   okButton.setEnabled(model.isSaveAllowed());
   deleteNickname.setEnabled(model.isSelectedProfileNicknamesValid());
   editNickname.setEnabled(model.isSelectedProfileNicknamesValid());
 }
Пример #10
0
 @Override
 public void profileEdited(final MutableProfile profile) {
   okButton.setEnabled(model.isSaveAllowed());
 }