}
}
else if (QUERY_VALUE_ROLE.equals(valueRole))
{
final Window window = SwingUtil.getWindowAncestor(AbstractStringValueCellEditor.this);
final QuerySelectorDialog editorDialog;
if (window instanceof Frame)
{
editorDialog = new QuerySelectorDialog((Frame) window);
}
else if (window instanceof Dialog)
{
editorDialog = new QuerySelectorDialog((Dialog) window);
}
else
{
editorDialog = new QuerySelectorDialog();
}
editorDialog.pack();
SwingUtil.centerDialogInParent(editorDialog);
final String selectedQuery =
editorDialog.performEdit(getQueryNames(), (String) comboBox.getSelectedItem());
if (editorDialog.isConfirmed())
{
comboBox.setSelectedItem(selectedQuery);
}
}
else if (GROUP_VALUE_ROLE.equals(valueRole))
{
final Window window = SwingUtil.getWindowAncestor(AbstractStringValueCellEditor.this);
final GroupSelectorDialog editorDialog;
if (window instanceof Frame)
{
editorDialog = new GroupSelectorDialog((Frame) window);
}
else if (window instanceof Dialog)
{
editorDialog = new GroupSelectorDialog((Dialog) window);
}
else
{
editorDialog = new GroupSelectorDialog();
}
editorDialog.pack();
SwingUtil.centerDialogInParent(editorDialog);
final String originalGroup = (String) comboBox.getSelectedItem();
final String selectedGroup = editorDialog.performEdit(getGroups(), originalGroup);
if (editorDialog.isConfirmed())
{
comboBox.setSelectedItem(selectedGroup);
}
}
else if (FORMULA_VALUE_ROLE.equals(valueRole))
{
final FormulaEditorDialog editorDialog =
GUIUtils.createFormulaEditorDialog(getReportDesignerContext(), AbstractStringValueCellEditor.this);
final String originalFormula = (String) comboBox.getSelectedItem();
final String formula = editorDialog.editFormula(originalFormula, getFields());
if (formula != null)
{
comboBox.setSelectedItem(formula);
}
}
else if (NUMBER_FORMAT_VALUE_ROLE.equals(valueRole) || DATE_FORMAT_VALUE_ROLE.equals(valueRole))
{
final Window window = SwingUtil.getWindowAncestor(AbstractStringValueCellEditor.this);
final TextAreaPropertyEditorDialog editorDialog;
if (window instanceof Frame)
{
editorDialog = new TextAreaPropertyEditorDialog((Frame) window);
}
else if (window instanceof Dialog)
{
editorDialog = new TextAreaPropertyEditorDialog((Dialog) window);
}
else
{
editorDialog = new TextAreaPropertyEditorDialog();
}
final String originalFormula = (String) comboBox.getSelectedItem();
final String text = editorDialog.performEdit(originalFormula);
if (editorDialog.isConfirmed())
{
comboBox.setSelectedItem(text);
}
}
else
{
final Window window = SwingUtil.getWindowAncestor(AbstractStringValueCellEditor.this);
final TextAreaPropertyEditorDialog editorDialog;
if (window instanceof Frame)
{
editorDialog = new TextAreaPropertyEditorDialog((Frame) window);
}
else if (window instanceof Dialog)
{
editorDialog = new TextAreaPropertyEditorDialog((Dialog) window);
}
else
{
editorDialog = new TextAreaPropertyEditorDialog();
}
final JTextComponent textField = getTextField();
final String originalValue = textField.getText();
final String text = editorDialog.performEdit(originalValue);
if (editorDialog.isConfirmed())
{
textField.setText(text);
}
}