Example usage for com.vaadin.ui Label setStyleName

List of usage examples for com.vaadin.ui Label setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Label setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

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);//from   www .  j  a  va 2  s .  c o 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.WiretapConfigurationWindow.java

License:BSD License

/**
  * Helper method to initialise this object.
  * /*from www  .  ja v a  2 s  .co  m*/
  * @param message
  */
protected void init() {
    setModal(true);
    setHeight("90%");
    setWidth("90%");

    GridLayout layout = new GridLayout(2, 10);
    layout.setSizeFull();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setColumnExpandRatio(0, .25f);
    layout.setColumnExpandRatio(1, .75f);

    Label wiretapLabel = new Label("Wiretap Configuration");
    wiretapLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(wiretapLabel);

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

    TextField moduleNameTextField = new TextField();
    moduleNameTextField.setRequired(true);
    moduleNameTextField.setValue(this.component.getFlow().getModule().getName());
    moduleNameTextField.setReadOnly(true);
    moduleNameTextField.setWidth("80%");
    layout.addComponent(moduleNameTextField, 1, 1);

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

    TextField flowNameTextField = new TextField();
    flowNameTextField.setRequired(true);
    flowNameTextField.setValue(this.component.getFlow().getName());
    flowNameTextField.setReadOnly(true);
    flowNameTextField.setWidth("80%");
    layout.addComponent(flowNameTextField, 1, 2);

    Label componentNameLabel = new Label();
    componentNameLabel.setContentMode(ContentMode.HTML);
    componentNameLabel.setValue(VaadinIcons.COG.getHtml() + " Component Name:");
    componentNameLabel.setSizeUndefined();
    layout.addComponent(componentNameLabel, 0, 3);
    layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT);

    TextField componentNameTextField = new TextField();
    componentNameTextField.setRequired(true);
    componentNameTextField.setValue(this.component.getName());
    componentNameTextField.setReadOnly(true);
    componentNameTextField.setWidth("80%");
    layout.addComponent(componentNameTextField, 1, 3);

    Label errorCategoryLabel = new Label("Relationship:");
    errorCategoryLabel.setSizeUndefined();
    layout.addComponent(errorCategoryLabel, 0, 4);
    layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_RIGHT);

    final ComboBox relationshipCombo = new ComboBox();
    //      relationshipCombo.addValidator(new StringLengthValidator(
    //               "An relationship must be selected!", 1, -1, false));
    relationshipCombo.setImmediate(false);
    relationshipCombo.setValidationVisible(false);
    relationshipCombo.setRequired(true);
    relationshipCombo.setRequiredError("A relationship must be selected!");
    relationshipCombo.setHeight("30px");
    relationshipCombo.setNullSelectionAllowed(false);
    layout.addComponent(relationshipCombo, 1, 4);
    relationshipCombo.addItem("before");
    relationshipCombo.setItemCaption("before", "Before");
    relationshipCombo.addItem("after");
    relationshipCombo.setItemCaption("after", "After");

    Label jobTypeLabel = new Label("Job Type:");
    jobTypeLabel.setSizeUndefined();
    layout.addComponent(jobTypeLabel, 0, 5);
    layout.setComponentAlignment(jobTypeLabel, Alignment.MIDDLE_RIGHT);

    final ComboBox jobTopCombo = new ComboBox();
    //      jobTopCombo.addValidator(new StringLengthValidator(
    //               "A job type must be selected!", 1, -1, false));
    jobTopCombo.setImmediate(false);
    jobTopCombo.setValidationVisible(false);
    jobTopCombo.setRequired(true);
    jobTopCombo.setRequiredError("A job type must be selected!");
    jobTopCombo.setHeight("30px");
    jobTopCombo.setNullSelectionAllowed(false);
    layout.addComponent(jobTopCombo, 1, 5);
    jobTopCombo.addItem("loggingJob");
    jobTopCombo.setItemCaption("loggingJob", "Logging Job");
    jobTopCombo.addItem("wiretapJob");
    jobTopCombo.setItemCaption("wiretapJob", "Wiretap Job");

    final Label timeToLiveLabel = new Label("Time to Live:");
    timeToLiveLabel.setSizeUndefined();
    timeToLiveLabel.setVisible(false);
    layout.addComponent(timeToLiveLabel, 0, 6);
    layout.setComponentAlignment(timeToLiveLabel, Alignment.MIDDLE_RIGHT);

    final TextField timeToLiveTextField = new TextField();
    timeToLiveTextField.setRequired(true);
    timeToLiveTextField.setValidationVisible(false);
    jobTopCombo.setRequiredError("A time to live value must be entered!");
    timeToLiveTextField.setVisible(false);
    timeToLiveTextField.setWidth("40%");
    layout.addComponent(timeToLiveTextField, 1, 6);

    jobTopCombo.addValueChangeListener(new ComboBox.ValueChangeListener() {

        /* (non-Javadoc)
         * @see com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data.Property.ValueChangeEvent)
         */
        @Override
        public void valueChange(ValueChangeEvent event) {
            String value = (String) event.getProperty().getValue();

            if (value.equals("wiretapJob")) {
                timeToLiveLabel.setVisible(true);
                timeToLiveTextField.setVisible(true);
            } else {
                timeToLiveLabel.setVisible(false);
                timeToLiveTextField.setVisible(false);
            }
        }

    });

    GridLayout buttonLayouts = new GridLayout(3, 1);
    buttonLayouts.setSpacing(true);

    Button saveButton = new Button("Save");
    saveButton.setStyleName(ValoTheme.BUTTON_SMALL);
    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                relationshipCombo.validate();
                jobTopCombo.validate();

                if (timeToLiveTextField.isVisible()) {
                    timeToLiveTextField.validate();
                }
            } catch (InvalidValueException e) {
                relationshipCombo.setValidationVisible(true);
                relationshipCombo.markAsDirty();
                jobTopCombo.setValidationVisible(true);
                jobTopCombo.markAsDirty();

                if (timeToLiveTextField.isVisible()) {
                    timeToLiveTextField.setValidationVisible(true);
                    timeToLiveTextField.markAsDirty();
                }

                Notification.show("There are errors on the wiretap creation form!", Type.ERROR_MESSAGE);
                return;
            }

            createWiretap((String) relationshipCombo.getValue(), (String) jobTopCombo.getValue(),
                    timeToLiveTextField.getValue());
        }
    });

    Button cancelButton = new Button("Cancel");
    cancelButton.setStyleName(ValoTheme.BUTTON_SMALL);
    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            close();
        }
    });

    buttonLayouts.addComponent(saveButton);
    buttonLayouts.addComponent(cancelButton);

    layout.addComponent(buttonLayouts, 0, 7, 1, 7);
    layout.setComponentAlignment(buttonLayouts, Alignment.MIDDLE_CENTER);

    Panel paramPanel = new Panel();
    paramPanel.setStyleName("dashboard");
    paramPanel.setWidth("100%");
    paramPanel.setContent(layout);

    triggerTable = new Table();

    Label existingWiretapLabel = new Label("Existing Wiretaps");
    existingWiretapLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(existingWiretapLabel, 0, 8, 1, 8);

    layout.addComponent(triggerTable, 0, 9, 1, 9);
    layout.setComponentAlignment(triggerTable, Alignment.TOP_CENTER);

    this.triggerTable.setWidth("80%");
    this.triggerTable.setHeight(150, Unit.PIXELS);
    this.triggerTable.setCellStyleGenerator(new IkasanCellStyleGenerator());
    this.triggerTable.addStyleName(ValoTheme.TABLE_SMALL);
    this.triggerTable.addStyleName("ikasan");
    this.triggerTable.addContainerProperty("Job Type", String.class, null);
    this.triggerTable.addContainerProperty("Relationship", String.class, null);
    this.triggerTable.addContainerProperty("Trigger Parameters", String.class, null);
    this.triggerTable.addContainerProperty("", Button.class, null);

    refreshTriggerTable();

    GridLayout wrapper = new GridLayout(1, 1);
    wrapper.setMargin(true);
    wrapper.setSizeFull();
    wrapper.addComponent(paramPanel);

    this.setContent(wrapper);
}

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  ww .  ja  v a 2  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.jdal.vaadin.ui.ListPane.java

