Revision 2083

View differences:

org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/.svnignore
1
.project
2
.settings
3
.classpath
4
bin
5
target
6

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.linux/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${gvsig.package.info.code}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>target/org.gvsig.jvmpreferences.native.mainplugin.common</directory>
21
      <outputDirectory>.</outputDirectory>
22
      <excludes>
23
        <exclude>package.info</exclude>
24
      </excludes>
25
    </fileSet>
26
    <fileSet>
27
      <directory>src/main/resources-plugin</directory>
28
      <outputDirectory>.</outputDirectory>
29
    </fileSet>
30
  </fileSets>
31

  
32

  
33
  <dependencySets>
34
  
35
    <dependencySet>
36
      <useProjectArtifact>false</useProjectArtifact>
37
      <useTransitiveDependencies>false</useTransitiveDependencies>
38
      <outputDirectory>lib</outputDirectory>
39
      <includes>
40
          <include>org.gvsig:org.gvsig.jvmpreferences.native.mainplugin.common</include>
41
          <include>org.gvsig:org.gvsig.jvmpreferences.native.lib.api</include>
42
          <include>org.gvsig:org.gvsig.jvmpreferences.native.lib.impl.linux</include>
43
          <include>org.gvsig:org.gvsig.jvmpreferences.native.lib.impl.common</include>
44
      </includes>
45
    </dependencySet>
46
    
47
    
48
    
49
  </dependencySets>
50

  
51
</assembly>
0 52

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.linux/src/main/java/org/gvsig/app/extension/NativePrefsExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.app.extension;
23

  
24
import org.gvsig.andami.preferences.IPreferenceExtension;
25
import org.gvsig.jvmpreferences.nativeprefs.NativePrefsLocator;
26
import org.gvsig.jvmpreferences.nativeprefs.NativePrefsManagerLinux;
27

  
28
/**
29
 * Extension to register the native preferences pages and managers
30
 * 
31
 * @author Cesar Martinez Izquierdo
32
 */
33
public class NativePrefsExtension extends BaseNativePrefsExtension
34
		implements IPreferenceExtension {
35
  
36
    protected void registerNativePrefsManagers() {
37
    	NativePrefsLocator.registerNativePrefsManagers(NativePrefsManagerLinux.class);
38
    }
39
}
0 40

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.linux/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
    
5
    <modelVersion>4.0.0</modelVersion>
6
    <packaging>jar</packaging>
7
    <artifactId>org.gvsig.jvmpreferences.native.mainplugin.linux</artifactId>
8
    <name>${project.artifactId}</name>
9
    
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>org.gvsig.jvmpreferences.native.mainplugin</artifactId>
13
        <version>1.0.108</version>
14
    </parent>
15
    <properties>
16
        <gvsig.package.info.operatingSystem>lin</gvsig.package.info.operatingSystem>
17
    </properties>    
18

  
19
  <build>
20
    <plugins>
21
      <plugin>
22
        <groupId>org.apache.maven.plugins</groupId>
23
        <artifactId>maven-dependency-plugin</artifactId>
24
        <executions>
25
          <execution>
26
                <id>unpack</id>
27
                <phase>process-sources</phase>
28
                <goals>
29
                  <goal>unpack</goal>
30
                </goals>
31
                <configuration>
32
                  <artifactItems>
33
                    <artifactItem>
34
                            <groupId>org.gvsig</groupId>
35
                            <artifactId>org.gvsig.jvmpreferences.native.mainplugin.common</artifactId>
36
                            <type>zip</type>
37
                                              <overWrite>true</overWrite>
38
                                              <outputDirectory>target</outputDirectory>
39
                    </artifactItem>
40
                  </artifactItems>
41
                </configuration>
42
          </execution>
43
        </executions>
44
      </plugin>
45
    </plugins>
46
  </build>
47

  
48

  
49
    <dependencies>
50
        <dependency>
51
          <groupId>org.gvsig</groupId>
52
          <artifactId>org.gvsig.jvmpreferences.native.mainplugin.common</artifactId>
53
          <version>1.0.108</version>
54
          <type>zip</type>
55
        </dependency>
56
        <dependency>
57
          <groupId>org.gvsig</groupId>
58
          <artifactId>org.gvsig.jvmpreferences.native.mainplugin.common</artifactId>
59
          <version>1.0.108</version>
60
        </dependency>
61
        <dependency>
62
          <groupId>org.gvsig</groupId>
63
          <artifactId>org.gvsig.jvmpreferences.native.lib.impl.linux</artifactId>
64
          <version>1.0.108</version>
65
        </dependency>
66
        <dependency>
67
          <groupId>org.gvsig</groupId>
