Example usage for com.vaadin.ui GridLayout setWidth

List of usage examples for com.vaadin.ui GridLayout setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui GridLayout setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:org.ikasan.dashboard.ui.topology.window.ErrorOccurrenceViewWindow.java

License:BSD License

protected Panel createErrorOccurrenceDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();

    GridLayout layout = new GridLayout(2, 6);
    layout.setSizeFull();//from w w w  . ja  v a 2 s  . c o  m
    layout.setSpacing(true);
    layout.setColumnExpandRatio(0, 0.25f);
    layout.setColumnExpandRatio(1, 0.75f);

    Label errorOccurrenceDetailsLabel = new Label("Error Occurence Details");
    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(errorOccurrenceDetailsLabel);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.errorOccurrence.getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.errorOccurrence.getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Component Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.errorOccurrence.getFlowElementName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.errorOccurrence.getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    label = new Label("Error Message:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 5);
    layout.setComponentAlignment(label, Alignment.TOP_RIGHT);

    TextArea tf5 = new TextArea();
    tf5.setValue(this.errorOccurrence.getErrorMessage());
    tf5.setReadOnly(true);
    tf5.setWidth("80%");
    tf5.setRows(3);
    layout.addComponent(tf5, 1, 5);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    AceEditor editor = new AceEditor();
    //      editor.setCaption("Error Details");
    editor.setValue(this.errorOccurrence.getErrorDetail());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setHeight(470, Unit.PIXELS);
    editor.setWidth("100%");

    AceEditor eventEditor = new AceEditor();
    //      eventEditor.setCaption("Event Payload");

    if (this.errorOccurrence.getEvent() != null) {
        eventEditor.setValue(new String((byte[]) this.errorOccurrence.getEvent()));
    }

    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setHeight(470, Unit.PIXELS);
    eventEditor.setWidth("100%");

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(230, Unit.PIXELS);
    formLayout.addComponent(layout);
    wrapperLayout.addComponent(formLayout, 0, 0);

    //      VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    //      vSplitPanel.setWidth("100%");
    //      vSplitPanel.setHeight(800, Unit.PIXELS);
    //      vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditor);
    //      vSplitPanel.setFirstComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(editor);
    //      vSplitPanel.setSecondComponent(h2);

    tabsheet.addTab(h2, "Error Details");
    tabsheet.addTab(h1, "Event Payload");

    wrapperLayout.addComponent(tabsheet, 0, 1);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.ikasan.dashboard.ui.topology.window.ExclusionEventViewWindow.java

License:BSD License

protected Panel createExclusionEventDetailsPanel() {
    Panel exclusionEventDetailsPanel = new Panel();
    exclusionEventDetailsPanel.setSizeFull();
    exclusionEventDetailsPanel.setStyleName("dashboard");

    GridLayout layout = new GridLayout(4, 7);
    layout.setSpacing(true);//www.  ja v  a2s.co m
    layout.setColumnExpandRatio(0, .10f);
    layout.setColumnExpandRatio(1, .30f);
    layout.setColumnExpandRatio(2, .05f);
    layout.setColumnExpandRatio(3, .30f);

    layout.setWidth("100%");

    Label exclusionEvenDetailsLabel = new Label("Exclusion Event Details");
    exclusionEvenDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(exclusionEvenDetailsLabel, 0, 0, 3, 0);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.exclusionEvent.getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.exclusionEvent.getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Event Id:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.errorOccurrence.getEventLifeIdentifier());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.exclusionEvent.getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    label = new Label("Error URI:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 5);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf5 = new TextField();
    tf5.setValue(exclusionEvent.getErrorUri());
    tf5.setReadOnly(true);
    tf5.setWidth("80%");
    layout.addComponent(tf5, 1, 5);

    label = new Label("Action:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    final TextField tf6 = new TextField();
    if (this.action != null) {
        tf6.setValue(action.getAction());
    }
    tf6.setReadOnly(true);
    tf6.setWidth("80%");
    layout.addComponent(tf6, 3, 1);

    label = new Label("Actioned By:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    final TextField tf7 = new TextField();
    if (this.action != null) {
        tf7.setValue(action.getActionedBy());
    }
    tf7.setReadOnly(true);
    tf7.setWidth("80%");
    layout.addComponent(tf7, 3, 2);

    label = new Label("Actioned Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    final TextField tf8 = new TextField();
    if (this.action != null) {
        tf8.setValue(new Date(action.getTimestamp()).toString());
    }
    tf8.setReadOnly(true);
    tf8.setWidth("80%");
    layout.addComponent(tf8, 3, 3);

    final Button resubmitButton = new Button("Re-submit");
    final Button ignoreButton = new Button("Ignore");

    resubmitButton.addClickListener(new Button.ClickListener() {
        @SuppressWarnings("unchecked")
        public void buttonClick(ClickEvent event) {
            IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest()
                    .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER);

            HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic(authentication.getName(),
                    (String) authentication.getCredentials());

            ClientConfig clientConfig = new ClientConfig();
            clientConfig.register(feature);

            Client client = ClientBuilder.newClient(clientConfig);

            Module module = topologyService.getModuleByName(exclusionEvent.getModuleName());

            if (module == null) {
                Notification
                        .show("Unable to find server information for module we are attempting to re-submit to: "
                                + exclusionEvent.getModuleName(), Type.ERROR_MESSAGE);

                return;
            }

            Server server = module.getServer();

            String url = "http://" + server.getUrl() + ":" + server.getPort() + module.getContextRoot()
                    + "/rest/resubmission/resubmit/" + exclusionEvent.getModuleName() + "/"
                    + exclusionEvent.getFlowName() + "/" + exclusionEvent.getErrorUri();

            logger.info("Resubmission Url: " + url);

            WebTarget webTarget = client.target(url);
            Response response = webTarget.request()
                    .put(Entity.entity(exclusionEvent.getEvent(), MediaType.APPLICATION_OCTET_STREAM));

            if (response.getStatus() != 200) {
                response.bufferEntity();

                String responseMessage = response.readEntity(String.class);
                Notification.show("An error was received trying to resubmit event: " + responseMessage,
                        Type.ERROR_MESSAGE);
            } else {
                Notification.show("Event resumitted successfully.");
                resubmitButton.setVisible(false);
                ignoreButton.setVisible(false);

                ExclusionEventAction action = hospitalManagementService
                        .getExclusionEventActionByErrorUri(exclusionEvent.getErrorUri());
                tf6.setReadOnly(false);
                tf7.setReadOnly(false);
                tf8.setReadOnly(false);
                tf6.setValue(action.getAction());
                tf7.setValue(action.getActionedBy());
                tf8.setValue(new Date(action.getTimestamp()).toString());
                tf6.setReadOnly(true);
                tf7.setReadOnly(true);
                tf8.setReadOnly(true);
            }
        }
    });

    ignoreButton.addClickListener(new Button.ClickListener() {
        @SuppressWarnings("unchecked")
        public void buttonClick(ClickEvent event) {
            IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest()
                    .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER);

            HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic(authentication.getName(),
                    (String) authentication.getCredentials());

            ClientConfig clientConfig = new ClientConfig();
            clientConfig.register(feature);

            Client client = ClientBuilder.newClient(clientConfig);

            Module module = topologyService.getModuleByName(exclusionEvent.getModuleName());

            if (module == null) {
                Notification
                        .show("Unable to find server information for module we are submitting the ignore to: "
                                + exclusionEvent.getModuleName(), Type.ERROR_MESSAGE);

                return;
            }

            Server server = module.getServer();

            String url = "http://" + server.getUrl() + ":" + server.getPort() + module.getContextRoot()
                    + "/rest/resubmission/ignore/" + exclusionEvent.getModuleName() + "/"
                    + exclusionEvent.getFlowName() + "/" + exclusionEvent.getErrorUri();

            logger.info("Ignore Url: " + url);

            WebTarget webTarget = client.target(url);
            Response response = webTarget.request()
                    .put(Entity.entity(exclusionEvent.getEvent(), MediaType.APPLICATION_OCTET_STREAM));

            if (response.getStatus() != 200) {
                response.bufferEntity();

                String responseMessage = response.readEntity(String.class);
                Notification.show("An error was received trying to resubmit event: " + responseMessage,
                        Type.ERROR_MESSAGE);
            } else {
                Notification.show("Event ignored successfully.");
                resubmitButton.setVisible(false);
                ignoreButton.setVisible(false);

                ExclusionEventAction action = hospitalManagementService
                        .getExclusionEventActionByErrorUri(exclusionEvent.getErrorUri());
                tf6.setReadOnly(false);
                tf7.setReadOnly(false);
                tf8.setReadOnly(false);
                tf6.setValue(action.getAction());
                tf7.setValue(action.getActionedBy());
                tf8.setValue(new Date(action.getTimestamp()).toString());
                tf6.setReadOnly(true);
                tf7.setReadOnly(true);
                tf8.setReadOnly(true);
            }
        }
    });

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setHeight("100%");
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth(200, Unit.PIXELS);
    buttonLayout.setMargin(true);
    buttonLayout.addComponent(resubmitButton);
    buttonLayout.addComponent(ignoreButton);

    if (this.action == null) {
        layout.addComponent(buttonLayout, 0, 6, 3, 6);
        layout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);
    }

    final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest()
            .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER);

    if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            && !authentication.hasGrantedAuthority(SecurityConstants.ACTION_EXCLUSIONS_AUTHORITY))) {
        resubmitButton.setVisible(false);
        ignoreButton.setVisible(false);
    }

    AceEditor eventEditor = new AceEditor();
    eventEditor.setCaption("Event Payload");
    logger.info("Setting exclusion event to: " + new String(this.exclusionEvent.getEvent()));
    Object event = this.serialiserFactory.getDefaultSerialiser().deserialise(this.exclusionEvent.getEvent());
    eventEditor.setValue(event.toString());
    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setWidth("100%");
    eventEditor.setHeight(600, Unit.PIXELS);

    HorizontalLayout eventEditorLayout = new HorizontalLayout();
    eventEditorLayout.setSizeFull();
    eventEditorLayout.setMargin(true);
    eventEditorLayout.addComponent(eventEditor);

    AceEditor errorEditor = new AceEditor();
    errorEditor.setCaption("Error Details");
    errorEditor.setValue(this.errorOccurrence.getErrorDetail());
    errorEditor.setReadOnly(true);
    errorEditor.setMode(AceMode.xml);
    errorEditor.setTheme(AceTheme.eclipse);
    errorEditor.setWidth("100%");
    errorEditor.setHeight(600, Unit.PIXELS);

    HorizontalLayout errorEditorLayout = new HorizontalLayout();
    errorEditorLayout.setSizeFull();
    errorEditorLayout.setMargin(true);
    errorEditorLayout.addComponent(errorEditor);

    VerticalSplitPanel splitPanel = new VerticalSplitPanel();
    splitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);
    splitPanel.setWidth("100%");
    splitPanel.setHeight(800, Unit.PIXELS);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditorLayout);
    splitPanel.setFirstComponent(eventEditorLayout);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(errorEditorLayout);
    splitPanel.setSecondComponent(errorEditorLayout);

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(240, Unit.PIXELS);
    formLayout.addComponent(layout);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");
    wrapperLayout.addComponent(formLayout);
    wrapperLayout.addComponent(splitPanel);

    exclusionEventDetailsPanel.setContent(wrapperLayout);
    return exclusionEventDetailsPanel;
}