License:Apache License

public MenuItem(ComponentHolder holder) {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);//from  w w w.j ava 2  s.  c o m
    setContent(layout);
    Embedded e = new Embedded("", holder.getIcon());
    layout.addComponent(e);
    Label l = new Label(holder.getName());
    l.setStyleName(Reindeer.LABEL_H2);
    layout.addComponent(l);
    layout.setComponentAlignment(l, Alignment.BOTTOM_LEFT);
    layout.setComponentAlignment(e, Alignment.BOTTOM_LEFT);
    setStyleName("menuItem");
    this.component = holder.getComponent();
}

From source file:org.jdal.vaadin.ui.table.VaadinPaginator.java

License:Apache License

/**
 * {@inheritDoc}/*from   w w w  .j  a  v  a  2 s .c  om*/
 */
@Override
protected Component buildPanel() {
    // buttons
    if (next == null) {
        setNext(createButton(nextIconUrl));
    }

    if (this.last == null) {
        setLast(createButton(lastIconUrl));
    }

    if (this.previous == null) {
        setPrevious(createButton(previousIconUrl));
    }

    if (this.first == null) {
        setFirst(createButton(firstIconUrl));
    }

    // goto page select
    Label goToLabel = new Label(messageSource.getMessage("vaadinPaginator.goto"));
    goToLabel.setSizeUndefined();
    goToLabel.setStyleName(PAGINATOR);
    goTo.addValueChangeListener(new GoToValueChangeListener());
    goTo.setImmediate(true);
    // records by page select
    Label showRecords = new Label(messageSource.getMessage("vaadinPaginator.pageSize"));
    showRecords.setSizeUndefined();
    // page size combo
    for (String size : pageSizes) {
        pgs.addItem(size);
    }

    pgs.setNullSelectionAllowed(false);
    pgs.setValue(String.valueOf(getModel().getPageSize()));
    pgs.setWidth("6em");
    pgs.setImmediate(true);

    pgs.addValueChangeListener(new PgsValueChangeListener());

    BoxFormBuilder fb = new BoxFormBuilder();
    fb.setMargin(false);
    fb.setFixedHeight();
    fb.row();
    fb.add(resultCount);
    fb.addHorizontalGlue();
    fb.add(first);
    fb.add(previous);
    fb.add(status);
    fb.add(next);
    fb.add(last);
    fb.add(goToLabel);
    fb.add(goTo, 60);
    fb.addHorizontalGlue();
    fb.add(showRecords);
    fb.add(pgs, 60);

    return fb.getForm();
}

