Example usage for com.vaadin.ui Panel setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(float width, Unit unit) 

Source Link

Usage

From source file:com.esofthead.mycollab.module.project.view.task.GanttChartTaskContainer.java

License:Open Source License

private Panel createControls() {

    Panel panel = new Panel();
    panel.setWidth(100, Unit.PERCENTAGE);

    HorizontalLayout controls = new HorizontalLayout();
    controls.setSpacing(true);//from   w  w  w  . j av  a 2 s  .  c om
    controls.setMargin(true);
    panel.setContent(controls);

    start = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE));
    start.setValue(gantt.getStartDate());
    start.setResolution(Resolution.DAY);
    start.setImmediate(true);
    start.addValueChangeListener(startDateValueChangeListener);

    end = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE));
    end.setValue(gantt.getEndDate());
    end.setResolution(Resolution.DAY);
    end.setImmediate(true);
    end.addValueChangeListener(endDateValueChangeListener);

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    panel.setStyleName(UIConstants.THEME_NO_BORDER);

    return panel;
}

From source file:com.esofthead.mycollab.module.project.view.task.GanttChartViewImpl.java

License:Open Source License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Unit.PERCENTAGE);

    MHorizontalLayout controls = new MHorizontalLayout().withMargin(true);
    panel.setContent(controls);/*from  ww w. j  a  va2 s  .  c o  m*/

    DateFieldExt start = new DateFieldExt(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE));
    start.setValue(gantt.getStartDate());
    start.setResolution(Resolution.DAY);
    start.setImmediate(true);
    start.addValueChangeListener(startDateValueChangeListener);

    DateField end = new DateFieldExt(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE));
    end.setValue(gantt.getEndDate());
    end.setResolution(Resolution.DAY);
    end.setImmediate(true);
    end.addValueChangeListener(endDateValueChangeListener);

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    controls.with(start, end, reso);
    panel.setStyleName(UIConstants.THEME_NO_BORDER);

    return panel;
}

From source file:com.klwork.explorer.ui.content.email.EmailDetailPanel.java

License:Apache License

protected void addHtmlContent(String html) {
    Panel panel = new Panel();
    panel.setWidth(800, UNITS_PIXELS);
    panel.setHeight(300, UNITS_PIXELS);// w  w  w . j  a v a 2s  . c  o  m

    content = new Label(html, Label.CONTENT_XHTML);
    content.setHeight(100, UNITS_PERCENTAGE);

    panel.setContent(content);
    mainLayout.addComponent(panel);
}

From source file:com.klwork.explorer.ui.task.ProcessInstanceEventsPanel.java

License:Apache License

public void initAddEventInput(HorizontalLayout hLayout) {
    Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be
    // attached to panels or windows
    textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout textFieldPanelLayout = new VerticalLayout();
    textFieldPanel.setContent(textFieldPanelLayout);

    textFieldPanel.setWidth(100, Unit.PERCENTAGE);
    hLayout.addComponent(textFieldPanel);
    hLayout.setExpandRatio(textFieldPanel, 1.0f);

    commentInputField = new TextField();
    commentInputField.setWidth(100, Unit.PERCENTAGE);
    textFieldPanelLayout.addComponent(commentInputField);

    // Hack to catch keyboard 'enter'
    textFieldPanel.addActionHandler(new Handler() {
        public void handleAction(Action action, Object sender, Object target) {
            addNewComment(commentInputField.getValue().toString());
        }/*from w w w  . j  a  v a  2  s. co m*/

        public Action[] getActions(Object target, Object sender) {
            return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
        }
    });
}

From source file:com.klwork.explorer.ui.task.TaskEventsPanel.java

License:Apache License

public void initAddEventInput(HorizontalLayout hLayout) {
    Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be attached to panels or windows
    textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout textFieldPanelLayout = new VerticalLayout();
    textFieldPanel.setContent(textFieldPanelLayout);

    textFieldPanel.setWidth(100, Unit.PERCENTAGE);
    hLayout.addComponent(textFieldPanel);
    hLayout.setExpandRatio(textFieldPanel, 1.0f);

    commentInputField = new TextField();
    commentInputField.setWidth(100, Unit.PERCENTAGE);
    textFieldPanelLayout.addComponent(commentInputField);

    // Hack to catch keyboard 'enter'
    textFieldPanel.addActionHandler(new Handler() {
        public void handleAction(Action action, Object sender, Object target) {
            addNewComment(commentInputField.getValue().toString());
        }/*from   ww w. j  a v a2 s.c  om*/

        public Action[] getActions(Object target, Object sender) {
            return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
        }
    });
}

From source file:com.lexaden.platform.web.GridApplication.java

License:Apache License

/**
 * Initializes the application.//w  w  w . java  2s  . com
 */
@Override
public void init(VaadinRequest request) {
    final Panel panel = new Panel("Grid Demo");
    panel.setWidth(850, Sizeable.Unit.PIXELS);
    panel.setContent(personViewService.buildPersonsGrid());

    setContent(panel);

    getPage().setTitle("Grid Demo");
}

From source file:com.pms.component.ganttchart.DemoUI.java

License:Apache License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);//from w ww.  jav a 2 s .  c o  m
    controls.setMargin(true);
    panel.setContent(controls);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    localeSelect = new NativeSelect("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setNullSelectionAllowed(false);
    for (Locale l : Locale.getAvailableLocales()) {
        localeSelect.addItem(l);
        localeSelect.setItemCaption(l, l.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    localeSelect.setImmediate(true);

    String[] zones = new String[] { "GMT-0", "GMT-1", "GMT-2", "GMT-3", "GMT-4", "GMT-5", "GMT-6", "GMT-7",
            "GMT-8", "GMT-9", "GMT-10", "GMT-11", "GMT-12", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5",
            "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12", "GMT+13", "GMT+14" };
    NativeSelect timezoneSelect = new NativeSelect("Timezone");
    timezoneSelect.setNullSelectionAllowed(false);
    timezoneSelect.addItem("Default");
    timezoneSelect.setItemCaption("Default", "Default (" + TimeZone.getDefault().getDisplayName() + ")");
    for (String timezoneId : zones) {
        TimeZone tz = TimeZone.getTimeZone(timezoneId);
        timezoneSelect.addItem(timezoneId);
        timezoneSelect.setItemCaption(timezoneId,
                tz.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    timezoneSelect.setValue("Default");
    timezoneSelect.setImmediate(true);
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    controls.addComponent(localeSelect);
    controls.addComponent(timezoneSelect);
    controls.addComponent(heightAndUnit);
    controls.addComponent(widthAndUnit);
    controls.addComponent(createStep);
    controls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);

    return panel;
}

From source file:com.pms.component.ganttchart.GanttChart.java

License:Apache License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);//from  w w  w.  j a v a2  s.  c  o m
    controls.setMargin(true);
    panel.setContent(controls);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    localeSelect = new NativeSelect("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setNullSelectionAllowed(false);
    for (Locale l : Locale.getAvailableLocales()) {
        localeSelect.addItem(l);
        localeSelect.setItemCaption(l, l.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    localeSelect.setImmediate(true);

    String[] zones = new String[] { "GMT-0", "GMT-1", "GMT-2", "GMT-3", "GMT-4", "GMT-5", "GMT-6", "GMT-7",
            "GMT-8", "GMT-9", "GMT-10", "GMT-11", "GMT-12", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5",
            "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12", "GMT+13", "GMT+14" };
    NativeSelect timezoneSelect = new NativeSelect("Timezone");
    timezoneSelect.setNullSelectionAllowed(false);
    timezoneSelect.addItem("Default");
    timezoneSelect.setItemCaption("Default", "Default (" + TimeZone.getDefault().getDisplayName() + ")");
    for (String timezoneId : zones) {
        TimeZone tz = TimeZone.getTimeZone(timezoneId);
        timezoneSelect.addItem(timezoneId);
        timezoneSelect.setItemCaption(timezoneId,
                tz.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    timezoneSelect.setValue("Default");
    timezoneSelect.setImmediate(true);
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    //controls.addComponent(localeSelect);
    //controls.addComponent(timezoneSelect);
    controls.addComponent(heightAndUnit);
    controls.addComponent(widthAndUnit);
    //controls.addComponent(createStep);
    // controls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);
    //controls.setComponentAlignment(widthAndUnit, Alignment.MIDDLE_LEFT);

    return panel;
}

From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java

License:Apache License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);//www.  ja v  a2 s.  co  m
    controls.setMargin(true);
    panel.setContent(controls);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    //reso.setValue(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    localeSelect = new NativeSelect("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setNullSelectionAllowed(false);
    for (Locale l : Locale.getAvailableLocales()) {
        localeSelect.addItem(l);
        localeSelect.setItemCaption(l, l.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    localeSelect.setImmediate(true);

    String[] zones = new String[] { "GMT-0", "GMT-1", "GMT-2", "GMT-3", "GMT-4", "GMT-5", "GMT-6", "GMT-7",
            "GMT-8", "GMT-9", "GMT-10", "GMT-11", "GMT-12", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5",
            "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12", "GMT+13", "GMT+14" };
    NativeSelect timezoneSelect = new NativeSelect("Timezone");
    timezoneSelect.setNullSelectionAllowed(false);
    timezoneSelect.addItem("Default");
    timezoneSelect.setItemCaption("Default", "Default (" + TimeZone.getDefault().getDisplayName() + ")");
    for (String timezoneId : zones) {
        TimeZone tz = TimeZone.getTimeZone(timezoneId);
        timezoneSelect.addItem(timezoneId);
        timezoneSelect.setItemCaption(timezoneId,
                tz.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    timezoneSelect.setValue("Default");
    timezoneSelect.setImmediate(true);
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    //controls.addComponent(localeSelect);
    //controls.addComponent(timezoneSelect);
    controls.addComponent(heightAndUnit);
    controls.addComponent(widthAndUnit);
    //controls.addComponent(createStep);
    // controls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);
    //controls.setComponentAlignment(widthAndUnit, Alignment.MIDDLE_LEFT);

    return panel;
}

From source file:com.pms.component.member.taskganntchart.TaskGanttChart.java

License:Apache License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);//from  www  .j a va2  s  . c  o  m
    controls.setMargin(true);
    panel.setContent(controls);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    localeSelect = new NativeSelect("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setNullSelectionAllowed(false);
    for (Locale l : Locale.getAvailableLocales()) {
        localeSelect.addItem(l);
        localeSelect.setItemCaption(l, l.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    localeSelect.setImmediate(true);

    String[] zones = new String[] { "GMT-0", "GMT-1", "GMT-2", "GMT-3", "GMT-4", "GMT-5", "GMT-6", "GMT-7",
            "GMT-8", "GMT-9", "GMT-10", "GMT-11", "GMT-12", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5",
            "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12", "GMT+13", "GMT+14" };
    NativeSelect timezoneSelect = new NativeSelect("Timezone");
    timezoneSelect.setNullSelectionAllowed(false);
    timezoneSelect.addItem("Default");
    timezoneSelect.setItemCaption("Default", "Default (" + TimeZone.getDefault().getDisplayName() + ")");
    for (String timezoneId : zones) {
        TimeZone tz = TimeZone.getTimeZone(timezoneId);
        timezoneSelect.addItem(timezoneId);
        timezoneSelect.setItemCaption(timezoneId,
                tz.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    timezoneSelect.setValue("Default");
    timezoneSelect.setImmediate(true);
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    //controls.addComponent(localeSelect);
    //controls.addComponent(timezoneSelect);
    //controls.addComponent(heightAndUnit);
    //controls.addComponent(widthAndUnit);
    //controls.addComponent(createStep);
    // controls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);
    //controls.setComponentAlignment(widthAndUnit, Alignment.MIDDLE_LEFT);

    return panel;
}