use of java.awt.Component in project adempiere by adempiere.
the class MiniTable method prepareRenderer.
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Component c = super.prepareRenderer(renderer, row, column);
JComponent jc = (JComponent) c;
if (c == null)
return c;
// Row is selected
Color selectedColor = AdempierePLAF.getFieldBackground_Selected();
// Even row
Color normalColor = AdempierePLAF.getFieldBackground_Normal();
// Odd row
Color backColor = AdempierePLAF.getInfoBackground();
// Lead row border
Color borderColor = AdempierePLAF.getFieldBackground_Mandatory();
CompoundBorder cb = null;
ListSelectionModel rsm = this.getSelectionModel();
boolean readOnly = !this.isCellEditable(row, column);
if (!(row == rsm.getLeadSelectionIndex())) {
if (// Highlighted but not the lead
rsm.isSelectedIndex(row)) {
c.setBackground(selectedColor);
jc.setBorder(new MatteBorder(1, 1, 1, 1, selectedColor));
} else if (// Not selected but even in number
row % 2 == 0) {
c.setBackground(normalColor);
jc.setBorder(new MatteBorder(1, 1, 1, 1, normalColor));
} else // Not selected and odd in number
{
// If not shaded, match the table's background
c.setBackground(backColor);
jc.setBorder(new MatteBorder(1, 1, 1, 1, backColor));
}
// Buttons and checkboxes need to have the border turned on
if (c.getClass().equals(JCheckBox.class)) {
((JCheckBox) c).setBorderPainted(false);
} else if (c.getClass().equals(JButton.class)) {
((JButton) c).setBorderPainted(false);
}
} else {
if (c.getClass().equals(JCheckBox.class)) {
((JCheckBox) c).setBorderPainted(true);
} else if (c.getClass().equals(JButton.class)) {
((JButton) c).setBorderPainted(true);
}
// Define border - compond border maintains the spacing of 1px around the field
if (column == 0) {
cb = new CompoundBorder(new EmptyBorder(new Insets(0, 0, 0, 1)), new MatteBorder(1, 1, 1, 0, borderColor));
} else if (column == this.getColumnCount() - 1) {
cb = new CompoundBorder(new EmptyBorder(new Insets(0, 1, 0, 0)), new MatteBorder(1, 0, 1, 1, borderColor));
} else {
cb = new CompoundBorder(new EmptyBorder(new Insets(0, 1, 0, 1)), new MatteBorder(1, 0, 1, 0, borderColor));
}
// Set border
jc.setBorder(cb);
// Set background color
if (!readOnly && this.isRowChecked(row))
c.setBackground(normalColor);
else
c.setBackground(selectedColor);
}
return c;
}
use of java.awt.Component in project adempiere by adempiere.
the class VCollect method removeCollectDetail.
/**
* Remove Collect Detal From Child
* @param child
* @return void
*/
public void removeCollectDetail(VCollectDetail child) {
Component comp = child.getPanel();
removeCollect(child);
centerPanel.remove(comp);
scrollPane.validate();
scrollPane.repaint();
}
use of java.awt.Component in project GDSC-SMLM by aherbert.
the class PeakFit method showDialog.
@SuppressWarnings("unchecked")
private int showDialog(ImagePlus imp) {
// Executing as an ImageJ plugin.
// Override the defaults with those in the configuration file
final String filename = SettingsManager.getSettingsFilename();
if (simpleFit) {
return showSimpleDialog(filename);
}
GlobalSettings settings = SettingsManager.loadSettings(filename);
calibration = settings.getCalibration();
config = settings.getFitEngineConfiguration();
fitConfig = config.getFitConfiguration();
resultsSettings = settings.getResultsSettings();
boolean isCrop = (bounds != null && imp != null && (bounds.width < imp.getWidth() || bounds.height < imp.getHeight()));
if (!extraOptions) {
integrateFrames = 1;
resultsSettings.imageRollingWindow = 0;
fitConfig.setBackgroundFitting(true);
fitConfig.setMinIterations(0);
fitConfig.setNoise(0);
config.setNoiseMethod(Method.QUICK_RESIDUALS_LEAST_MEAN_OF_SQUARES);
showProcessedFrames = false;
}
ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addHelp(About.HELP_URL);
gd.addMessage((maximaIdentification) ? "Identify candidate maxima" : "Fit 2D Gaussian to identified maxima");
String[] templates = ConfigurationTemplate.getTemplateNames(true);
gd.addChoice("Template", templates, templates[0]);
gd.addStringField("Config_file", filename, 40);
gd.addNumericField("Calibration (nm/px)", calibration.getNmPerPixel(), 2);
gd.addNumericField("Gain (ADU/photon)", calibration.getGain(), 2);
gd.addCheckbox("EM-CCD", calibration.isEmCCD());
gd.addNumericField("Exposure_time (ms)", calibration.getExposureTime(), 2);
if (isCrop)
gd.addCheckbox("Ignore_bounds_for_noise", optionIgnoreBoundsForNoise);
// This is already set to false before the dialog is displayed
//else
// ignoreBoundsForNoise = false;
gd.addNumericField("Initial_StdDev0", fitConfig.getInitialPeakStdDev0(), 3);
if (!maximaIdentification) {
gd.addNumericField("Initial_StdDev1", fitConfig.getInitialPeakStdDev1(), 3);
gd.addNumericField("Initial_Angle", fitConfig.getInitialAngle(), 3);
}
String[] filterTypes = SettingsManager.getNames((Object[]) DataFilterType.values());
gd.addChoice("Spot_filter_type", filterTypes, filterTypes[config.getDataFilterType().ordinal()]);
String[] filterNames = SettingsManager.getNames((Object[]) DataFilter.values());
gd.addChoice("Spot_filter", filterNames, filterNames[config.getDataFilter(0).ordinal()]);
gd.addSlider("Smoothing", 0, 2.5, config.getSmooth(0));
gd.addSlider("Search_width", 0.5, 2.5, config.getSearch());
gd.addSlider("Border", 0.5, 2.5, config.getBorder());
gd.addSlider("Fitting_width", 2, 4.5, config.getFitting());
if (extraOptions && !fitMaxima) {
gd.addCheckbox("Interlaced_data", optionInterlacedData);
gd.addSlider("Integrate_frames", 1, 5, optionIntegrateFrames);
}
Component discardLabel = null;
if (!maximaIdentification) {
gd.addMessage("--- Gaussian fitting ---");
String[] solverNames = SettingsManager.getNames((Object[]) FitSolver.values());
gd.addChoice("Fit_solver", solverNames, solverNames[fitConfig.getFitSolver().ordinal()]);
String[] functionNames = SettingsManager.getNames((Object[]) FitFunction.values());
gd.addChoice("Fit_function", functionNames, functionNames[fitConfig.getFitFunction().ordinal()]);
if (extraOptions)
gd.addCheckbox("Fit_background", fitConfig.isBackgroundFitting());
// Parameters specific to each Fit solver are collected in a second dialog
gd.addNumericField("Fail_limit", config.getFailuresLimit(), 0);
gd.addCheckbox("Include_neighbours", config.isIncludeNeighbours());
gd.addSlider("Neighbour_height", 0.01, 1, config.getNeighbourHeightThreshold());
gd.addSlider("Residuals_threshold", 0.01, 1, config.getResidualsThreshold());
gd.addSlider("Duplicate_distance", 0, 1.5, fitConfig.getDuplicateDistance());
gd.addMessage("--- Peak filtering ---\nDiscard fits that shift; are too low; or expand/contract");
discardLabel = gd.getMessage();
gd.addCheckbox("Smart_filter", fitConfig.isSmartFilter());
gd.addCheckbox("Disable_simple_filter", fitConfig.isDisableSimpleFilter());
gd.addSlider("Shift_factor", 0.01, 2, fitConfig.getCoordinateShiftFactor());
gd.addNumericField("Signal_strength", fitConfig.getSignalStrength(), 2);
gd.addNumericField("Min_photons", fitConfig.getMinPhotons(), 0);
if (extraOptions) {
gd.addNumericField("Noise", fitConfig.getNoise(), 2);
String[] noiseMethodNames = SettingsManager.getNames((Object[]) Method.values());
gd.addChoice("Noise_method", noiseMethodNames, noiseMethodNames[config.getNoiseMethod().ordinal()]);
}
gd.addSlider("Min_width_factor", 0, 0.99, fitConfig.getMinWidthFactor());
gd.addSlider("Width_factor", 1.01, 5, fitConfig.getWidthFactor());
gd.addNumericField("Precision", fitConfig.getPrecisionThreshold(), 2);
}
gd.addMessage("--- Results ---");
gd.addCheckbox("Log_progress", resultsSettings.logProgress);
if (!maximaIdentification) {
gd.addCheckbox("Show_deviations", resultsSettings.showDeviations);
}
String[] tableNames = SettingsManager.getNames((Object[]) ResultsTable.values());
gd.addChoice("Results_table", tableNames, tableNames[resultsSettings.getResultsTable().ordinal()]);
String[] imageNames = SettingsManager.getNames((Object[]) ResultsImage.values());
gd.addMessage("--- Image output ---");
gd.addChoice("Image", imageNames, imageNames[resultsSettings.getResultsImage().ordinal()]);
gd.addCheckbox("Weighted", resultsSettings.weightedImage);
gd.addCheckbox("Equalised", resultsSettings.equalisedImage);
gd.addSlider("Image_Precision (nm)", 5, 30, resultsSettings.precision);
gd.addSlider("Image_Scale", 1, 15, resultsSettings.imageScale);
if (extraOptions) {
gd.addNumericField("Image_window", resultsSettings.imageRollingWindow, 0);
gd.addCheckbox("Show_processed_frames", optionShowProcessedFrames);
}
gd.addMessage("--- File output ---");
gd.addStringField("Results_dir", resultsSettings.resultsDirectory);
String[] formatNames = SettingsManager.getNames((Object[]) ResultsFileFormat.values());
gd.addChoice("Results_format", formatNames, formatNames[resultsSettings.getResultsFileFormat().ordinal()]);
gd.addMessage(" ");
gd.addCheckbox("Results_in_memory", resultsSettings.resultsInMemory);
if (extraOptions) {
gd.addMessage("--- Misc ---");
gd.addSlider("Fraction_of_threads", 0.1, 1, fractionOfThreads);
}
if (gd.getLayout() != null) {
GridBagLayout grid = (GridBagLayout) gd.getLayout();
int xOffset = 0, yOffset = 0;
int lastY = -1, rowCount = 0;
for (Component comp : gd.getComponents()) {
// Check if this should be the second major column
if (comp == discardLabel) {
xOffset += 2;
yOffset -= rowCount;
}
// Reposition the field
GridBagConstraints c = grid.getConstraints(comp);
if (lastY != c.gridy)
rowCount++;
lastY = c.gridy;
c.gridx = c.gridx + xOffset;
c.gridy = c.gridy + yOffset;
c.insets.left = c.insets.left + 10 * xOffset;
c.insets.top = 0;
c.insets.bottom = 0;
grid.setConstraints(comp, c);
}
if (IJ.isLinux())
gd.setBackground(new Color(238, 238, 238));
}
// Add a mouse listener to the config file field
if (Utils.isShowGenericDialog()) {
Vector<TextField> texts = (Vector<TextField>) gd.getStringFields();
Vector<TextField> numerics = (Vector<TextField>) gd.getNumericFields();
Vector<Checkbox> checkboxes = (Vector<Checkbox>) gd.getCheckboxes();
Vector<Choice> choices = (Vector<Choice>) gd.getChoices();
int n = 0;
int t = 0;
int b = 0;
int ch = 0;
Choice textTemplate = choices.get(ch++);
textTemplate.addItemListener(this);
textConfigFile = texts.get(t++);
textConfigFile.addMouseListener(this);
textConfigFile.addTextListener(this);
// TODO: add a value changed listener to detect when typing a new file
textNmPerPixel = numerics.get(n++);
textGain = numerics.get(n++);
textEMCCD = checkboxes.get(b++);
textExposure = numerics.get(n++);
textInitialPeakStdDev0 = numerics.get(n++);
if (!maximaIdentification) {
textInitialPeakStdDev1 = numerics.get(n++);
textInitialAngleD = numerics.get(n++);
}
textDataFilterType = choices.get(ch++);
textDataFilter = choices.get(ch++);
textSmooth = numerics.get(n++);
textSearch = numerics.get(n++);
textBorder = numerics.get(n++);
textFitting = numerics.get(n++);
if (extraOptions && !fitMaxima) {
// Skip over the interlaced data option
b++;
// Skip over the integrate frames option
n++;
}
if (!maximaIdentification) {
textFitSolver = choices.get(ch++);
textFitFunction = choices.get(ch++);
if (extraOptions)
textFitBackground = checkboxes.get(b++);
textFailuresLimit = numerics.get(n++);
textIncludeNeighbours = checkboxes.get(b++);
textNeighbourHeightThreshold = numerics.get(n++);
textResidualsThreshold = numerics.get(n++);
textDuplicateDistance = numerics.get(n++);
textSmartFilter = checkboxes.get(b++);
textDisableSimpleFilter = checkboxes.get(b++);
textCoordinateShiftFactor = numerics.get(n++);
textSignalStrength = numerics.get(n++);
textMinPhotons = numerics.get(n++);
if (extraOptions) {
textNoise = numerics.get(n++);
textNoiseMethod = choices.get(ch++);
}
textMinWidthFactor = numerics.get(n++);
textWidthFactor = numerics.get(n++);
textPrecisionThreshold = numerics.get(n++);
updateFilterInput();
textSmartFilter.addItemListener(this);
textDisableSimpleFilter.addItemListener(this);
}
textLogProgress = checkboxes.get(b++);
if (!maximaIdentification)
textShowDeviations = checkboxes.get(b++);
textResultsTable = choices.get(ch++);
textResultsImage = choices.get(ch++);
textWeightedImage = checkboxes.get(b++);
textEqualisedImage = checkboxes.get(b++);
textPrecision = numerics.get(n++);
textImageScale = numerics.get(n++);
if (extraOptions) {
textImageRollingWindow = numerics.get(n++);
// Skip over show processed frames option
b++;
}
textResultsDirectory = texts.get(t++);
textResultsDirectory.addMouseListener(this);
textBinaryResults = choices.get(ch++);
textResultsInMemory = checkboxes.get(b++);
}
gd.showDialog();
// The refreshSettings method can be called by the dialog listener.
// This updates the Calibration, FitEngineConfiguration, and ResultsSettings so set these
// back in the GlobalSettings object.
settings.setCalibration(this.calibration);
settings.setFitEngineConfiguration(this.config);
settings.setResultsSettings(this.resultsSettings);
if (gd.wasCanceled() || !readDialog(settings, gd, isCrop))
return DONE;
if (imp != null) {
// Store whether the user selected to process all the images.
int flags = IJ.setupDialog(imp, plugin_flags);
// Check if cancelled
if ((flags & DONE) != 0)
return DONE;
if ((flags & DOES_STACKS) == 0) {
// Save the slice number for the overlay
singleFrame = imp.getCurrentSlice();
// Account for interlaced data
if (interlacedData) {
int start = singleFrame;
// Calculate the first frame that is not skipped
while (ignoreFrame(start) && start > dataStart) start--;
if (start < dataStart) {
log("The current frame (%d) is before the start of the interlaced data", singleFrame);
return DONE;
}
if (start != singleFrame)
log("Updated the current frame (%d) to a valid interlaced data frame (%d)", singleFrame, start);
singleFrame = start;
}
// Account for integrated frames
int endFrame = singleFrame;
if (integrateFrames > 1) {
int totalFrames = 1;
while (totalFrames < integrateFrames) {
endFrame++;
if (!ignoreFrame(endFrame))
totalFrames++;
}
log("Updated the image end frame (%d) to %d allow %d integrated frames", singleFrame, endFrame, integrateFrames);
}
// Create a new image source with the correct frames
setSource(new IJImageSource(imp, singleFrame, endFrame - singleFrame));
// Store the image so the results can be added as an overlay
this.imp = imp;
this.imp.setOverlay(null);
}
}
// Allow interlaced data by wrapping the image source
if (interlacedData) {
setSource(new InterlacedImageSource(this.source, dataStart, dataBlock, dataSkip));
}
// Allow frame aggregation by wrapping the image source
if (integrateFrames > 1) {
setSource(new AggregatedImageSource(this.source, integrateFrames));
}
// Ask if the user wants to log progress on multiple frame images
if (resultsSettings.logProgress && source.getFrames() > 1) {
gd = new ExtendedGenericDialog(TITLE);
gd.addMessage("Warning: Log progress on multiple-frame image will be slow");
gd.addCheckbox("Log_progress", resultsSettings.logProgress);
gd.showDialog();
if (gd.wasCanceled())
return DONE;
resultsSettings.logProgress = gd.getNextBoolean();
if (!resultsSettings.logProgress)
SettingsManager.saveSettings(settings, filename);
}
// Get a bias if required
if (resultsSettings.getResultsTable() == ResultsTable.CALIBRATED && calibration.getBias() == 0) {
gd = new ExtendedGenericDialog(TITLE);
gd.addMessage("Calibrated results requires a camera bias");
gd.addNumericField("Camera_bias (ADUs)", calibration.getBias(), 2);
gd.showDialog();
if (!gd.wasCanceled()) {
calibration.setBias(Math.abs(gd.getNextNumber()));
if (calibration.getBias() > 0)
SettingsManager.saveSettings(settings, filename);
}
}
// single call to be made.
return plugin_flags;
}
use of java.awt.Component in project adempiere by adempiere.
the class InfoPAttribute method createQuery.
// actionPerformed
/**
* Create Query
* <code>
* Available synonyms:
* M_Product p
* M_ProductPrice pr
* M_AttributeSet pa
* </code>
* @return query
*/
private String createQuery() {
/** Base Query
SELECT *
FROM M_Product p
INNER JOIN M_ProductPrice pr ON (p.M_Product_ID=pr.M_Product_ID)
LEFT OUTER JOIN M_AttributeSet pa ON (p.M_AttributeSet_ID=pa.M_AttributeSet_ID)
WHERE
**/
/*** Instance Attributes */
StringBuffer sb = new StringBuffer();
// Serial No
String s = serNoField.getText();
if (s != null && s.length() > 0) {
sb.append(" AND asi.SerNo");
if (s.indexOf('%') == -1 && s.indexOf('_') == 1)
sb.append("=");
else
sb.append(" LIKE ");
sb.append(DB.TO_STRING(s));
}
// Lot Number
s = lotField.getText();
if (s != null && s.length() > 0) {
sb.append(" AND asi.Lot");
if (s.indexOf('%') == -1 && s.indexOf('_') == 1)
sb.append("=");
else
sb.append(" LIKE ");
sb.append(DB.TO_STRING(s));
}
// Lot ID
KeyNamePair pp = (KeyNamePair) lotSelection.getSelectedItem();
if (pp != null && pp.getKey() != -1) {
int ID = pp.getKey();
sb.append(" AND asi.M_Lot_ID=").append(ID);
}
// Guarantee Date
Timestamp ts = (Timestamp) guaranteeDateField.getValue();
if (ts != null) {
sb.append(" AND TRUNC(asi.GuaranteeDate, 'DD')");
// < = >
int index = guaranteeDateSelection.getSelectedIndex();
if (index == 0)
sb.append("<");
else if (index == 1)
sb.append("=");
else
sb.append(">");
sb.append(DB.TO_DATE(ts, true));
}
// Instance Editors
for (int i = 0; i < m_instanceEditors.size(); i++) {
StringBuffer iAttr = new StringBuffer();
Component c = (Component) m_instanceEditors.get(i);
Component cTo = (Component) m_instanceEditorsTo.get(i);
int M_Attribute_ID = Integer.parseInt(c.getName());
if (c instanceof VComboBox) {
VComboBox field = (VComboBox) c;
pp = (KeyNamePair) field.getSelectedItem();
if (pp != null && pp.getKey() != -1) {
iAttr.append("M_Attribute_ID=").append(M_Attribute_ID).append(" AND M_AttributeValue_ID=").append(pp.getKey());
}
} else if (c instanceof VNumber) {
VNumber field = (VNumber) c;
BigDecimal value = (BigDecimal) field.getValue();
VNumber fieldTo = (VNumber) cTo;
BigDecimal valueTo = (BigDecimal) fieldTo.getValue();
if (value != null || valueTo != null) {
iAttr.append("M_Attribute_ID=").append(M_Attribute_ID).append(" AND ValueNumber");
if (value != null && valueTo == null)
iAttr.append("=").append(value);
else if (value == null && valueTo != null)
iAttr.append("<=").append(valueTo);
else if (value != null && valueTo != null)
iAttr.append(" BETWEEN ").append(value).append(" AND ").append(valueTo);
}
} else {
VString field = (VString) c;
String value = field.getText();
if (value != null && value.length() > 0) {
iAttr.append("M_Attribute_ID=").append(M_Attribute_ID).append(" AND Value");
if (value.indexOf('%') == -1 && value.indexOf('_') == -1)
iAttr.append("=");
else
iAttr.append(" LIKE ");
iAttr.append(DB.TO_STRING(value));
}
}
// Add to where
if (iAttr.length() > 0)
sb.append(" AND asi.M_AttributeSetInstance_ID IN " + "(SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance " + "WHERE ").append(iAttr).append(")");
}
// finish Instance Attributes
if (sb.length() > 0) {
sb.insert(0, " AND EXISTS (SELECT * FROM M_Storage s" + " INNER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) " + "WHERE s.M_Product_ID=p.M_Product_ID");
sb.append(")");
}
// Product Attributes
for (int i = 0; i < m_productEditors.size(); i++) {
StringBuffer pAttr = new StringBuffer();
Component c = (Component) m_productEditors.get(i);
Component cTo = (Component) m_productEditorsTo.get(i);
int M_Attribute_ID = Integer.parseInt(c.getName());
if (c instanceof VComboBox) {
VComboBox field = (VComboBox) c;
pp = (KeyNamePair) field.getSelectedItem();
if (pp != null && pp.getKey() != -1) {
pAttr.append("M_Attribute_ID=").append(M_Attribute_ID).append(" AND M_AttributeValue_ID=").append(pp.getKey());
}
} else if (c instanceof VNumber) {
VNumber field = (VNumber) c;
BigDecimal value = (BigDecimal) field.getValue();
VNumber fieldTo = (VNumber) cTo;
BigDecimal valueTo = (BigDecimal) fieldTo.getValue();
if (value != null || valueTo != null) {
pAttr.append("M_Attribute_ID=").append(M_Attribute_ID).append(" AND ValueNumber");
if (value != null && valueTo == null)
pAttr.append("=").append(value);
else if (value == null && valueTo != null)
pAttr.append("<=").append(valueTo);
else if (value != null && valueTo != null)
pAttr.append(" BETWEEN ").append(value).append(" AND ").append(valueTo);
}
} else {
VString field = (VString) c;
String value = field.getText();
if (value != null && value.length() > 0) {
pAttr.append("M_Attribute_ID=").append(M_Attribute_ID).append(" AND Value");
if (value.indexOf('%') == -1 && value.indexOf('_') == -1)
pAttr.append("=");
else
pAttr.append(" LIKE ");
pAttr.append(DB.TO_STRING(value));
}
}
// Add to Where
if (pAttr.length() > 0)
sb.append(" AND p.M_AttributeSetInstance_ID IN " + "(SELECT M_AttributeSetInstance_ID " + "FROM M_AttributeInstance WHERE ").append(pAttr).append(")");
}
//
m_query = null;
if (sb.length() > 0)
m_query = sb.toString();
log.config(m_query);
return m_query;
}
use of java.awt.Component in project adempiere by adempiere.
the class InfoPAttribute method setDisplay.
/**
* Set the display text
*/
private void setDisplay() {
StringBuffer display = new StringBuffer();
if (serNoField != null && serNoField.getValue().toString().length() > 0)
display.append(serNoField.getValue().toString() + "-");
if (lotField != null && lotField.getValue().toString().length() > 0)
display.append(lotField.getValue().toString() + "-");
if (lotSelection != null && lotSelection.getDisplay().length() > 0)
display.append(lotSelection.getDisplay() + "-");
if (guaranteeDateField != null && guaranteeDateField.getValue() != null)
display.append(guaranteeDateSelection.getDisplay() + guaranteeDateField.getValue().toString() + "-");
for (int i = 0; i < m_productEditors.size(); i++) {
Component c = (Component) m_productEditors.get(i);
Component cTo = (Component) m_productEditorsTo.get(i);
if (c instanceof VComboBox) {
VComboBox field = (VComboBox) c;
display.append(field.getDisplay() + "-");
} else if (c instanceof VNumber) {
VNumber field = (VNumber) c;
display.append(field.getDisplay() + "-");
VNumber fieldTo = (VNumber) cTo;
display.append(fieldTo.getDisplay() + "-");
} else {
VString field = (VString) c;
display.append(field.getDisplay() + "-");
}
}
for (int i = 0; i < m_instanceEditors.size(); i++) {
Component c = (Component) m_instanceEditors.get(i);
Component cTo = (Component) m_instanceEditorsTo.get(i);
if (c instanceof VComboBox) {
VComboBox field = (VComboBox) c;
display.append(field.getDisplay() + "-");
} else if (c instanceof VNumber) {
VNumber field = (VNumber) c;
display.append(field.getDisplay() + "-");
VNumber fieldTo = (VNumber) cTo;
display.append(fieldTo.getDisplay() + "-");
} else {
VString field = (VString) c;
display.append(field.getDisplay() + "-");
}
}
// TODO - there is a more elegant way to do this.
while (display.toString().contains("--") && display.length() > 1) {
display.delete(display.indexOf("--"), display.indexOf("--") + 1);
}
while (display.toString().startsWith("-") && display.length() >= 1) {
display.delete(0, 1);
}
while (display.toString().endsWith("-") && display.length() >= 1) {
display.delete(display.length() - 1, display.length());
}
m_display = display.toString();
}
Aggregations