From source file:org.jpos.qi.minigl.AccountsView.java

License:Open Source License

@Override
protected HorizontalLayout createHeader(String title) {
    HorizontalLayout header = super.createHeader(title);
    if (isGeneralView()) {
        Label refDebit = new Label(FontAwesome.SQUARE.getHtml() + " DEBIT accounts");
        Label refCredit = new Label(FontAwesome.SQUARE.getHtml() + " CREDIT accounts");
        refDebit.setContentMode(ContentMode.HTML);
        refCredit.setContentMode(ContentMode.HTML);
        refDebit.setStyleName("debit-color");
        refCredit.setStyleName("credit-color");
        refDebit.addStyleName(ValoTheme.LABEL_SMALL);
        refCredit.addStyleName(ValoTheme.LABEL_SMALL);
        Button collapse = new Button(getApp().getMessage("collapseAll"), event -> {
            ((TreeGrid) getGrid()).collapse(expandedItems.toArray());

        });//from   w  ww . j a  v  a  2 s  .  com
        collapse.setStyleName(ValoTheme.BUTTON_LINK);
        collapse.addStyleName(ValoTheme.BUTTON_SMALL);
        HorizontalLayout l = new HorizontalLayout(refDebit, refCredit, collapse);
        l.setSpacing(true);
        l.setComponentAlignment(refDebit, Alignment.BOTTOM_CENTER);
        l.setComponentAlignment(refCredit, Alignment.BOTTOM_CENTER);
        l.setComponentAlignment(collapse, Alignment.BOTTOM_CENTER);
        header.addComponent(l);
        header.setComponentAlignment(l, Alignment.MIDDLE_RIGHT);
    }
    return header;
}