From source file:org.ikasan.dashboard.ui.topology.window.NewBusinessStreamWindow.java

License:BSD License

public void init() {
    this.setModal(true);
    this.setResizable(false);

    GridLayout gridLayout = new GridLayout(2, 4);
    gridLayout.setWidth("480px");
    gridLayout.setColumnExpandRatio(0, .15f);
    gridLayout.setColumnExpandRatio(1, .85f);

    gridLayout.setSpacing(true);/*ww  w .  ja va 2 s  .  c  o m*/
    gridLayout.setMargin(true);

    Label newBusinessStreamLabel = new Label("New Business Steam");
    Label nameLabel = new Label("Name:");
    newBusinessStreamLabel.addStyleName(ValoTheme.LABEL_HUGE);

    gridLayout.addComponent(newBusinessStreamLabel, 0, 0, 1, 0);

    nameLabel.setSizeUndefined();
    this.roleName = new TextField();
    this.roleName.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.roleName.setWidth("90%");

    gridLayout.addComponent(nameLabel, 0, 1);
    gridLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(roleName, 1, 1);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    this.roleDescription = new TextArea();
    this.roleDescription
            .addValidator(new StringLengthValidator("A description must be entered.", 1, null, false));
    this.roleDescription.setWidth("90%");
    this.roleDescription.setRows(4);

    this.roleName.setValidationVisible(false);
    this.roleDescription.setValidationVisible(false);

    gridLayout.addComponent(descriptionLabel, 0, 2);
    gridLayout.setComponentAlignment(descriptionLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(roleDescription, 1, 2);

    Button createButton = new Button("Create");
    Button cancelButton = new Button("Cancel");

    GridLayout buttonLayout = new GridLayout(2, 1);
    buttonLayout.setSpacing(true);

    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

    gridLayout.addComponent(buttonLayout, 0, 3, 1, 3);
    gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    BeanItem<BusinessStream> policyItem = new BeanItem<BusinessStream>(this.businessStream);

    roleName.setPropertyDataSource(policyItem.getItemProperty("name"));
    roleDescription.setPropertyDataSource(policyItem.getItemProperty("description"));
    this.businessStream.setFlows(new HashSet<BusinessStreamFlow>());

    createButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                NewBusinessStreamWindow.this.roleName.validate();
                NewBusinessStreamWindow.this.roleDescription.validate();
            } catch (InvalidValueException e) {
                NewBusinessStreamWindow.this.roleName.setValidationVisible(true);
                NewBusinessStreamWindow.this.roleDescription.setValidationVisible(true);

                return;
            }

            NewBusinessStreamWindow.this.roleName.setValidationVisible(false);
            NewBusinessStreamWindow.this.roleDescription.setValidationVisible(false);

            UI.getCurrent().removeWindow(NewBusinessStreamWindow.this);
        }
    });

    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(NewBusinessStreamWindow.this);
        }
    });

    this.setContent(gridLayout);
}

