/** * setEDPData * * @param data EDPCellData */ public void setCellData(EDPCellData data) { m_data = data; paramKeys = data.getPlugin().getPrintfDescrs(!m_isCrawlRuleEditor); data.getPlugin().addParamListener(this); setTemplate((PrintfTemplate) data.getData()); m_isCrawlRuleEditor = data.getKey().equals(DefinableArchivalUnit.KEY_AU_CRAWL_RULES); // initialize the combobox updateParams(data); if (m_isCrawlRuleEditor) { matchPanel.setVisible(true); } else { matchPanel.setVisible(false); } }
void saveButton_actionPerformed(ActionEvent e) { updateEditableTemplate(selectedPane); originalTemplate.setFormat(editableTemplate.m_format); originalTemplate.setTokens(editableTemplate.m_tokens); m_data.updateTemplateData(originalTemplate); setVisible(false); }
void okButton_actionPerformed(ActionEvent e) { int num_rows = filtersTable.getRowCount(); EditableDefinablePlugin edp = m_data.getPlugin(); for (int row = 0; row < num_rows; row++) { String mimeType = (String) filtersTable.getValueAt(row, 0); String mimeTypeValue = (String) filtersTable.getValueAt(row, 1); try { mimeTypeEditorBuilder.checkValue(edp, mimeType, mimeTypeValue); } catch (DynamicallyLoadedComponentException dlce) { String logMessage = "Failed to set the " + mimeTypeEditorBuilder.getValueName() + " for MIME type " + mimeType + " to " + mimeTypeValue; logger.error(logMessage, dlce); if (!EDPInspectorTableModel.handleDynamicallyLoadedComponentException(this, dlce)) { return; } else { logger.debug("User override; allow " + mimeTypeValue); } } } mimeTypeEditorBuilder.clear(edp); for (int row = 0; row < num_rows; row++) { String mimeType = (String) filtersTable.getValueAt(row, 0); String mimeTypeValue = (String) filtersTable.getValueAt(row, 1); try { mimeTypeEditorBuilder.put(edp, mimeType, mimeTypeValue); } catch (DynamicallyLoadedComponentException dlce) { String logMessage = "Internal error; MIME type " + mimeType + " not set to " + mimeTypeValue; logger.error(logMessage, dlce); } catch (PluginException.InvalidDefinition ex) { JOptionPane.showMessageDialog( this, ex.getMessage(), WordUtils.capitalize(mimeTypeEditorBuilder.getValueName()) + " Warning", JOptionPane.WARNING_MESSAGE); } } setVisible(false); }
private void updateParams(EDPCellData data) { paramComboBox.removeAllItems(); paramKeys = data.getPlugin().getPrintfDescrs(!m_isCrawlRuleEditor); if (!m_isCrawlRuleEditor) { paramComboBox.addItem(STRING_LITERAL); } for (Iterator it = paramKeys.values().iterator(); it.hasNext(); ) { ConfigParamDescr descr = (ConfigParamDescr) it.next(); int type = descr.getType(); if (!m_isCrawlRuleEditor && (type == ConfigParamDescr.TYPE_SET || type == ConfigParamDescr.TYPE_RANGE)) continue; paramComboBox.addItem(descr); } paramComboBox.setEnabled(true); paramComboBox.setSelectedIndex(0); paramComboBox.setToolTipText("Select a parameter to insert into the format string"); insertButton.setEnabled(true); }
/** * setEDPData * * @param data DPCellData */ public void setCellData(EDPCellData data) { m_data = data; m_filters = mimeTypeEditorBuilder.getMap(m_data.getPlugin()); m_model.updateTableData(); }