Example usage for com.google.gwt.user.client.ui Widget addStyleName

List of usage examples for com.google.gwt.user.client.ui Widget addStyleName

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Widget addStyleName.

Prototype

public void addStyleName(String style) 

Source Link

Document

Adds a secondary or dependent style name to this object.

Usage

From source file:org.kaaproject.avro.ui.gwt.client.widget.RecordFieldWidget.java

License:Apache License

@Override
protected Widget constructLabel(FlexTable table, FormField field, int row, int column) {
    Widget label = super.constructLabel(table, field, row, column);
    if (!navigationDisabled) {
        label.addStyleName(style.padded());
    }/*w  ww . j a v  a 2  s  .co m*/
    return label;
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.RecordFieldWidget.java

License:Apache License

@Override
protected int placeWidget(FlexTable table, FieldType type, Widget widget, int row, int column,
        List<HandlerRegistration> handlerRegistrations) {
    if (!navigationDisabled && (!type.isComplex() || shouldPlaceNestedWidgetButton(type))) {
        widget.addStyleName(style.padded());
    }/*from  w  w  w .j ava  2 s  . c  o m*/
    return super.placeWidget(table, type, widget, row, column, handlerRegistrations);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.dialog.AddEcfSchemaDialog.java

License:Apache License

public AddEcfSchemaDialog(String ecfId, Listener listener) {
    super(false, true);

    this.ecfId = ecfId;
    this.listener = listener;

    setWidth("500px");

    setTitle(Utils.constants.addEcfSchema());

    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);/*from  ww w  . java  2 s. c  o  m*/
    setWidget(dialogContents);

    errorPanel = new AlertPanel(AlertPanel.Type.ERROR);
    errorPanel.setVisible(false);
    dialogContents.add(errorPanel);

    FlexTable table = new FlexTable();
    table.setCellSpacing(6);

    int row = 0;

    Widget label = new Label(Utils.constants.selectSchemaFile());
    label.addStyleName(Utils.avroUiStyle.requiredField());
    schemaFileUpload = new FileUploadForm();
    schemaFileUpload.setWidth("200px");

    table.setWidget(row, 0, label);
    table.setWidget(row, 1, schemaFileUpload);
    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    dialogContents.add(table);

    schemaFileUpload.addChangeHandler(this);
    fileItemName = schemaFileUpload.getFileItemName();

    schemaFileUpload.addSubmitCompleteHandler(new SubmitCompleteHandler() {
        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            performAdd();
        }
    });

    addButton = new Button(Utils.constants.add(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            schemaFileUpload.submit();
        }
    });

    Button closeButton = new Button(Utils.constants.close(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
            AddEcfSchemaDialog.this.listener.onClose();
        }
    });
    addButton(addButton);
    addButton(closeButton);

    addButton.setEnabled(false);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.dialog.AddTopicDialog.java

License:Apache License