From source file:org.ikasan.dashboard.ui.topology.window.NewServerWindow.java

License:BSD License

public void init() {
    this.setModal(true);
    this.setResizable(false);

    GridLayout gridLayout = new GridLayout(2, 6);
    gridLayout.setWidth("480px");
    gridLayout.setColumnExpandRatio(0, .15f);
    gridLayout.setColumnExpandRatio(1, .85f);

    gridLayout.setSpacing(true);//from   w  w  w .j  ava 2 s.c om
    gridLayout.setMargin(true);

    Label newBusinessStreamLabel = new Label("New Server");
    newBusinessStreamLabel.addStyleName(ValoTheme.LABEL_HUGE);

    gridLayout.addComponent(newBusinessStreamLabel, 0, 0, 1, 0);

    Label nameLabel = new Label("Name:");
    nameLabel.setSizeUndefined();
    this.name = new TextField();
    this.name.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.name.setWidth("90%");

    gridLayout.addComponent(nameLabel, 0, 1);
    gridLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(name, 1, 1);

    Label urlLabel = new Label("URL:");
    urlLabel.setSizeUndefined();
    this.url = new TextField();
    this.url.addValidator(new StringLengthValidator("A url must be entered.", 1, null, false));
    this.url.setWidth("90%");

    gridLayout.addComponent(urlLabel, 0, 2);
    gridLayout.setComponentAlignment(urlLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(url, 1, 2);

    Label portLabel = new Label("Port Number:");
    portLabel.setSizeUndefined();
    this.port = new TextField();
    this.port.addValidator(new IntegerValidator("A port number and must be a valid number."));
    this.port.setWidth("45%");

    StringToIntegerConverter plainIntegerConverter = new StringToIntegerConverter() {
        protected java.text.NumberFormat getFormat(Locale locale) {
            NumberFormat format = super.getFormat(locale);
            format.setGroupingUsed(false);
            return format;
        };
    };
    // either set for the field or in your field factory for multiple fields
    this.port.setConverter(plainIntegerConverter);

    gridLayout.addComponent(portLabel, 0, 3);
    gridLayout.setComponentAlignment(portLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(port, 1, 3);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    this.description = new TextArea();
    this.description.addValidator(new StringLengthValidator("A description must be entered.", 1, null, false));
    this.description.setWidth("90%");
    this.description.setRows(4);

    this.name.setValidationVisible(false);
    this.description.setValidationVisible(false);
    this.url.setValidationVisible(false);
    this.port.setValidationVisible(false);

    gridLayout.addComponent(descriptionLabel, 0, 4);
    gridLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    gridLayout.addComponent(description, 1, 4);

    Button createButton = new Button("Create");
    Button cancelButton = new Button("Cancel");

    GridLayout buttonLayout = new GridLayout(2, 1);
    buttonLayout.setSpacing(true);

    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

    gridLayout.addComponent(buttonLayout, 0, 5, 1, 5);
    gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    BeanItem<Server> policyItem = new BeanItem<Server>(this.server);

    name.setPropertyDataSource(policyItem.getItemProperty("name"));
    description.setPropertyDataSource(policyItem.getItemProperty("description"));
    url.setPropertyDataSource(policyItem.getItemProperty("url"));
    port.setPropertyDataSource(policyItem.getItemProperty("port"));

    createButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                NewServerWindow.this.name.validate();
                NewServerWindow.this.description.validate();
                NewServerWindow.this.url.validate();
                NewServerWindow.this.port.validate();
            } catch (InvalidValueException e) {
                NewServerWindow.this.name.setValidationVisible(true);
                NewServerWindow.this.description.setValidationVisible(true);
                NewServerWindow.this.url.setValidationVisible(true);
                NewServerWindow.this.port.setValidationVisible(true);

                return;
            }

            NewServerWindow.this.name.setValidationVisible(false);
            NewServerWindow.this.description.setValidationVisible(false);
            NewServerWindow.this.url.setValidationVisible(false);
            NewServerWindow.this.port.setValidationVisible(false);

            topologyService.save(server);

            Notification.show("New Server Created!");

            UI.getCurrent().removeWindow(NewServerWindow.this);
        }
    });

    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(NewServerWindow.this);
        }
    });

    this.setContent(gridLayout);
}