68
          <artifactId>org.gvsig.jvmpreferences.native.lib.impl.common</artifactId>
69
          <version>1.0.108</version>
70
        </dependency>
71
        <dependency>
72
          <groupId>org.gvsig</groupId>
73
          <artifactId>org.gvsig.jvmpreferences.native.lib.api</artifactId>
74
          <version>1.0.108</version>
75
        </dependency>
76
    </dependencies>
77

  
78
  <profiles>
79
    <profile>
80
      <id>gvsig-plugin-install-nativepreferences-linux</id>
81
      <activation>
82
         <os>
83
             <family>unix</family>
84
             <!--  It can be further specialized in the fture (for instance if we want to create a Mac profile):
85
             <name>linux</name>
86
             <arch>x86</arch> (or i386, depending on the JVM and distribution)
87
             -->
88
         </os>
89
      </activation>
90
            <properties>
91
              <gvsig.install.plugin>true</gvsig.install.plugin>
92
            </properties>
93
    </profile>
94
  </profiles>
95

  
96
</project>
97

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.linux/buildNumber.properties
1
#Fri Jul 31 23:41:46 CEST 2020
2
buildNumber=111
0 3

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
    
5
    <modelVersion>4.0.0</modelVersion>
6
    <packaging>pom</packaging>
7
    <artifactId>org.gvsig.jvmpreferences.native.mainplugin</artifactId>
8
    <name>Native preferences: mainplugin</name>
9
    
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>org.gvsig.jvmpreferences.native</artifactId>
13
        <version>1.0.108</version>
14
    </parent>
15
    
16

  
17
    <properties>
18
        <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0</gvsig.package.info.dependencies>
19
        <gvsig.package.info.categories>Native preferences</gvsig.package.info.categories>
20
	<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-jvmpreferences/pool</gvsig.package.info.poolURL>
21
	<gvsig.package.info.sourcesURL>https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.jvmpreferences/trunk/org.gvsig.jvmpreferences.native</gvsig.package.info.sourcesURL>
22
	<gvsig.package.info.state>final</gvsig.package.info.state>
23
        <gvsig.package.info.official>true</gvsig.package.info.official>
24
        <!-- <gvsig.package.info.operatingSystem>all</gvsig.package.info.operatingSystem> -->
25
        <gvsig.package.info.architecture>all</gvsig.package.info.architecture>
26
        <gvsig.install.plugin>false</gvsig.install.plugin>
27
        <gvsig.package.info.code>${project.parent.artifactId}</gvsig.package.info.code>
28
        <gvsig.package.info.description>${project.parent.description}</gvsig.package.info.description>
29
        <gvsig.package.info.name>${project.parent.name}</gvsig.package.info.name>
30
    </properties>
31

  
32
  <modules>
33
    <module>org.gvsig.jvmpreferences.native.mainplugin.common</module>
34
    <module>org.gvsig.jvmpreferences.native.mainplugin.linux</module>
35
    <module>org.gvsig.jvmpreferences.native.mainplugin.windows</module>
36
  </modules>
37

  
38
</project>
39

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
    
5
    <modelVersion>4.0.0</modelVersion>
6
    <packaging>jar</packaging>
7
    <artifactId>org.gvsig.jvmpreferences.native.mainplugin.common</artifactId>
8
    <name>${project.artifactId}</name>
9
    
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>org.gvsig.jvmpreferences.native.mainplugin</artifactId>
13
        <version>1.0.108</version>
14
    </parent>
15
    
16
    <dependencies>
17

  
18
        <dependency>
19
            <groupId>org.gvsig</groupId>
20
            <artifactId>org.gvsig.app.mainplugin</artifactId>
21
            <scope>compile</scope>
22
        </dependency>
23
        <dependency>
24
            <groupId>org.gvsig</groupId>
25
            <artifactId>org.gvsig.andami</artifactId>
26
            <scope>compile</scope>
27
        </dependency>
28
        <dependency>
29
            <groupId>org.gvsig</groupId>
30
            <artifactId>org.gvsig.compat.api</artifactId>
31
            <scope>compile</scope>
32
        </dependency>
33
        <dependency>
34
            <groupId>org.gvsig</groupId>
35
            <artifactId>org.gvsig.i18n</artifactId>
36
            <scope>compile</scope>
37
        </dependency>
38

  
39
        <dependency>
40
            <groupId>org.gvsig</groupId>
41
            <artifactId>org.gvsig.jvmpreferences.native.lib.api</artifactId>
42
            <scope>compile</scope>
43
            <version>1.0.108</version>
44
        </dependency>
45
        <dependency>
46
            <groupId>org.gvsig</groupId>
47
            <artifactId>org.gvsig.jvmpreferences.native.lib.impl.common</artifactId>
