General GUI Code Migration

BEAM classes

Class VisatApp

 Method New code
getApp() SnapApp.getDefault()
getPreferences()
SnapApp.getDefault().getPreferences()
SnapApp.getDefault().
getCompatiblePreferences()
addInternalFrameListener(l)
SnapApp.getDefault().addSelectionChangeListener(ProductSceneView.class, new
SelectionChangeListener<ProductSceneView>() {...})
updateImages()
WindowUtilities.getOpened(ProductSceneViewTopComponent.class).forEach(tc -> {
ProductSceneView view = tc.getView();
for (RasterDataNode raster : view.getRasters()) {
if (modifiedRasters.contains(raster)) {
view.updateImage();
return;
}
}
});
showErrorDialog()
SnapDialogs.showError()
showInfoDialog()
SnapDialogs.showInformation()
showWarningDialog()SnapDialogs.showWarning()
promptForOverwrite(File file)SnapDialogs.requestOverwriteDecision(String title, File file);

 

Interface ToolView and class AbstractToolView

MethodNew code
getPaneControl()The TopComponent instance itself or any child of it
setTitle()
setDisplayName()
getDescriptor()
see PageComponentDescriptor
getPaneWindow()
SwingUtilities.getWindowAncestor(topComponent)

Interface PageComponentDescriptor

Method 
getTitle()
Use @NbBundle.Messages({"key=text"}) and Bundle.key()
getHelpId()
Implement HelpCtx.Provider or directly return constant, take from module.xml

Class HelpSys

Method 
enableHelpOnButton(button, id)
AbstractButton helpButton = ToolButtonFactory.createButton(new HelpAction(provider), false);
or
Button helpButton = new JButton(new HelpAction(new HelpCtx(id)))
or
helpButton.addActionListener(e -> { new HelpCtx(helpId).display();}); 
enableHelpKey(...)
HelpCtx.setHelpIDString(JComponent , helpID);

Class ResourceInstaller

Method 
<init>(File, String, File)

<init>(Path, String, Path) 

To retrieve a path instance either use File.toPath() or Paths.get(String/URI).

getSourceUrl(class)
findModuleCodeBasePath(class)

JIDE Components

 

ComponentReplacement
TitledSeparator
OK!
ColorComboBox
org.esa.beam.framework.ui.color.ColorComboBox
ColorCellEditor
org.esa.beam.framework.ui.color.ColorTableCellEditor
ColorCellRenderer
org.esa.beam.framework.ui.color.ColorTableCellRenderer
SortableTable
JTable table = new JTable(tableModel);
table.setRowSorter(new TableRowSorter<>(tableModel));

 TableRowSorter can also be used for filtering

FilterableCheckBoxList

com.jidesoft.swing.CheckBoxList

along with

org.esa.beam.framework.ui.util.FilteredListModel

QuickListFilterField

com.jidesoft.swing.LabeledTextField

and add DocumentListener to update filter of FilteredListModel

DateExComboBox

org.jdesktop.swingx.JXDatePicker

DateCellEditor

org.jdesktop.swingx.table.DatePickerCellEditor or

org.esa.snap.rcp.util.DateTimePicker

snap-visat-rcp

Delete package
s3tbx-sentinel3-reader.pomAdd the dependency: jidesoft and snap-ui
SpeedTesterDelete Class

DockableBarContext,

DockableBar, DockableBarManager ,

DockableBarAdapter, DockableBarEvent,

DefaultDockableBarDockableHolder,

jide.action objects and are used in BasicApp, Delete BasicApp and fix its usages.

DockContext ,DockableFrame,

DockableFrameAdapter, DockableFrameEvent,

 

 jide.dock objects and are used in

DefaultToolViewPane, FloatingDockableFrame, 

DefaultDockingManager, DockingManager

jide.dock objects and are used in VisatApplicationPage, FloatingDockableFrame,

PixelInfoView

  
LabelStatusBarItemjide.components is used in BasicApp and VisatApp, Solved after deleting the classes
JidePopupMenu

found in ImageInfoEditor

Other

ComponentReplacement
FloatCellEditorDecimalCellEditor