protected void firePointModelDataChange() { init(); for (ModelsLibraryDataChangeEvent l : this.pointModelDataChange) { l.fireModelsLibraryDataChange(); } }
/** * Clear all cache data and reload configuration. */ public void clear() { modelLibrary.clear(); init(); }
/** * Initialize layer. */ public void init() { modelsLibraryService.removePointModelDataChangeListener(this); modelsLibraryService.addPointModelDataChangeListener(this); loadData(); }
private void loadData() { List<NodeModelConf> nodeModelsList = new ArrayList<NodeModelConf>(); for (String configurationFile : modelsLibraryService.findAllConfigurationFiles()) { List<NodeModel> nodeModels = modelsLibraryService.findAllNodeModels(configurationFile); for (String configurationFile : modelsLibraryService.findAllConfigurationFiles()) { List<WayNodeModel> wayNodeModels = modelsLibraryService.findAllWayNodeModels(configurationFile); for (WayNodeModel nodeModel : wayNodeModels) { try {
@Override public void run() { try { ResourceService urlReciverService = new UrlReciverServiceTest(); ModelsLibraryService pms = new ModelsLibraryService(urlReciverService, new LibraryResourcesMemoryDao()); pms.init(); ModelLibraryResourcesListFrameAction frame = new ModelLibraryResourcesListFrameAction(pms); frame.loadTableData(); frame.setVisible(true); } catch (Exception e) { log.error(e); } } });
public List<NodeModel> findNodeModels(String fileKey) { if (GLOBAL.equals(fileKey)) { return findAllNodeModels(); } return modelLibrary.get(fileKey).getNodeModel(); }
public void setDefaultResourcesPaths() { libraryResourcesDao.setDefaultResourcesPaths(); firePointModelDataChange(); } }
@Override protected void onAddResourceFile() { final JFileChooser fc = new JFileChooser(); fc.addChoosableFileFilter(new ModelLibraryFilter()); fc.setAcceptAllFileFilterUsed(false); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File selectedFile = fc.getSelectedFile(); if (selectedFile != null) { String path = selectedFile.getAbsoluteFile().toURI().toString(); this.modelsLibraryService.addResourcesPath(path); loadTableData(); } } }
@Override protected void onDefaultResources() { modelsLibraryService.setDefaultResourcesPaths(); loadTableData(); } }
public void loadTableData() { List<NodeModel> all = this.modelsLibraryService.findNodeModels(fileKey); this.dataModel.setData(all); }
public void loadTableData() { List<String> all = this.modelsLibraryService.loadResourcesPath(); this.dataModel.setData(all); }
@Override protected void onRemoveResourceFile() { String fileName = getSelected(); modelsLibraryService.removeResourcesPath(fileName); loadTableData(); }
/** * Initialize. */ public void init() { modelLibrary.clear(); for (String fileKey : libraryResourcesDao.loadResourcesPath()) { try { ModelsLibrary models = modelLibraryXmlDao.loadXml(fileKey); saveModelLibrary(fileKey, models); } catch (ModelLibraryLoadException e) { log.error("faild to load file key: " + fileKey, e); } } }
@Override protected void dictAction() { LocalModelsDictAction frame = new LocalModelsDictAction(); frame.setUrlReciverService(modelsLibraryService.getUrlReciverService()); frame.setModal(true); frame.initUi(); frame.setVisible(true); if (frame.getModel() != null) { txtModel.setText(frame.getModel()); } }
@Override public void actionPerformed(ActionEvent pE) { modelsLibraryService.clear(); textureLibraryStorageService.reload(); textureCacheService.clear(); modelCacheService.clear(); modelsLibraryLayer.cleanUp(); } }
@Override public void run() { try { NodeModelListFrameAction frame = new NodeModelListFrameAction(); ResourceService urlReciverService = new UrlReciverServiceTest(); ModelsLibraryService temp = new ModelsLibraryService(urlReciverService, new LibraryResourcesMemoryDao()); temp.init(); frame.setNodeModelService(temp); frame.loadTableData(); frame.setVisible(true); } catch (Exception e) { log.error(e); } } });
public void removeResourcesPath(String path) { List<String> paths = libraryResourcesDao.loadResourcesPath(); paths.remove(path); libraryResourcesDao.saveResourcesPath(paths); firePointModelDataChange(); }
/** Constructor. * @param urlReciverService url reciver service */ @Inject public ModelsLibraryService(ResourceService urlReciverService, LibraryResourcesDao libraryResourcesMemoryDao) { super(); this.urlReciverService = urlReciverService; this.libraryResourcesDao = libraryResourcesMemoryDao; modelLibraryXmlDao = new ModelLibraryXmlDao(urlReciverService); init(); }
@Override protected void onAddResourceUrl() { String ret = (String) JOptionPane.showInputDialog(this, "Enter url for models library", "Add URL resource", JOptionPane.PLAIN_MESSAGE, null, null, "http://foo.com/modelLibrary.xml"); if (!StringUtil.isBlankOrNull(ret)) { URL url; try { url = new URL(ret); this.modelsLibraryService.addResourcesPath(url.toString()); loadTableData(); } catch (MalformedURLException e) { throw new RuntimeException(e); } } }
public void addResourcesPath(String path) { List<String> paths = libraryResourcesDao.loadResourcesPath(); paths.add(path); libraryResourcesDao.saveResourcesPath(paths); firePointModelDataChange(); }