X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFeatureEditor.java;fp=src%2Fjalview%2Fgui%2FFeatureEditor.java;h=721c798959beea784c68edbbc1545e45e58b4b74;hb=5e20c0116864d77705d951e35c41a13197791156;hp=d547c5882bc4e61f23da6733a9da3676713efd72;hpb=1bad3c3f74b2e204e0d7ba93a745f5ec775c8a3e;p=jalview.git diff --git a/src/jalview/gui/FeatureEditor.java b/src/jalview/gui/FeatureEditor.java index d547c58..721c798 100644 --- a/src/jalview/gui/FeatureEditor.java +++ b/src/jalview/gui/FeatureEditor.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.gui; import jalview.api.FeatureColourI; @@ -170,30 +190,30 @@ public class FeatureEditor }); description = new JTextArea(3, 25); - + start = new JSpinner(); end = new JSpinner(); start.setPreferredSize(new Dimension(80, 20)); end.setPreferredSize(new Dimension(80, 20)); - + /* * ensure that start can never be more than end */ - start.addChangeListener(new ChangeListener() + start.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - Integer startVal = (Integer) start.getValue(); + Integer startVal = (Integer) start.getValue(); ((SpinnerNumberModel) end.getModel()).setMinimum(startVal); } }); - end.addChangeListener(new ChangeListener() + end.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - Integer endVal = (Integer) end.getValue(); + Integer endVal = (Integer) end.getValue(); ((SpinnerNumberModel) start.getModel()).setMaximum(endVal); } }); @@ -381,8 +401,10 @@ public class FeatureEditor start.setValue(new Integer(firstFeature.getBegin())); end.setValue(new Integer(firstFeature.getEnd())); - ((SpinnerNumberModel) start.getModel()).setMaximum(firstFeature.getEnd()); - ((SpinnerNumberModel) end.getModel()).setMinimum(firstFeature.getBegin()); + ((SpinnerNumberModel) start.getModel()) + .setMaximum(firstFeature.getEnd()); + ((SpinnerNumberModel) end.getModel()) + .setMinimum(firstFeature.getBegin()); description.setText(firstFeature.getDescription()); featureColour = fr.getFeatureStyle(featureType); @@ -405,15 +427,16 @@ public class FeatureEditor */ public void showDialog() { - Runnable okAction = forCreate ? getCreateAction() : getAmendAction(); - Runnable cancelAction = getCancelAction(); + Runnable okAction = forCreate ? getCreateAction() : getAmendAction(); + Runnable cancelAction = getCancelAction(); /* * set dialog action handlers for OK (create/Amend) and Cancel options * also for Delete if applicable (when amending features) */ JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop) - .setResponseHandler(0, okAction).setResponseHandler(2, cancelAction); + .setResponseHandler(0, okAction) + .setResponseHandler(2, cancelAction); if (!forCreate) { dialog.setResponseHandler(1, getDeleteAction()); @@ -439,9 +462,8 @@ public class FeatureEditor } dialog.showInternalDialog(mainPanel, title, - JvOptionPane.YES_NO_CANCEL_OPTION, - JvOptionPane.PLAIN_MESSAGE, null, options, - MessageManager.getString("action.ok")); + JvOptionPane.YES_NO_CANCEL_OPTION, JvOptionPane.PLAIN_MESSAGE, + null, options, MessageManager.getString("action.ok")); } /** @@ -454,7 +476,7 @@ public class FeatureEditor */ protected Runnable getCancelAction() { - Runnable okAction = new Runnable() + Runnable okAction = new Runnable() { @Override public void run() @@ -478,7 +500,7 @@ public class FeatureEditor */ protected Runnable getCreateAction() { - Runnable okAction = new Runnable() + Runnable okAction = new Runnable() { boolean useLastDefaults = features.get(0).getType() == null; @@ -536,7 +558,7 @@ public class FeatureEditor */ protected Runnable getDeleteAction() { - Runnable deleteAction = new Runnable() + Runnable deleteAction = new Runnable() { public void run() { @@ -638,14 +660,14 @@ public class FeatureEditor */ protected Runnable getAmendAction() { - Runnable okAction = new Runnable() + Runnable okAction = new Runnable() { boolean useLastDefaults = features.get(0).getType() == null; - + String featureType = name.getText(); - + String featureGroup = group.getText(); - + public void run() { final String enteredType = name.getText().trim();