Examples of LayoutStyle


Examples of org.dyno.visual.swing.layouts.LayoutStyle

  }

  private List<Quartet> getTConAnchor(JComponent todrop, Point this_point) {
    Insets insets = container.getInsets();
    int ty = this_point.y;
    LayoutStyle style = LayoutStyle.getInstance();
    int north = style.getContainerGap(todrop, SwingConstants.NORTH, container);
    int w = container.getWidth();
    if (Math.abs(ty - insets.top) < THRESHOLD_DISTANCE) {
      List<Quartet> list = new ArrayList<Quartet>();
      Quartet trio = new Quartet(insets.top, insets.top, insets.left, w - insets.right, new HorizontalLeadingContainerAnchor(container));
      list.add(trio);
View Full Code Here

Examples of org.dyno.visual.swing.layouts.LayoutStyle

      return list;
    } else
      return null;
  }
  private List<Quartet> getBAnchor(JComponent todrop, JComponent target, Point this_point) {
    LayoutStyle style = LayoutStyle.getInstance();
    int nr = style.getPreferredGap(todrop, target, ComponentPlacement.RELATED, SwingConstants.NORTH, container);
    int nu = style.getPreferredGap(todrop, target, ComponentPlacement.UNRELATED, SwingConstants.NORTH, container);
    int nm = nr + nu;
    int sr = style.getPreferredGap(todrop, target, ComponentPlacement.RELATED, SwingConstants.SOUTH, container);
    int su = style.getPreferredGap(todrop, target, ComponentPlacement.UNRELATED, SwingConstants.SOUTH, container);
    int sm = sr + su;
    int ty = target.getY();
    int tby = target.getY() + target.getHeight();
    nr = ty - nr;
    nu = ty - nu;
View Full Code Here

Examples of org.dyno.visual.swing.layouts.LayoutStyle

  protected Alignment createVerticalLeading(Component me, Rectangle bounds, Container parent) {
    int min = Integer.MIN_VALUE;
    int pref = Integer.MIN_VALUE;
    int count = parent.getComponentCount();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    for (int i = 0; i < count; i++) {
      Component target = parent.getComponent(i);
      Constraints constraints = layout.getConstraints(target);
      Rectangle targetBounds = target.getBounds();
      if (constraints != null && isOverlap(bounds.x, bounds.width, targetBounds.x, targetBounds.width)) {
        Alignment vertical = constraints.getVertical();
        Dimension prefs = target.getPreferredSize();
        Dimension mins = target.getMinimumSize();
        if (vertical instanceof Trailing) {
          int gap = layoutStyle.getPreferredGap((JComponent) target, (JComponent) me, ComponentPlacement.UNRELATED, SwingConstants.NORTH, parent);
          Trailing trailing = (Trailing) vertical;
          int pref_size = trailing.getSize() == Alignment.PREFERRED ? prefs.height : trailing.getSize();
          int min_size = pref_size > mins.height ? mins.height : pref_size;
          int actual = gap + min_size + trailing.getTrailing();
          if (actual > min)
            min = actual;
          actual = gap + pref_size + trailing.getTrailing();
          if (actual > pref)
            pref = actual;
        } else if (vertical instanceof Bilateral) {
          int gap = layoutStyle.getPreferredGap((JComponent) target, (JComponent) me, ComponentPlacement.RELATED, SwingConstants.NORTH, parent);
          Bilateral bilateral = (Bilateral) vertical;
          int actual = gap + mins.height + bilateral.getTrailing();
          if (actual > min)
            min = actual;
          actual = gap + prefs.height + bilateral.getTrailing();
          if (actual > pref)
            pref = actual;
        }
      }
    }
    int gap = layoutStyle.getContainerGap((JComponent) me, SwingConstants.SOUTH, parent);
    if (gap > min)
      min = gap;
    if (gap > pref)
      pref = gap;
    Spring spring = new Spring(min, pref);
View Full Code Here

Examples of org.jdesktop.layout.LayoutStyle

                NbBundle.getMessage(bundleLocation, title),
                JOptionPane.WARNING_MESSAGE);
    }

    public static JComponent addContainerBorder(JComponent comp) {
        final LayoutStyle layoutStyle = LayoutStyle.getSharedInstance();

        JPanel panel = new JPanel();
        panel.add(comp);
        panel.setBorder(BorderFactory.createEmptyBorder(
                layoutStyle.getContainerGap(comp, SwingConstants.NORTH, null),
                layoutStyle.getContainerGap(comp, SwingConstants.WEST, null),
                layoutStyle.getContainerGap(comp, SwingConstants.SOUTH, null),
                layoutStyle.getContainerGap(comp, SwingConstants.EAST, null)));
        return panel;
    }
View Full Code Here

