fix layouts & nullpointer

This commit is contained in:
f43nd1r 2018-11-30 03:04:34 +01:00
parent 2899a37c84
commit 36f27a7d75
3 changed files with 10 additions and 8 deletions

View file

@ -18,9 +18,9 @@ package com.faendir.acra.ui.base;
import com.faendir.acra.i18n.Messages;
import com.faendir.acra.rest.RestReportInterface;
import com.faendir.acra.ui.component.Label;
import com.faendir.acra.ui.view.Overview;
import com.faendir.acra.util.PlainTextUser;
import com.vaadin.flow.component.Text;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.i18n.LocaleChangeEvent;
import com.vaadin.flow.i18n.LocaleChangeObserver;
@ -30,7 +30,7 @@ import org.springframework.lang.NonNull;
* @author lukas
* @since 09.11.18
*/
public class ConfigurationLabel extends Text implements LocaleChangeObserver {
public class ConfigurationLabel extends Label implements LocaleChangeObserver {
private final PlainTextUser user;
public ConfigurationLabel(@NonNull PlainTextUser user) {
@ -40,6 +40,6 @@ public class ConfigurationLabel extends Text implements LocaleChangeObserver {
@Override
public void localeChange(LocaleChangeEvent event) {
setText(getTranslation(Messages.CONFIGURATION_LABEL, UI.getCurrent().getRouter().getUrl(Overview.class), RestReportInterface.REPORT_PATH, user.getUsername(), user.getPlaintextPassword()));
getElement().setProperty("innerHTML", getTranslation(Messages.CONFIGURATION_LABEL, UI.getCurrent().getRouter().getUrl(Overview.class), RestReportInterface.REPORT_PATH, user.getUsername(), user.getPlaintextPassword()));
}
}

View file

@ -17,12 +17,12 @@
package com.faendir.acra.ui.base.popup;
import com.faendir.acra.i18n.Messages;
import com.faendir.acra.ui.component.FlexLayout;
import com.faendir.acra.ui.component.Translatable;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasSize;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.dialog.Dialog;
import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import org.springframework.data.util.Pair;
import org.springframework.lang.NonNull;
@ -140,9 +140,9 @@ public class Popup extends Dialog {
}
}
});
FormLayout layout = new FormLayout();
layout.setResponsiveSteps(new FormLayout.ResponsiveStep("0px", 1));
components.forEach(c -> layout.addFormItem(c, ""));
FlexLayout layout = new FlexLayout();
layout.setFlexDirection(FlexLayout.FlexDirection.COLUMN);
components.forEach(layout::add);
checkValid();
removeAll();
add(layout);

View file

@ -99,7 +99,9 @@ class Property<F, C extends Component & HasValue<?, F> & HasEnabled & HasSize &
ComboBox<String> comboBox = new ComboBox<>(null, list);
comboBox.setAllowCustomValue(false);
comboBox.setRequired(true);
if(!list.isEmpty()) {
comboBox.setValue(list.get(0));
}
return new Property<>(app, comboBox, stringExpression::eq, new PieChart(chartTitleId), dataService, stringExpression, filterTextId);
}