use of com.sldeditor.ui.widgets.FieldPanel in project sldeditor by robward-scisys.
the class FieldConfigFont method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
if (comboBox == null) {
final UndoActionInterface parentObj = this;
populateFontFamilyList();
if (!fontFamilyList.isEmpty()) {
defaultValue = fontFamilyList.get(0).getKey();
}
comboBox = new ValueComboBox();
comboBox.initialiseSingle(fontFamilyList);
int xPos = getXPos();
comboBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
fieldPanel.add(comboBox);
comboBox.setSelectValueKey(defaultValue);
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ValueComboBox comboBox = (ValueComboBox) e.getSource();
if (comboBox.getSelectedItem() != null) {
Object newValueObj = comboBox.getSelectedValue().getKey();
if ((oldValueObj == null) && comboBox.getItemCount() > 0) {
oldValueObj = comboBox.getFirstItem().getKey();
}
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
oldValueObj = newValueObj;
valueUpdated();
}
}
});
if (!isValueOnly()) {
setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(Font.class, this, isRasterSymbol()));
}
}
}
use of com.sldeditor.ui.widgets.FieldPanel in project sldeditor by robward-scisys.
the class FieldConfigFontPreview method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
if (textField == null) {
int xPos = getXPos();
int height = getRowY(sampleTextLines);
int width = BasePanel.WIDGET_EXTENDED_WIDTH * 2;
textField = new JTextArea();
textField.setBounds(xPos + BasePanel.WIDGET_X_START, 0, width, height);
textField.setWrapStyleWord(true);
textField.setLineWrap(false);
textField.setText(sampleText);
textField.setRows(sampleTextLines);
JScrollPane scrollPane = new JScrollPane(textField);
scrollPane.setBounds(xPos + BasePanel.WIDGET_X_START, 0, width, height);
FieldPanel fieldPanel = createFieldPanel(xPos, height, getLabel());
fieldPanel.add(scrollPane);
}
}
use of com.sldeditor.ui.widgets.FieldPanel in project sldeditor by robward-scisys.
the class FieldConfigColourMap method createUI.
/**
* Creates the ui.
*/
@Override
public void createUI() {
if (colourRampConfig == null) {
int xPos = getXPos();
int maxNoOfConfigRows = 7;
int maxNoOfTableRows = 12;
int totalRows = maxNoOfConfigRows + maxNoOfTableRows + ColourMapEntryPanel.getNoOfRows();
FieldPanel fieldPanel = createFieldPanel(xPos, getRowY(totalRows), getLabel());
colourRampConfig = new ColourRampConfigPanel(this, model);
colourRampConfig.setBounds(xPos, 0, BasePanel.FIELD_PANEL_WIDTH, getRowY(maxNoOfConfigRows));
fieldPanel.add(colourRampConfig);
table = new JTable(model);
table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
table.setBounds(xPos, getRowY(maxNoOfConfigRows), BasePanel.FIELD_PANEL_WIDTH, getRowY(totalRows - 2));
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
removeButton.setEnabled(true);
List<ColorMapEntry> entries;
if (table.getSelectedRowCount() == 1) {
ColorMapEntry entry = model.getColourMapEntry(table.getSelectedRow());
entries = new ArrayList<ColorMapEntry>();
entries.add(entry);
} else {
entries = model.getColourMapEntries(table.getSelectedRows());
}
colourMapEntryPanel.setSelectedEntry(entries);
}
}
});
model.setCellRenderer(table);
JScrollPane scrollPanel = new JScrollPane(table);
int endOfTableRow = maxNoOfConfigRows + maxNoOfTableRows - 2;
scrollPanel.setBounds(xPos, getRowY(maxNoOfConfigRows), BasePanel.FIELD_PANEL_WIDTH, getRowY(endOfTableRow) - getRowY(maxNoOfConfigRows));
fieldPanel.add(scrollPanel);
int buttonY = getRowY(endOfTableRow);
//
// Add button
//
addButton = new JButton(Localisation.getString(FieldConfigBase.class, "FieldConfigColourMap.add"));
addButton.setBounds(xPos + BasePanel.WIDGET_X_START, buttonY, BasePanel.WIDGET_BUTTON_WIDTH, BasePanel.WIDGET_HEIGHT);
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addEntry();
}
});
fieldPanel.add(addButton);
//
// Remove button
//
removeButton = new JButton(Localisation.getString(FieldConfigBase.class, "FieldConfigColourMap.remove"));
removeButton.setBounds(xPos + BasePanel.WIDGET_BUTTON_WIDTH + BasePanel.WIDGET_X_START + 10, buttonY, BasePanel.WIDGET_BUTTON_WIDTH, BasePanel.WIDGET_HEIGHT);
removeButton.setEnabled(false);
removeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
removeEntry();
}
});
fieldPanel.add(removeButton);
colourMapEntryPanel = new ColourMapEntryPanel(getPanelId(), this);
colourMapEntryPanel.setBounds(xPos, getRowY(maxNoOfConfigRows + maxNoOfTableRows - 1), BasePanel.FIELD_PANEL_WIDTH, colourMapEntryPanel.getPanelHeight());
fieldPanel.add(colourMapEntryPanel);
}
}
use of com.sldeditor.ui.widgets.FieldPanel in project sldeditor by robward-scisys.
the class FieldConfigDSProperties method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
final UndoActionInterface parentObj = this;
int xPos = getXPos();
comboBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, isValueOnly() ? BasePanel.WIDGET_EXTENDED_WIDTH : BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
fieldPanel.add(comboBox);
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (isAttributeComboBoxPopulated()) {
if (comboBox.getSelectedItem() != null) {
String newValueObj = new String((String) comboBox.getSelectedItem());
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
oldValueObj = new String(newValueObj);
valueUpdated();
}
}
}
});
}
use of com.sldeditor.ui.widgets.FieldPanel in project sldeditor by robward-scisys.
the class FieldConfigEnum method createUI.
/**
* Creates the ui.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
*/
@Override
public void createUI() {
if (comboBox == null) {
final UndoActionInterface parentObj = this;
List<ValueComboBoxData> dataList = new ArrayList<ValueComboBoxData>();
for (String key : keyList) {
dataList.add(new ValueComboBoxData(key, valueMap.get(key), getPanelId()));
}
if (!dataList.isEmpty()) {
defaultValue = dataList.get(0).getKey();
}
int xPos = getXPos();
comboBox = new ValueComboBox();
comboBox.initialiseSingle(dataList);
comboBox.setBounds(xPos + BasePanel.WIDGET_X_START, 0, isValueOnly() ? BasePanel.WIDGET_EXTENDED_WIDTH : BasePanel.WIDGET_STANDARD_WIDTH, BasePanel.WIDGET_HEIGHT);
FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());
fieldPanel.add(comboBox);
if (!isValueOnly()) {
setAttributeSelectionPanel(fieldPanel.internalCreateAttrButton(String.class, this, isRasterSymbol()));
}
if (dataList != null) {
for (ValueComboBoxData data : dataList) {
this.comboDataMap.put(data.getKey(), data);
}
}
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ValueComboBox comboBox = (ValueComboBox) e.getSource();
if (comboBox.getSelectedItem() != null) {
Object newValueObj = comboBox.getSelectedValue().getKey();
if ((oldValueObj == null) && comboBox.getItemCount() > 0) {
oldValueObj = comboBox.getFirstItem().getKey();
}
UndoManager.getInstance().addUndoEvent(new UndoEvent(parentObj, getFieldId(), oldValueObj, newValueObj));
oldValueObj = newValueObj;
valueUpdated();
}
}
});
}
}
Aggregations