use of org.compiere.impexp.ImpFormatRow in project adempiere by adempiere.
the class WFileImport method cmd_loadFormat.
// cmd_loadFile
/**
* Load Format
*/
private void cmd_loadFormat() {
// clear panel
previewPanel.getChildren().clear();
ListItem listitem = pickFormat.getSelectedItem();
String formatName = (String) listitem.getValue();
if (formatName.equals(s_none))
return;
m_format = ImpFormat.load(formatName);
if (m_format == null) {
FDialog.error(m_WindowNo, this, formatName);
return;
}
// pointers
int size = m_format.getRowCount();
m_labels = new Label[size];
m_fields = new Textbox[size];
for (int i = 0; i < size; i++) {
ImpFormatRow row = m_format.getRow(i);
m_labels[i] = new Label(row.getColumnName());
Hbox hbox = new Hbox();
hbox.setWidth("100%");
hbox.setWidths("30%, 70%");
hbox.setStyle("padding-bottom: 3px");
hbox.appendChild(m_labels[i].rightAlign());
int length = row.getEndNo() - row.getStartNo();
if (length <= 5)
length = 5;
else if (length > 20)
length = 20;
m_fields[i] = new Textbox();
m_fields[i].setStyle("margin-left: 2px");
hbox.appendChild(m_fields[i]);
previewPanel.appendChild(hbox);
}
m_record = -1;
record.setValue("------");
previewPanel.invalidate();
}
use of org.compiere.impexp.ImpFormatRow in project adempiere by adempiere.
the class VFileImport method cmd_loadFormat.
// cmd_loadFile
/**
* Load Format
*/
private void cmd_loadFormat() {
// clear panel
previewPanel.removeAll();
//
String formatName = pickFormat.getSelectedItem().toString();
if (formatName.equals(s_none))
return;
m_format = ImpFormat.load(formatName);
if (m_format == null) {
ADialog.error(m_WindowNo, this, "FileImportNoFormat", formatName);
return;
}
// pointers
int size = m_format.getRowCount();
m_labels = new JLabel[size];
m_fields = new JTextField[size];
for (int i = 0; i < size; i++) {
ImpFormatRow row = m_format.getRow(i);
m_labels[i] = new JLabel(row.getColumnName());
previewPanel.add(m_labels[i], new GridBagConstraints(i, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
//
int length = row.getEndNo() - row.getStartNo();
if (length <= 5)
length = 5;
else if (length > 20)
length = 20;
m_fields[i] = new JTextField(length);
previewPanel.add(m_fields[i], new GridBagConstraints(i, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
}
m_record = -1;
record.setText("------");
previewPanel.invalidate();
previewPanel.repaint();
}
Aggregations