48
            <scope>compile</scope>
49
            <version>1.0.108</version>
50
        </dependency>
51
        <dependency>
52
            <groupId>org.gvsig</groupId>
53
            <artifactId>org.gvsig.ui</artifactId>
54
            <scope>compile</scope>
55
        </dependency>
56

  
57

  
58
    </dependencies>
59

  
60
    <properties>
61
        <gvsig.install.plugin.package>false</gvsig.install.plugin.package>
62
        <gvsig.install.plugin>false</gvsig.install.plugin>
63
    </properties>
64

  
65

  
66
</project>
67

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/buildNumber.properties
1
#Fri Jul 31 23:41:45 CEST 2020
2
buildNumber=111
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/src/test/resources/README.txt
1
Put into this folder the resources needed by your test classes.
2

  
3
This folder is added to the Tests classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your tests classes.
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.app.document.layout">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25
  <dependencySets>
26
  
27
    <dependencySet>
28
      <useProjectArtifact>false</useProjectArtifact>
29
      <useTransitiveDependencies>false</useTransitiveDependencies>
30
      <outputDirectory>lib</outputDirectory>
31
      <includes>
32
          <include>org.gvsig:org.gvsig.jvmpreferences.native.lib.api</include>
33
      </includes>
34
    </dependencySet>
35
    
36
    
37
    
38
  </dependencySets>
