Example usage for com.vaadin.ui Component setVisible

List of usage examples for com.vaadin.ui Component setVisible

Introduction

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

Prototype

public void setVisible(boolean visible);

Source Link

Document

Sets the visibility of the component.

Usage

From source file:org.semanticsoft.vaaclipse.presentation.fastview.SingleElementFastViewManager.java

License:Open Source License

public synchronized void showStack(boolean show) {
    Component ctf = (Component) minimizedElement.getWidget();

    if (show && !isShowing) {
        hostPane = getHostPane();//  w  w  w . j av a2  s .  com
        VerticalLayout vl = new VerticalLayout();
        vl.setSizeFull();
        hostPane.setContent(vl);

        ctf.setVisible(true);

        TrimmedWindowContent windowContent = (TrimmedWindowContent) vaadinWindow.getContent();
        ExtendedVerticalLayout clientArea = windowContent.getClientArea();

        hostPane.setTrimmedWindowClientArea(clientArea);
        //hostPane.setContent(ctf);
        vl.addComponent(ctf);

        vaadinUI.addWindow(hostPane);
        vaadinWindow.addClickListener(layoutClickListener);

        isShowing = true;
    } else if (!show && isShowing) {
        if (hostPane != null) {
            vaadinUI.removeWindow(hostPane);
            // capture the current shell's bounds
            toolBar.getPersistedState().put(STATE_XSIZE, Float.toString(Float.valueOf(hostPane.getWidth())));
            toolBar.getPersistedState().put(STATE_YSIZE, Float.toString(Float.valueOf(hostPane.getHeight())));
        }

        fixToolItemSelection(null);

        vaadinWindow.removeClickListener(layoutClickListener);

        partService.requestActivation();

        isShowing = false;
    }
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.TrimBarRenderer.java

License:Open Source License

private void refreshVisibility(MTrimBar trimBar) {

    AbstractLayout trimBarWidget = (AbstractLayout) trimBar.getWidget();
    int orientation = trimBar.getSide().getValue();

    trimBarWidget.setVisible(trimBarWidget.getComponentCount() != 0);

    if (orientation == SideValue.TOP_VALUE) {
        MWindow window = modelService.getTopLevelWindowFor(trimBar);
        TrimmedWindowContent windowContent = (TrimmedWindowContent) ((Panel) window.getWidget()).getContent();

        Component topbar = windowContent.getTopbar();
        if (topbar != null)
            topbar.setVisible(trimBarWidget.getComponentCount() != 0);
    }//from  w w w . ja va2 s.  com
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.TrimBarRenderer.java

License:Open Source License

@Override
public void addChildGui(MUIElement child, MElementContainer<MUIElement> element) {
    if (!(child instanceof MTrimElement && (MElementContainer<?>) element instanceof MTrimBar))
        return;// ww w .j  a v  a  2s  .  c  o  m

    MTrimBar trimBar = (MTrimBar) (MElementContainer<?>) element;

    final Component childWidget = (Component) child.getWidget();
    childWidget.setVisible(child.isVisible());
    childWidget.setSizeUndefined();
    int orientation = trimBar.getSide().getValue();
    if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE)
        childWidget.addStyleName("horizontaltrimelement");
    else
        childWidget.addStyleName("verticaltrimelement");

    int index = indexOf(child, element);
    if (element.getWidget() instanceof CssLayout) {
        CssLayout trimWidget = (CssLayout) element.getWidget();
        trimWidget.addComponent(childWidget, index);
        trimWidget.markAsDirty();
    } else if (element.getWidget() instanceof AbstractOrderedLayout) {
        AbstractOrderedLayout trimWidget = (AbstractOrderedLayout) element.getWidget();
        trimWidget.addComponent(childWidget, index);
        trimWidget.markAsDirty();
    }

    refreshVisibility(trimBar);
}

From source file:org.tltv.gantt.demo.DemoUI.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("Step Editor");
    win.setResizable(false);//from  ww w. j ava2 s.  c o  m
    win.center();

    final Collection<Component> hidden = new ArrayList<Component>();

    BeanItem<AbstractStep> item = new BeanItem<AbstractStep>(step);

    final FieldGroup group = new FieldGroup(item);
    group.setBuffered(true);

    TextField captionField = new TextField("Caption");
    captionField.setNullRepresentation("");
    group.bind(captionField, "caption");

    TextField descriptionField = new TextField("Description");
    descriptionField.setNullRepresentation("");
    group.bind(descriptionField, "description");
    descriptionField.setVisible(false);
    hidden.add(descriptionField);

    NativeSelect captionMode = new NativeSelect("Caption Mode");
    captionMode.addItem(Step.CaptionMode.TEXT);
    captionMode.addItem(Step.CaptionMode.HTML);
    group.bind(captionMode, "captionMode");
    captionMode.setVisible(false);
    hidden.add(captionMode);

    CheckBox showProgress = new CheckBox("Show progress");
    group.bind(showProgress, "showProgress");
    showProgress.setVisible(false);
    hidden.add(showProgress);

    Slider progress = new Slider("Progress");
    progress.setWidth(100, Unit.PERCENTAGE);
    group.bind(progress, "progress");
    progress.setVisible(false);
    hidden.add(progress);

    NativeSelect predecessorSelect = new NativeSelect("Predecessor Step");
    predecessorSelect.setWidth(100, Unit.PERCENTAGE);
    fillPredecessorCanditatesToSelect(step, predecessorSelect);
    predecessorSelect.setEnabled(step instanceof Step);
    if (step instanceof Step) {
        group.bind(predecessorSelect, "predecessor");
    }
    predecessorSelect.setVisible(false);
    hidden.add(predecessorSelect);

    final NativeSelect parentStepSelect = new NativeSelect("Parent Step");
    parentStepSelect.setWidth(100, Unit.PERCENTAGE);
    parentStepSelect.setEnabled(false);
    fillParentStepCanditatesToSelect(step, parentStepSelect);
    parentStepSelect.setVisible(false);
    hidden.add(parentStepSelect);

    HorizontalLayout colorLayout = new HorizontalLayout();
    colorLayout.setWidth(100, Unit.PERCENTAGE);
    colorLayout.setVisible(false);
    hidden.add(colorLayout);

    final TextField bgField = new TextField("Background color");
    bgField.setNullRepresentation("");
    group.bind(bgField, "backgroundColor");
    bgField.setEnabled(false);

    final ColorPicker bgColorPicker = new ColorPicker();
    bgColorPicker.setPosition(300, 100);
    bgColorPicker.setColor(new CssColorToColorPickerConverter().convertToModel(step.getBackgroundColor()));
    bgColorPicker.addColorChangeListener(new ColorChangeListener() {
        @Override
        public void colorChanged(ColorChangeEvent event) {
            bgField.setValue(event.getColor().getCSS());
        }
    });

    colorLayout.addComponent(bgField);
    colorLayout.addComponent(bgColorPicker);
    colorLayout.setExpandRatio(bgField, 1);
    colorLayout.setComponentAlignment(bgColorPicker, Alignment.BOTTOM_LEFT);

    DateField startDate = new DateField("Start date");
    startDate.setLocale(gantt.getLocale());
    startDate.setTimeZone(gantt.getTimeZone());
    startDate.setResolution(Resolution.SECOND);
    startDate.setConverter(new DateToLongConverter());
    group.bind(startDate, "startDate");

    DateField endDate = new DateField("End date");
    endDate.setLocale(gantt.getLocale());
    endDate.setTimeZone(gantt.getTimeZone());
    endDate.setResolution(Resolution.SECOND);
    endDate.setConverter(new DateToLongConverter());
    group.bind(endDate, "endDate");

    CheckBox showMore = new CheckBox("Show all settings");
    showMore.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            for (Component c : hidden) {
                c.setVisible((Boolean) event.getProperty().getValue());
            }
            win.center();
        }
    });

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    content.addComponent(captionField);
    content.addComponent(captionMode);
    content.addComponent(descriptionField);
    content.addComponent(showProgress);
    content.addComponent(progress);
    content.addComponent(predecessorSelect);
    content.addComponent(parentStepSelect);
    content.addComponent(colorLayout);
    content.addComponent(startDate);
    content.addComponent(endDate);
    content.addComponent(showMore);

    HorizontalLayout buttons = new HorizontalLayout();
    content.addComponent(buttons);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            commit(win, group, parentStepSelect);
        }

    });
    Button cancel = new Button("Cancel", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            cancel(win, group);
        }
    });
    Button delete = new Button("Delete", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            delete(win, group);
        }

    });
    buttons.addComponent(ok);
    buttons.addComponent(cancel);
    buttons.addComponent(delete);
    win.setClosable(true);

    getUI().addWindow(win);
}

From source file:org.vaadin.addons.layouts.CardLayout.java

License:Apache License

/**
 * {@inheritDoc}//from  www . j  a v  a 2  s.co  m
 *
 * If there are no components present then this component is made the visible component; otherwise, it is marked as invisible.
 */
@Override
public void addComponent(Component c) {
    boolean visible = this.isEmpty();
    super.addComponent(c);
    c.setVisible(visible);
}

From source file:org.vaadin.addons.layouts.CardLayout.java

License:Apache License

/**
 * {@inheritDoc}//from   w w w.  ja va  2 s.  c om
 *
 * If there was a component already present at the beginning of the layout it is made invisible and the newly added component
 * is made visible.
 */
@Override
public void addComponentAsFirst(Component c) {
    boolean visible = this.currentCard == 0;
    if (visible && !this.isEmpty()) {
        Component existing = this.getComponent(0);
        if (existing != null)
            existing.setVisible(false);
    }
    super.addComponentAsFirst(c);
    c.setVisible(visible);
}

From source file:org.vaadin.addons.layouts.CardLayout.java

License:Apache License

/**
 * {@inheritDoc}//w  ww. j a  v  a  2s .  co  m
 *
 * If there was a component already the specified index it is made invisible and the newly added component is made visible.
 */
@Override
public void addComponent(Component c, int index) {
    boolean visible = this.currentCard == index;
    if (visible) {
        Component existing = this.getComponent(index);
        if (existing != null)
            existing.setVisible(false);
    }
    super.addComponent(c, index);
    c.setVisible(visible);
}

