*/
public SpreadSheetColumnMenu(CommonSpreadSheet spreadSheet, final int col) {
super();
// setLabel("");
setBorder(new BevelBorder(BevelBorder.RAISED));
final CommonSpreadSheet sp = spreadSheet;
final SpreadSheetFieldArray fields = (SpreadSheetFieldArray) sp.getFieldArray();
insert.setIcon(IconManager.getIcon("menu.insertColumn")); //$NON-NLS-1$
insert.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Field field = ColumnDialog.getFieldFromDialog(sp,sp.getAvailableFields(),fields);
if (field != null) {
int c = col;
if (c == 0) // takes care of when adding off to right. openproj bug 1815404
c = fields.size();
sp.setFieldArray(fields.insertField(c, field));
}
}
});
hide.setIcon(IconManager.getIcon("menu.hideColumn")); //$NON-NLS-1$
hide.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (fields.size() > 2 ) { // there is always the hidden Id field, so only allow delete if more than one other field
sp.setFieldArray(fields.removeField(col));
} else {
Alert.warn(Messages.getString("Message.cantEmptySpreadsheet"),sp); //$NON-NLS-1$
}
}
});
final Field f = (Field) fields.get(col);
rename.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (fields.size() > 2 ) { // there is always the hidden Id field, so only allow delete if more than one other field
FieldAliasDialog.doRename(f);
sp.setFieldArray(fields);
} else {
Alert.warn(Messages.getString("Message.cantEmptySpreadsheet"),sp); //$NON-NLS-1$
}
}
});