本文整理汇总了Java中org.esa.snap.ui.AppContext类的典型用法代码示例。如果您正苦于以下问题:Java AppContext类的具体用法?Java AppContext怎么用?Java AppContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppContext类属于org.esa.snap.ui包,在下文中一共展示了AppContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SimpleExampleDialog
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
public SimpleExampleDialog(String alias, AppContext appContext, String title, String helpId) {
super(appContext, title, helpId);
this.alias = alias;
final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(alias);
parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor());
form = new SimpleForm(appContext, operatorSpi, parameterSupport.getPropertySet(),
getTargetProductSelector());
OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
operatorSpi.getOperatorDescriptor(),
parameterSupport,
appContext,
helpId);
getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}
示例2: S2tbxMosaicDialog
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
S2tbxMosaicDialog(final String title, final String helpID, AppContext appContext) {
super(appContext, title, ID_APPLY_CLOSE, helpID);
final TargetProductSelector selector = getTargetProductSelector();
selector.getModel().setSaveToFileSelected(false);
selector.getModel().setProductName("Multi-size Mosaic");
selector.getSaveToFileCheckBox().setEnabled(true);
form = new S2tbxMosaicForm(selector, appContext);
final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi("Multi-size Mosaic");
S2tbxMosaicFormModel formModel = form.getFormModel();
OperatorParameterSupport parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor(),
formModel.getPropertySet(),
formModel.getParameterMap(),
null);
OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
operatorSpi.getOperatorDescriptor(),
parameterSupport,
appContext,
helpID);
getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}
示例3: getDefaultOutputPath
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
private String getDefaultOutputPath(AppContext appContext) {
final Property dirProperty = container.getProperty("outputDir");
String userHomePath = SystemUtils.getUserHomeDir().getAbsolutePath();
String lastDir = appContext.getPreferences().getPropertyString(PROPERTY_NAME_LAST_OPEN_OUTPUT_DIR, userHomePath);
String path;
try {
path = new File(lastDir).getCanonicalPath();
} catch (IOException ignored) {
path = userHomePath;
}
try {
dirProperty.setValue(new File(path));
} catch (ValidationException ignore) {
}
return path;
}
示例4: CreateOpTab
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
@Override
public JComponent CreateOpTab(String operatorName, Map<String, Object> parameterMap, AppContext appContext) {
paramMap = parameterMap;
targetProductSelector = new TargetProductSelector(new TargetProductSelectorModel(), true);
this.appContext = appContext;
File saveDir = null;
final Object value = paramMap.get(FILE_PARAMETER);
if (value != null) {
final File file = (File) value;
saveDir = file.getParentFile();
}
if (saveDir == null) {
final String homeDirPath = SystemUtils.getUserHomeDir().getPath();
final String savePath = SnapApp.getDefault().getPreferences().get(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR, homeDirPath);
saveDir = new File(savePath);
}
targetProductSelector.getModel().setProductDir(saveDir);
initParameters();
return targetProductSelector.createDefaultPanel();
}
示例5: BatchGraphDialog
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
public BatchGraphDialog(final AppContext theAppContext, final String title, final String helpID,
final boolean closeOnDone) {
super(theAppContext.getApplicationWindow(), title, ID_YES | ID_APPLY_CLOSE_HELP, helpID);
this.appContext = theAppContext;
this.baseTitle = title;
this.closeOnDone = closeOnDone;
openProcessedProducts = true;
setContent(createUI());
if (getJDialog().getJMenuBar() == null) {
final GraphsMenu operatorMenu = new GraphsMenu(getJDialog(), this);
getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}
super.getJDialog().setMinimumSize(new Dimension(400, 300));
}
示例6: GraphBuilderDialog
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
public GraphBuilderDialog(final AppContext theAppContext, final String title, final String helpID, final boolean allowGraphBuilding) {
super(theAppContext.getApplicationWindow(), title, 0, helpID);
this.allowGraphBuilding = allowGraphBuilding;
appContext = theAppContext;
graphEx = new GraphExecuter();
graphEx.addObserver(this);
String lastDir = SnapApp.getDefault().getPreferences().get(LAST_GRAPH_PATH,
ResourceUtils.getGraphFolder("").toFile().getAbsolutePath());
if (new File(lastDir).exists()) {
SnapApp.getDefault().getPreferences().put(LAST_GRAPH_PATH, lastDir);
}
initUI();
}
示例7: SourceProductPanel
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
public SourceProductPanel(final AppContext appContext) {
final TableLayout tableLayout = new TableLayout(1);
tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST);
tableLayout.setTableWeightX(1.0);
tableLayout.setTableFill(TableLayout.Fill.BOTH);
tableLayout.setTablePadding(1, 1);
setLayout(tableLayout);
// Fetch source products
sourceProductSelectorList.add(new SourceProductSelector(appContext));
for (SourceProductSelector selector : sourceProductSelectorList) {
add(selector.createDefaultPanel());
}
add(tableLayout.createVerticalSpacer());
}
示例8: BinningDialog
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
protected BinningDialog(AppContext appContext, String title, String helpID) {
super(appContext, title, ID_APPLY_CLOSE_HELP, helpID, new TargetProductSelectorModel(), true);
formModel = new BinningFormModel();
form = new BinningForm(appContext, formModel, getTargetProductSelector());
OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(OPERATOR_NAME);
ParameterUpdater parameterUpdater = new BinningParameterUpdater();
OperatorParameterSupport parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor(),
formModel.getPropertySet(),
formModel.getParameterMap(),
parameterUpdater);
OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
operatorSpi.getOperatorDescriptor(),
parameterSupport,
appContext,
helpID);
getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}
示例9: processingParamsComputeButtonActionPerformed
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
private void processingParamsComputeButtonActionPerformed(java.awt.event.ActionEvent evt) {
if(validCompute()){
//Create performance parameters benchmark lists
java.util.List<String> tileDimensionList = new ArrayList<>();
java.util.List<Integer> cacheSizesList = new ArrayList<>();
java.util.List<Integer> nbThreadsList = new ArrayList<>();
//for(String dimension : StringUtils.split(benchmarkTileDimensionTextField.getText(), ';')){
// tileDimensionList.add(dimension);
//}
tileDimensionList.add(JAI.getDefaultTileSize().width + "," + JAI.getDefaultTileSize().height);
for(String cacheSize : StringUtils.split(benchmarkCacheSizeTextField.getText(), ';')){
cacheSizesList.add(Integer.parseInt(cacheSize));
}
for(String nbThread : StringUtils.split(benchmarkNbThreadsTextField.getText(), ';')){
nbThreadsList.add(Integer.parseInt(nbThread));
}
Benchmark benchmarkModel = new Benchmark(tileDimensionList, cacheSizesList, nbThreadsList);
String opName = procGraphJComboBox.getSelectedItem().toString();
AppContext appContext = SnapApp.getDefault().getAppContext();
//launch Benchmark dialog
BenchmarkDialog productDialog = new BenchmarkDialog(this, opName, benchmarkModel, appContext);
productDialog.show();
}
}
示例10: CreateOpTab
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
public JComponent CreateOpTab(String operatorName, Map<String, Object> parameterMap, AppContext appContext) {
initializeOperatorUI(operatorName, parameterMap);
JComponent panel = createPanel();
initParameters();
kernelFile.setColumns(30);
kernelFileBrowseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final File file = Dialogs.requestFileForOpen("User Defined Kernel File", false, null, "snap.filterDir");
kernelFile.setText(file.getAbsolutePath());
}
});
return panel;
}
示例11: SingleTargetProductDialog
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
protected SingleTargetProductDialog(AppContext appContext, String title, int buttonMask, String helpID, TargetProductSelectorModel model, boolean alwaysWriteOutput) {
super(appContext.getApplicationWindow(), title, buttonMask, helpID);
this.appContext = appContext;
targetProductSelector = new TargetProductSelector(model, alwaysWriteOutput);
String homeDirPath = SystemUtils.getUserHomeDir().getPath();
String saveDir = appContext.getPreferences().getPropertyString(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR, homeDirPath);
targetProductSelector.getModel().setProductDir(new File(saveDir));
if (!alwaysWriteOutput) {
targetProductSelector.getOpenInAppCheckBox().setText("Open in " + appContext.getApplicationName());
}
targetProductSelector.getModel().getValueContainer().addPropertyChangeListener(evt -> {
if (evt.getPropertyName().equals("saveToFileSelected") ||
evt.getPropertyName().equals("openInAppSelected")) {
updateRunButton();
}
});
AbstractButton button = getButton(ID_APPLY);
button.setText("Run");
button.setMnemonic('R');
updateRunButton();
}
示例12: ReprojectionDialog
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
ReprojectionDialog(boolean orthorectify, final String title, final String helpID, AppContext appContext) {
super(appContext, title, ID_APPLY_CLOSE, helpID);
form = new ReprojectionForm(getTargetProductSelector(), orthorectify, appContext);
final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(OPERATOR_NAME);
ParameterUpdater parameterUpdater = new ReprojectionParameterUpdater();
OperatorParameterSupport parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor(),
null,
null,
parameterUpdater);
OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
operatorSpi.getOperatorDescriptor(),
parameterSupport,
appContext,
helpID);
getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}
示例13: ReprojectionForm
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
ReprojectionForm(TargetProductSelector targetProductSelector, boolean orthorectify, AppContext appContext) {
this.targetProductSelector = targetProductSelector;
this.orthoMode = orthorectify;
this.appContext = appContext;
this.sourceProductSelector = new SourceProductSelector(appContext, "Source Product:");
if (orthoMode) {
targetProductSuffix = "orthorectified";
this.sourceProductSelector.setProductFilter(new OrthorectifyProductFilter());
} else {
targetProductSuffix = "reprojected";
this.sourceProductSelector.setProductFilter(new GeoCodingProductFilter());
}
this.reprojectionModel = new Model();
this.reprojectionContainer = PropertyContainer.createObjectBacked(reprojectionModel);
createUI();
}
示例14: createPageComponent
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
@Override
public Component createPageComponent() {
final AppContext snapContext = SnapApp.getDefault().getAppContext();
final ProductCrsForm productCrsForm = new ProductCrsForm(snapContext, SnapApp.getDefault().getSelectedProduct(VIEW));
final CustomCrsForm customCrsForm = new CustomCrsForm(snapContext);
final PredefinedCrsForm predefinedCrsForm = new PredefinedCrsForm(snapContext);
final TableLayout tableLayout = new TableLayout(1);
tableLayout.setTablePadding(4, 4);
tableLayout.setTableWeightX(1.0);
tableLayout.setTableWeightY(1.0);
tableLayout.setTableFill(TableLayout.Fill.BOTH);
final JPanel pageComponent = new JPanel(tableLayout);
final JLabel label = new JLabel("<html><b>No CRS found for ESRI Shapefile. Please specify.</b>");
crsSelectionPanel = new CrsSelectionPanel(productCrsForm, customCrsForm, predefinedCrsForm);
pageComponent.add(label);
pageComponent.add(crsSelectionPanel);
return pageComponent;
}
示例15: OperatorMenu
import org.esa.snap.ui.AppContext; //导入依赖的package包/类
public OperatorMenu(Component parentComponent,
OperatorDescriptor opDescriptor,
OperatorParameterSupport parameterSupport,
AppContext appContext,
String helpId) {
this.parentComponent = parentComponent;
this.parameterSupport = parameterSupport;
this.opDescriptor = opDescriptor;
this.appContext = appContext;
this.helpId = helpId;
lastDirPreferenceKey = opDescriptor.getName() + ".lastDir";
loadParametersAction = new LoadParametersAction();
saveParametersAction = new SaveParametersAction();
displayParametersAction = new DisplayParametersAction();
aboutAction = new AboutOperatorAction();
}