use of com.sldeditor.filter.FilterPanelInterface in project sldeditor by robward-scisys.
the class FieldConfigFeatureTypeConstraint method createFilterTable.
/**
* Creates the filter table.
*
* @param xPos the x pos
* @param maxNoOfRows the max no of rows
* @param fieldPanel the field panel
*/
private void createFilterTable(int xPos, int maxNoOfRows, FieldPanel fieldPanel) {
filterTable = new JTable(filterModel);
filterTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
filterTable.setBounds(xPos, 0, BasePanel.FIELD_PANEL_WIDTH, getRowY(maxNoOfRows - 2));
filterTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
FeatureTypeConstraint ftc = filterModel.getFeatureTypeConstraint(filterTable.getSelectedRow());
if (ftc != null) {
extentModel.populate(ftc.getExtents());
addExtentButton.setEnabled(true);
removeFTCButton.setEnabled(true);
int[] selectedColumns = filterTable.getSelectedColumns();
if (filterModel.isFilterColumn(selectedColumns)) {
FilterPanelInterface filterPanel = ExpressionPanelFactory.getFilterPanel(null);
String panelTitle = Localisation.getString(FieldConfigBase.class, "FieldConfigFeatureTypeConstraint.filterPanel");
filterPanel.configure(panelTitle, Object.class, SelectedSymbol.getInstance().isRasterSymbol());
filterPanel.populate(ftc.getFilter());
if (filterPanel.showDialog()) {
ftc.setFilter(filterPanel.getFilter());
filterModel.fireTableDataChanged();
featureTypeConstraintUpdated();
}
}
}
}
}
});
JScrollPane scrollPanel = new JScrollPane(filterTable);
scrollPanel.setBounds(xPos, BasePanel.WIDGET_HEIGHT, BasePanel.FIELD_PANEL_WIDTH, BasePanel.WIDGET_HEIGHT * (maxNoOfRows - 2));
fieldPanel.add(scrollPanel);
int buttonY = getRowY(maxNoOfRows - 1);
//
// Add button
//
addFTCButton = new JButton(Localisation.getString(FieldConfigBase.class, "FieldConfigFeatureTypeConstraint.add"));
addFTCButton.setBounds(xPos + BasePanel.WIDGET_X_START, buttonY, BasePanel.WIDGET_BUTTON_WIDTH, BasePanel.WIDGET_HEIGHT);
addFTCButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addEntry();
}
});
fieldPanel.add(addFTCButton);
//
// Remove button
//
removeFTCButton = new JButton(Localisation.getString(FieldConfigBase.class, "FieldConfigFeatureTypeConstraint.remove"));
removeFTCButton.setBounds(xPos + BasePanel.WIDGET_BUTTON_WIDTH + BasePanel.WIDGET_X_START + 10, buttonY, BasePanel.WIDGET_BUTTON_WIDTH, BasePanel.WIDGET_HEIGHT);
removeFTCButton.setEnabled(false);
removeFTCButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
removeEntry();
}
});
fieldPanel.add(removeFTCButton);
}
use of com.sldeditor.filter.FilterPanelInterface in project sldeditor by robward-scisys.
the class RuleDetails method editFilter.
/**
* Edits the filter.
*
* @param filterFieldId the filter field id
*/
protected void editFilter(FieldIdEnum filterFieldId) {
FilterPanelInterface filterPanel = ExpressionPanelFactory.getFilterPanel(null);
String panelTitle = Localisation.getString(RuleDetails.class, "RuleDetails.panelTitle");
filterPanel.configure(panelTitle, Object.class, SelectedSymbol.getInstance().isRasterSymbol());
Rule rule = SelectedSymbol.getInstance().getRule();
if (rule != null) {
filterPanel.populate(rule.getFilter());
}
if (filterPanel.showDialog()) {
originalFilter = filterPanel.getFilter();
fieldConfigVisitor.populateTextField(filterFieldId, filterPanel.getFilterString());
updateSymbol();
}
}
Aggregations