Package edu.wpi.first.smartdashboard.gui.layout.LayoutAllocator

Examples of edu.wpi.first.smartdashboard.gui.layout.LayoutAllocator.LayoutAllocation


        this.addComponentListener(new ComponentListener() {

            // Whenever a component is resized
            public void componentResized(ComponentEvent e) {
                if(thisDisplayElement.getLayoutAllocation() != null) {
                    LayoutAllocation oldLa = thisDisplayElement.getLayoutAllocation();
                    oldLa.deallocate();

                    // Try to re-allocate the same location with the new size
                    LayoutAllocation newLa = LayoutAllocator.allocate(oldLa.point,
                                                                      thisDisplayElement.getWidth(),
                                                                      thisDisplayElement.getHeight());

                    if(newLa == null) {
                        // Try to get a completely new allocation
View Full Code Here


          if ("main".equalsIgnoreCase(strp)) {
            x += CAMERA_PANEL_WIDTH; // main panel is shifted over.
          }
          Point loc = new Point();
          loc.setLocation(x, y);
          LayoutAllocation la = LayoutAllocator.forceAllocate(loc, size.width, size.height);
          if (la != null) {
            elem.setLayoutAllocation(la);
            m_elemPanel.add(elem);
            elem.setSize(size.width, size.height);
            elem.setLocation(la.point);
            m_elemPanel.revalidate();
            m_elemPanel.repaint();
          } else {
            elem.disconnect();
            System.err
                .println("Unable to allocate new DisplayElement of width "
                    + size.width
                    + " pixels and height "
                    + size.height + " pixels.");
          }
       
        }
        else if (props == null || props.size()==0) {
         
        Dimension size = elem.getPreferredSize();

        LayoutAllocation la = LayoutAllocator.allocate(size.width,
            size.height);
        if (la != null) {
          elem.setLayoutAllocation(la);
          m_elemPanel.add(elem);
          elem.setSize(size.width, size.height);
View Full Code Here

        // This code assumes that dragTargetDE.getLayoutAllocation()
        // will never be null since
        // objects are put on the screen (and are this draggable) only
        // if they were assigned an allocation
        LayoutAllocation newLa = LayoutAllocator.forceMoveAllocation(
            dragTargetDE.getLayoutAllocation(), newLocation);
        dragTargetDE.setLayoutAllocation(newLa);
        dragTargetDE.setLocation(newLa.point);
      }
      dragging = false;
View Full Code Here

TOP

Related Classes of edu.wpi.first.smartdashboard.gui.layout.LayoutAllocator.LayoutAllocation

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.