本文整理汇总了Java中java.util.prefs.PreferencesFactory类的典型用法代码示例。如果您正苦于以下问题:Java PreferencesFactory类的具体用法?Java PreferencesFactory怎么用?Java PreferencesFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PreferencesFactory类属于java.util.prefs包,在下文中一共展示了PreferencesFactory类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCameraData
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
/**
* Updates the image URL's for all the CameraData objects in a VideoArchive
* so that local references are converted to http URL's
* @param videoArchive
*/
public void updateCameraData(VideoArchive videoArchive) {
PreferencesFactory preferencesFactory = Lookup.getPreferencesFactory();
UserAccount userAccount = (UserAccount) Lookup.getUserAccountDispatcher().getValueObject();
if (videoArchive != null &&
preferencesFactory instanceof VarsUserPreferencesFactory &&
userAccount != null) {
VarsUserPreferencesFactory vpf = (VarsUserPreferencesFactory) preferencesFactory;
PreferencesService preferencesService = new PreferencesService(vpf);
File imageTarget = preferencesService.findImageTarget(userAccount.getUserName(), preferencesService.getHostname());
URL imageTargetMapping = preferencesService.findImageTargetMapping(userAccount.getUserName(),
preferencesService.getHostname());
try {
toolBelt.getPersistenceController().updateCameraDataUrls(videoArchive, imageTarget, imageTargetMapping);
} catch (MalformedURLException ex) {
EventBus.publish(Lookup.TOPIC_NONFATAL_ERROR, ex);
}
}
}
示例2: NodeReader
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
public NodeReader(Reader r, PreferencesFactory factory) {
if(r instanceof BufferedReader) {
br = (BufferedReader) r;
} else {
br = new BufferedReader(r);
}
this.factory = factory;
}
示例3: PreferencesAcceptanceTest
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
protected PreferencesAcceptanceTest(Class<F> factoryClass,
Class<P> preferencesClass,
long delay) {
super(delay);
System.setProperty(PreferencesFactory.class.getName(), factoryClass.getName());
this.factoryClass = factoryClass;
this.preferencesClass = preferencesClass;
}
示例4: configure
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
public void configure(Binder binder) {
/*
* Binding an iso8601 data format
*/
final DateFormat dateFormatISO = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") {{
setTimeZone(TimeZone.getTimeZone("UTC"));
}};
binder.bind(DateFormat.class).toInstance(dateFormatISO);
// Bind the EntityManagerFactories
binder.bind(EntityManagerFactory.class).annotatedWith(Names.named("annotationPersistenceUnit")).toInstance(Persistence.createEntityManagerFactory(annotationPersistenceUnit));
binder.bind(EntityManagerFactory.class).annotatedWith(Names.named("knowledgebasePersistenceUnit")).toInstance(Persistence.createEntityManagerFactory(knowledgebasePersistenceUnit));
binder.bind(EntityManagerFactory.class).annotatedWith(Names.named("miscPersistenceUnit")).toInstance(Persistence.createEntityManagerFactory(miscPersistenceUnit));
// Bind annotation object and DAO factories
binder.bind(AnnotationDAOFactory.class).to(AnnotationDAOFactoryImpl.class).in(Scopes.SINGLETON);
binder.bind(AnnotationFactory.class).to(AnnotationFactoryImpl.class);
binder.bind(AnnotationPersistenceService.class).to(AnnotationPersistenceServiceImpl.class).in(Scopes.SINGLETON);
binder.bind(ExternalDataPersistenceService.class).to(EXPDPersistenceService.class);
binder.bind(KnowledgebaseDAOFactory.class).to(KnowledgebaseDAOFactoryImpl.class).in(Scopes.SINGLETON);
binder.bind(KnowledgebaseFactory.class).to(KnowledgebaseFactoryImpl.class);
binder.bind(KnowledgebasePersistenceService.class).to(KnowledgebasePersistenceServiceImpl.class);
binder.bind(MiscDAOFactory.class).to(MiscDAOFactoryImpl.class).in(Scopes.SINGLETON);
binder.bind(MiscFactory.class).to(MiscFactoryImpl.class);
binder.bind(PersistenceCacheProvider.class).to(JPACacheProvider.class);
binder.bind(QueryPersistenceService.class).to(QueryPersistenceServiceImpl.class);
binder.bind(VarsUserPreferencesFactory.class).to(VarsUserPreferencesFactoryImpl.class).in(Scopes.SINGLETON);
binder.bind(PreferencesFactory.class).toProvider(PreferenceFactoryProvider.class);
}
示例5: ImagePreferencesPanel
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
/**
* Create the panel
*
* @param preferencesFactory
*/
public ImagePreferencesPanel(PreferencesFactory preferencesFactory) {
super();
this.controller = new ImagePreferencesPanelController(this, preferencesFactory);
try {
initialize();
}
catch (Exception e) {
log.warn("Failed to initialize!", e);
}
}
示例6: PreferencesFrame
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
/**
* Create the frame
*/
@Inject
public PreferencesFrame(PreferencesFactory preferencesFactory) {
super();
this.preferencesFactory = preferencesFactory;
setBounds(100, 100, 500, 375);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
try {
initialize();
}
catch (Throwable e) {
e.printStackTrace();
}
}
示例7: getPreferencesFactory
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
public PreferencesFactory getPreferencesFactory() {
return preferencesFactory;
}
示例8: setPreferencesFactory
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
public void setPreferencesFactory(PreferencesFactory preferencesFactory) {
this.preferencesFactory = preferencesFactory;
}
示例9: VideoConnectionPreferencesPanelController
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
public VideoConnectionPreferencesPanelController(VideoConnectionPreferencesPanel panel, PreferencesFactory preferencesFactory) {
this.panel = panel;
preferencesService = new PreferencesService(preferencesFactory);
}
示例10: VideoConnectionPreferencesPanel
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
public VideoConnectionPreferencesPanel(PreferencesFactory preferencesFactory) {
this.controller = new VideoConnectionPreferencesPanelController(this, preferencesFactory);
initialize();
}
示例11: persistPreferences
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
private void persistPreferences(Preferences userPreferences) {
if (userPreferences != null) {
// Persist UI preferences
String hostName = null;
try {
hostName = InetAddress.getLocalHost().getHostName();
}
catch (UnknownHostException ex) {
throw new VARSException("Unable to get hostname", ex);
}
String className = getClass().getCanonicalName();
Preferences preferences = userPreferences.node(hostName).node(className);
// -- Save AnnotationFrame size
Dimension size = annotationFrame.getSize();
preferences.putInt(PREF_WIDTH, size.width);
preferences.putInt(PREF_HEIGHT, size.height);
// -- Save TableScrollPane size();
Dimension tablePaneSize = annotationFrame.getTableScrollPane().getSize();
preferences.putInt(PREF_TABLE_WIDTH, tablePaneSize.width);
preferences.putInt(PREF_TABLE_HEIGHT, tablePaneSize.height);
// -- Save OuterSplitPane split location
int outerDividerLocation = annotationFrame.getOuterSplitPane().getDividerLocation();
preferences.putInt(PREF_OUTER_DIVIDER_LOCATION, outerDividerLocation);
// -- Save InnerSplitPane split location
int innerDividerLocation = annotationFrame.getInnerSplitPane().getDividerLocation();
preferences.putInt(PREF_INNER_DIVIDER_LOCATION, innerDividerLocation);
// -- Save AllControlsSplitPane location
int allControlsDividerLocation = annotationFrame.getAllControlsSplitPane().getDividerLocation();
preferences.putInt(PREF_ALLCONTROLS_DIVIDER_LOCATION, allControlsDividerLocation);
// -- Save ControlSplitPane location
int controlsDividerLocation = annotationFrame.getControlsPanelSplitPane().getDividerLocation();
preferences.putInt(PREF_CONTROLS_DIVIDER_LOCATION, controlsDividerLocation);
// -- Save video control info
Injector injector = (Injector) Lookup.getGuiceInjectorDispatcher().getValueObject();
PreferencesFactory preferencesFactory = injector.getInstance(PreferencesFactory.class);
PreferencesService preferencesService = new PreferencesService(preferencesFactory);
VideoControlService videoControlService = (VideoControlService) Lookup.getVideoControlServiceDispatcher().getValueObject();
try {
preferencesService.persistLastVideoConnectionId(preferencesService.getHostname(),
videoControlService.getVideoControlInformation().getVideoConnectionID());
}
catch (NullPointerException e) {
log.info("Did not save Last VideoConnection ID preference. Most likely this " +
"was attempted after the video connection was closed");
}
}
}
示例12: loadPreferences
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
private void loadPreferences(Preferences userPreferences) {
if (userPreferences != null) {
String hostName = null;
try {
hostName = InetAddress.getLocalHost().getHostName();
}
catch (UnknownHostException ex) {
log.warn("Unable to get hostname, defaulting to 'localhost'.", ex);
hostName = "localhost";
}
String className = getClass().getCanonicalName();
Preferences hostPreferences = userPreferences.node(hostName);
Preferences preferences = hostPreferences.node(className);
// -- Set AnnotationFrame size
Dimension currentSize = annotationFrame.getSize();
int width = preferences.getInt(PREF_WIDTH, currentSize.width);
int height = preferences.getInt(PREF_HEIGHT, currentSize.height);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
width = width <= screenSize.width ? width : screenSize.width;
height = height <= screenSize.height ? height : screenSize.height;
annotationFrame.setSize(width, height);
annotationFrame.validate();
// -- Set TableScrollPane size
int tablePaneWidth = preferences.getInt(PREF_TABLE_WIDTH, -1);
int tablePaneHeight = preferences.getInt(PREF_TABLE_HEIGHT, -1);
if (tablePaneWidth > 0 && tablePaneHeight > 0) {
annotationFrame.getTableScrollPane().setPreferredSize(new Dimension(tablePaneWidth, tablePaneHeight));
}
// -- Set OuterSplitPane divider location
int outerDividerLocation = preferences.getInt(PREF_OUTER_DIVIDER_LOCATION, -1);
if (outerDividerLocation > 0) {
annotationFrame.getOuterSplitPane().setDividerLocation(outerDividerLocation);
}
// -- Set innerSplitPane divider location
int innerDividerLocation = preferences.getInt(PREF_INNER_DIVIDER_LOCATION, -1);
if (innerDividerLocation > 0) {
annotationFrame.getInnerSplitPane().setDividerLocation(innerDividerLocation);
}
// -- Set AllControlsSplitPane divider location
int allControlsDividerLocation = preferences.getInt(PREF_ALLCONTROLS_DIVIDER_LOCATION, -1);
if (allControlsDividerLocation > 0) {
annotationFrame.getAllControlsSplitPane().setDividerLocation(allControlsDividerLocation);
}
// -- Set ControlsSplitPane divider location
int controlsDividerLocation = preferences.getInt(PREF_CONTROLS_DIVIDER_LOCATION, -1);
if (controlsDividerLocation > 0) {
annotationFrame.getControlsPanelSplitPane().setDividerLocation(controlsDividerLocation);
}
// -- Load video control info
Injector injector = (Injector) Lookup.getGuiceInjectorDispatcher().getValueObject();
PreferencesFactory preferencesFactory = injector.getInstance(PreferencesFactory.class);
PreferencesService preferencesService = new PreferencesService(preferencesFactory);
if (preferencesService.findAutoconnectVcr(preferencesService.getHostname())) {
String videoID = preferencesService.findLastVideoConnectionId(preferencesService.getHostname());
VideoControlService videoControlService;
try {
videoControlService = VideoControlServiceFactory.newVideoControlService(videoID);
}
catch (Exception e) {
log.warn("Failed to create a VideoControlService for " + videoID);
videoControlService = new DoNothingVideoControlService();
}
Lookup.getVideoControlServiceDispatcher().setValueObject(videoControlService);
}
}
}
示例13: getPreferencesFactory
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
/**
* @return The {@link PreferencesFactory} object used to fetch preferences.
* The PreferencesFactory object should be configured in your Guice
* injector Module
*/
public static PreferencesFactory getPreferencesFactory() {
return PREFERENCES_FACTORY;
}
示例14: ImagePreferencesPanelController
import java.util.prefs.PreferencesFactory; //导入依赖的package包/类
/**
* Constructs ...
*
* @param panel
* @param preferencesFactory
*/
public ImagePreferencesPanelController(ImagePreferencesPanel panel, PreferencesFactory preferencesFactory) {
this.panel = panel;
this.preferencesService = new PreferencesService(preferencesFactory);
}