39

  
40
</assembly>
0 41

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/src/main/java/org/gvsig/jvmpreferences/nativeprefs/ui/MemoryPreferencesPage.java
1
package org.gvsig.jvmpreferences.nativeprefs.ui;
2

  
3

  
4
import java.awt.Color;
5
import java.awt.Dimension;
6
import java.awt.GridBagConstraints;
7
import java.awt.GridBagLayout;
8
import java.awt.Insets;
9
import java.awt.event.ActionEvent;
10
import java.awt.event.ActionListener;
11
import java.util.Hashtable;
12

  
13
import javax.swing.BorderFactory;
14
import javax.swing.ButtonGroup;
15
import javax.swing.ImageIcon;
16
import javax.swing.JEditorPane;
17
import javax.swing.JLabel;
18
import javax.swing.JPanel;
19
import javax.swing.JRadioButton;
20
import javax.swing.JSlider;
21
import javax.swing.event.ChangeEvent;
22
import javax.swing.event.ChangeListener;
23

  
24
import org.gvsig.andami.preferences.AbstractPreferencePage;
25
import org.gvsig.andami.preferences.StoreException;
26
import org.gvsig.i18n.Messages;
27
import org.gvsig.jvmpreferences.nativeprefs.MemoryPreferences;
28
import org.gvsig.jvmpreferences.nativeprefs.NativePrefsLocator;
29
import org.gvsig.tools.swing.api.ToolsSwingLocator;
30
import org.gvsig.gui.beans.swing.JNumberSpinner;
31

  
32
public class MemoryPreferencesPage extends AbstractPreferencePage {
33
	private ImageIcon icon =  ToolsSwingLocator.getIconThemeManager().getCurrent().get("memory-preferences");
34
	private MemoryPreferences mempref = NativePrefsLocator.getManager().getMemoryPreferences();
35
	private JSlider slider;
36
	private int maxSafe;
37
	private JLabel lblHeader = null;
38
	private ButtonGroup btGroup = null;
39
	private JRadioButton rbSafeLimits = null;
40
	private JRadioButton rbCustomValue = null;
41
	private JNumberSpinner nfCustomValueFld = null;
42
	private JEditorPane lblWarning = null;
43
	private boolean enabled;
44
	private int initialValue;
45
	private JPanel pnlWarningContainer = null;
46
	private JPanel pnlSlider = null;
47
	private JLabel lblSliderValue = null;
48
	private static final int MIN_VALUE = 256;
49

  
50
	public MemoryPreferencesPage() {
51
		super();
52
		initComponents();
53
//		setParentID(GeneralPage.class.getName()); // commented as we don't want to depend from core plugin
54
	}
55
	
56
	private void initComponents() {
57
		GridBagConstraints c = new GridBagConstraints();
58
		Insets mainInsets = new Insets(4, 4, 4, 4);
59
		int gridy = 0;
60
		if (mempref.isConfigWritable()) {
61
			enabled = true;
62
			maxSafe = mempref.getSafeMemoryMaximum();
63
			Insets indentedInsets = new Insets(4, 22, 4, 4);
64
			c.gridx = 0;
65
			c.anchor = GridBagConstraints.LINE_START;
66
			c.gridwidth = 2;
67
			c.gridy = gridy++;
68
			c.insets = mainInsets;
69
			add(getRbSafeLimits(), c);
70
			c.fill = GridBagConstraints.HORIZONTAL;
71
			c.gridy = gridy++;
72
			c.insets = indentedInsets;
73
			add(getPnlSlider(), c);
74
			c.gridx = 0;
75
			c.gridwidth = 2;
76
			c.gridy = gridy++;
77
			c.insets = mainInsets;
78
			c.fill = GridBagConstraints.NONE;
79
			add(getRbCustomValue(), c);
80
			c.gridwidth = 1;
81
			c.gridy = gridy++;
82
			c.fill = GridBagConstraints.NONE;
83
			c.insets = indentedInsets;
84
			add(getNfCustomValueFld(), c);
85
			c.insets = mainInsets;
86
			c.gridx = 1;
87
			add(getLblMegabytes(), c);
88
			c.gridx = 0;
89
			c.gridwidth = 2;
90
			c.fill = GridBagConstraints.HORIZONTAL;
91
			c.insets = new Insets(10, 10, 10, 10);
92
			c.gridy = gridy;
93
			add(getPnlWarningContainer(), c);
94
/*
95
			c.insets = mainInsets;
96
			c.fill = GridBagConstraints.HORIZONTAL;
97
			c.gridx = 0;
98
			c.gridy = 0;
99
			this.add(getGroupPanel(), c);*/
100
			enableSafeValue();
101
		}
102
		else {
103
			enabled = false;
104
			c.gridx = 0;
105
			c.gridy = gridy;
106
			c.anchor = GridBagConstraints.LINE_START;
107
			c.insets = mainInsets;
108
			add(getLblWarning(getPermissionsWarningText()), c);
109
			/*
110
			c.insets = mainInsets;
111
			c.fill = GridBagConstraints.HORIZONTAL;
112
			c.gridx = 0;
113
			c.gridy = 0;
114
			this.add(getGroupPanel(), c);*/
115
		}
116
	}
117
	
118
	public String getID() {
119
		return MemoryPreferencesPage.class.getName();
120
	}
121

  
122
	public String getTitle() {
123
		return Messages.getText("Memory");
124
	}
125

  
126
	public JPanel getPanel() {
127
		return this;
128
	}
129
	
130
	
131
	private JLabel getHeaderLabel() {
132
		if (lblHeader==null) {
133
			lblHeader  = new JLabel(Messages.getText("Maximum_memory_configuration_Requires_restart"));
134
		}
135
		return lblHeader;
136
	}
137

  
138
	public void initializeValues() {
139
		if (enabled) {
140
			int currentValue = mempref.readConfiguredMaximum();
141
			initialValue = currentValue;
142
			setValue(currentValue);
143
		}
144
	}
145
	
146
	public void setValue(int maxMemory) {
147
		if (enabled) {
148
			if (maxMemory>maxSafe) {
149
				enableCustomValue();
150
				getNfCustomValueFld().setInteger(maxMemory);
151
			}
152
			else {
153
				enableSafeValue();
154
				getSafeSlider().setValue(maxMemory);
155
			}
156
		}
157
	}
158
	
159
	public int getValue() {
160
		if (enabled) {
161
			if (getRbCustomValue().isSelected()) {
162
				return getNfCustomValueFld().getInteger();
163
			}
164
			else {
165
				return getSafeSlider().getValue();
166
			}
167
		}
168
		else return -1;
169
	}
170
	
171
	private void enableCustomValue() {
172
		getRbCustomValue().setSelected(true);
173
		getSafeSlider().setEnabled(false);
174
		getNfCustomValueFld().setEnabled(true);
175
	}
176
	
177
	private void enableSafeValue() {
178
		getRbSafeLimits().setSelected(true);
179
		getNfCustomValueFld().setEnabled(false);
180
		getSafeSlider().setEnabled(true);
181
	}
182

  
183
	public void initializeDefaults() {
184
		if (enabled) {
185
			int maxMem = mempref.getFactoryDefaultMaximum();
186
			setValue(maxMem);
187
		}
188
	}
189

  
190
	public ImageIcon getIcon() {
191
		return icon;
192
	}
193

  
194
	public boolean isValueChanged() {
195
		return (initialValue!=getValue());
196
	}
197

  
198
	@Override
199
	public void storeValues() throws StoreException {
200
		if (enabled) {
201
			mempref.saveConguredMaximum(getValue());
202
		}
203
	}
204

  
205
	@Override
206
	public void setChangesApplied() {
207
	}
208

  
209
	///////////////////////////
210
	// UI components follow: 
211
	//////////////////////////
212
	
213
	
214
	private JRadioButton getRbSafeLimits() {
215
		if (rbSafeLimits==null) {
216
			rbSafeLimits = new JRadioButton(Messages.getText("Safe_limits"));
217
			getButtonGroup().add(rbSafeLimits);
218
			rbSafeLimits.addActionListener(new ActionListener() {
219

  
220
				public void actionPerformed(ActionEvent e) {
221
					if (e.getSource()==rbSafeLimits) {
222
						int currentValue = getNfCustomValueFld().getInteger();
223
						if (currentValue>maxSafe) {
224
							getSafeSlider().setValue(maxSafe);
225
						}
226
						else {
227
							getSafeSlider().setValue(currentValue);
228
						}
229
						enableSafeValue();
230
					}
231
				}
232
				
233
			});
234
			
235
		}
236
		return rbSafeLimits;
237
	}
238
	
239
	private JRadioButton getRbCustomValue() {
240
		if (rbCustomValue==null) {
241
			rbCustomValue = new JRadioButton(Messages.getText("Custom_value"));
242
			getButtonGroup().add(rbCustomValue);
243
			rbCustomValue.addActionListener(new ActionListener() {
244

  
245
				public void actionPerformed(ActionEvent e) {
246
					if (e.getSource()==rbCustomValue) {
247
						getNfCustomValueFld().setInteger(getSafeSlider().getValue());
248
						enableCustomValue();
249
					}
250
				}
251
				
252
			});
253
		}
254
		return rbCustomValue;	
255
	}
256
	
257
	private ButtonGroup getButtonGroup() {
258
		if (btGroup==null) {
259
			btGroup = new ButtonGroup();
260
		}
261
		return btGroup;
262
	}
263
	
264
	private JSlider getSafeSlider() {
265
		if (slider==null) {
266
			slider = new JSlider(MIN_VALUE, maxSafe);
267
			//slider.setMajorTickSpacing((maxSafe-MIN_VALUE));
268
			//slider.setPaintTicks(true);
269
			slider.setPaintLabels(true);
270
			Hashtable labels = slider.createStandardLabels((maxSafe-MIN_VALUE));
271
			labels.put(MIN_VALUE, new JLabel(Messages.getText("Min_value_MB", new String[]{Integer.toString(MIN_VALUE)})));
272
			labels.put(maxSafe, new JLabel(Messages.getText("Max_value_MB", new String[]{Integer.toString(maxSafe)})));
273
			slider.setLabelTable(labels);
274
			slider.setValue(maxSafe);
275
			slider.addChangeListener(new ChangeListener() {
276

  
277
				public void stateChanged(ChangeEvent e) {
278
					JSlider sl = ((JSlider) e.getSource());
279
					getLblSliderValue().setText(getSliderValue());					
280
				}
281
				
282
			});
283
		}
284
		return slider;
285
	}
286
	
287
	private JNumberSpinner getNfCustomValueFld() {
288
		if (nfCustomValueFld==null) {
289
			nfCustomValueFld = new JNumberSpinner(MIN_VALUE, 6, MIN_VALUE, 1048576, 4);
290
		}
291
		return nfCustomValueFld;
292
	}
293
	
294
	private JLabel getLblMegabytes() {
295
		return new JLabel(Messages.getText("MB"));
296
	}
297
	
298
	private String getSafeRangeWarningText() {
299
		StringBuffer buffer = new StringBuffer();
300
		buffer.append("<p><b>").append(Messages.getText("Warning_using_values_higher_than_safe_range_can_cause_gvSIG_doesnt_start")).append("</b></p>");
301
		buffer.append("<p><b>").append(Messages.getText("In_this_case_you_will_need_to_edit_gvSIG_config_files_by_hand")).append("</b></p>");
302
		buffer.append("<p><b>").append(Messages.getText("On_Windows_config_is_stored_in_file_gvsig-desktop.l4j.ini_On_Linux_edit_gvSIG.sh_directly")).append("</b></p>");
303
		return buffer.toString();
304
	}
305
	
306
	private String getPermissionsWarningText() {
307
		StringBuffer buffer = new StringBuffer();
308
		buffer.append("<p><b>").append(Messages.getText("You_need_to_execute_gvSIG_as_administrator_to_configure_memory")).append("</b></p>");
309
		buffer.append("<p><b>").append(Messages.getText("On_Windows_right_click_gvSIG_icon_and_select_Run_as_administrator")).append("</b></p>");
310
		return buffer.toString();
311
	}
312
	
313
	private JPanel getPnlWarningContainer() {
314
		// this panel is just used to add some padding between the border and the inner html text
315
		if (pnlWarningContainer==null) {
316
			pnlWarningContainer = new JPanel(new GridBagLayout());
317
			GridBagConstraints c = new GridBagConstraints();
318
			c.gridx = 0;
319
			c.gridy = 0;
320
			c.insets = new Insets(0, 5, 0, 5);
321
			JEditorPane pane = getLblWarning(getSafeRangeWarningText());
322
			pnlWarningContainer.add(pane, c);
323
			pnlWarningContainer.setBorder(BorderFactory.createLineBorder(Color.RED));
324
		}
325
		return pnlWarningContainer;
326
	}
327
	
328
	private String getSliderValue() {
329
		return Messages.getText("Selected_value_MB", new String[]{Integer.toString(getSafeSlider().getValue())});
330
	}
331
	
332
	private JLabel getLblSliderValue() {
333
		if (lblSliderValue==null) {
334
			lblSliderValue  = new JLabel(getSliderValue());
335
		}
336
		return lblSliderValue;
337
	}
338
	
339
	private JPanel getPnlSlider() {
340
		if (pnlSlider==null) {
341
			pnlSlider = new JPanel(new GridBagLayout());
342
			GridBagConstraints c = new GridBagConstraints();
343
			c.gridx = 0;
344
			c.gridy = 0;
345
			c.anchor = GridBagConstraints.PAGE_START;
346
			c.fill = GridBagConstraints.HORIZONTAL;
347
			pnlSlider.add(getSafeSlider(), c);
348
			c.gridx = 1;
349
			c.fill = GridBagConstraints.NONE;
350
			pnlSlider.add(getLblSliderValue(), c);
351
		}
352
		return pnlSlider;
353
	}
354
	
355
	private JEditorPane getLblWarning(String text) {
356
		if (lblWarning==null) {
357
			lblWarning=new JEditorPane();
358
			lblWarning.setBackground(getLblMegabytes().getBackground());
359
			lblWarning.setContentType("text/html");
360
			lblWarning.setText(text);
361
			Dimension size = new Dimension(400, 200);
362
			lblWarning.setPreferredSize(size);
363
		}
364
		return lblWarning;
365
	}
366
}
0 367

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/src/main/java/org/gvsig/app/extension/BaseNativePrefsExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.app.extension;
23

  
24
import org.gvsig.andami.IconThemeHelper;
25
import org.gvsig.andami.plugins.Extension;
26
import org.gvsig.andami.preferences.IPreference;
27
import org.gvsig.andami.preferences.IPreferenceExtension;
28
import org.gvsig.jvmpreferences.nativeprefs.ui.MemoryPreferencesPage;
29
import org.slf4j.Logger;
30
import org.slf4j.LoggerFactory;
31

  
32
/**
33
 * Extension to register the native preferences pages and managers
34
 * 
35
 * @author Cesar Martinez Izquierdo
36
 */