public AddTopicDialog(String endpointGroupId, List<TopicDto> topics) {
    super(false, true);

    this.endpointGroupId = endpointGroupId;

    setWidth("500px");

    setTitle(Utils.constants.addTopicToEp());

    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);/* w  w  w. ja v  a 2s.  c  o  m*/
    setWidget(dialogContents);

    errorPanel = new AlertPanel(AlertPanel.Type.ERROR);
    errorPanel.setVisible(false);
    dialogContents.add(errorPanel);

    FlexTable table = new FlexTable();
    table.setCellSpacing(6);

    int row = 0;

    Widget label = new Label(Utils.constants.selectNotificationTopics());
    label.addStyleName(Utils.avroUiStyle.requiredField());
    topic = new TopicListBox();
    topic.setWidth("200px");
    topic.setAcceptableValues(topics);
    topic.addValueChangeHandler(this);

    table.setWidget(row, 0, label);
    table.setWidget(row, 1, topic);
    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    dialogContents.add(table);

    addButton = new Button(Utils.constants.add(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            performAdd();
        }
    });

    Button closeButton = new Button(Utils.constants.close(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    addButton(addButton);
    addButton(closeButton);

    addButton.setEnabled(false);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.dialog.ChangePasswordDialog.java

License:Apache License

public ChangePasswordDialog(final Listener listener, String username, String message) {
    super(false, true);

    this.username = username;

    InputChangeHandler handler = new InputChangeHandler(listener);

    setWidth("500px");

    setTitle(Utils.constants.changePassword());

    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);/*from w  w w  . j av  a 2s  . co m*/
    setWidget(dialogContents);

    errorPanel = new AlertPanel(AlertPanel.Type.ERROR);
    errorPanel.setVisible(false);
    dialogContents.add(errorPanel);

    if (message != null) {
        AlertPanel warningPanel = new AlertPanel(AlertPanel.Type.WARNING);
        warningPanel.setMessage(message);
        dialogContents.add(warningPanel);
    }

    FlexTable table = new FlexTable();
    table.setCellSpacing(6);

    int row = 0;
    Widget label = new Label(Utils.constants.oldPassword());
    label.addStyleName(REQUIRED);
    oldPassword = new ExtendedPasswordTextBox();
    table.setWidget(row, 0, label);
    table.setWidget(row, 1, oldPassword);
    oldPassword.addInputHandler(handler);
    oldPassword.addKeyDownHandler(handler);

    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    row++;
    label = new Label(Utils.constants.newPassword());
    label.addStyleName(REQUIRED);
    newPassword = new ExtendedPasswordTextBox();
    table.setWidget(row, 0, label);
    table.setWidget(row, 1, newPassword);
    newPassword.addInputHandler(handler);
    newPassword.addKeyDownHandler(handler);

    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    row++;
    label = new Label(Utils.constants.newPasswordAgain());
    label.addStyleName(REQUIRED);
    newPasswordAgain = new ExtendedPasswordTextBox();
    table.setWidget(row, 0, label);
    table.setWidget(row, 1, newPasswordAgain);
    newPasswordAgain.addInputHandler(handler);
    newPasswordAgain.addKeyDownHandler(handler);

    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    dialogContents.add(table);

    changePasswordButton = new Button(Utils.constants.changePassword(), handler);

    Button cancelButton = new Button(Utils.constants.cancel(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
            listener.onCancel();
        }
    });
    addButton(changePasswordButton);
    addButton(cancelButton);

    changePasswordButton.setEnabled(false);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.dialog.EditSchemaRecordDialog.java

License:Apache License

public EditSchemaRecordDialog(Listener listener, String title, List<SchemaInfoDto> schemas, int schemaVersion) {
    setWidth("100%");
    setTitle(title);// w  ww  .j a va2s .c o  m
    this.listener = listener;

    SchemaInfoDto currentValue = null;
    for (SchemaInfoDto schema : schemas) {
        if (schema.getVersion() == schemaVersion) {
            currentValue = schema;
            break;
        }
    }

    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    setWidget(dialogContents);

    errorPanel = new AlertPanel(AlertPanel.Type.ERROR);
    errorPanel.setVisible(false);
    dialogContents.add(errorPanel);

    FlexTable table = new FlexTable();
    table.setCellSpacing(6);
    table.addStyleName(Utils.avroUiStyle.fieldWidget());

    int row = 0;

    Widget schemaVersionLabel = new Label(Utils.constants.schemaVersion());
    schemaVersionLabel.addStyleName(Utils.avroUiStyle.requiredField());
    schemaBox = new SchemaInfoListBox();
    schemaBox.setWidth("50px");
    schemaBox.getElement().getStyle().setMarginLeft(10, Unit.PX);
    schemaBox.setValue(currentValue);
    schemaBox.setAcceptableValues(schemas);
    schemaBox.addValueChangeHandler(this);

    HorizontalPanel versionPanel = new HorizontalPanel();
    versionPanel.add(schemaVersionLabel);
    versionPanel.add(schemaBox);

    table.setWidget(row, 0, versionPanel);

    schemaRecordPanel = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(),
            Utils.constants.schema(), this, false, false);

    //schemaRecordPanel.setWidth("750px");
    schemaRecordPanel.getElement().getStyle().setPropertyPx("minWidth", 750);
    schemaRecordPanel.getRecordWidget().setForceNavigation(true);
    schemaRecordPanel.setPreferredHeightPx(250);
    schemaRecordPanel.addValueChangeHandler(new ValueChangeHandler<RecordField>() {
        @Override
        public void onValueChange(ValueChangeEvent<RecordField> event) {
            validate();
        }
    });

    table.setWidget(++row, 0, schemaRecordPanel);
    table.getFlexCellFormatter().setColSpan(row, 0, 2);

    dialogContents.add(table);

    saveButton = new Button(Utils.constants.save(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            performSave();
        }
    });

    Button cancelButton = new Button(Utils.constants.cancel(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
            EditSchemaRecordDialog.this.listener.onCancel();
        }
    });
    addButton(saveButton);
    addButton(cancelButton);

    updateValue(currentValue);

    saveButton.setEnabled(false);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.dialog.GenerateSdkDialog.java

