use of jmri.profile.Profile in project JMRI by JMRI.
the class WebAppManager method getAngularDependencies.
public String getAngularDependencies(Profile profile, Locale locale) {
// NOI18N
StringJoiner dependencies = new StringJoiner("',\n '", "\n '", "'");
List<String> items = new ArrayList<>();
this.getManifests(profile).forEach((WebManifest manifest) -> {
manifest.getAngularDependencies().stream().filter((dependency) -> (!items.contains(dependency))).forEachOrdered((dependency) -> {
items.add(dependency);
});
});
items.forEach((String dependency) -> {
dependencies.add(dependency);
});
return dependencies.toString();
}
use of jmri.profile.Profile in project JMRI by JMRI.
the class JsonUtilHttpService method getConfigProfiles.
/**
*
* @param locale the client's Locale.
* @return the JSON configProfiles message.
*/
public ArrayNode getConfigProfiles(Locale locale) {
ArrayNode root = mapper.createArrayNode();
for (Profile p : ProfileManager.getDefault().getProfiles()) {
boolean isActiveProfile = (p == ProfileManager.getDefault().getActiveProfile());
// only true for activeprofile
boolean isAutoStart = (isActiveProfile && ProfileManager.getDefault().isAutoStartActiveProfile());
ObjectNode connection = mapper.createObjectNode().put(JSON.TYPE, JSON.CONFIG_PROFILE);
ObjectNode data = connection.putObject(JSON.DATA);
data.put(JSON.NAME, p.getName());
data.put(JSON.UNIQUE_ID, p.getUniqueId());
data.put(JSON.ID, p.getId());
data.put(JSON.IS_ACTIVE_PROFILE, isActiveProfile);
data.put(JSON.IS_AUTO_START, isAutoStart);
root.add(connection);
}
return root;
}
use of jmri.profile.Profile in project JMRI by JMRI.
the class JmriConfigurationManager method storePrefs.
/**
* Save preferences. Preferences are saved using either the
* {@link jmri.util.prefs.JmriConfigurationProvider} or
* {@link jmri.util.prefs.JmriPreferencesProvider} as appropriate to the
* register preferences handler.
*/
@Override
public void storePrefs() {
log.debug("Saving preferences...");
Profile profile = ProfileManager.getDefault().getActiveProfile();
InstanceManager.getList(PreferencesManager.class).stream().forEach((o) -> {
log.debug("Saving preferences for {}", o.getClass().getName());
o.savePreferences(profile);
});
}
Aggregations