new AccessMode(AccessMode.OP, AccessMode.NORMAL),
Widget.NO_BUTTON);
inputPane.add(new JLabel("LV Name"));
inputPane.add(lvNameWidget.getComponent());
inputPane.add(new JLabel());
lvNameWidget.addListeners(new WidgetListener() {
@Override
public void check(final Value value) {
checkButtons();
}
});
final String maxBlockSize = getMaxBlockSize(selectedHosts);
/* size */
final String newBlockSize = Long.toString(Long.parseLong(maxBlockSize) / 2);
final JLabel sizeLabel = new JLabel("New Size");
lvSizeWidget = widgetFactory.createInstance(
Widget.Type.TEXTFIELDWITHUNIT,
VmsXml.convertKilobytes(newBlockSize),
Widget.NO_ITEMS,
getUnits(),
Widget.NO_REGEXP,
250,
Widget.NO_ABBRV,
new AccessMode(AccessMode.OP, AccessMode.NORMAL),
Widget.NO_BUTTON);
inputPane.add(sizeLabel);
inputPane.add(lvSizeWidget.getComponent());
createButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
application.invokeAndWait(new Runnable() {
@Override
public void run() {
enableCreateButton(false);
}
});
disableComponents();
getProgressBar().start(LV_CREATE_TIMEOUT * hostCheckBoxes.size());
boolean oneFailed = false;
for (final Map.Entry<Host, JCheckBox> hostEntry : hostCheckBoxes.entrySet()) {
if (hostEntry.getValue().isSelected()) {
final boolean ret = lvCreate(hostEntry.getKey(),
lvNameWidget.getStringValue(),
lvSizeWidget.getStringValue());
if (!ret) {
oneFailed = true;
}
}
}
for (final Host h : hostCheckBoxes.keySet()) {
h.getBrowser().getClusterBrowser().updateHWInfo(h, Host.UPDATE_LVM);
}
final String maxBlockSize = getMaxBlockSize(getSelectedHostCbs());
maxSizeWidget.setValue(VmsXml.convertKilobytes(maxBlockSize));
enableComponents();
if (oneFailed) {
progressBarDoneError();
} else {
progressBarDone();
}
}
});
thread.start();
}
});
inputPane.add(createButton);
/* max size */
final JLabel maxSizeLabel = new JLabel("Max Size");
maxSizeLabel.setEnabled(false);
maxSizeWidget = widgetFactory.createInstance(
Widget.Type.TEXTFIELDWITHUNIT,
VmsXml.convertKilobytes(maxBlockSize),
Widget.NO_ITEMS,
getUnits(),
Widget.NO_REGEXP,
250,
Widget.NO_ABBRV,
new AccessMode(AccessMode.OP, AccessMode.NORMAL),
Widget.NO_BUTTON);
maxSizeWidget.setEnabled(false);
inputPane.add(maxSizeLabel);
inputPane.add(maxSizeWidget.getComponent());
inputPane.add(new JLabel());
lvSizeWidget.addListeners(new WidgetListener() {
@Override
public void check(final Value value) {
checkButtons();
}
});