License:Apache License

public GenerateSdkDialog(String applicationId, SchemaVersions schemaVersions, List<AefMapInfoDto> aefMaps) {
    super(false, true);

    this.applicationId = applicationId;
    this.aefMaps = aefMaps;

    setWidth("500px");

    setTitle(Utils.constants.generate_sdk());

    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);/*  w  w w  .  j av a2  s . co  m*/
    setWidget(dialogContents);

    errorPanel = new AlertPanel(AlertPanel.Type.ERROR);
    errorPanel.setVisible(false);
    dialogContents.add(errorPanel);

    FlexTable table = new FlexTable();
    table.setCellSpacing(6);

    int row = 0;

    ValueChangeHandler<SchemaDto> schemaValueChangeHandler = new ValueChangeHandler<SchemaDto>() {
        @Override
        public void onValueChange(ValueChangeEvent<SchemaDto> event) {
            fireChanged();
        }
    };

    Widget label = new Label(Utils.constants.configurationSchemaVersion());
    label.addStyleName(REQUIRED);
    configurationSchemaVersion = new SchemaListBox();
    configurationSchemaVersion.setWidth("80px");
    List<SchemaDto> confSchemaVersions = schemaVersions.getConfigurationSchemaVersions();
    configurationSchemaVersion.setValue(getMaxSchemaVersions(confSchemaVersions));
    configurationSchemaVersion.setAcceptableValues(confSchemaVersions);
    configurationSchemaVersion.addValueChangeHandler(schemaValueChangeHandler);

    table.setWidget(row, 0, label);
    table.setWidget(row, 1, configurationSchemaVersion);
    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    row++;

    label = new Label(Utils.constants.profileSchemaVersion());
    label.addStyleName(REQUIRED);
    profileSchemaVersion = new SchemaListBox();
    profileSchemaVersion.setWidth("80px");
    List<SchemaDto> pfSchemaVersions = schemaVersions.getProfileSchemaVersions();
    profileSchemaVersion.setValue(getMaxSchemaVersions(pfSchemaVersions));
    profileSchemaVersion.setAcceptableValues(pfSchemaVersions);
    profileSchemaVersion.addValueChangeHandler(schemaValueChangeHandler);

    table.setWidget(row, 0, label);
    table.setWidget(row, 1, profileSchemaVersion);
    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    row++;

    label = new Label(Utils.constants.notificationSchemaVersion());
    label.addStyleName(REQUIRED);
    notificationSchemaVersion = new SchemaListBox();
    notificationSchemaVersion.setWidth("80px");
    List<SchemaDto> notSchemaVersions = schemaVersions.getNotificationSchemaVersions();
    notificationSchemaVersion.setValue(getMaxSchemaVersions(notSchemaVersions));
    notificationSchemaVersion.setAcceptableValues(notSchemaVersions);
    notificationSchemaVersion.addValueChangeHandler(schemaValueChangeHandler);

    table.setWidget(row, 0, label);
    table.setWidget(row, 1, notificationSchemaVersion);
    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    row++;

    label = new Label(Utils.constants.logSchemaVersion());
    label.addStyleName(REQUIRED);
    logSchemaVersion = new SchemaListBox();
    logSchemaVersion.setWidth("80px");
    List<SchemaDto> logSchemaVersions = schemaVersions.getLogSchemaVersions();
    logSchemaVersion.setValue(getMaxSchemaVersions(logSchemaVersions));
    logSchemaVersion.setAcceptableValues(logSchemaVersions);
    logSchemaVersion.addValueChangeHandler(schemaValueChangeHandler);

    table.setWidget(row, 0, label);
    table.setWidget(row, 1, logSchemaVersion);
    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    row++;

    label = new Label(Utils.constants.targetPlatform());
    label.addStyleName(REQUIRED);

    Renderer<SdkPlatform> targetPlatformRenderer = new Renderer<SdkPlatform>() {
        @Override
        public String render(SdkPlatform object) {
            if (object != null) {
                return Utils.constants.getString(object.getResourceKey());
            } else {
                return "";
            }
        }

        @Override
        public void render(SdkPlatform object, Appendable appendable) throws IOException {
            appendable.append(render(object));
        }
    };

    targetPlatform = new ValueListBox<>(targetPlatformRenderer);
    targetPlatform.setWidth("80px");
    // Set default sdk platform
    targetPlatform.setValue(SdkPlatform.ANDROID);
    targetPlatform.setAcceptableValues(Arrays.asList(SdkPlatform.values()));
    targetPlatform.addValueChangeHandler(new ValueChangeHandler<SdkPlatform>() {
        @Override
        public void onValueChange(ValueChangeEvent<SdkPlatform> event) {
            fireChanged();
        }
    });

    table.setWidget(row, 0, label);
    table.setWidget(row, 1, targetPlatform);
    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    row++;

    FlexTable ecfsTable = new FlexTable();
    ecfsTable.setCellSpacing(6);

    availableAefMaps = new MultiAefMapListBox();
    selectedAefMaps = new MultiAefMapListBox();

    addAefMapButton = new Button(Utils.constants.add());
    removeAefMapButton = new Button(Utils.constants.remove());

    VerticalPanel availableEcfsPanel = new VerticalPanel();
    availableEcfsPanel.setSpacing(6);
    Label availableLabel = new Label(Utils.constants.available());
    availableEcfsPanel.add(availableLabel);
    availableEcfsPanel.add(availableAefMaps);

    VerticalPanel ecfButtonsPanel = new VerticalPanel();
    ecfButtonsPanel.setSpacing(6);
    ecfButtonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    ecfButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    ecfButtonsPanel.add(addAefMapButton);
    ecfButtonsPanel.add(removeAefMapButton);

    VerticalPanel selectedEcfsPanel = new VerticalPanel();
    selectedEcfsPanel.setSpacing(6);
    Label selectedLabel = new Label(Utils.constants.selected());
    selectedEcfsPanel.add(selectedLabel);
    selectedEcfsPanel.add(selectedAefMaps);

    ecfsTable.setWidget(0, 0, availableEcfsPanel);
    ecfsTable.setWidget(0, 1, ecfButtonsPanel);
    ecfsTable.setWidget(0, 2, selectedEcfsPanel);

    DisclosurePanel ecfsDisclosure = new DisclosurePanel(Utils.constants.ecfs());
    ecfsDisclosure.setAnimationEnabled(true);
    ecfsDisclosure.setContent(ecfsTable);

    aefMapComparator = new AefMapInfoDtoComparator();
    Collections.sort(aefMaps, aefMapComparator);

    availableAefMaps.setAcceptableValues(aefMaps);

    addAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
    removeAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());

    addAefMapButton.setEnabled(false);
    removeAefMapButton.setEnabled(false);

    addAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            addAefMap();
        }
    });

    removeAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            removeAefMap();
        }
    });

    availableAefMaps.setSize("150px", "100px");
    selectedAefMaps.setSize("150px", "100px");

    availableAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });

    selectedAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });

    dialogContents.add(table);
    dialogContents.add(ecfsDisclosure);

    generateSdkButton = new Button(Utils.constants.generate_sdk(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            performGenerateSdk();
        }
    });

    Button closeButton = new Button(Utils.constants.close(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    addButton(generateSdkButton);
    addButton(closeButton);

    generateSdkButton.setEnabled(false);
    fireChanged();
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.dialog.ResetPasswordDialog.java

License:Apache License

public ResetPasswordDialog(Listener listener) {
    super(false, true);

    this.listener = listener;

    setWidth("500px");

    setTitle(Utils.constants.resetPassword());

    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);//w  w w .  j a  v  a  2s .c o  m
    setWidget(dialogContents);

    errorPanel = new AlertPanel(AlertPanel.Type.ERROR);
    errorPanel.setVisible(false);
    dialogContents.add(errorPanel);

    messagePanel = new AlertPanel(AlertPanel.Type.WARNING);
    messagePanel.setMessage(Utils.messages.resetPasswordMessage());
    dialogContents.add(messagePanel);

    FlexTable table = new FlexTable();
    table.setCellSpacing(6);

    int row = 0;
    Widget label = new Label(Utils.constants.usernameOrEmail());
    label.addStyleName(Utils.avroUiStyle.requiredField());
    usernameOrEmail = new KaaAdminSizedTextBox(255);
    table.setWidget(row, 0, label);
    table.setWidget(row, 1, usernameOrEmail);
    usernameOrEmail.addInputHandler(new InputEventHandler() {
        @Override
        public void onInputChanged(InputEvent event) {
            boolean valid = validate();
            sendResetPasswordLinkButton.setEnabled(valid);
        }
    });

    table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    dialogContents.add(table);

    sendResetPasswordLinkButton = new Button(Utils.constants.sendResetPasswordLink(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            validateUsernameOrEmail();
        }
    });

    Button cancelButton = new Button(Utils.constants.cancel(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
            ResetPasswordDialog.this.listener.onCancel();
        }
    });
    addButton(sendResetPasswordLinkButton);
    addButton(cancelButton);

    sendResetPasswordLinkButton.setEnabled(false);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.sdk.AddSdkProfileViewImpl.java

