File: SetLineWidth.java

package info (click to toggle)
gpsprune 17-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,984 kB
  • ctags: 5,218
  • sloc: java: 39,403; sh: 25; makefile: 17; python: 15
file content (58 lines) | stat: -rw-r--r-- 1,363 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package tim.prune.function;

import tim.prune.App;
import tim.prune.DataSubscriber;
import tim.prune.UpdateMessageBroker;
import tim.prune.config.Config;

/**
 * Function to set the width with which lines are drawn
 */
public class SetLineWidth extends SingleNumericParameterFunction
{

	/**
	 * Constructor
	 * @param inApp App object
	 */
	public SetLineWidth(App inApp) {
		super(inApp, 1, 4);
	}

	/** @return name key */
	public String getNameKey() {
		return "function.setlinewidth";
	}

	/** @return description key */
	public String getDescriptionKey() {
		return "dialog.setlinewidth.text";
	}

	/** @return the current value to display */
	public int getCurrentParamValue() {
		return Config.getConfigInt(Config.KEY_LINE_WIDTH);
	}

	/**
	 * Run function
	 */
	public void begin()
	{
		// Not required, because this function is started from a ChooseSingleParameter function
		// and goes directly to the completeFunction method.
	}

	/**
	 * Complete the function using the given line width parameter
	 */
	public void completeFunction(int inLineWidth)
	{
		final int currLineWidth = Config.getConfigInt(Config.KEY_LINE_WIDTH);
		if (inLineWidth >= 1 && inLineWidth <= 4 && inLineWidth != currLineWidth)
		{
			Config.setConfigInt(Config.KEY_LINE_WIDTH, inLineWidth);
			UpdateMessageBroker.informSubscribers(DataSubscriber.SELECTION_CHANGED);
		}
	}
}