Check-in [c51e50ac6c]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Base for icons in the launch list.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c51e50ac6c810c4b09371cb33eb715e183bca7d1
User & Date: stephanie.gawroriski 2019-05-19 13:40:08
Context
2019-05-19
13:42
If no VM was specified, default to SpringCoat rather than the first found one. check-in: a458307b91 user: stephanie.gawroriski tags: trunk
13:40
Base for icons in the launch list. check-in: c51e50ac6c user: stephanie.gawroriski tags: trunk
13:21
Corrections to prevent NPE in profiler NPS writing check-in: 674d4e7bf1 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/apis/meep-swm/javax/microedition/swm/Suite.java.

154
155
156
157
158
159
160





161
162
163
164
165
166
167
	 * @since 2016/06/24
	 */
	public String getAttributeValue(String __a)
	{
		// System suite always returns null
		if (this._name == null)
			return null;





		
		// Just need to read the value from the manifest
		return this.__manifest().getMainAttributes().getValue(__a);
	}
	
	/**
	 * Returns the library suites which this suite depends on.







>
>
>
>
>







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
	 * @since 2016/06/24
	 */
	public String getAttributeValue(String __a)
	{
		// System suite always returns null
		if (this._name == null)
			return null;
		
		// Requesting the JAR file this is associated with, this might be
		// used for an icon
		if ("x-squirreljme-jarfile".equalsIgnoreCase(__a))
			return this._name;
		
		// Just need to read the value from the manifest
		return this.__manifest().getMainAttributes().getValue(__a);
	}
	
	/**
	 * Returns the library suites which this suite depends on.

Changes to runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/MidletMain.java.

170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
				
				// Split off
				String title = value.substring(0, fc).trim(),
					iconrc = value.substring(fc + 1, sc).trim(),
					main = value.substring(sc + 1).trim();
				
				// Build program
				programs.add(new __Program__(suite, main, title, activetask));

				
				// Say it was found via the title
				programlist.setTitle(String.format(
					"Loading (%d Found)...", ++foundcount));
			}
		}
		







|
>







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
				
				// Split off
				String title = value.substring(0, fc).trim(),
					iconrc = value.substring(fc + 1, sc).trim(),
					main = value.substring(sc + 1).trim();
				
				// Build program
				programs.add(new __Program__(suite, main, title, activetask,
					iconrc));
				
				// Say it was found via the title
				programlist.setTitle(String.format(
					"Loading (%d Found)...", ++foundcount));
			}
		}
		

Changes to runt/kmid/launcher/cc/squirreljme/runtime/launcher/ui/__Program__.java.

6
7
8
9
10
11
12



13
14
15
16
17
18
19
..
36
37
38
39
40
41
42






43
44



45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
..
86
87
88
89
90
91
92

93







94
95
96
97
98
99
100
101
102
103
104
105






106





















107
108
109
110
111
112
113
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;




import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Image;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.Task;
import javax.microedition.swm.TaskStatus;
................................................................................
	
	/** The display name of this suite. */
	protected final String displayname;
	
	/** The SquirrelJME name. */
	protected final String squirreljmename;
	






	/** The active task. */
	final __ActiveTask__ _activetask;



	
	/**
	 * Initializes the program.
	 *
	 * @param __suite The suite used.
	 * @param __main The main class.
	 * @param __dn The display name of this suite.
	 * @param __at The active task.

	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/16
	 */
	__Program__(Suite __suite, String __main, String __dn,
		__ActiveTask__ __at)
		throws NullPointerException
	{
		if (__suite == null || __main == null || __at == null)
			throw new NullPointerException("NARG");
		
		this.suite = __suite;
		this.main = __main;

		
		String suitename = __suite.getName();
		this.suitename = suitename;
		
		String displayname;
		this.displayname = (displayname = (__dn != null ? __dn :
			suitename + " " + __main));
................................................................................
					Character.isUpperCase(c))
					sb.append(c);
			}
			
			sjn = sb.toString();
		}
		

		this.squirreljmename = sjn.toLowerCase();







	}
	
	/**
	 * The display image for this suite.
	 *
	 * @return The display image.
	 * @since 2018/11/16
	 */
	public final Image displayImage()
	{
		// Not currently implemented
		todo.TODO.note("Implement launch icon display.");






		return null;





















	}
	
	/**
	 * The display name for this suite.
	 *
	 * @return The display name.
	 * @since 2018/11/16







>
>
>







 







>
>
>
>
>
>


>
>
>








>




|







>







 







>
|
>
>
>
>
>
>
>










|
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.launcher.ui;

import cc.squirreljme.runtime.cldc.io.ResourceInputStream;
import java.io.InputStream;
import java.io.IOException;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Image;
import javax.microedition.swm.ManagerFactory;
import javax.microedition.swm.Suite;
import javax.microedition.swm.Task;
import javax.microedition.swm.TaskStatus;
................................................................................
	
	/** The display name of this suite. */
	protected final String displayname;
	
	/** The SquirrelJME name. */
	protected final String squirreljmename;
	
	/** The name of the JAR (SquirrelJME specific). */
	protected final String jarfile;
	
	/** The icon resource to use. */
	protected final String iconrc;
	
	/** The active task. */
	final __ActiveTask__ _activetask;
	
	/** The icon to show for this program. */
	Image _icon;
	
	/**
	 * Initializes the program.
	 *
	 * @param __suite The suite used.
	 * @param __main The main class.
	 * @param __dn The display name of this suite.
	 * @param __at The active task.
	 * @param __iconrc The icon resource used, may be {@code null}.
	 * @throws NullPointerException On null arguments.
	 * @since 2018/11/16
	 */
	__Program__(Suite __suite, String __main, String __dn,
		__ActiveTask__ __at, String __iconrc)
		throws NullPointerException
	{
		if (__suite == null || __main == null || __at == null)
			throw new NullPointerException("NARG");
		
		this.suite = __suite;
		this.main = __main;
		this.iconrc = __iconrc;
		
		String suitename = __suite.getName();
		this.suitename = suitename;
		
		String displayname;
		this.displayname = (displayname = (__dn != null ? __dn :
			suitename + " " + __main));
................................................................................
					Character.isUpperCase(c))
					sb.append(c);
			}
			
			sjn = sb.toString();
		}
		
		// SquirrelJME special name
		String squirreljmename = sjn.toLowerCase();
		this.squirreljmename = squirreljmename;
		
		// SquirrelJME specific name for the JAR file this belongs to,
		// note that this is only valid within SquirrelJME itself as the
		// property is set from the launcher
		String jarfile = __suite.getAttributeValue("x-squirreljme-jarfile");
		this.jarfile = (jarfile == null ? squirreljmename : jarfile);
	}
	
	/**
	 * The display image for this suite.
	 *
	 * @return The display image.
	 * @since 2018/11/16
	 */
	public final Image displayImage()
	{
		// Image already known?
		Image rv = this._icon;
		if (rv != null)
			return rv;
		
		// No image is here at all
		String iconrc = this.iconrc;
		if (iconrc == null)
			return null;
		
		// Load image from JAR resource
		try (InputStream in = ResourceInputStream.open(this.jarfile, iconrc))
		{
			// No resource exists
			if (in == null)
				return null;
			
			// Load image data
			rv = Image.createImage(in);
		}
		
		// Not a valid image, ignore
		catch (IOException e)
		{
			return null;
		}
		
		// Cache and use
		this._icon = rv;
		return rv;
	}
	
	/**
	 * The display name for this suite.
	 *
	 * @return The display name.
	 * @since 2018/11/16