License:Apache License

@Override
protected void initDetailsTable() {

    detailsTable.getColumnFormatter().setWidth(0, "250px");
    detailsTable.getColumnFormatter().setWidth(1, "500px");

    int row = 0;/*from w w  w .  j  a v  a  2  s.co  m*/
    Widget label = new Label(Utils.constants.name());
    label.addStyleName(REQUIRED);
    name = new KaaAdminSizedTextBox(256);
    name.addInputHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, name);

    row++;
    label = new Label(Utils.constants.configurationSchemaVersion());
    label.addStyleName(REQUIRED);
    configurationSchemaVersion = new VersionListBox();
    configurationSchemaVersion.setWidth("80px");
    configurationSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, configurationSchemaVersion);

    row++;
    label = new Label(Utils.constants.profileSchemaVersion());
    label.addStyleName(REQUIRED);
    profileSchemaVersion = new VersionListBox();
    profileSchemaVersion.setWidth("80px");
    profileSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, profileSchemaVersion);

    row++;
    label = new Label(Utils.constants.notificationSchemaVersion());
    label.addStyleName(REQUIRED);
    notificationSchemaVersion = new VersionListBox();
    notificationSchemaVersion.setWidth("80px");
    notificationSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, notificationSchemaVersion);

    row++;
    label = new Label(Utils.constants.logSchemaVersion());
    label.addStyleName(REQUIRED);
    logSchemaVersion = new VersionListBox();
    logSchemaVersion.setWidth("80px");
    logSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, logSchemaVersion);

    row++;
    FlexTable ecfsTable = new FlexTable();
    ecfsTable.setCellSpacing(6);

    availableAefMaps = new MultiAefMapListBox();
    selectedAefMaps = new MultiAefMapListBox();

    addAefMapButton = new Button(Utils.constants.add());
    removeAefMapButton = new Button(Utils.constants.remove());

    VerticalPanel availableEcfsPanel = new VerticalPanel();
    availableEcfsPanel.setSpacing(6);
    Label availableLabel = new Label(Utils.constants.available());
    availableEcfsPanel.add(availableLabel);
    availableEcfsPanel.add(availableAefMaps);

    VerticalPanel ecfButtonsPanel = new VerticalPanel();
    ecfButtonsPanel.setSpacing(6);
    ecfButtonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    ecfButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    ecfButtonsPanel.add(addAefMapButton);
    ecfButtonsPanel.add(removeAefMapButton);

    VerticalPanel selectedEcfsPanel = new VerticalPanel();
    selectedEcfsPanel.setSpacing(6);
    Label selectedLabel = new Label(Utils.constants.selected());
    selectedEcfsPanel.add(selectedLabel);
    selectedEcfsPanel.add(selectedAefMaps);

    ecfsTable.setWidget(0, 0, availableEcfsPanel);
    ecfsTable.setWidget(0, 1, ecfButtonsPanel);
    ecfsTable.setWidget(0, 2, selectedEcfsPanel);

    ecfsTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    DisclosurePanel ecfsDisclosure = new DisclosurePanel(Utils.constants.ecfs());
    ecfsDisclosure.setAnimationEnabled(true);
    ecfsDisclosure.setContent(ecfsTable);

    addAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
    removeAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());

    addAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            addAefMap();
        }
    });

    removeAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            removeAefMap();
        }
    });

    availableAefMaps.setSize("250px", "100px");
    selectedAefMaps.setSize("250px", "100px");

    availableAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });

    selectedAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });
    detailsTable.setWidget(row, 0, ecfsDisclosure);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);

    row++;
    label = new Label(Utils.constants.defaultUserVerifier());
    Renderer<UserVerifierDto> userVerifierRenderer = new Renderer<UserVerifierDto>() {
        @Override
        public String render(UserVerifierDto object) {
            if (object != null) {
                return object.getName();
            } else {
                return "";
            }
        }

        @Override
        public void render(UserVerifierDto object, Appendable appendable) throws IOException {
            appendable.append(render(object));
        }
    };
    defaultUserVerifier = new ValueListBox<>(userVerifierRenderer);
    defaultUserVerifier.addValueChangeHandler(new ValueChangeHandler<UserVerifierDto>() {
        @Override
        public void onValueChange(ValueChangeEvent<UserVerifierDto> event) {
            fireChanged();
        }
    });
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, defaultUserVerifier);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.sdk.GenerateSdkViewImpl.java