37
public abstract class BaseNativePrefsExtension extends Extension implements IPreferenceExtension {
38

  
39
    protected static final Logger logger = LoggerFactory
40
        .getLogger(BaseNativePrefsExtension.class);
41

  
42

  
43
    /**
44
     * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
45
     */
46
    public void execute(String s) {
47
    }
48

  
49
    /**
50
     * @see org.gvsig.andami.plugins.IExtension#isVisible()
51
     */
52
    public boolean isVisible() {
53
        return false;
54
    }
55

  
56
    /**
57
     * @see org.gvsig.andami.plugins.IExtension#initialize()
58
     */
59
    public void initialize() {
60
        registerIcons();
61
        registerNativePrefsManagers();
62
    }
63

  
64
    protected void registerIcons() {
65
        // preference icons
66
        IconThemeHelper.registerIcon("preferences", "memory-preferences", this);
67
    }
68
    
69
    protected abstract void registerNativePrefsManagers();
70

  
71
    /**
72
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
73
     */
74
    public boolean isEnabled() {
75
        return false;
76
    }
77

  
78
    public IPreference[] getPreferencesPages() {
79
        return new IPreference[] { 
80
        		new MemoryPreferencesPage()
81
        };
82
    }
83
}
0 84

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/src/main/resources-plugin/i18n/text.properties
1
Encuadre_Vista=Encuadre sobre la vista
2
Zoom_Completo_Vista=Zoom completo sobre la vista
3
Zoom_Mas_Vista=Zoom m\u00e1s sobre la vista
4
Zoom_Menos_Vista=Zoom menos sobre la vista
5
seleccionar_por_rectangulo=Seleccionar por rect\u00e1ngulo
6
pila_de_comandos=Pila de comandos
7
Imprimir=Imprimir
8
tamano_posicion=Tama\u00f1o/posici\u00f3n
9
insertar_localizador=Insertar localizador
10
_Undo_redo_history=Pila de comandos
11
_Error_while_showing_print_dialog=Error al mostrar di?logo de impresi?n
12
_Some_views_excluded_from_list_because_have_editing_layers=Algunas vistas se han exclu?do de la lista por tener capas en edici?n
13
_Cannot_draw_view_if_layers_in_editing_mode=No es posible dibujar vista con capas en edici?n
14
_Layout_template=Plantilla de mapa
15
_Cant_load_layout_template=No se ha podido abrir plantilla de mapa
16
_Bad_format_in_layout_template=Formato inv?lido en plantilla de mapa
17
Mapa2=Mapa v2
18
High_600_dpi=Alta: 600 puntos por pulgada
19
Normal_300_dpi=Normal: 300 puntos por pulgada
20
Low_72_dpi=Baja: 72 puntos por pulgada
21
Create_new_view=Crear nueva Vista
22
Insert_view=Insertar vista
23
Configure_view=Configurar vista
24
Grid_and_ruler=Malla y regla
25
Show_page_config_dialog_when_layout_document_is_created=Mostrar el di?logo de configuraci?n de p?gina cuando se crea un documento Mapa
26
User_interface=Interfaz de usuario
27
Show_table_of_contents_TOC_for_Layout_views=Mostrar tabla de contenidos (TOC) para las vistas del Layout
28
Synchronize_layers=Sincronizar capas
29
Synchronize_extents=Sincronizar extensi?n del mapa
30
Warning_Enabling_layer_synchronization_will_discard_any_change_not_present_in_associated_view=??Cuidado!! Al activar la sincronizaci?n de capas se perder? cualquier cambio que no est? presente en la vista asociada
31
Warning_Layer_sync=Aviso: sincronizaci?n de capas
32
Top_extent_lbl=Superior
33
Bottom_extent_lbl=Inferior
34
Left_extent_lbl=Izquierda
35
Right_extent_lbl=Derecha
36
Synchronization_of_the_view_and_the_frame_view=Sincronizaci?n de la vista y el marco de la vista
37
Fixed_scale_and_extent=Escala y extensi?n fijos
38
Non_fixed=No fija
39
Fixed_scale=Escala fija
40
Fixed_extent=Extensi?n fija
41
1__=1:
42
Extent_cant_be_synchronized_when_using_fixed_scale_or_fixed_extent=La extensi?n no se puede sincronizar en modo escala fija o extensi?n fija
43
Warning_using_values_higher_than_safe_range_can_cause_gvSIG_doesnt_start=??Cuidado!! El uso de valores por encima del rango de seguridad puede provocar que gvSIG no arranque.
44
In_this_case_you_will_need_to_edit_gvSIG_config_files_by_hand=En ese caso, necesitar? editar a mano el fichero de configuraci?n de gvSIG.
45
On_Windows_config_is_stored_in_file_gvsig-desktop.l4j.ini_On_Linux_edit_gvSIG.sh_directly=La configuraci?n se almacena en el fichero 'gvSIG.config' en su directorio de instalaci?n.
46
Maximum_memory_configuration_Requires_restart=Configuraci?n de memoria m?xima (requiere reiniciar)
47
Safe_limits=L?mites seguros
48
Custom_value=Valor personalizado
49
You_need_to_execute_gvSIG_as_administrator_to_configure_memory=Es necesario ejecutar gvSIG como Administrador para poder configurar la memoria.
50
On_Windows_right_click_gvSIG_icon_and_select_Run_as_administrator=En Windows, haga click derecho en el icono de gvSIG y seleccione "Ejecutar como Administrador"
51
Memory=Memoria
52
Min_value_MB=M?n: {0} MB
53
Max_value_MB=Max: {0} MB
54
Selected_value_MB=Seleccionado: {0} MB
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/src/main/resources-plugin/i18n/text_en.properties
1
Encuadre_Vista=View frame pan
2
Zoom_Completo_Vista=Full zoom on view
3
Zoom_Mas_Vista=Zoom in on view
4
Zoom_Menos_Vista=Zoom out on view
5
seleccionar_por_rectangulo=Select by rectangle
6
pila_de_comandos=Command stack
7
Imprimir=Print
8
tamano_posicion=Size/location
9
insertar_localizador=Insert locator
10
_Undo_redo_history=Command stack
11
_Error_while_showing_print_dialog=Error while showing print dialog
12
_Some_views_excluded_from_list_because_have_editing_layers=Some views where excluded from the list because they have layers in editing mode
13
_Cannot_draw_view_if_layers_in_editing_mode=Cannot draw view containing layers in editing mode
14
_Layout_template=Layout template
15
_Cant_load_layout_template=Unable to open layout template
16
_Bad_format_in_layout_template=Bad format in layout template
17
Mapa2=Map v2
18
High_600_dpi=High: 600 dots per inch
19
Normal_300_dpi=Normal: 300 dots per inch
20
Low_72_dpi=Low: 72 dots per inch
21
Create_new_view=Create new View
22
Insert_view=Insert view
23
Configure_view=Configure view
24
Grid_and_ruler=Grid and ruler
25
Show_page_config_dialog_when_layout_document_is_created=Show the page config dialog when layout document is created
26
User_interface=User interface
27
Show_table_of_contents_TOC_for_Layout_views=Show table of contents (TOC) for Layout views
28
Synchronize_layers=Synchronize layers
29
Synchronize_extents=Synchronize map extent
30
Warning_Enabling_layer_synchronization_will_discard_any_change_not_present_in_associated_view=Warning!! Enabling layer synchronization will discard any change not present in the associated view
31
Warning_Layer_sync=Warning: Layer synchronization
32
Top_extent_lbl=Top
33
Bottom_extent_lbl=Bottom
34
Left_extent_lbl=Left
35
Right_extent_lbl=Right
36
Synchronization_of_the_view_and_the_frame_view=Synchronization of the view and the frame view
37
Fixed_scale_and_extent=Fixed scale and extent
38
Non_fixed=Non fixed
39
Fixed_scale=Fixed scale
40
Fixed_extent=Fixed extent
41
1__=1:
42
Extent_cant_be_synchronized_when_using_fixed_scale_or_fixed_extent=Extent can\'t be synchronized when using fixed scale or fixed extent
43
Warning_using_values_higher_than_safe_range_can_cause_gvSIG_doesnt_start=Warning!! Using values higher than the safe range can cause gvSIG to doesn't start.
44
In_this_case_you_will_need_to_edit_gvSIG_config_files_by_hand=In this case, you will need to edit gvSIG config file by hand!!
45
On_Windows_config_is_stored_in_file_gvsig-desktop.l4j.ini_On_Linux_edit_gvSIG.sh_directly=Config is stored in file 'gvSIG.config' in your installation directory
46
Maximum_memory_configuration_Requires_restart=Maximum memory configuration (requires restart)
47
Safe_limits=Safe limits
48
Custom_value=Custom value
49
You_need_to_execute_gvSIG_as_administrator_to_configure_memory=You need to execute gvSIG as administrator to be able to configure memory
50
On_Windows_right_click_gvSIG_icon_and_select_Run_as_administrator=On Windows, right click gvSIG icon and select 'Run as Administrator'.
51
Memory=Memory
52
Min_value_MB=Min: {0} MB
53
Max_value_MB=Max: {0} MB
54
Selected_value_MB=Selected: {0} MB
0 55

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.common/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
    <alternativeNames name="org.gvsig.jvmpreferences.native"/>
