}
}
@Override
protected JComponent getInputPane() {
final ResourceInfo dri = getDrbdVolumeInfo().getDrbdResourceInfo();
final JPanel inputPane = new JPanel();
inputPane.setLayout(new BoxLayout(inputPane, BoxLayout.LINE_AXIS));
final JPanel optionsPanel = new JPanel();
optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.PAGE_AXIS));
/* common options */
final Map<String, Value> commonPreferredValue = new HashMap<String, Value>();
commonPreferredValue.put(DrbdXml.PROTOCOL_PARAM, DrbdXml.PROTOCOL_C);
commonPreferredValue.put(DEGR_WFC_TIMEOUT_PARAM, new StringValue("0"));
commonPreferredValue.put(CRAM_HMAC_ALG_PARAM, new StringValue("sha1"));
commonPreferredValue.put(SHARED_SECRET_PARAM, new StringValue(getRandomSecret()));
commonPreferredValue.put(ON_IO_ERROR_PARAM, new StringValue("detach"));
commonPreferredValue.put(PROXY_MEMLIMIT_PARAM, new StringValue("100", DrbdXml.getUnitMiBytes("")));
commonPreferredValue.put(PROXY_PLUGIN_ZLIB_PARAM, new StringValue("level 9"));
final GlobalInfo globalInfo = dri.getBrowser().getGlobalInfo();
final boolean protocolInNetSection = globalInfo.atLeastVersion("8.4");
if (globalInfo.getDrbdResources().size() <= 1) {
for (final String commonP : COMMON_PARAMS) {
if (!protocolInNetSection && DrbdXml.PROTOCOL_PARAM.equals(commonP)) {
continue;
}
final Widget widget = globalInfo.getWidget(commonP, null);
if (widget == null) {
LOG.appError("widget for param: " + commonP + " was not created");
return new JPanel();
}
/* for the first resource set common options. */
final Value commonValue = globalInfo.getResource().getValue(commonP);
if (commonPreferredValue.containsKey(commonP)) {
final Value defaultValue = globalInfo.getParamDefault(commonP);
if (Tools.areEqual(defaultValue, commonValue)) {
widget.setValue(commonPreferredValue.get(commonP));
dri.getResource().setValue(commonP, commonPreferredValue.get(commonP));
} else {
dri.getResource().setValue(commonP, commonValue);
}
}
}
} else {
/* resource options, if not defined in common section. */
for (final String commonP : COMMON_PARAMS) {
final Value commonValue = globalInfo.getResource().getValue(commonP);
if (commonValue == null || commonValue.isNothingSelected()
&& commonPreferredValue.containsKey(commonP)) {
dri.getResource().setValue(commonP, commonPreferredValue.get(commonP));
}
}
}
/* address combo boxes */
dri.addHostAddresses(optionsPanel,
application.getServiceLabelWidth(),
application.getServiceFieldWidth() << 1,
true,
buttonClass(nextButton()));
dri.addWizardParams(optionsPanel,
PARAMS,
buttonClass(nextButton()),
application.getDefaultSize("Dialog.DrbdConfig.Resource.LabelWidth"),
application.getDefaultSize("Dialog.DrbdConfig.Resource.FieldWidth") << 1,
null);