License:Apache License

@Override
protected void initDetailsTable() {

    detailsTable.getColumnFormatter().setWidth(0, "250px");
    detailsTable.getColumnFormatter().setWidth(1, "500px");

    int row = 0;/*w w  w  .j  a  v  a2  s . co  m*/
    Widget label = new Label(Utils.constants.configurationSchemaVersion());
    label.addStyleName(REQUIRED);
    configurationSchemaVersion = new SchemaListBox();
    configurationSchemaVersion.setWidth("80px");
    configurationSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, configurationSchemaVersion);

    row++;
    label = new Label(Utils.constants.profileSchemaVersion());
    label.addStyleName(REQUIRED);
    profileSchemaVersion = new SchemaListBox();
    profileSchemaVersion.setWidth("80px");
    profileSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, profileSchemaVersion);

    row++;
    label = new Label(Utils.constants.notificationSchemaVersion());
    label.addStyleName(REQUIRED);
    notificationSchemaVersion = new SchemaListBox();
    notificationSchemaVersion.setWidth("80px");
    notificationSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, notificationSchemaVersion);

    row++;
    label = new Label(Utils.constants.logSchemaVersion());
    label.addStyleName(REQUIRED);
    logSchemaVersion = new SchemaListBox();
    logSchemaVersion.setWidth("80px");
    logSchemaVersion.addValueChangeHandler(this);
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, logSchemaVersion);

    row++;
    label = new Label(Utils.constants.targetPlatform());
    label.addStyleName(REQUIRED);
    Renderer<SdkPlatform> targetPlatformRenderer = new Renderer<SdkPlatform>() {
        @Override
        public String render(SdkPlatform object) {
            if (object != null) {
                return Utils.constants.getString(object.getResourceKey());
            } else {
                return "";
            }
        }

        @Override
        public void render(SdkPlatform object, Appendable appendable) throws IOException {
            appendable.append(render(object));
        }
    };
    targetPlatform = new ValueListBox<>(targetPlatformRenderer);
    targetPlatform.addValueChangeHandler(new ValueChangeHandler<SdkPlatform>() {
        @Override
        public void onValueChange(ValueChangeEvent<SdkPlatform> event) {
            fireChanged();
        }
    });
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, targetPlatform);

    row++;
    FlexTable ecfsTable = new FlexTable();
    ecfsTable.setCellSpacing(6);

    availableAefMaps = new MultiAefMapListBox();
    selectedAefMaps = new MultiAefMapListBox();

    addAefMapButton = new Button(Utils.constants.add());
    removeAefMapButton = new Button(Utils.constants.remove());

    VerticalPanel availableEcfsPanel = new VerticalPanel();
    availableEcfsPanel.setSpacing(6);
    Label availableLabel = new Label(Utils.constants.available());
    availableEcfsPanel.add(availableLabel);
    availableEcfsPanel.add(availableAefMaps);

    VerticalPanel ecfButtonsPanel = new VerticalPanel();
    ecfButtonsPanel.setSpacing(6);
    ecfButtonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    ecfButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    ecfButtonsPanel.add(addAefMapButton);
    ecfButtonsPanel.add(removeAefMapButton);

    VerticalPanel selectedEcfsPanel = new VerticalPanel();
    selectedEcfsPanel.setSpacing(6);
    Label selectedLabel = new Label(Utils.constants.selected());
    selectedEcfsPanel.add(selectedLabel);
    selectedEcfsPanel.add(selectedAefMaps);

    ecfsTable.setWidget(0, 0, availableEcfsPanel);
    ecfsTable.setWidget(0, 1, ecfButtonsPanel);
    ecfsTable.setWidget(0, 2, selectedEcfsPanel);

    ecfsTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    DisclosurePanel ecfsDisclosure = new DisclosurePanel(Utils.constants.ecfs());
    ecfsDisclosure.setAnimationEnabled(true);
    ecfsDisclosure.setContent(ecfsTable);

    addAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
    removeAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());

    addAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            addAefMap();
        }
    });

    removeAefMapButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            removeAefMap();
        }
    });

    availableAefMaps.setSize("250px", "100px");
    selectedAefMaps.setSize("250px", "100px");

    availableAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });

    selectedAefMaps.addValueChangeHandler(new ValueChangeHandler<List<AefMapInfoDto>>() {
        @Override
        public void onValueChange(ValueChangeEvent<List<AefMapInfoDto>> event) {
            updateAefMapButtons();
        }
    });
    detailsTable.setWidget(row, 0, ecfsDisclosure);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);

    row++;
    label = new Label(Utils.constants.defaultUserVerifier());
    Renderer<UserVerifierDto> userVerifierRenderer = new Renderer<UserVerifierDto>() {
        @Override
        public String render(UserVerifierDto object) {
            if (object != null) {
                return object.getName();
            } else {
                return "";
            }
        }

        @Override
        public void render(UserVerifierDto object, Appendable appendable) throws IOException {
            appendable.append(render(object));
        }
    };
    defaultUserVerifier = new ValueListBox<>(userVerifierRenderer);
    defaultUserVerifier.addValueChangeHandler(new ValueChangeHandler<UserVerifierDto>() {
        @Override
        public void onValueChange(ValueChangeEvent<UserVerifierDto> event) {
            fireChanged();
        }
    });
    detailsTable.setWidget(row, 0, label);
    detailsTable.setWidget(row, 1, defaultUserVerifier);
}