Tabnine Logo
SDimension
Code IndexAdd Tabnine to your IDE (free)

How to use
SDimension
in
org.wings

Best Java code snippets using org.wings.SDimension (Showing top 20 results out of 315)

origin: io.github.dheid/wings

public String toString() {
  return "width: " + getWidth() + "; height: " + getHeight();
}
origin: io.github.dheid/wings

/**
 * Utility method that creates a dimension from a dimension string separated by comma 
 *
 * @return the create color
 */
public static SDimension makeDimension(String dimensionString) {
  if (dimensionString != null) {
    int commaIndex = dimensionString.indexOf(',');
    if (commaIndex > 0) {
      return new SDimension(dimensionString.substring(0, commaIndex),
          dimensionString.substring(commaIndex + 1));
    }
  }
  return null;
}
origin: io.github.dheid/wings

if (preferredSize != null) {
  boolean msie = isMSIE(component);
  if (msie && "px".equals(preferredSize.getWidthUnit())) {
    int oversize = calculateHorizontalOversize(component, false);
    styleString
        .append("width:")
        .append(preferredSize.getWidthInt() - oversize)
        .append("px;");
  else if (!SDimension.AUTO.equals(preferredSize.getWidthUnit()))
    styleString.append("width:").append(preferredSize.getWidth()).append(';');
  if (msie && "px".equals(preferredSize.getHeightUnit())) {
    int oversize = calculateVerticalOversize(component, false);
    styleString
        .append("height:")
        .append(preferredSize.getHeightInt() - oversize)
        .append("px;");
  else if (!SDimension.AUTO.equals(preferredSize.getHeightUnit()))
    styleString.append("height:").append(preferredSize.getHeight()).append(';');
origin: io.github.dheid/wings

public static final boolean hasDimension(final SComponent component) {
  SDimension dim = component.getPreferredSize();
  return dim != null && (dim.getHeightInt() != SDimension.AUTO_INT
              || dim.getWidthInt() != SDimension.AUTO_INT);
}
origin: io.github.dheid/wings

/**
 * Sets the preferred size of the given component. In case the component's current
 * dimension is unmodifiable (e.g. FULLAREA, FULLWIDTH, ...) a new dimension object
 * with the desired initial values is created and set for the component.
 *
 * @param component the component which needs to be changed in size
 * @param width the new width for the given component
 * @param height the new height for the given component
 */
public static void setPreferredSize(SComponent component, String width, String height) {
  try {
    component.getPreferredSize().setSize(width, height);
  } catch(UnsupportedOperationException e) {
    component.setPreferredSize(new SDimension(width, height));
  }
}
origin: io.github.dheid/wings

@Override
public void writeInternal(Device device, SComponent component) throws IOException {
  SScrollPane scrollpane = (SScrollPane) component;
  if (scrollpane.getMode() == SScrollPane.MODE_COMPLETE) {
    SDimension preferredSize = scrollpane.getPreferredSize();
    if (preferredSize == null) {
      scrollpane.setPreferredSize(new SDimension(200, 400));
    } else {
      if (preferredSize.getWidthInt() < 0) Utils.setPreferredSize(component, "200", preferredSize.getHeight());
      if (preferredSize.getHeightInt() < 0) Utils.setPreferredSize(component, preferredSize.getWidth(), "400");;
    }
    ScriptManager.getInstance().addScriptListener(new LayoutScrollPaneScript(component.getName()));
    writeContent(device, component);
  } else {
    writeContent(device, component);
  }
  
  Adjustable sb = scrollpane.getVerticalScrollBar();
  SComponent viewport = (SComponent)scrollpane.getScrollable();
  if (viewport != null && sb instanceof SScrollBar) {
    final JavaScriptDOMListener handleMouseWheel = new JavaScriptDOMListener(
        "DOMMouseScroll",
        "wingS.scrollbar.handleMouseWheel", '\'' +((SScrollBar)sb).getName()+ '\'', viewport);
    viewport.addScriptListener(handleMouseWheel);            
  }
}
origin: io.github.dheid/wings-experimental

@Override
public void writeInternal(Device device, final XRichTextEditor component) throws IOException {
  SDimension preferredSize = component.getPreferredSize();
  boolean tableWrapping = Utils.isMSIE(component) && preferredSize != null && "%".equals(preferredSize.getWidthUnit());
  if (tableWrapping) {
    String actualWidth = preferredSize.getWidth();
    Utils.setPreferredSize(component, "100%", preferredSize.getHeight());
    device.print("<table style=\"table-layout: fixed; width: " + actualWidth + "\"><tr>");
    device.print("<td style=\"padding-right: " + Utils.calculateHorizontalOversize(component, true) + "px\">");
origin: org.jspresso.framework/jspresso-wings-application

scrollPane.setPreferredSize(new SDimension("180px", scrollPane
  .getPreferredSize().getHeight()));
IView<SComponent> view = constructView(scrollPane, viewDescriptor,
  connector);
origin: io.github.dheid/wings

/**
 * @param d the device to write the code to
 * @param l the layout manager
 * @throws IOException
 */
@Override
public void write(Device d, SLayoutManager l)
    throws IOException
{
  SCardLayout cardLayout = (SCardLayout) l;
  SContainer container = l.getContainer();
  SComponent c = cardLayout.getVisibleComponent();
  SDimension preferredSize = container.getPreferredSize();
  String height = preferredSize != null ? preferredSize.getHeight() : null;
  boolean clientLayout = Utils.isMSIE(container) && height != null && !"auto".equals(height);
  if (clientLayout)
    d.print("<tr yweight=\"100\">");
  else
    openLayouterRow(d, "100%");
  openLayouterCell(d, c);
  // Just present visible component
  if (c != null) {
    c.write(d);
  }
  closeLayouterCell(d);
  closeLayouterRow(d);
}
origin: io.github.dheid/wings

String height = preferredSize != null ? preferredSize.getHeight() : null;
boolean clientLayout = height != null && Utils.isMSIE(container) && !"auto".equals(height)
  && (layout instanceof SBorderLayout || layout instanceof SGridBagLayout || layout instanceof SCardLayout);
  if (!"px".equals(preferredSize.getHeightUnit()))
    Utils.setPreferredSize(component, preferredSize.getWidth(), null);
  if (!"px".equals(preferredSize.getHeightUnit()))
    Utils.setPreferredSize(component, preferredSize.getWidth(), height);
  ScriptManager.getInstance().addScriptListener(new LayoutFillScript(component.getName()));
origin: org.jspresso/jspresso-wings-application

dialog.setPreferredSize(new SDimension(WIZARD_DIMENSION.getWidth(),
  SDimension.AUTO));
origin: io.github.dheid/wings

public void showOption(SComponent c, String title, Object message) {
  if (title != null)
    setTitle(title);
  optionData.removeAll();
  if (message instanceof SComponent) {
    optionData.add((SComponent) message);
  }
  else if (message != null) {
    StringTokenizer stringTokenizer = new StringTokenizer(message.toString(), "\n");
    while (stringTokenizer.hasMoreElements()) {
      SLabel label = new SLabel(stringTokenizer.nextElement().toString());
      if (SOptionPane.defaultSize != null &&
        SOptionPane.defaultSize.getWidthInt() != SDimension.AUTO_INT) {
        label.setWordWrap(true);
      }
      optionData.add(label);
    }
  }
  setOwner(c);
  show();
}
origin: io.github.dheid/wings

SDimension preferredSize = component.getPreferredSize();
if (preferredSize != null) {
  String widthUnit = preferredSize.getWidthUnit();
  if (!SDimension.AUTO.equals(widthUnit)) {
    if (percentageUnitOnly && !"%".equals(widthUnit))
origin: io.github.dheid/wings

int height = size != null ? size.getHeightInt() : 10;
origin: io.github.dheid/wings

boolean tableWrapping = Utils.isMSIE(component) && preferredSize != null && "%".equals(preferredSize.getWidthUnit());
String actualWidth = null;
if (tableWrapping) {
  actualWidth = preferredSize.getWidth();
  Utils.setPreferredSize(component, "100%", preferredSize.getHeight());
  device.print("<table style=\"table-layout: fixed; width: " + actualWidth + "\"><tr>");
  device.print("<td style=\"padding-right: " + Utils.calculateHorizontalOversize(component, true) + "px\">");
device.print("/>");
if (tableWrapping) {
  Utils.setPreferredSize(component, actualWidth, preferredSize.getHeight());
  device.print("</td></tr></table>");
origin: org.jspresso/jspresso-wings-application

scrollPane.setPreferredSize(new SDimension("180px", scrollPane
  .getPreferredSize().getHeight()));
IView<SComponent> view = constructView(scrollPane, viewDescriptor,
  connector);
origin: io.github.dheid/wings

String height = preferredSize != null ? preferredSize.getHeight() : null;
boolean clientLayout = Utils.isMSIE(container) && height != null && !"auto".equals(height);
origin: io.github.dheid/wings

  break;
case COMPONENT_MOVED:
  typeStr = "COMPONENT_MOVED (" + d.getWidthInt() + 'x' + d.getHeightInt()+ ')';
  break;
case COMPONENT_RESIZED:
  typeStr = "COMPONENT_RESIZED (" + d.getWidthInt() + 'x' + d.getHeightInt() + ')';
  break;
default:
origin: io.github.dheid/wings

/**
 * Sets the preferred size of the given component. In case the component's current
 * dimension is unmodifiable (e.g. FULLAREA, FULLWIDTH, ...) a new dimension object
 * with the desired initial values is created and set for the component.
 *
 * @param component the component which needs to be changed in size
 * @param width the new width for the given component
 * @param height the new height for the given component
 */
public static void setPreferredSize(SComponent component, int width, int height) {
  try {
    component.getPreferredSize().setSize(width, height);
  } catch(UnsupportedOperationException e) {
    component.setPreferredSize(new SDimension(width, height));
  }
}
origin: io.github.dheid/wings

public SDimension(SDimension dim) {
  this(dim.getWidth(), dim.getHeight());
}
org.wingsSDimension

Javadoc

Holds preferred component sizes (dimensions).

Web browsers support different notations for sizes. Absolute pixel values, realtive percentages (of the available viewport) and special CSS values as 'inherit' and 'auto' (Default). This class if capable of handling all these cases.

Most used methods

  • getHeight
  • <init>
  • getWidth
  • getHeightInt
    Get just the height as number without trailing unit.
  • getWidthInt
    Get just the width as number without trailing unit.
  • getWidthUnit
  • equals
  • extractNumericValue
    Extract number from string.
  • extractUnit
    Tries to extract unit from passed string. I.e. returtn "px" if you pass "120px".
  • getHeightUnit
  • setHeight
    Sets the preferred height via an string. Expects an dimension/unit compount i.e. "120px" or "80%" bu
  • setSize
    Set the size of this Dimension object to the specified width and height.
  • setHeight,
  • setSize,
  • setWidth,
  • toString

Popular in Java

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • startActivity (Activity)
  • setContentView (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Notification (javax.management)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now