4
    <libraries library-dir="lib"/>
5
    <depends plugin-name="org.gvsig.app.mainplugin" />
6
	<resourceBundle name="text"/>
7
	<extensions>
8
		<extension class-name="org.gvsig.app.extension.NativePrefsExtension"
9
			description="Provides native preferences."
10
			active="true"
11
			priority="10">
12
			
13
		</extension>
14

  
15
	</extensions>
16
</plugin-config>
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.windows/buildNumber.properties
1
#Fri Jul 31 23:41:46 CEST 2020
2
buildNumber=111
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.windows/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${gvsig.package.info.code}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>target/org.gvsig.jvmpreferences.native.mainplugin.common</directory>
21
      <outputDirectory>.</outputDirectory>
22
      <excludes>
23
        <exclude>package.info</exclude>
24
      </excludes>
25
    </fileSet>
26
    <fileSet>
27
      <directory>src/main/resources-plugin</directory>
28
      <outputDirectory>.</outputDirectory>
29
    </fileSet>
30
  </fileSets>
31

  
32
  <dependencySets>
33
    <dependencySet>
34
      <useProjectArtifact>false</useProjectArtifact>
35
      <useTransitiveDependencies>false</useTransitiveDependencies>
36
      <outputDirectory>lib</outputDirectory>
37
      <includes>
38
          <include>org.gvsig:org.gvsig.jvmpreferences.native.mainplugin.common</include>
39
          <include>org.gvsig:org.gvsig.jvmpreferences.native.lib.api</include>
40
          <include>org.gvsig:org.gvsig.jvmpreferences.native.lib.impl.windows</include>
41
          <include>org.gvsig:org.gvsig.jvmpreferences.native.lib.impl.common</include>
42
      </includes>
43
    </dependencySet>
44
  </dependencySets>
45

  
46
</assembly>
0 47

  
org.gvsig.jvmpreferences/tags/org.gvsig.jvmpreferences.native-1.0.108/org.gvsig.jvmpreferences.native.mainplugin/org.gvsig.jvmpreferences.native.mainplugin.windows/src/main/java/org/gvsig/app/extension/NativePrefsExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff