Example usage for com.vaadin.ui TextArea TextArea

List of usage examples for com.vaadin.ui TextArea TextArea

Introduction

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

Prototype

public TextArea(ValueChangeListener<String> valueChangeListener) 

Source Link

Document

Constructs a new TextArea with a value change listener.

Usage

From source file:org.milleni.dunning.ui.prcstart.BulkDunningProcessStartPanel.java

License:Apache License

protected void initSettingsProperties() {
    panelLayout = new VerticalLayout();
    panelLayout.setSpacing(true);/*from www .  java  2 s .c  om*/
    detailLayout.setMargin(true, true, true, false);
    detailLayout.addComponent(panelLayout);

    processDate = new DateField("Sre Balama Zaman");
    panelLayout.addComponent(processDate);
    // Database type

    textArea = new TextArea("");
    textArea.setRequired(true);
    textArea.setEnabled(true);
    textArea.setRows(10);
    textArea.setColumns(50);
    check = new CheckBox("Gn gemi stepi yapma");
    panelLayout.addComponent(check);
    panelLayout.addComponent(textArea);

    Button claimButton = new Button("Balat");
    claimButton.setIcon(Images.EXECUTE);
    claimButton.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            String customerIds = (String) textArea.getValue();
            Date processDateValue = (Date) processDate.getValue();

            boolean startStepFirst = false;
            if ((Boolean) check.getValue()) {
                startStepFirst = true;
            }

            String[] customerIdArray = customerIds.split("\n");
            List<Long> customerIdList = new ArrayList<Long>();
            for (String strCustomerId : customerIdArray) {
                strCustomerId = strCustomerId.trim();
                if (StringUtils.hasText(strCustomerId)) {
                    customerIdList.add(Long.parseLong(strCustomerId));
                }
            }

            for (Long customerId : customerIdList) {
                Map<String, Object> variables = new HashMap<String, Object>();
                variables.put(Constants.customerId, customerId);
                if (loggedInUser != null)
                    variables.put(Constants.user, loggedInUser.getFullName());
                if (startStepFirst)
                    variables.put(Constants.firstStepNext, true);
                if (processDateValue != null)
                    variables.put(Constants.processStartDate, processDateValue);
                runtimeService.startProcessInstanceByKey(Constants.FL100_DunningProcessInitializer, variables);
            }
            textArea.setValue("");
        }
    });

    panelLayout.addComponent(claimButton);
}

From source file:org.milleni.dunning.ui.prcstart.CompleteFinansTaskPanel.java

License:Apache License

protected void initSettingsProperties() {
    panelLayout = new VerticalLayout();
    panelLayout.setSpacing(true);/*from   w w w  .j  ava  2  s.com*/
    detailLayout.setMargin(true, true, true, false);
    detailLayout.addComponent(panelLayout);

    // Database type

    textArea = new TextArea("");
    textArea.setRequired(true);
    textArea.setEnabled(true);
    textArea.setRows(10);
    textArea.setColumns(50);

    textAreaFinansNot = new TextArea("");
    textAreaFinansNot.setRequired(true);
    textAreaFinansNot.setEnabled(true);
    textAreaFinansNot.setRows(2);
    textAreaFinansNot.setColumns(50);
    textAreaFinansNot.setMaxLength(150);

    panelLayout.addComponent(yasalOrTakipCombo);
    Label lblFinansNot = new Label("Finans Notu");
    lblFinansNot.setSizeUndefined();
    lblFinansNot.addStyleName(Reindeer.LABEL_H2);
    panelLayout.addComponent(lblFinansNot);
    panelLayout.addComponent(textAreaFinansNot);

    Label lblCustomer = new Label("Musteriler");
    lblCustomer.setSizeUndefined();
    lblCustomer.addStyleName(Reindeer.LABEL_H2);
    panelLayout.addComponent(lblCustomer);
    panelLayout.addComponent(textArea);

    Button claimButton = new Button("Tasklari Tamamla");
    claimButton.setIcon(Images.EXECUTE);
    claimButton.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {

            String customerIds = (String) textArea.getValue();
            boolean takipDisi = (yasalOrTakipCombo.getValue() != null
                    && takipDisiBirak.equals(yasalOrTakipCombo.getValue())) ? true : false;

            String finansNotu = textAreaFinansNot.getValue() != null ? textAreaFinansNot.getValue().toString()
                    : null;

            String[] customerIdArray = customerIds.split("\n");
            List<Long> customerIdList = new ArrayList<Long>();
            for (String strCustomerId : customerIdArray) {
                strCustomerId = strCustomerId.trim();
                if (StringUtils.hasText(strCustomerId)) {
                    customerIdList.add(Long.parseLong(strCustomerId));
                }
            }

            for (Long customerId : customerIdList) {
                Map<String, Object> variables = new HashMap<String, Object>();
                variables.put(Constants.customerId, customerId);
                if (loggedInUser != null)
                    variables.put(Constants.user, loggedInUser.getFullName());

                if (takipDisi)
                    variables.put(Constants.taskStatusFinans, Constants.takipDisiBirak);

                if (StringUtils.hasText(finansNotu))
                    variables.put("finansNotu", finansNotu);

                ProcessInstance instance = runtimeService.createProcessInstanceQuery()
                        .variableValueEquals("customerId", customerId).singleResult();
                Task task = taskService.createTaskQuery().taskDefinitionKeyLike("%taskYasal%")
                        .processInstanceId(instance.getProcessInstanceId()).singleResult();
                taskService.complete(task.getId(), variables);
                //runtimeService.startProcessInstanceByKey(Constants.FL100_DunningProcessInitializer,variables);
            }
            textArea.setValue("");
        }
    });

    panelLayout.addComponent(claimButton);

}

From source file:org.milleni.dunning.ui.prcstart.StepSelectStartDunningProcessPanel.java

License:Apache License

protected void initSettingsProperties() {
    panelLayout = new VerticalLayout();
    panelLayout.setSpacing(true);//  ww  w  . j  av a  2  s . c  o  m
    detailLayout.setMargin(true, true, true, false);
    detailLayout.addComponent(panelLayout);

    processDate = new DateField("Sre Balama Zaman");
    panelLayout.addComponent(processDate);
    // Database type

    textArea = new TextArea("");
    textArea.setRequired(true);
    textArea.setEnabled(true);
    textArea.setRows(10);
    textArea.setColumns(50);
    check = new CheckBox("Gn gemi stepi yapma");

    panelLayout.addComponent(policyCombo);
    panelLayout.addComponent(stepCombo);
    panelLayout.addComponent(textArea);

    Button claimButton = new Button("Balat");
    claimButton.setIcon(Images.EXECUTE);
    claimButton.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            if (selectedProcessStep == null)
                throw new RuntimeException("Adm bo olamaz");
            String customerIds = (String) textArea.getValue();
            Date processDateValue = (Date) processDate.getValue();

            String[] customerIdArray = customerIds.split("\n");
            List<Long> customerIdList = new ArrayList<Long>();
            for (String strCustomerId : customerIdArray) {
                strCustomerId = strCustomerId.trim();
                if (StringUtils.hasText(strCustomerId)) {
                    customerIdList.add(Long.parseLong(strCustomerId));
                }
            }

            for (Long customerId : customerIdList) {
                Map<String, Object> variables = new HashMap<String, Object>();
                variables.put(Constants.customerId, customerId);
                if (loggedInUser != null)
                    variables.put(Constants.user, loggedInUser.getFullName());
                if (processDateValue != null)
                    variables.put(Constants.processStartDate, processDateValue);

                if (selectedProcessStep != null) {
                    variables.put(Constants.userSelectedProcessStep, selectedProcessStep.getStepId());
                }
                runtimeService.startProcessInstanceByKey(Constants.FL100_DunningProcessInitializer, variables);
            }
            textArea.setValue("");
        }
    });

    panelLayout.addComponent(claimButton);

}

From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java

License:Apache License

private Component createTaskSummary(UserTask task) {

    //      TextField name = new TextField("Name");
    //      name.setValue(task.getName());
    //      name.setReadOnly(true);
    //      name.setWidth("100%");

    TextField priority = new TextField("Priority");
    priority.setValue(Integer.toString(task.getPriority()));
    priority.setReadOnly(true);/*from www . j a  va 2s.  com*/

    TextField status = new TextField("Status");
    status.setValue(task.getStatus().getDescription());
    status.setReadOnly(true);

    TextArea description = new TextArea("Description");
    description.setSizeFull();
    description.setValue(task.getDescription());
    description.setReadOnly(true);
    description.setRows(3);

    ComponentContainer buttons = createSummaryButtons(task);

    VerticalLayout secondColumnFields = new VerticalLayout();
    secondColumnFields.setMargin(false);
    secondColumnFields.setSizeFull();

    secondColumnFields.addComponent(priority);
    secondColumnFields.addComponent(status);

    HorizontalLayout fieldsLayout = new HorizontalLayout();
    fieldsLayout.setSizeFull();
    fieldsLayout.setMargin(false);
    fieldsLayout.setSpacing(false);
    fieldsLayout.addComponent(description);
    fieldsLayout.addComponent(secondColumnFields);
    fieldsLayout.setExpandRatio(description, 4.0f);
    fieldsLayout.setExpandRatio(secondColumnFields, 1.0f);

    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setMargin(true);
    mainLayout.setSpacing(false);
    mainLayout.setSizeFull();
    mainLayout.addComponent(fieldsLayout);
    mainLayout.addComponent(buttons);
    mainLayout.setComponentAlignment(buttons, Alignment.TOP_LEFT);
    mainLayout.setExpandRatio(fieldsLayout, 1.0f);

    Panel panel = new Panel("Summary");
    panel.setStyleName("background-transparent");
    panel.setContent(mainLayout);

    return panel;
}

From source file:org.opennms.features.vaadin.events.EventFormFieldFactory.java

License:Open Source License

public Field createField(Item item, Object propertyId, Component uiContext) {
    if ("logMsgDest".equals(propertyId)) {
        final ComboBox dest = new ComboBox("Destination");
        dest.addItem("logndisplay");
        dest.addItem("logonly");
        dest.addItem("suppress");
        dest.addItem("donotpersist");
        dest.addItem("discardtraps");
        dest.setNullSelectionAllowed(false);
        dest.setRequired(true);//from ww  w . j  av a2s  . c  om
        return dest;
    }
    if ("logMsgContent".equals(propertyId)) {
        final TextArea content = new TextArea("Log Message");
        content.setWidth("100%");
        content.setRows(10);
        content.setRequired(true);
        content.setNullRepresentation("");
        return content;
    }
    if ("alarmDataAlarmType".equals(propertyId)) {
        final ComboBox f = new ComboBox("Alarm Type");
        f.addItem(new Integer(1));
        f.addItem(new Integer(2));
        f.addItem(new Integer(3));
        f.setNewItemHandler(new NewItemHandler() {
            @Override
            public void addNewItem(String newItemCaption) {
                try {
                    f.addItem(new Integer(newItemCaption));
                } catch (Exception e) {
                }
            }
        });
        f.setDescription(
                "<b>1</b> to be a problem that has a possible resolution, alarm-type set to <b>2</b> to be a resolution event, and alarm-type set to <b>3</b> for events that have no possible resolution");
        f.setNullSelectionAllowed(false);
        return f;
    }
    if ("alarmDataAutoClean".equals(propertyId)) {
        final CheckBox f = new CheckBox("Auto Clean");
        f.setWidth("100%");
        return f;
    }
    if ("alarmDataReductionKey".equals(propertyId)) {
        final TextField f = new TextField("Reduction Key");
        f.setWidth("100%");
        f.setNullRepresentation("");
        return f;
    }
    if ("alarmDataClearKey".equals(propertyId)) {
        final TextField f = new TextField("Clear Key");
        f.setWidth("100%");
        f.setNullRepresentation("");
        return f;
    }
    if ("severity".equals(propertyId)) {
        final ComboBox severity = new ComboBox("Severity");
        for (String sev : OnmsSeverity.names()) {
            severity.addItem(sev.substring(0, 1).toUpperCase() + sev.substring(1).toLowerCase());
        }
        severity.setNullSelectionAllowed(false);
        severity.setRequired(true);
        return severity;
    }
    if ("descr".equals(propertyId)) {
        final TextArea descr = new TextArea("Description");
        descr.setWidth("100%");
        descr.setRows(10);
        descr.setRequired(true);
        descr.setNullRepresentation("");
        return descr;
    }
    if ("operinstruct".equals(propertyId)) {
        final TextArea oper = new TextArea("Operator Instructions") {
            @Override
            public Object getValue() { // This is because of the intern usage on Event.setOperInstruct()
                return super.getValue() == null ? "" : super.getValue();
            }
        };
        oper.setWidth("100%");
        oper.setRows(10);
        oper.setNullRepresentation("");
        return oper;
    }
    if ("maskElements".equals(propertyId)) {
        final MaskElementField field = new MaskElementField();
        field.setCaption("Mask Elements");
        return field;
    }
    if ("maskVarbinds".equals(propertyId)) {
        final MaskVarbindField field = new MaskVarbindField();
        field.setCaption("Mask Varbinds");
        return field;
    }
    if ("varbindsdecodeCollection".equals(propertyId)) {
        final VarbindsDecodeField field = new VarbindsDecodeField();
        field.setCaption("Varbind Decodes");
        return field;
    }
    if ("uei".equals(propertyId)) {
        final TextField f = new TextField("Event UEI");
        f.setRequired(true);
        f.setWidth("100%");
        return f;
    }
    if ("eventLabel".equals(propertyId)) {
        final TextField f = new TextField("Event Label");
        f.setRequired(true);
        f.setWidth("100%");
        return f;
    }
    final Field f = DefaultFieldFactory.get().createField(item, propertyId, uiContext);
    f.setWidth("100%");
    return f;
}

From source file:org.ow2.sirocco.cloudmanager.KeyPairImportDialog.java

License:Open Source License

public KeyPairImportDialog(final DialogCallback callback) {
    super("Import Key Pair");
    this.callback = callback;
    this.center();
    this.setClosable(false);
    this.setModal(true);
    this.setResizable(false);

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();/*from  w w  w .  j  av a 2 s .  c  o  m*/
    content.setMargin(true);
    content.setSpacing(true);
    content.setWidth("500px");
    content.setHeight("250px");

    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);
    form.setSpacing(true);

    this.nameField = new TextField("Name");
    this.nameField.setWidth("50%");
    this.nameField.setRequired(true);
    this.nameField.setRequiredError("Please enter a name for your key pair");
    form.addComponent(this.nameField);

    this.publicKeyField = new TextArea("Public Key");
    this.publicKeyField.setWidth("100%");
    this.publicKeyField.setRequired(true);
    this.publicKeyField.setRequiredError("Please enter a name for your key pair");
    form.addComponent(this.publicKeyField);

    content.addComponent(form);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    this.okButton = new Button("Ok", this);
    this.cancelButton = new Button("Cancel", this);
    this.cancelButton.focus();
    buttonLayout.addComponent(this.okButton);
    buttonLayout.addComponent(this.cancelButton);
    content.addComponent(buttonLayout);
    content.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);

    this.setContent(content);

}

From source file:org.processbase.ui.bpm.generator.GeneratedWindow.java

License:Open Source License

private TextArea getTextArea(Widget widget) {
    TextArea component = new TextArea(widget.getLabel());
    //        if (widget.getValidatorName() != null) {
    //            component.addValidator(new GeneratedValidator(widget, taskInstance, processDefinition, getApplication().getLocale(), ProcessbaseApplication.getCurrent().getBpmModule()));
    //        }//  w w  w  . j  a va2s . co m
    component.setNullRepresentation("");
    return component;
}

From source file:org.processbase.ui.bpm.identity.GroupWindow.java

License:Open Source License

public void initUI() {
    try {/* w  w  w.j  a v  a  2  s  .  co m*/
        if (group == null) {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("newGroup"));
        } else {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("group"));
        }
        setModal(true);
        VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName(Reindeer.LAYOUT_WHITE);

        cancelBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnCancel"),
                this);
        applyBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSave"), this);
        groupName = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("groupName"));
        groupLabel = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("groupLabel"));
        groupDescription = new TextArea(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("groupDescription"));
        parentGroup = new ComboBox(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("groupParent"));

        parentGroup.setWidth("270px");
        parentGroup.setContainerDataSource(getGroups());
        parentGroup.setItemCaptionPropertyId("path");
        parentGroup.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS);
        addComponent(parentGroup);
        groupName.setWidth("270px");
        addComponent(groupName);
        groupLabel.setWidth("270px");
        addComponent(groupLabel);
        groupDescription.setWidth("270px");
        addComponent(groupDescription);

        if (group != null) {
            groupName.setValue(group.getName());
            groupLabel.setValue(group.getLabel());
            groupDescription.setValue(group.getDescription());
            if (group.getParentGroup() != null) {
                parentGroup.setValue(group.getParentGroup().getUUID());
            }
        }

        buttons.addButton(applyBtn);
        buttons.setComponentAlignment(applyBtn, Alignment.MIDDLE_RIGHT);
        buttons.setExpandRatio(applyBtn, 1);
        buttons.addButton(cancelBtn);
        buttons.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(false);
        buttons.setHeight("30px");
        buttons.setWidth("100%");
        addComponent(buttons);
        setWidth("310px");
        setResizable(false);
    } catch (Exception ex) {
        ex.printStackTrace();
        showError(ex.getMessage());
    }
}

From source file:org.processbase.ui.bpm.identity.RoleWindow.java

License:Open Source License

public void initUI() {
    try {/*w w w. ja  va 2 s  . com*/
        if (role == null) {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("newRole"));
        } else {
            setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("role"));
        }
        setModal(true);
        VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName(Reindeer.LAYOUT_WHITE);

        cancelBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnCancel"),
                this);
        applyBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSave"), this);
        roleName = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("roleName"));
        roleLabel = new TextField(ProcessbaseApplication.getCurrent().getPbMessages().getString("roleLabel"));
        roleDescription = new TextArea(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("roleDescription"));

        roleName.setWidth("270px");
        addComponent(roleName);
        roleLabel.setWidth("270px");
        addComponent(roleLabel);
        roleDescription.setWidth("270px");
        addComponent(roleDescription);

        if (role != null) {
            roleName.setValue(role.getName());
            roleLabel.setValue(role.getLabel());
            roleDescription.setValue(role.getDescription());
        }

        buttons.addButton(applyBtn);
        buttons.setComponentAlignment(applyBtn, Alignment.MIDDLE_RIGHT);
        buttons.setExpandRatio(applyBtn, 1);
        buttons.addButton(cancelBtn);
        buttons.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(false);
        buttons.setHeight("30px");
        buttons.setWidth("100%");
        addComponent(buttons);
        setWidth("310px");
        setResizable(false);
    } catch (Exception ex) {
        ex.printStackTrace();
        showError(ex.getMessage());
    }
}

From source file:org.processbase.ui.portlet.chart.ChartConfigurationPanel.java

License:Open Source License