From source file:org.jpos.qi.Sidebar.java

License:Open Source License

@SuppressWarnings("unchecked")
private void loadSideBarOptions(String id) {
    if (id != null && id.equals(currentSidebarId))
        return;//from  w  w  w  .j a  v  a  2s  .  com

    options = new LinkedHashMap<>();
    if (menuItems != null)
        removeComponent(menuItems);

    currentSidebarId = id;
    menuItems = new CssLayout();
    menuItems.setPrimaryStyleName("valo-menuitems");

    Element cfg = app.getXmlConfiguration();
    for (Element sb : cfg.getChildren("sidebar")) {
        String eid = sb.getAttributeValue("id");
        if (id == eid || (eid != null && eid.equals(id))) {
            for (Element e : sb.getChildren()) {
                if ("section".equals(e.getName())) {
                    Label l = new Label(e.getAttributeValue("name"));
                    l.setStyleName(ValoTheme.MENU_SUBTITLE);
                    l.setSizeUndefined();
                    menuItems.addComponent(l);
                } else if ("option".equals(e.getName())) {
                    if (((QINavigator) QI.getQI().getNavigator())
                            .hasAccessToRoute(e.getAttributeValue("action"))) {
                        Button b = new Button(e.getAttributeValue("name"));
                        b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
                        String iconName = e.getAttributeValue("icon");
                        if (iconName != null) {
                            try {
                                b.setIcon(FontAwesome.valueOf(iconName));
                            } catch (IllegalArgumentException ex) {
                                b.setIcon(FontAwesome.EXCLAMATION_TRIANGLE);
                                b.setEnabled(false);
                            }
                        }
                        String action = e.getAttributeValue("action");
                        options.put(action, b);
                        if (action != null)
                            b.addClickListener((Button.ClickListener) event -> app.getNavigator()
                                    .navigateTo("/" + action));
                        menuItems.addComponent(b);
                    }
                }
            }
            addComponent(menuItems);
        }
    }
}

From source file:org.jumpmind.vaadin.ui.common.CommonUiUtils.java

License:Open Source License

public static Label createSeparator() {
    Label separator = new Label(" ");
    separator.setStyleName("vrule");
    separator.setHeight(100, Unit.PERCENTAGE);
    separator.setWidthUndefined();//from   w  w  w  .j av a2  s .c  om
    return separator;
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.SqlRunner.java

License:Open Source License

protected Component wrapTextInComponent(String text, String style) {
    Panel panel = new Panel();
    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);/* ww w. java2s. co m*/
    panel.setContent(content);
    Label label = new Label("<pre>" + text.toString() + "</pre>", ContentMode.HTML);
    if (StringUtils.isNotBlank(style)) {
        label.setStyleName(style);
    }
    content.addComponent(label);
    return panel;
}

From source file:org.metawidget.vaadin.ui.layout.HeadingTagLayoutDecorator.java

License:LGPL

@Override
protected void addSectionWidget(String section, int level, ComponentContainer container,
        VaadinMetawidget metawidget) {//from  w  w w .  j  ava2 s  .  c  o  m

    String currentActiveSection = metawidget.getClientProperty("currentActiveSection");

    if ((currentActiveSection != null) && currentActiveSection.equals(section)) {
        return;
    }

    Label label = new Label();

    // Section name (possibly localized)

    String localizedSection = metawidget.getLocalizedKey(StringUtils.camelCase(section));

    if (localizedSection == null) {
        label.setValue(section);
    } else {
        label.setValue(localizedSection);
    }

    int headingLevel = level + 1;
    label.setStyleName("h" + headingLevel);

    // Add to parent container

    Map<String, String> attributes = CollectionUtils.newHashMap();

    getDelegate().layoutWidget(label, PROPERTY, attributes, container, metawidget);

    metawidget.putClientProperty("currentActiveSection", section);
}