From source file:org.vaadin.addons.layouts.CardLayout.java

License:Apache License

private void setVisible(int index) {
    this.checkBounds(index);
    int idx = 0;/*ww  w .j  av a  2  s.  c o  m*/
    for (Component c : this) {
        if (idx == index) {
            c.setVisible(true);
        } else if (c.isVisible()) {
            c.setVisible(false);
        }
        idx++;
    }
    this.currentCard = index;
}

From source file:ru.codeinside.adm.ui.employee.TableEmployee.java

License:Mozilla Public License

public static void setRolesEnabled(OptionGroup optionGroup, Component certificateBlock,
        Component executorGroups, HorizontalLayout supervisorGroupsEmp, HorizontalLayout supervisorGroupsOrg) {

    Set<Role> roles = (Set) optionGroup.getValue();
    Boolean e = roles.isEmpty();/*from  w  w w.  j  a va  2  s. c  o m*/
    Boolean c = roles.contains(Role.Administrator);
    for (Object role : optionGroup.getItemIds()) {
        if (role == Role.Administrator) {
            optionGroup.setItemEnabled(role, e || c);
        } else {
            optionGroup.setItemEnabled(role, e || !c);
        }
    }
    certificateBlock.setVisible(roles.contains(Role.Executor) || roles.contains(Role.Declarant)
            || roles.contains(Role.Supervisor) || roles.contains(Role.SuperSupervisor));
    executorGroups.setVisible(roles.contains(Role.Executor));
    supervisorGroupsEmp.setVisible(roles.contains(Role.Supervisor));
    supervisorGroupsOrg.setVisible(roles.contains(Role.Supervisor));
}

From source file:ru.codeinside.gses.webui.components.LayoutChanger.java

License:Mozilla Public License

@Override
public void set(Component newComponent, String name) {
    components.put(name, newComponent);//from w w  w . ja v a2  s .  c  om
    layout.addComponent(newComponent);
    newComponent.setVisible(false);
}