GuiHelper { public static File getDefaultTargetDirectory(AppContext appContext) { return getFileFromProperties(appContext, LAST_TARGET_DIR_KEY); }  static JPanel createPanelWithBoxLayout(); static TableLayout createTableLayout(int columnCount); static TableLayout createWeightedTablelayout(int columnCount); static void addSourceProductsButtons(JPanel sourceProductPanel, boolean canProductSelectionBeEnabled, BindingContext bindingContext); static JComponent createFileEditorComponent(PropertyDescriptor descriptor, final ChooserFactory cf, BindingContext bindingContext); static JComponent createFileEditorComponent(PropertyDescriptor descriptor, final ChooserFactory cf, BindingContext bindingContext, boolean bindEtcButton); static File getDefaultSourceDirectory(AppContext appContext); static void setDefaultSourceDirectory(File sourceDirectory, AppContext appContext); static File getDefaultTargetDirectory(AppContext appContext); static void setDefaultTargetDirectory(File targetDirectory, AppContext appContext); static Geometry getSelectedGeometry(AppContext appContext); static java.util.List<VectorDataNode> getGeometries(Product selectedProduct); static java.util.List<Geometry> getPolygonGeometries(Product selectedProduct); static void bindGeometryVectorDataNodes(java.util.List<VectorDataNode> geometryNodeList, PropertyContainer propertyContainer); static void bindGeometries(java.util.List<Geometry> geometryNodeList, PropertyContainer propertyContainer); static JComboBox createGeometryComboBox(PropertyDescriptor geometryDescriptor, BindingContext bindingContext); static Component createLatLonCoordinatePanel(String name, String displayName, int numColumns, PropertyContainer propertyContainer, BindingContext bindingContext); static Component createLatLonPanel(PropertyContainer propertyContainer, BindingContext bindingContext); static void bindLonLatPanelToRoiType(int roiTypeId, BindingContext bindingContext); static final String LAST_SOURCE_DIR_KEY; static final String LAST_TARGET_FILE_KEY; static final String LAST_TARGET_DIR_KEY; }
@Test public void testGetDefaultTargetDirectory_fromUserHome() { assumeTrue(isGuiAvailable); final DefaultAppContext appContext = new DefaultAppContext("bla"); final String propertyString = appContext.getPreferences().getPropertyString("org.esa.beam.smos.export.targetDir"); assertEquals("", propertyString); final String expected = System.getProperty("user.home", "."); assertEquals(expected, GuiHelper.getDefaultTargetDirectory(appContext).getPath()); }
@Test public void testGetDefaultTargetDirectory_fromPreferences() { assumeTrue(isGuiAvailable); final String expected = File.separator + "target" + File.separator + "directory"; final DefaultAppContext appContext = new DefaultAppContext("bla"); appContext.getPreferences().setPropertyString("org.esa.beam.smos.export.targetDir", expected); assertEquals(expected, GuiHelper.getDefaultTargetDirectory(appContext).getPath()); }