Examples of org.jfree.layouting.layouter.context.LayoutStyle

  {
    this.globalX = globalX;
    this.globalY = globalY;
    this.pageContext = pageContext;

    final LayoutStyle areaDefinition =
        pageContext.getAreaDefinition(PageAreaType.CONTENT);
    final CSSValue pageValue = areaDefinition.getValue(PageStyleKeys.SIZE);
    final PageSize pageSize = PageGridUtility.lookupPageSize(pageValue, metaData);

    this.width = StrictGeomUtility.toInternalValue(pageSize.getWidth());
    this.height = StrictGeomUtility.toInternalValue(pageSize.getHeight());

    final CSSValue marginTopValue =
        areaDefinition.getValue(BoxStyleKeys.MARGIN_TOP);
    final CSSValue marginLeftValue =
        areaDefinition.getValue(BoxStyleKeys.MARGIN_LEFT);
    final CSSValue marginBottomValue =
        areaDefinition.getValue(BoxStyleKeys.MARGIN_BOTTOM);
    final CSSValue marginRightValue =
        areaDefinition.getValue(BoxStyleKeys.MARGIN_RIGHT);

    final long marginTop = computeWidth(marginTopValue, metaData).resolve(width);
    final long marginLeft  = computeWidth(marginLeftValue, metaData).resolve(width);
    final long marginBottom = computeWidth(marginBottomValue, metaData).resolve(width);
    final long marginRight = computeWidth(marginRightValue, metaData).resolve(width);
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.dom.LayoutStyle

   */
  public void resolve (final DocumentContext process,
                       final LayoutElement currentNode,
                       final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, 1));
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.dom.LayoutStyle

   */
  public void resolve (final DocumentContext process,
                       final LayoutElement element,
                       final StyleKey key)
  {
    final LayoutStyle layoutContext = element.getLayoutStyle();
    final ContentSpecification contentSpecification =
        (ContentSpecification) layoutContext.getValue(InternalStyleKeys.INTERNAL_CONTENT);
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant)
    {
      if (ContentValues.NONE.equals(value))
      {
        contentSpecification.setStrings(XAlternateTextResolveHandler.DEFAULT_CONTENT);
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.dom.LayoutStyle

   */
  public void resolve(final DocumentContext process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    CSSStringValue lineEllipsis = null;
    CSSStringValue blockEllipsis = null;
    if (value instanceof CSSValueList)
    {
      final CSSValueList vlist = (CSSValueList) value;
      if (vlist.getLength() == 2)
      {
        lineEllipsis = filterString(vlist.getItem(0));
        blockEllipsis = filterString(vlist.getItem(1));
      }
      else if (vlist.getLength() == 1)
      {
        lineEllipsis = filterString(vlist.getItem(0));
        blockEllipsis = filterString(vlist.getItem(0));
      }
    }
    if (lineEllipsis == null)
    {
      lineEllipsis = new CSSStringValue(CSSStringType.STRING, "..");
    }
    if (blockEllipsis == null)
    {
      blockEllipsis = new CSSStringValue(CSSStringType.STRING, "..");
    }

    layoutContext.setValue(TextStyleKeys.X_BLOCK_TEXT_OVERFLOW_ELLIPSIS, blockEllipsis);
    layoutContext.setValue(TextStyleKeys.X_LINE_TEXT_OVERFLOW_ELLIPSIS, lineEllipsis);
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.dom.LayoutStyle

  public void resolve(final DocumentContext process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant == false)
    {
      // fine, we're done here ...
      return;
    }

    final LayoutOutputMetaData metaData = process.getOutputMetaData();
    final int resolution = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);

    final CSSConstant constant = (CSSConstant) value;
    final LayoutElement parent = currentNode.getParentLayoutElement();
    if (parent != null)
    {
      final CSSValue parentFontSizeValue = parent.getLayoutStyle().getValue(FontStyleKeys.FONT_SIZE);

      final double parentFontSize = StyleSheetUtility.convertLengthToDouble(parentFontSizeValue, resolution);
      if (RelativeFontSize.LARGER.equals(value))
      {
        final double scaleFactor = getScaleLargerFactor(parentFontSize);
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor));
        return;
      }

      if (RelativeFontSize.SMALLER.equals(value))
      {
        final double scaleFactor = getScaleSmallerFactor(parentFontSize);
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor));
        return;
      }
    }
    else
    {
      // we might not have a parent, but that won't stop us ..
      if (RelativeFontSize.LARGER.equals(value))
      {
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 120));
        return;
      }

      if (RelativeFontSize.SMALLER.equals(value))
      {
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 85));
        return;
      }
    }

    final CSSValue resolvedValue = lookupValue(constant);
    if (resolvedValue != null)
    {
      layoutContext.setValue(key, resolvedValue);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.dom.LayoutStyle

   */
  public void resolve(final DocumentContext process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    final int fontWeight;
    if (FontWeight.BOLD.equals(value))
    {
      // ask the parent ...
      fontWeight = 700;
    }
    else if (FontWeight.NORMAL.equals(value))
    {
      // ask the parent ...
      fontWeight = 400;
    }
    else if (FontWeight.BOLDER.equals(value))
    {
      final int parentFontWeight = queryParent(currentNode.getParentLayoutElement());
      fontWeight = Math.max (900, parentFontWeight + 100);
    }
    else if (FontWeight.LIGHTER.equals(value))
    {
      final int parentFontWeight = queryParent(currentNode.getParentLayoutElement());
      fontWeight = Math.min (100, parentFontWeight - 100);
    }
    else if (value instanceof CSSNumericValue)
    {
      final CSSNumericValue nval = (CSSNumericValue) value;
      if (CSSNumericType.NUMBER.equals(nval.getType()) == false)
      {
        // preserve the parent's weight...
        fontWeight = queryParent(currentNode.getParentLayoutElement());
      }
      else
      {
        fontWeight = (int) nval.getValue();
      }
    }
    else
    {
      fontWeight = queryParent(currentNode.getParentLayoutElement());
    }

    layoutContext.setValue(FontStyleKeys.FONT_WEIGHT, CSSNumericValue.createValue(CSSNumericType.NUMBER, fontWeight));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.