Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Accordion$Attributes


  /**
   * Support for CustomControlCreator
   * @param interact
   */
  public ControlInteractAttributes(final InteractType interact) {
    this.attributes = new Attributes(interact.getAttributes());
  }
View Full Code Here


      final Nifty nifty,
      final Element element,
      final EffectEventId effectEventId,
      final Attributes effectsTypeAttibutes,
      final LinkedList < Object > controllers) {
    Attributes effectAttributes = new Attributes(getAttributes());
    effectAttributes.merge(effectsTypeAttibutes);

    Attributes attributes = effectAttributes;

    RegisterEffectType registerEffectType = getRegisteredEffectType(nifty, attributes);
    if (registerEffectType == null) {
      return;
    }

    Class < ? > effectClass = registerEffectType.getEffectClass();
    if (effectClass == null) {
      return;
    }

    EffectProperties effectProperties = new EffectProperties(attributes.createProperties());
    applyEffectValues(effectProperties);

    Effect effect = createEffect(nifty, effectEventId, attributes);
    effect.init(
        element,
View Full Code Here

    parent = parentParam;
    controlAttributes = controlAttributesParam;
  }

  public Attributes resolve(final Attributes attributes) {
    Attributes result = new Attributes(attributes);

    for (Entry entry : getParameterSet(attributes)) {
      String key = (String) entry.getKey();
      String value = (String) entry.getValue();
      if (controlAttributes.isSet(key)) {
        result.set(value, controlAttributes.get(key));
      }
    }

    Attributes res = parent.resolve(result);
    for (Entry entry : getParameterSet(attributes)) {
      String value = (String) entry.getValue();
      result.set(value, "");
    }
    return res;
View Full Code Here

  public RegisterEffectType() {
  }

  public RegisterEffectType(final String nameParam, final String classParam) {
    Attributes attributes = new Attributes();
    attributes.set("name", nameParam);
    attributes.set("class", classParam);
    try {
      initFromAttributes(attributes);
    } catch (Exception e) {
      logger.warning(
          "unable to register effect [" + nameParam + "] for class [" + classParam + "] (" + e.getMessage() + "]");
View Full Code Here

            @Override
            public void selectionChanged(ButtonGroup buttonGroup, Button previousSelection) {
                Button button = panelHeaderGroup.getSelection();
                int index = (button == null) ? -1 : panelHeaders.indexOf((PanelHeader)button);

                Accordion accordion = (Accordion)getComponent();
                accordion.setSelectedIndex(index);
            }
        });
    }
View Full Code Here

    @Override
    public void install(Component component) {
        super.install(component);

        Accordion accordion = (Accordion)component;
        accordion.getAccordionListeners().add(this);
        accordion.getAccordionSelectionListeners().add(this);
        accordion.getAccordionAttributeListeners().add(this);
    }
View Full Code Here

        accordion.getAccordionAttributeListeners().add(this);
    }

    @Override
    public int getPreferredWidth(int height) {
        Accordion accordion = (Accordion)getComponent();

        // The preferred width is the maximum unconstrained preferred width of
        // the headers and the panels, plus border
        int maxPanelHeaderWidth = 0;
        for (PanelHeader panelHeader : panelHeaders) {
            maxPanelHeaderWidth = Math.max(panelHeader.getPreferredWidth(), maxPanelHeaderWidth);
        }

        int maxPanelWidth = 0;
        for (Component panel : accordion.getPanels()) {
            maxPanelWidth = Math.max(panel.getPreferredWidth(), maxPanelWidth);
        }

        int preferredWidth = Math.max(maxPanelHeaderWidth, maxPanelWidth
            + (padding.left + padding.right + 2));
View Full Code Here

        return preferredWidth;
    }

    @Override
    public int getPreferredHeight(int width) {
        Accordion accordion = (Accordion)getComponent();

        int preferredHeight = 0;

        // The preferred height is the sum of the constrained preferred heights
        // of the headers and selected panel, plus border
        for (PanelHeader panelHeader : panelHeaders) {
            preferredHeight += panelHeader.getPreferredHeight(width) - 1;
        }

        if (width != -1) {
            width = Math.max(0, width - (padding.left + padding.right + 2));
        }

        int maxPanelHeight = 0;
        for (Component panel : accordion.getPanels()) {
            maxPanelHeight = Math.max(maxPanelHeight, panel.getPreferredHeight(width));
        }

        preferredHeight += (maxPanelHeight + padding.top + padding.bottom + 2);
View Full Code Here

        return preferredHeight;
    }

    @Override
    public Dimensions getPreferredSize() {
        Accordion accordion = (Accordion)getComponent();

        int preferredHeight = 0;

        int maxPanelHeaderWidth = 0;
        for (PanelHeader panelHeader : panelHeaders) {
            Dimensions preferredSize = panelHeader.getPreferredSize();
            maxPanelHeaderWidth = Math.max(preferredSize.width, maxPanelHeaderWidth);
            preferredHeight += preferredSize.height - 1;
        }

        int maxPanelWidth = 0;
        int maxPanelHeight = 0;

        for (Component panel : accordion.getPanels()) {
            Dimensions preferredSize = panel.getPreferredSize();
            maxPanelWidth = Math.max(preferredSize.width, maxPanelWidth);
            maxPanelHeight = Math.max(maxPanelHeight, preferredSize.height);
        }
View Full Code Here

        return baseline;
    }

    @Override
    public void layout() {
        Accordion accordion = (Accordion)getComponent();

        int width = getWidth();
        int height = getHeight();

        int contentWidth = Math.max(width - (padding.left + padding.right + 2), 0);

        // Determine the content height
        int panelHeight = 0;
        int contentHeight = 0;

        if (selectionChangeTransition == null) {
            panelHeight = height;
            for (PanelHeader panelHeader : panelHeaders) {
                panelHeader.setSize(width, panelHeader.getPreferredHeight(width));
                panelHeight -= (panelHeader.getHeight() - 1);
            }

            panelHeight = Math.max(panelHeight - 2, 0);
            contentHeight = Math.max(panelHeight - (padding.top + padding.bottom), 0);
        } else {
            panelHeight = selectionChangeTransition.toPanel.getHeight()
                + (padding.top + padding.bottom);
        }

        // Lay out the components
        Accordion.PanelSequence panels = accordion.getPanels();

        int panelY = 0;
        for (int i = 0, n = panels.getLength(); i < n; i++) {
            Component panel = panels.get(i);

            PanelHeader panelHeader = panelHeaders.get(i);
            panelHeader.setLocation(0, panelY);
            panelY += (panelHeader.getHeight() - 1);

            if (selectionChangeTransition == null) {
                Component toPanel = accordion.getSelectedPanel();

                if (panel == toPanel) {
                    panel.setVisible(true);

                    panel.setSize(contentWidth, contentHeight);
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Accordion$Attributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.