@Override public JComponent getComponent(Lookup lookup) { if (!isInitialised()) { initialize(); } return panel.getComponent(); }
@Override public boolean isChanged() { return isInitialised() && panel.isChanged(); }
static class STAOptionsBean { @Preference(label = "Validate tool paths and variables on save", key = PREFERENCE_KEY_VALIDATE_ON_SAVE) boolean validatePaths = DEFAULT_VALUE_VALIDATE_PATHS; @Preference(label = "Display warning when source products are missing", key = PREFERENCE_KEY_SHOW_EMPTY_PRODUCT_WARNING) boolean warnNoProduct = DEFAULT_VALUE_SHOW_EMPTY_PRODUCT_WARINING; @Preference(label = "Display execution output", key = PREFERENCE_KEY_SHOW_EXECUTION_OUTPUT) boolean displayOutput = DEFAULT_VALUE_SHOW_EXECUTION_OUTPUT; @Preference(label = "Use autocomplete of parameters for template editing [experimental]", key = PREFERENCE_KEY_AUTOCOMPLETE) boolean autocomplete = DEFAULT_VALUE_AUTOCOMPLETE; } }
private void initialize() { bindingContext = new BindingContext(createPropertySet()); panel = new PreferencesPanel(createPanel(bindingContext), bindingContext); panel.getComponent(); // trigger component initialisation configure(bindingContext); }
/** * Create a panel that allows the user to set the parameters in the given {@link BindingContext}. Clients that want * to create their own panel representation on the given properties need to overwrite this method. * * @param context The {@link BindingContext} for the panel. * * @return A JPanel instance for the given {@link BindingContext}, never {@code null}. */ protected JPanel createPanel(BindingContext context) { Assert.state(isInitialised()); return new PreferencesPanel(null, bindingContext).getComponent(); }
@Override public void cancel() { if (isInitialised()) { setChanged(false); } }
protected void setChanged(boolean changed) { panel.setChanged(changed); }
/** * Creates color combobox components for a given property. * * @param colorProperty The property to create the components for. * * @return A new color combobox. */ public static JComponent[] createColorComponents(Property colorProperty) { JComponent[] components = new JComponent[2]; components[0] = new JLabel(colorProperty.getDescriptor().getDisplayName() + ":"); components[1] = createColorCombobox(colorProperty); return components; }
@SuppressWarnings("UnusedDeclaration") static class NoDataBean { @Preference(label = "No-data overlay colour", key = PROPERTY_KEY_NO_DATA_OVERLAY_COLOR) Color noDataOverlayColor = NoDataLayerType.DEFAULT_COLOR; @Preference(label = "No-data overlay transparency", key = PROPERTY_KEY_NO_DATA_OVERLAY_TRANSPARENCY, interval = "[0.0,1.0]") double noDataOverlayTransparency = 0.3; }
static class OtherBean { @Preference(label = "Release check interval", config = "snap", key = VersionChecker.PK_CHECK_INTERVAL) VersionChecker.CHECK checkInterval = VersionChecker.CHECK.WEEKLY; }
@SuppressWarnings("UnusedDeclaration") static class WriteOptionsBean { @Preference(label = "Save product header (MPH, SPH, Global_Attributes)", key = PREFERENCE_KEY_SAVE_PRODUCT_HEADERS) boolean saveProductHeaders = DEFAULT_VALUE_SAVE_PRODUCT_HEADERS; @Preference(label = "Save product history (History)", key = PREFERENCE_KEY_SAVE_PRODUCT_HISTORY) boolean saveProductHistory = DEFAULT_VALUE_SAVE_PRODUCT_HISTORY; @Preference(label = "Save product annotation datasets (ADS)", key = PREFERENCE_KEY_SAVE_PRODUCT_ANNOTATIONS) boolean saveProductAds = DEFAULT_VALUE_SAVE_PRODUCT_ANNOTATIONS; @Preference(label = "Use incremental save (only save modified items)", key = PREFERENCE_KEY_SAVE_INCREMENTAL) boolean saveIncremental = DEFAULT_VALUE_SAVE_INCREMENTAL; }
@SuppressWarnings("UnusedDeclaration") static class MaskBean { @SuppressWarnings("AccessStaticViaInstance") @Preference(label = "Default mask overlay colour", key = PREFERENCE_KEY_MASK_COLOR) Color maskOverlayColor = Mask.ImageType.DEFAULT_COLOR.RED; @Preference(label = "Default mask overlay transparency", key = PREFERENCE_KEY_MASK_TRANSPARENCY, interval = "[0.0,1.0]") double maskOverlayTransparency = Mask.ImageType.DEFAULT_TRANSPARENCY; }
@SuppressWarnings("UnusedDeclaration") static class WorldMapBean { @Preference(label = "World Map Layer", key = PROPERTY_KEY_WORLDMAP_TYPE) String worldMapLayerType = "BlueMarbleLayerType"; }
@SuppressWarnings("UnusedDeclaration") static class QuicklookOptionsBean { @Preference(label = "Save quicklooks with product where possible", config = "snap", key = QuicklookGenerator.PREFERENCE_KEY_QUICKLOOKS_SAVE_WITH_PRODUCT) boolean saveWithProduct = QuicklookGenerator.DEFAULT_VALUE_QUICKLOOKS_SAVE_WITH_PRODUCT; @Preference(label = "Max quicklook width in pixels", config = "snap", key = QuicklookGenerator.PREFERENCE_KEY_QUICKLOOKS_MAX_WIDTH) int maxWidth = QuicklookGenerator.DEFAULT_VALUE_QUICKLOOKS_MAX_WIDTH; }
static class GPFBean { @Preference(label = "Beep when processing has finished", key = GPF.BEEP_AFTER_PROCESSING_PROPERTY) boolean beepSound = false; }
@SuppressWarnings("UnusedDeclaration") static class GeneralLayerBean { @Preference(label = "Show a navigation control widget in image views", key = ProductSceneView.PREFERENCE_KEY_IMAGE_NAV_CONTROL_SHOWN) boolean showNavigationControl = true; @Preference(label = "Show scroll bars in image views", key = ProductSceneView.PREFERENCE_KEY_IMAGE_SCROLL_BARS_SHOWN) boolean showScrollBars = false; @Preference(label = "Invert mouse wheel scrolling (zoom-in/out)", key = ProductSceneView.PREFERENCE_KEY_INVERT_ZOOMING) boolean reverseZom = false; }
static class GeoLocationBean { @Preference(label = "Use sub-pixel fraction accuracy for pixel-based geo-coding", key = PREFERENCE_KEY_PIXEL_GEO_CODING_FRACTION_ACCURACY, config = "snap") boolean getPixelPosWithFractionAccuracy = false; @Preference(label = "Snap pins to exact geo-location after import, transfer to another product, or geo-coding change", key = PREFERENCE_KEY_ADJUST_PIN_GEO_POS, config = "snap") boolean snapToExactGeoLocation = true; @Preference(label = "Show geographical coordinates in decimal degrees", key = PREFERENCE_KEY_SHOW_GEO_POS_DECIMALS) boolean showGeoPosAsDecimals = PREFERENCE_DEFAULT_SHOW_GEO_POS_DECIMALS; @Preference(label = "Show pixel coordinates with fractional part", key = PREFERENCE_KEY_SHOW_PIXEL_POS_DECIMALS) boolean showPixelPosAsDecimals = PREFERENCE_DEFAULT_SHOW_PIXEL_POS_DECIMALS; @Preference(label = "Show pixel coordinates starting at (1,1)", key = PREFERENCE_KEY_SHOW_PIXEL_POS_OFFSET_ONE, description = "Show pixel coordinates so that the upper left image corner is (1,1), instead of (0,0).") boolean showPixelPosWithOffset1 = PREFERENCE_DEFAULT_SHOW_PIXEL_POS_OFFSET_1; }
static class UiBehaviorBean { @Preference(label = "Show navigation window when image views are opened", key = PREFERENCE_KEY_AUTO_SHOW_NAVIGATION) boolean autoShowNavigation = true; @Preference(label = "Open image view for new (virtual) bands", key = PREFERENCE_KEY_AUTO_SHOW_NEW_BANDS) boolean autoShowNewBands = true; @Preference(label = "Show only pixel values of loaded or displayed bands", key = PixelInfoView.PREFERENCE_KEY_SHOW_ONLY_DISPLAYED_BAND_PIXEL_VALUES) boolean showOnlyLoadedOrDisplayedBandPixels = PixelInfoView.PREFERENCE_DEFAULT_SHOW_DISPLAYED_BAND_PIXEL_VALUES; @Preference(label = "Maximum recent file list", key = PREFERENCE_KEY_LIST_FILES_TO_REOPEN, interval = "[1,20]") int fileReopen = 10; @Preference(label = "Show suppressed message dialogs again", key = PREFERENCE_KEY_SHOW_SUPPRESSED) boolean showSuppressedDialogsAgain = false; }
@SuppressWarnings("UnusedDeclaration") static class ImageLayerBean { @Preference(label = "Background colour", key = PROPERTY_KEY_IMAGE_BG_COLOR) Color backgroundColor = ProductSceneView.DEFAULT_IMAGE_BACKGROUND_COLOR; @Preference(label = "Show image border", key = PROPERTY_KEY_IMAGE_BORDER_SHOWN) boolean showImageBorder = ImageLayer.DEFAULT_BORDER_SHOWN; @Preference(label = "Image border size", key = PROPERTY_KEY_IMAGE_BORDER_SIZE) double imageBorderSize = ImageLayer.DEFAULT_BORDER_WIDTH; @Preference(label = "Image border colour", key = PROPERTY_KEY_IMAGE_BORDER_COLOR) Color imageBorderColor = ImageLayer.DEFAULT_BORDER_COLOR; @Preference(label = "Show pixel borders in magnified views", key = PROPERTY_KEY_PIXEL_BORDER_SHOWN) boolean showPixelBorder = ImageLayer.DEFAULT_PIXEL_BORDER_SHOWN; @Preference(label = "Pixel border size", key = PROPERTY_KEY_PIXEL_BORDER_SIZE) double pixelBorderSize = ImageLayer.DEFAULT_PIXEL_BORDER_WIDTH; @Preference(label = "Pixel border colour", key = PROPERTY_KEY_PIXEL_BORDER_COLOR) Color pixelBorderColor = ImageLayer.DEFAULT_PIXEL_BORDER_COLOR; }
@Preference(label = "Compute latitude and longitude steps", key = GraticuleLayerType.PROPERTY_NAME_RES_AUTO) boolean computeLatLonSteps = true; @Preference(label = "Average grid size in pixels", key = GraticuleLayerType.PROPERTY_NAME_RES_PIXELS, interval = "[16,512]") int averageGridSize = 128; @Preference(label = "Latitude step (dec. degree)", key = GraticuleLayerType.PROPERTY_NAME_RES_LAT, interval = "[0.01,90.0]") double latStep = 1.0; @Preference(label = "Longitude step (dec. degree)", key = GraticuleLayerType.PROPERTY_NAME_RES_LON, interval = "[0.01,180.0]") double lonStep = 1.0; @Preference(label = "Line colour", key = GraticuleLayerType.PROPERTY_NAME_LINE_COLOR) Color lineColor = new Color(204, 204, 255); @Preference(label = "Line width", key = GraticuleLayerType.PROPERTY_NAME_LINE_WIDTH) double lineWidth = 0.5; @Preference(label = "Line transparency", key = GraticuleLayerType.PROPERTY_NAME_LINE_TRANSPARENCY,