Tabnine Logo
SDimension.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.wings.SDimension
constructor

Best Java code snippets using org.wings.SDimension.<init> (Showing top 18 results out of 315)

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

/** C'tor of an invisible element. */
public SSpacer(int width, int height) {
  setPreferredSize(new SDimension(Integer.toString(width) + "px", Integer.toString(height) + "px"));
}
origin: io.github.dheid/wings

/** C'tor of an invisible element. */
public SSpacer(String width, String height) {
  setPreferredSize(new SDimension(width, height));
}
origin: org.jspresso/jspresso-wings-application

private void adjustSizes(SComponent component, IFormatter formatter,
  Object templateValue, int extraWidth) {
 int preferredWidth = computePixelWidth(component, getFormatLength(
   formatter, templateValue))
   + extraWidth;
 SDimension size = new SDimension(preferredWidth + "px", null);
 component.setPreferredSize(size);
}
origin: io.github.dheid/wings

@Override
public void setProperty(SComponent comp, String name, String value) {
  STable t = (STable) comp;
  switch (name) {
    case "GRID":
      t.setShowGrid(Boolean.valueOf(value));
      break;
    case "CELLSPACING":
      t.setIntercellSpacing(new SDimension(value, value));
      break;
    case "CELLPADDING":
      t.setIntercellPadding(new SDimension(value, value));
      break;
    case "SELECTION_FOREGROUND":
      t.setSelectionForeground(Color.decode(value));
      break;
    case "SELECTION_BACKGROUND":
      t.setSelectionBackground(Color.decode(value));
      break;
    default:
      super.setProperty(comp, name, value);
      break;
  }
}
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

/**
 * 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: org.jspresso.framework/jspresso-wings-application

/**
 * {@inheritDoc}
 */
@Override
protected void applyPreferredSize(SComponent component,
  org.jspresso.framework.util.gui.Dimension preferredSize) {
 if (preferredSize != null) {
  Integer pW = null;
  Integer pH = null;
  if (preferredSize.getWidth() > 0) {
   pW = new Integer(preferredSize.getWidth());
  }
  if (preferredSize.getHeight() > 0) {
   pH = new Integer(preferredSize.getHeight());
  }
  component.setPreferredSize(new SDimension(pW, pH));
 }
}
origin: org.jspresso.framework/jspresso-wings-components

 /**
  * Set the detailsPane section to be either visible or invisible. Set the text
  * of the Details button accordingly.
  * 
  * @param b
  *            if true detailsPane section will be visible
  */
 private void setDetailsVisible(boolean b) {
  if (b) {
   collapsedHeight = 200;
   int height;
   if (expandedHeight == 0) {
    height = collapsedHeight + 300;
   } else {
    height = expandedHeight;
   }
   detailsPanel.setVisible(true);
   detailsButton.setText(translationProvider.getTranslation("details",
     locale)
     + " <<");
   setPreferredSize(new SDimension(null, height + "px"));
  } else {
   detailsPanel.setVisible(false);
   detailsButton.setText(translationProvider.getTranslation("details",
     locale)
     + " >>");
   setPreferredSize(new SDimension(null, collapsedHeight + "px"));
  }
 }
}
origin: org.jspresso.framework/jspresso-wings-application

/**
 * {@inheritDoc}
 */
@Override
protected void adjustSizes(IViewDescriptor viewDescriptor,
  SComponent component, IFormatter formatter, Object templateValue,
  int extraWidth) {
 if (viewDescriptor.getFont() != null) {
  // must set font before computing size.
  component.setFont(createFont(viewDescriptor.getFont(),
    component.getFont()));
 }
 int preferredWidth = computePixelWidth(component,
   getFormatLength(formatter, templateValue))
   + extraWidth;
 SDimension size = new SDimension(preferredWidth + "px", null);
 component.setPreferredSize(size);
}
origin: org.jspresso.framework/jspresso-wings-components

SScrollPane detailsScrollPane = new SScrollPane(detailsPane);
detailsScrollPane.setMode(SScrollPane.MODE_COMPLETE);
detailsScrollPane.setPreferredSize(new SDimension(10, 250));
detailsPanel = new SPanel(new SGridBagLayout());
detailsPanel.add(detailsScrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0,
origin: org.jspresso/jspresso-wings-application

private SFrame createControllerFrame() {
 SFrame frame = new SFrame();
 frame
   .setPreferredSize(new SDimension(frameWidth, frameHeight/* WingsUtil.FULL_DIM_PERCENT */));
 cardPanel = new SPanel(new SCardLayout());
 cardPanel.setPreferredSize(SDimension.FULLAREA);
 frame.getContentPane().add(createApplicationMenuBar(), SBorderLayout.NORTH);
 frame.getContentPane().add(cardPanel, SBorderLayout.CENTER);
 frame.getContentPane().setPreferredSize(SDimension.FULLAREA);
 return frame;
}
origin: org.jspresso.framework/jspresso-wings-application

private void createControllerFrame() {
 controllerFrame = new SFrame();
 String w = "95%";
 String h = "768px";
 if (getFrameWidth() != null) {
  w = getFrameWidth().intValue() + "px";
 }
 if (getFrameHeight() != null) {
  h = getFrameHeight().intValue() + "px";
 }
 controllerFrame.setPreferredSize(new SDimension(w, h));
 controllerFrame.getContentPane().setPreferredSize(SDimension.FULLAREA);
 cardPanel = new SPanel(new SCardLayout());
 cardPanel.setPreferredSize(SDimension.FULLAREA);
 controllerFrame.getContentPane().add(cardPanel, SBorderLayout.CENTER);
 statusBar = new SLabel();
 statusBar.setBorder(new SLineBorder(1));
 statusBar.setVisible(false);
 controllerFrame.getContentPane().add(statusBar, BorderLayout.SOUTH);
 updateFrameTitle();
 controllerFrame.setVisible(true);
}
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: org.jspresso/jspresso-wings-application

scrollPane.setPreferredSize(new SDimension("180px", scrollPane
  .getPreferredSize().getHeight()));
IView<SComponent> view = constructView(scrollPane, viewDescriptor,
origin: org.jspresso.framework/jspresso-wings-application

scrollPane.setPreferredSize(new SDimension("180px", scrollPane
  .getPreferredSize().getHeight()));
IView<SComponent> view = constructView(scrollPane, viewDescriptor,
origin: org.jspresso.framework/jspresso-wings-application

 mainView.setPreferredSize(new SDimension(dimension.getWidth() + "px",
   dimension.getHeight() + "px"));
} else {
origin: org.jspresso/jspresso-wings-application

dialog.setPreferredSize(new SDimension(WIZARD_DIMENSION.getWidth(),
  SDimension.AUTO));
org.wingsSDimension<init>

Javadoc

Construct a new dimension with absolute values. The value is interpreted as absolute pixel values.

Popular methods of SDimension

  • getHeight
  • 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.
  • setWidth
    Sets the preferred width via an string. Expects an dimension/unit compount i.e. "120px" or "80%" but
  • setSize,
  • setWidth,
  • toString

Popular in Java

  • Creating JSON documents from java classes using gson
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • onRequestPermissionsResult (Fragment)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top PhpStorm plugins
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