public ChartConfigurationPanel() {
    super(4, 7);/*  w w  w.ja va2s.  c  om*/
    setWidth("100%");
    chartType = new NativeSelect("Chart Type");
    chartType.addItem("BarChart");
    chartType.addItem("ColumnChart");
    chartType.addItem("PieChart");
    chartType.addItem("LineChart");
    chartType.addItem("AreaChart");

    chartType.setWidth("100px");

    refreshInterval = new TextField(ChartPortlet.getCurrent().messages.getString("refreshInterval"));
    refreshInterval.setMaxLength(3);
    refreshInterval.setRequired(true);
    refreshInterval
            .addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("refreshInterval")
                    + " " + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError")));
    refreshInterval.setValue(new Integer("10"));

    title = new TextField(ChartPortlet.getCurrent().messages.getString("title"));
    title.setWidth("100%");
    title.setRequired(true);

    legend = new NativeSelect(ChartPortlet.getCurrent().messages.getString("legend"));
    legend.setWidth("100%");
    legend.addItem("bottom");
    legend.addItem("top");
    legend.addItem("left");
    legend.addItem("right");

    titleX = new TextField(ChartPortlet.getCurrent().messages.getString("titleX"));
    titleX.setWidth("100%");
    titleX.setRequired(true);

    titleY = new TextField(ChartPortlet.getCurrent().messages.getString("titleY"));
    titleY.setWidth("100%");
    titleY.setRequired(true);

    height = new TextField(ChartPortlet.getCurrent().messages.getString("height"));
    height.setWidth("70px");
    //        height.addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("height") + " " + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError")));
    height.setRequired(true);

    width = new TextField(ChartPortlet.getCurrent().messages.getString("width"));
    width.setWidth("70px");
    //        width.addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("width") + " " + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError")));
    width.setRequired(true);

    min = new TextField(ChartPortlet.getCurrent().messages.getString("min"));
    min.setWidth("70px");
    min.addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("min") + " "
            + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError")));

    max = new TextField(ChartPortlet.getCurrent().messages.getString("max"));
    max.setWidth("70px");
    max.addValidator(new IntegerValidator(ChartPortlet.getCurrent().messages.getString("max") + " "
            + ChartPortlet.getCurrent().messages.getString("IntegerValidatorError")));

    sqlText = new TextArea(ChartPortlet.getCurrent().messages.getString("sqlText"));
    sqlText.setWidth("100%");
    sqlText.setRequired(true);
    sqlText.setRows(7);

    isStacked = new CheckBox("Stacked");

    btnSave = new Button(ChartPortlet.getCurrent().messages.getString("btnSave"), this);
    btnTestSQL = new Button(ChartPortlet.getCurrent().messages.getString("btnTestSQL"), this);
    btnView = new Button(ChartPortlet.getCurrent().messages.getString("btnView"), this);

    buttons.addComponent(btnSave);
    buttons.addComponent(btnTestSQL);
    buttons.addComponent(btnView);

    addComponent(chartType, 0, 0, 1, 0);
    addComponent(isStacked, 3, 0);

    addComponent(title, 0, 1, 1, 1);
    addComponent(legend, 2, 1);
    addComponent(refreshInterval, 3, 1);

    addComponent(titleX, 0, 2, 1, 2);
    addComponent(titleY, 2, 2, 3, 2);

    addComponent(height, 0, 3);
    addComponent(width, 1, 3);
    addComponent(max, 2, 3);
    addComponent(min, 3, 3);

    addComponent(sqlText, 0, 4, 3, 4);
    addComponent(buttons, 0, 6, 3, 6);

    setComponentAlignment(btnSave, Alignment.TOP_RIGHT);
    setMargin(true);
    setSpacing(true);

    try {
        portletPreferences = ChartPortlet.portletPreferences.get();
        for (String key : portletPreferences.getMap().keySet()) {
            String[] value = portletPreferences.getMap().get(key);
            if (key.equals("refreshInterval") && value.length > 0) {
                refreshInterval.setValue(value[0]);
            } else if (key.equals("sqlText") && value.length > 0) {
                sqlText.setValue(value[0]);
            } else if (key.equals("chartType") && value.length > 0) {
                chartType.setValue(value[0]);
            } else if (key.equals("title") && value.length > 0) {
                title.setValue(value[0]);
            } else if (key.equals("legend") && value.length > 0) {
                legend.setValue(value[0]);

            } else if (key.equals("height") && value.length > 0) {
                height.setValue(value[0]);
            } else if (key.equals("width") && value.length > 0) {
                width.setValue(value[0]);
            } else if (key.equals("min") && value.length > 0) {
                min.setValue(value[0]);
            } else if (key.equals("max") && value.length > 0) {
                max.setValue(value[0]);
            } else if (key.equals("titleX") && value.length > 0) {
                titleX.setValue(value[0]);
            } else if (key.equals("titleY") && value.length > 0) {
                titleY.setValue(value[0]);
            } else if (key.equals("isStacked") && value.length > 0) {
                isStacked.setValue(Boolean.parseBoolean(value[0]));
            } else if (key.equals("legend") && value.length > 0) {
                legend.setValue(value[0]);
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}