From source file:org.ikasan.dashboard.ui.topology.window.ServerWindow.java

License:BSD License

public void init() {
    this.setModal(true);
    this.setResizable(false);

    GridLayout gridLayout = new GridLayout(2, 7);
    gridLayout.setWidth("480px");
    gridLayout.setColumnExpandRatio(0, .15f);
    gridLayout.setColumnExpandRatio(1, .85f);

    gridLayout.setSpacing(true);/*from   ww w .j a  v  a  2s  . com*/
    gridLayout.setMargin(true);

    Label newBusinessStreamLabel = new Label("Server");
    newBusinessStreamLabel.addStyleName(ValoTheme.LABEL_HUGE);

    gridLayout.addComponent(newBusinessStreamLabel, 0, 0, 1, 0);

    Label nameLabel = new Label("Name:");
    nameLabel.setSizeUndefined();
    this.name = new TextField();
    this.name.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.name.setWidth("90%");

    gridLayout.addComponent(nameLabel, 0, 1);
    gridLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(name, 1, 1);

    Label urlLabel = new Label("URL:");
    urlLabel.setSizeUndefined();
    this.url = new TextField();
    this.url.addValidator(new StringLengthValidator("A url must be entered.", 1, null, false));
    this.url.setWidth("90%");

    gridLayout.addComponent(urlLabel, 0, 3);
    gridLayout.setComponentAlignment(urlLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(url, 1, 3);

    Label portLabel = new Label("Port Number:");
    portLabel.setSizeUndefined();
    this.port = new TextField();
    this.port.addValidator(new IntegerValidator("A port number and must be a valid number."));
    this.port.setWidth("45%");

    StringToIntegerConverter plainIntegerConverter = new StringToIntegerConverter() {
        protected java.text.NumberFormat getFormat(Locale locale) {
            NumberFormat format = super.getFormat(locale);
            format.setGroupingUsed(false);
            return format;
        };
    };
    // either set for the field or in your field factory for multiple fields
    this.port.setConverter(plainIntegerConverter);

    gridLayout.addComponent(portLabel, 0, 4);
    gridLayout.setComponentAlignment(portLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(port, 1, 4);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    this.description = new TextArea();
    this.description.addValidator(new StringLengthValidator("A description must be entered.", 1, null, false));
    this.description.setWidth("90%");
    this.description.setRows(4);

    this.name.setValidationVisible(false);
    this.description.setValidationVisible(false);
    this.url.setValidationVisible(false);
    this.port.setValidationVisible(false);

    gridLayout.addComponent(descriptionLabel, 0, 5);
    gridLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    gridLayout.addComponent(description, 1, 5);

    Button saveButton = new Button("Save");
    Button cancelButton = new Button("Cancel");

    GridLayout buttonLayout = new GridLayout(2, 1);
    buttonLayout.setSpacing(true);

    buttonLayout.addComponent(saveButton);
    buttonLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

    gridLayout.addComponent(buttonLayout, 0, 6, 1, 6);
    gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    BeanItem<Server> serverItem = new BeanItem<Server>(this.server);

    name.setPropertyDataSource(serverItem.getItemProperty("name"));
    description.setPropertyDataSource(serverItem.getItemProperty("description"));
    url.setPropertyDataSource(serverItem.getItemProperty("url"));
    this.port.setPropertyDataSource(serverItem.getItemProperty("port"));

    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                ServerWindow.this.name.validate();
                ServerWindow.this.description.validate();
                ServerWindow.this.url.validate();
                ServerWindow.this.port.validate();
            } catch (InvalidValueException e) {
                ServerWindow.this.name.setValidationVisible(true);
                ServerWindow.this.description.setValidationVisible(true);
                ServerWindow.this.url.setValidationVisible(true);
                ServerWindow.this.port.setValidationVisible(true);

                return;
            }

            ServerWindow.this.name.setValidationVisible(false);
            ServerWindow.this.description.setValidationVisible(false);
            ServerWindow.this.url.setValidationVisible(false);
            ServerWindow.this.port.setValidationVisible(false);

            topologyService.save(server);

            Notification.show("New Server Created!");

            UI.getCurrent().removeWindow(ServerWindow.this);
        }
    });

    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(ServerWindow.this);
        }
    });

    this.setContent(gridLayout);
}

