@Override public AbstractLayerSourceAssistantPage getNextPage() { LayerSourcePageContext pageContext = getContext(); WebMapServer wms = null; WMSCapabilities wmsCapabilities = null; String wmsUrl = wmsUrlBox.getSelectedItem().toString(); if (wmsUrl != null && !wmsUrl.isEmpty()) { try { wms = getWms(pageContext.getWindow(), wmsUrl); wmsCapabilities = wms.getCapabilities(); } catch (Exception e) { e.printStackTrace(); pageContext.showErrorDialog("Failed to access WMS:\n" + e.getMessage()); } } history.copyInto(getContext().getAppContext().getPreferences()); if (wms != null && wmsCapabilities != null) { pageContext.setPropertyValue(WmsLayerSource.PROPERTY_NAME_WMS, wms); pageContext.setPropertyValue(WmsLayerSource.PROPERTY_NAME_WMS_CAPABILITIES, wmsCapabilities); return new WmsAssistantPage2(); } else { return null; } }
@Override public AbstractLayerSourceAssistantPage getNextPage() { imageHistoryModel.getHistory().copyInto(getContext().getAppContext().getPreferences()); createTransform(getContext()); return new ImageFileAssistantPage2(); }
@Override public AbstractLayerSourceAssistantPage getNextPage() { final LayerSourcePageContext context = getContext(); fileHistoryModel.getHistory().copyInto(context.getAppContext().getPreferences()); String path = (String) fileHistoryModel.getSelectedItem(); if (path != null && !path.trim().isEmpty()) {
@Override public boolean performFinish() { imageHistoryModel.getHistory().copyInto(getContext().getAppContext().getPreferences()); createTransform(getContext()); return ImageFileLayerSource.insertImageLayer(getContext()); }
@Test public void testSaveHistory() { final HistoryComboBoxModel model = new HistoryComboBoxModel(new UserInputHistory(3, "historyItem")); model.setSelectedItem("one"); model.setSelectedItem("two"); final PropertyMap map = new PropertyMap(); model.getHistory().copyInto(map); assertEquals("two", map.getPropertyString("historyItem.0")); assertEquals("one", map.getPropertyString("historyItem.1")); assertEquals("", map.getPropertyString("historyItem.2")); model.setSelectedItem("three"); model.getHistory().copyInto(map); assertEquals("three", map.getPropertyString("historyItem.0")); assertEquals("two", map.getPropertyString("historyItem.1")); assertEquals("one", map.getPropertyString("historyItem.2")); } }
assertEquals("0", entries[1]); history.copyInto(properties);