1 package tim.prune.function;
3 import javax.swing.JOptionPane;
6 import tim.prune.DataSubscriber;
7 import tim.prune.GenericFunction;
8 import tim.prune.I18nManager;
9 import tim.prune.UpdateMessageBroker;
10 import tim.prune.config.Config;
12 public class SetLineWidth extends GenericFunction
17 * @param inApp App object
19 public SetLineWidth(App inApp) {
23 /** @return name key */
24 public String getNameKey() {
25 return "function.setlinewidth";
34 int currLineWidth = Config.getConfigInt(Config.KEY_LINE_WIDTH);
35 if (currLineWidth < 1 || currLineWidth > 4) {
38 Object lineWidthStr = JOptionPane.showInputDialog(_app.getFrame(),
39 I18nManager.getText("dialog.setlinewidth.text"),
40 I18nManager.getText(getNameKey()),
41 JOptionPane.QUESTION_MESSAGE, null, null, "" + currLineWidth);
42 if (lineWidthStr != null)
46 lineWidth = Integer.parseInt(lineWidthStr.toString());
47 if (lineWidth >= 1 && lineWidth <= 4 && lineWidth != currLineWidth)
49 Config.setConfigInt(Config.KEY_LINE_WIDTH, lineWidth);
50 UpdateMessageBroker.informSubscribers(DataSubscriber.SELECTION_CHANGED);
53 catch (NumberFormatException nfe) {};