From source file:org.ikasan.dashboard.ui.topology.window.StartupControlConfigurationWindow.java

License:BSD License

/**
  * Helper method to initialise this object.
  * /* ww w.  j  ava 2s. co  m*/
  * @param message
  */
protected void init() {
    setModal(true);
    setResizable(false);
    setHeight("320px");
    setWidth("550px");

    GridLayout gridLayout = new GridLayout(2, 6);
    gridLayout.setWidth("500px");
    gridLayout.setColumnExpandRatio(0, .15f);
    gridLayout.setColumnExpandRatio(1, .85f);

    gridLayout.setSpacing(true);
    gridLayout.setMargin(true);

    Label startupControlLabel = new Label("Startup Control");
    startupControlLabel.addStyleName(ValoTheme.LABEL_HUGE);

    gridLayout.addComponent(startupControlLabel, 0, 0, 1, 0);

    Label moduleNameLabel = new Label();
    moduleNameLabel.setContentMode(ContentMode.HTML);
    moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:");
    moduleNameLabel.setSizeUndefined();
    gridLayout.addComponent(moduleNameLabel, 0, 1);
    gridLayout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT);

    startupControl = this.startupControlService.getStartupControl(flow.getModule().getName(), flow.getName());

    startupControlItem = new BeanItem<StartupControl>(startupControl);

    moduleNameTextField = new TextField();
    moduleNameTextField.setRequired(true);
    moduleNameTextField.setPropertyDataSource(startupControlItem.getItemProperty("moduleName"));
    moduleNameTextField.setReadOnly(true);
    moduleNameTextField.setWidth("90%");
    gridLayout.addComponent(moduleNameTextField, 1, 1);

    Label flowNameLabel = new Label();
    flowNameLabel.setContentMode(ContentMode.HTML);
    flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:");
    flowNameLabel.setSizeUndefined();
    gridLayout.addComponent(flowNameLabel, 0, 2);
    gridLayout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT);

    flowNameTextField = new TextField();
    flowNameTextField.setRequired(true);
    flowNameTextField.setPropertyDataSource(startupControlItem.getItemProperty("flowName"));
    flowNameTextField.setReadOnly(true);
    flowNameTextField.setWidth("90%");
    gridLayout.addComponent(flowNameTextField, 1, 2);

    Label startupTypeLabel = new Label("Startup Type:");
    startupTypeLabel.setSizeUndefined();
    this.startupType = new ComboBox();
    this.startupType.addItem(StartupType.MANUAL);
    this.startupType.setItemCaption(StartupType.MANUAL, "Manual");
    this.startupType.addItem(StartupType.AUTOMATIC);
    this.startupType.setItemCaption(StartupType.AUTOMATIC, "Automatic");
    this.startupType.addItem(StartupType.DISABLED);
    this.startupType.setItemCaption(StartupType.DISABLED, "Disabled");
    this.startupType.setPropertyDataSource(startupControlItem.getItemProperty("startupType"));
    this.startupType.setNullSelectionAllowed(false);

    this.startupType.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.startupType.setWidth("90%");
    this.startupType.setValidationVisible(false);

    gridLayout.addComponent(startupTypeLabel, 0, 3);
    gridLayout.setComponentAlignment(startupTypeLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.startupType, 1, 3);

    Label commentLabel = new Label("Comment:");
    commentLabel.setSizeUndefined();
    this.comment = new TextArea();
    this.comment.setRows(3);
    this.comment.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.comment.setWidth("90%");
    this.comment.setValidationVisible(false);
    this.comment.setNullRepresentation("");
    this.comment.setPropertyDataSource(startupControlItem.getItemProperty("comment"));

    gridLayout.addComponent(commentLabel, 0, 4);
    gridLayout.setComponentAlignment(commentLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.comment, 1, 4);

    Button saveButton = new Button("Save");
    Button cancelButton = new Button("Cancel");

    GridLayout buttonLayout = new GridLayout(2, 1);
    buttonLayout.setSpacing(true);

    buttonLayout.addComponent(saveButton);
    buttonLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

    gridLayout.addComponent(buttonLayout, 0, 5, 1, 5);
    gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            StartupControl sc = startupControlItem.getBean();

            if (((StartupType) startupType.getValue()) == StartupType.DISABLED
                    && (comment.getValue() == null || comment.getValue().length() == 0)) {
                Notification.show("A comment must be entered for a 'Disabled' start up type!",
                        Type.ERROR_MESSAGE);

                return;
            } else {
                final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService
                        .getCurrentRequest().getWrappedSession()
                        .getAttribute(DashboardSessionValueConstants.USER);

                StartupControlConfigurationWindow.this.startupControlService.setStartupType(sc.getModuleName(),
                        sc.getFlowName(), (StartupType) startupType.getValue(), comment.getValue(),
                        authentication.getName());

                Notification.show("Saved!");
            }
        }
    });

    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(StartupControlConfigurationWindow.this);
        }
    });

    this.setContent(gridLayout);
}

From source file:org.ikasan.dashboard.ui.topology.window.WiretapPayloadViewWindow.java

License:BSD License

protected Panel createWiretapDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();
    errorOccurrenceDetailsPanel.setSizeFull();
    errorOccurrenceDetailsPanel.setStyleName("dashboard");

    GridLayout layout = new GridLayout(2, 6);
    layout.setSizeFull();/*from w  w w  .java2 s .c  o  m*/
    layout.setSpacing(true);
    layout.setColumnExpandRatio(0, 0.2f);
    layout.setColumnExpandRatio(1, 0.8f);

    Label wiretapDetailsLabel = new Label("Wiretap Details");
    wiretapDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(wiretapDetailsLabel);

    Label moduleNameLabel = new Label("Module Name:");
    moduleNameLabel.setSizeUndefined();

    layout.addComponent(moduleNameLabel, 0, 1);
    layout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT);

    TextField moduleName = new TextField();
    moduleName.setValue(this.wiretapEvent.getModuleName());
    moduleName.setReadOnly(true);
    moduleName.setWidth("80%");
    layout.addComponent(moduleName, 1, 1);

    Label flowNameLabel = new Label("Flow Name:");
    flowNameLabel.setSizeUndefined();

    layout.addComponent(flowNameLabel, 0, 2);
    layout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.wiretapEvent.getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    Label componentNameLabel = new Label("Component Name:");
    componentNameLabel.setSizeUndefined();

    layout.addComponent(componentNameLabel, 0, 3);
    layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.wiretapEvent.getComponentName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    Label dateTimeLabel = new Label("Date/Time:");
    dateTimeLabel.setSizeUndefined();

    layout.addComponent(dateTimeLabel, 0, 4);
    layout.setComponentAlignment(dateTimeLabel, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.wiretapEvent.getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    Label eventIdLabel = new Label("Event Id:");
    eventIdLabel.setSizeUndefined();

    layout.addComponent(eventIdLabel, 0, 5);
    layout.setComponentAlignment(eventIdLabel, Alignment.MIDDLE_RIGHT);

    TextField tf5 = new TextField();
    tf5.setValue(((WiretapFlowEvent) wiretapEvent).getEventId());
    tf5.setReadOnly(true);
    tf5.setWidth("80%");
    layout.addComponent(tf5, 1, 5);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setWidth("100%");
    //      wrapperLayout.setMargin(true);
    //      wrapperLayout.setSizeFull();

    AceEditor editor = new AceEditor();
    editor.setCaption("Event");
    editor.setValue(this.wiretapEvent.getEvent());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setWidth("100%");
    editor.setHeight(550, Unit.PIXELS);

    //      HorizontalLayout formLayout = new HorizontalLayout();
    //      formLayout.setWidth("100%");
    //      formLayout.setHeight(120, Unit.PIXELS);
    //      formLayout.addComponent(layout);
    wrapperLayout.addComponent(layout, 0, 0);
    wrapperLayout.addComponent(editor, 0, 2);
    wrapperLayout.setComponentAlignment(editor, Alignment.TOP_LEFT);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.lunifera.examples.runtime.web.vaadin.databinding.DatabindingDemoUI.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    VaadinObservables.getRealm(getUI());
    dbc = new DataBindingContext();

    GridLayout layout = new GridLayout(3, 4);
    layout.setStyleName(Reindeer.LAYOUT_BLUE);
    layout.setWidth("100%");
    layout.setMargin(true);// w w  w  . j  av a 2 s.com
    setContent(layout);

    row1(layout);
    row2(layout);
    row3(layout);
    row4(layout);
}

From source file:org.opennms.features.topology.netutils.internal.TracerouteWindow.java

License:Open Source License

/**
 * The TracerouteWindow method constructs a TracerouteWindow component with a size proportionate to the 
 * width and height of the main window./*from  w w  w  .  j  a v a2  s .com*/
 * @param node 
 * @param width Width of Main window
 * @param height Height of Main window
 */
public TracerouteWindow(final Node node, final String url) {

    this.tracerouteUrl = url;

    String label = "";
    String ipAddress = "";
    if (node != null) {
        label = node.getLabel();
        ipAddress = node.getIPAddress();
    }
    String caption = "";
    /*Sets up window settings*/
    if (label == null || label.equals("") || label.equalsIgnoreCase(noLabel)) {
        label = "";
    }
    if (!label.equals(""))
        caption = " - " + label;
    setCaption("Traceroute" + caption);
    setImmediate(true);
    setResizable(false);

    /*Initialize the header of the Sub-window with the name of the selected Node*/
    String nodeName = "<div style=\"text-align: center; font-size: 18pt; font-weight:bold;\">" + label
            + "</div>";
    nodeLabel = new Label(nodeName);
    nodeLabel.setContentMode(ContentMode.HTML);

    /*Creating various layouts to encapsulate all of the components*/
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    vSplit = new VerticalSplitPanel();
    topLayout = new VerticalLayout();
    bottomLayout = new VerticalLayout();
    VerticalLayout form = new VerticalLayout();
    GridLayout grid = new GridLayout(2, 2);
    grid.setWidth("420");
    grid.setHeight("62");

    /*Sets up IP Address dropdown with the Name as default*/
    ipDropdown = new NativeSelect();
    ipDropdown.addItem(ipAddress);
    ipDropdown.select(ipAddress);

    /*Creates the Numerical Output Check box and sets up the listener*/
    numericalDataCheckBox = new CheckBox("Use Numerical Node Names");
    numericalDataCheckBox.setImmediate(true);
    numericalDataCheckBox.setValue(false);

    /*Creates the form labels and text fields*/
    Label ipLabel = new Label("IP Address: ");
    Label forcedHopLabel = new Label("Forced Hop IP: ");
    forcedHopField = new TextField();
    forcedHopField.setMaxLength(15);

    /*Add all of the components to the GridLayout*/
    grid.addComponent(ipLabel);
    grid.setComponentAlignment(ipLabel, Alignment.MIDDLE_LEFT);
    grid.addComponent(ipDropdown);
    grid.setComponentAlignment(ipDropdown, Alignment.MIDDLE_LEFT);
    grid.addComponent(forcedHopLabel);
    grid.setComponentAlignment(forcedHopLabel, Alignment.MIDDLE_LEFT);
    grid.addComponent(forcedHopField);
    grid.setComponentAlignment(forcedHopField, Alignment.MIDDLE_LEFT);

    /*Creates the Ping button and sets up the listener*/
    tracerouteButton = new Button("Traceroute");
    tracerouteButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            changeBrowserURL(buildURL());
        }
    });

    /*Adds components to the form and sets the width and spacing*/
    form.addComponent(grid);
    form.addComponent(numericalDataCheckBox);
    form.addComponent(tracerouteButton);
    form.setWidth("100%");
    form.setSpacing(true);

    /*Adds components to the Top Layout and sets the width and margins*/
    topLayout.addComponent(nodeLabel);
    topLayout.setComponentAlignment(nodeLabel, Alignment.MIDDLE_CENTER);
    topLayout.addComponent(form);
    topLayout.setSizeFull();
    topLayout.setMargin(new MarginInfo(true, true, false, true));

    /*Adds components to the Bottom Layout and sets the width and margins*/
    bottomLayout.setSizeFull();
    bottomLayout.setMargin(true);
    bottomLayout.setImmediate(true);

    buildEmbeddedBrowser();

    /*Setting first and second components for the split panel and setting the panel divider position*/
    vSplit.setFirstComponent(topLayout);
    vSplit.setSecondComponent(bottomLayout);
    vSplit.setSplitPosition(splitHeight, Unit.PIXELS);
    vSplit.setLocked(true);

    /*Adds split panel to the main layout and expands the split panel to 100% of the layout space*/
    mainLayout.addComponent(vSplit);
    mainLayout.setExpandRatio(vSplit, 1);

    setContent(mainLayout);
}

From source file:org.vaadin.johannesh.jfokus2012.touchkit.view.ShowContactView.java

License:Open Source License

private void buildLayout() {
    layout = new CssLayout();
    layout.addStyleName("show-contact-view");
    layout.setWidth("100%");

    VerticalComponentGroup infoGroup = new VerticalComponentGroup("");
    infoGroup.setWidth("100%");

    Component label;//from www. ja va2 s .c om
    Property p;

    p = item.getItemProperty(ContactUtils.PROPERTY_COMPANY);
    label = new Label(new ContactUtils.CompanyPropertyFormatter(p));
    label.setCaption(ContactUtils.formatFieldCaption(ContactUtils.PROPERTY_COMPANY));
    infoGroup.addComponent(label);

    p = item.getItemProperty(ContactUtils.PROPERTY_MOBILE);
    label = new Label(p);
    label.setCaption(ContactUtils.formatFieldCaption(ContactUtils.PROPERTY_MOBILE));
    infoGroup.addComponent(label);

    p = item.getItemProperty(ContactUtils.PROPERTY_EMAIL);
    label = new Label(p);
    label.setCaption(ContactUtils.formatFieldCaption(ContactUtils.PROPERTY_EMAIL));
    infoGroup.addComponent(label);

    Embedded picture = new Embedded("", new ThemeResource("icon/picture.png"));
    picture.setWidth("57px");
    picture.setHeight("57px");

    Label firstName = new Label(item.getItemProperty(ContactUtils.PROPERTY_FIRST_NAME));
    firstName.addStyleName("strong-name");

    Label lastName = new Label(item.getItemProperty(ContactUtils.PROPERTY_LAST_NAME));
    lastName.addStyleName("strong-name");

    GridLayout nameLayout = new GridLayout(2, 2);
    nameLayout.setWidth("100%");
    nameLayout.setSpacing(true);
    nameLayout.setMargin(true, true, false, true);
    nameLayout.setColumnExpandRatio(1, 1.0f);
    nameLayout.addComponent(picture, 0, 0, 0, 1);
    nameLayout.addComponent(firstName, 1, 0);
    nameLayout.addComponent(lastName, 1, 1);
    nameLayout.setComponentAlignment(firstName, Alignment.MIDDLE_LEFT);
    nameLayout.setComponentAlignment(lastName, Alignment.MIDDLE_LEFT);

    final Favourite favourite = new Favourite();
    favourite.setImmediate(true);
    favourite.setReadOnly(true);
    favourite.setIcon(new ThemeResource("icon/favourite.png"));
    favourite.setPropertyDataSource(item.getItemProperty(ContactUtils.PROPERTY_FAVOURITE));

    layout.addComponent(nameLayout);
    layout.addComponent(favourite);
    layout.addComponent(infoGroup);

    Button editButton = new Button("Edit");
    editButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getNavigationManager().navigateTo(new EditContactView(item));
        }
    });
    setRightComponent(editButton);
    setContent(layout);
}