private boolean fitsInBounds(final Rectangle rect) {
   final Container container = getParent();
   if (container instanceof JViewport) {
     final Container scrollPane = container.getParent();
     if (scrollPane instanceof JScrollPane) {
       final Rectangle rectangle =
           SwingUtilities.convertRectangle(this, rect, scrollPane.getParent());
       return scrollPane.getBounds().contains(rectangle);
     }
   }
   return true;
 }
  private int checkSetSizesFromParent(Container container, Insets insets) {
    int skipLayout = 0;
    GridLayoutManager parentGridLayout = null;
    GridConstraints parentGridConstraints = null;
    Container parent = container.getParent();
    if (parent != null) {
      if (parent.getLayout() instanceof GridLayoutManager) {
        parentGridLayout = (GridLayoutManager) parent.getLayout();
        parentGridConstraints = parentGridLayout.getConstraintsForComponent(container);
      } else {
        Container col = parent.getParent();
        if (col != null && col.getLayout() instanceof GridLayoutManager) {
          parentGridLayout = (GridLayoutManager) col.getLayout();
          parentGridConstraints = parentGridLayout.getConstraintsForComponent(parent);
        }
      }
    }

    if (parentGridLayout != null && parentGridConstraints.isUseParentLayout()) {
      int i;
      if (this.myRowStretches.length == parentGridConstraints.getRowSpan()) {
        int row = parentGridConstraints.getRow();
        this.myYs[0] = insets.top + this.myMargin.top;
        this.myHeights[0] = parentGridLayout.myHeights[row] - this.myYs[0];

        for (i = 1; i < this.myRowStretches.length; ++i) {
          this.myYs[i] = parentGridLayout.myYs[i + row] - parentGridLayout.myYs[row];
          this.myHeights[i] = parentGridLayout.myHeights[i + row];
        }

        this.myHeights[this.myRowStretches.length - 1] -= insets.bottom + this.myMargin.bottom;
        skipLayout |= 1;
      }

      if (this.myColumnStretches.length == parentGridConstraints.getColSpan()) {
        int column = parentGridConstraints.getColumn();
        this.myXs[0] = insets.left + this.myMargin.left;
        this.myWidths[0] = parentGridLayout.myWidths[column] - this.myXs[0];

        for (i = 1; i < this.myColumnStretches.length; ++i) {
          this.myXs[i] = parentGridLayout.myXs[i + column] - parentGridLayout.myXs[column];
          this.myWidths[i] = parentGridLayout.myWidths[i + column];
        }

        this.myWidths[this.myColumnStretches.length - 1] -= insets.right + this.myMargin.right;
        skipLayout |= 2;
      }
    }

    return skipLayout;
  }
 public static Container getRootContainer(Component c) {
   if (c == null) {
     return null;
   }
   Container parent = c.getParent();
   while ((parent != null)
       && !(parent instanceof JPopupMenu)
       && !(parent instanceof JInternalFrame)
       && !(parent instanceof Window)
       && (parent.getParent() != null)) {
     parent = parent.getParent();
   }
   return parent;
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFInternetDomainBaseObj focus = getSwingFocusAsDomainBase();
   if (focus != null) {
     ICFInternetDomainBaseEditObj editObj = (ICFBamDomainBaseEditObj) focus.getEdit();
     if (editObj != null) {
       focus = editObj;
     }
     JInternalFrame frame = null;
     Container cont;
     JDesktopPane desktop;
     ICFBamTenantObj referencedObj =
         (ICFBamTenantObj) focus.getRequiredOwnerTenant(swingIsInitializing);
     if (referencedObj != null) {
       String classCode = referencedObj.getClassCode();
       if ("TENT".equals(classCode)) {
         frame = swingSchema.getTenantFactory().newViewEditJInternalFrame(referencedObj);
         cont = getParent();
         while ((cont != null) && (!(cont instanceof JInternalFrame))) {
           cont = cont.getParent();
         }
         if (cont != null) {
           JInternalFrame myInternalFrame = (JInternalFrame) cont;
           myInternalFrame.getDesktopPane().add(frame);
           frame.setVisible(true);
           frame.show();
         }
       } else {
         throw CFLib.getDefaultExceptionFactory()
             .newUnsupportedClassException(
                 getClass(), S_ProcName, "swingFocus", focus, "ICFBamTenantObj");
       }
     }
   }
 }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   FinderTableModel model = getDataModel();
   ICFSecurityISOTimezoneObj o =
       (ICFSecurityISOTimezoneObj) model.getValueAt(row, COLID_ROW_HEADER);
   if (o == null) {
     return;
   }
   JInternalFrame frame = swingSchema.getISOTimezoneFactory().newViewEditJInternalFrame(o);
   ((ICFSecuritySwingISOTimezoneJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   if (frame == null) {
     return;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFAccSchemaObj schemaObj = swingSchema.getSchema();
   if (schemaObj == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj");
   }
   ICFSecurityServiceObj selectedInstance = getSwingFocusAsService();
   if (selectedInstance != null) {
     String classCode = selectedInstance.getClassCode();
     if ("HSVC".equals(classCode)) {
       JInternalFrame frame =
           swingSchema.getServiceFactory().newAskDeleteJInternalFrame(selectedInstance);
       ((ICFAccSwingServiceJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
       frame.addInternalFrameListener(getViewEditInternalFrameListener());
       Container cont = getParent();
       while ((cont != null) && (!(cont instanceof JInternalFrame))) {
         cont = cont.getParent();
       }
       if (cont != null) {
         JInternalFrame myInternalFrame = (JInternalFrame) cont;
         myInternalFrame.getDesktopPane().add(frame);
         frame.setVisible(true);
         frame.show();
       }
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFAccServiceObj");
     }
   }
 }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   PickerTableModel model = getDataModel();
   ICFInternetISOCountryObj o =
       (ICFInternetISOCountryObj) model.getValueAt(row, COLID_ROW_HEADER);
   invokeWhenChosen.choseISOCountry(o);
   try {
     Container cont = getParent();
     while ((cont != null) && (!(cont instanceof JInternalFrame))) {
       cont = cont.getParent();
     }
     if (cont != null) {
       ((JInternalFrame) cont).setClosed(true);
     }
   } catch (Exception x) {
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame frame = (JInternalFrame) cont;
     if (frame instanceof ICFSecuritySwingISOCurrencyJPanelCommon) {
       ICFSecuritySwingISOCurrencyJPanelCommon jpanelCommon =
           (ICFSecuritySwingISOCurrencyJPanelCommon) frame;
       jpanelCommon.setPanelMode(CFJPanel.PanelMode.Unknown);
       ICFSecurityISOCurrencyEditObj editObj =
           (ICFSecurityISOCurrencyEditObj) jpanelCommon.getSwingFocusAsISOCurrency().getEdit();
       if (editObj != null) {
         editObj.endEdit();
       }
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(),
               S_ProcName,
               "frame",
               frame,
               "ICFSecuritySwingISOCurrencyJPanelCommon");
     }
     try {
       frame.setClosed(true);
     } catch (Exception x) {
     }
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFBamSchemaObj schemaObj = swingSchema.getSchema();
   ICFBamAuditActionObj obj =
       (ICFBamAuditActionObj) schemaObj.getAuditActionTableObj().newInstance();
   JInternalFrame frame = swingSchema.getAuditActionFactory().newViewEditJInternalFrame(obj);
   frame.addInternalFrameListener(getViewEditInternalFrameListener());
   ICFBamAuditActionEditObj edit = (ICFBamAuditActionEditObj) (obj.beginEdit());
   if (edit == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "edit");
   }
   ICFBamSwingAuditActionJPanelCommon jpanelCommon = (ICFBamSwingAuditActionJPanelCommon) frame;
   jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add);
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame frame = (JInternalFrame) cont;
     if (frame instanceof ICFSecuritySwingSecGroupFormJPanelCommon) {
       ICFSecuritySwingSecGroupFormJPanelCommon jpanelCommon =
           (ICFSecuritySwingSecGroupFormJPanelCommon) frame;
       jpanelCommon.setPanelMode(CFJPanel.PanelMode.Delete);
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(),
               S_ProcName,
               "frame",
               frame,
               "ICFSecuritySwingSecGroupFormJPanelCommon");
     }
     try {
       frame.setClosed(true);
     } catch (Exception x) {
     }
   }
 }
 private void disposeAndUpdate(boolean update) {
   if (myView != null) {
     boolean visible = myView.isVisible();
     myView.setVisible(false);
     Container container = myContent.getParent();
     if (container != null) {
       container.remove(myContent);
     }
     if (myView instanceof Window) {
       myViewBounds = myView.getBounds();
       Window window = (Window) myView;
       if (!push(UIUtil.getWindow(myOwner), window)) {
         window.dispose();
       }
     } else {
       Container parent = myView.getParent();
       if (parent == null) {
         myViewBounds = new Rectangle(myContent.getPreferredSize());
       } else {
         myViewBounds = new Rectangle(myView.getBounds());
         parent.remove(myView);
         Point point = new Point(myViewBounds.x, myViewBounds.y);
         SwingUtilities.convertPointToScreen(point, parent);
         myViewBounds.x = point.x;
         myViewBounds.y = point.y;
       }
     }
     myView = null;
     if (update && visible) {
       setVisible(true);
     }
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFInternetSchemaObj schemaObj = swingSchema.getSchema();
   ICFInternetMajorVersionObj obj =
       (ICFInternetMajorVersionObj) schemaObj.getMajorVersionTableObj().newInstance();
   JInternalFrame frame = swingSchema.getMajorVersionFactory().newViewEditJInternalFrame(obj);
   frame.addInternalFrameListener(getViewEditInternalFrameListener());
   ICFInternetMajorVersionEditObj edit = (ICFInternetMajorVersionEditObj) (obj.beginEdit());
   if (edit == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "edit");
   }
   ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
   edit.setRequiredOwnerTenant(secTenant);
   ICFInternetRealProjectObj container = (ICFInternetRealProjectObj) (getSwingContainer());
   if (container == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "SwingContainer");
   }
   edit.setRequiredContainerParent(container);
   ICFInternetSwingMajorVersionJPanelCommon jpanelCommon =
       (ICFInternetSwingMajorVersionJPanelCommon) frame;
   jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add);
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 /** Return the root container (ie Frame) of this component. */
 public Container getRootParent() {
   Container c = getParent(), prev = null;
   while (c != null) {
     prev = c;
     c = c.getParent();
   }
   return prev;
 }
Beispiel #14
0
 /** Find the hosting frame, for the file-chooser dialog. */
 protected Frame getFrame() {
   for (Container p = getParent(); p != null; p = p.getParent()) {
     if (p instanceof Frame) {
       return (Frame) p;
     }
   }
   return null;
 }
 @NotNull
 private String logSwingPath() {
   //noinspection HardCodedStringLiteral
   final StringBuilder buffer = new StringBuilder("Components hierarchy:\n");
   for (Container c = this; c != null; c = c.getParent()) {
     buffer.append('\n');
     buffer.append(c);
   }
   return buffer.toString();
 }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   ListTableModel model = getDataModel();
   ICFInternetVersionObj o = (ICFInternetVersionObj) model.getValueAt(row, COLID_ROW_HEADER);
   if (o == null) {
     return;
   }
   JInternalFrame frame = null;
   String classCode = o.getClassCode();
   if (classCode.equals("VERN")) {
     frame = swingSchema.getVersionFactory().newViewEditJInternalFrame(o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else if (classCode.equals("MJVR")) {
     frame =
         swingSchema
             .getMajorVersionFactory()
             .newViewEditJInternalFrame((ICFInternetMajorVersionObj) o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingMajorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else if (classCode.equals("MNVR")) {
     frame =
         swingSchema
             .getMinorVersionFactory()
             .newViewEditJInternalFrame((ICFInternetMinorVersionObj) o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingMinorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else {
     frame = null;
   }
   if (frame == null) {
     return;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 public void actionPerformed(ActionEvent e) {
   try {
     Container cont = getParent();
     while ((cont != null) && (!(cont instanceof JInternalFrame))) {
       cont = cont.getParent();
     }
     if (cont != null) {
       ((JInternalFrame) cont).setClosed(true);
     }
   } catch (Exception x) {
   }
 }
Beispiel #18
0
 public void fokusniSe() {
   Container panel = null;
   for (Container comp = this; comp != null; comp = comp.getParent()) {
     if (comp instanceof JTabbedPane) {
       final JTabbedPane tabpane = (JTabbedPane) comp;
       tabpane.setSelectedComponent(panel);
       break;
     }
     panel = comp;
   }
   jtext.requestFocus();
 }
Beispiel #19
0
  /**
   * Convenience method for searching above the given component in the component hierarchy and
   * returns the first object of the given type it finds, or <code>null</code> if no such parent was
   * found.
   *
   * <p>The reason this method exists is for tidyness of the calling code, as no longer a explicit
   * cast is needed.
   *
   * @param aType the type of the parent to find, cannot be <code>null</code>;
   * @param aComponent the component to search in the hierarchy, cannot be <code>null</code>.
   * @return the requested ancestor, or <code>null</code> if not found.
   * @see SwingUtilities#getAncestorOfClass(Class, Component)
   */
  @SuppressWarnings("unchecked")
  public static <T> T getAncestorOfClass(final Class<T> aType, final Component aComponent) {
    if ((aComponent == null) || (aType == null)) {
      return null;
    }

    Container parent = aComponent.getParent();
    while ((parent != null) && !(aType.isInstance(parent))) {
      parent = parent.getParent();
    }

    return (T) parent;
  }
  private static int getDesignTimeInsets(Container container) {
    for (; container != null; container = container.getParent()) {
      if (container instanceof JComponent) {
        Integer designTimeInsets =
            (Integer) ((JComponent) container).getClientProperty(DESIGN_TIME_INSETS);
        if (designTimeInsets != null) {
          return designTimeInsets;
        }
      }
    }

    return 0;
  }
 public void actionPerformed(ActionEvent e) {
   swingSchema.setKeyStore(null);
   CFBamSwingMainJFrame mainJFrame = null;
   {
     Container cont = getParent();
     while ((cont != null) && (!(cont instanceof CFBamSwingMainJFrame))) {
       cont = cont.getParent();
     }
     if (cont != null) {
       mainJFrame = (CFBamSwingMainJFrame) cont;
       mainJFrame.exitApplication();
     }
   }
 }
 public void valueChanged(ListSelectionEvent lse) {
   final String S_ProcName = "valueChanged";
   ICFSecurityISOTimezoneObj selectedObj;
   if (lse.getValueIsAdjusting()) {
     return;
   }
   if (dataTable == null) {
     return;
   }
   int dataRow = dataTable.getSelectedRow();
   int modelIndex = dataTable.convertRowIndexToModel(dataRow);
   FinderTableModel tblDataModel = getDataModel();
   Object selectedRowData = tblDataModel.getValueAt(modelIndex, COLID_ROW_HEADER);
   if (selectedRowData != null) {
     if (selectedRowData instanceof ICFSecurityISOTimezoneObj) {
       int selectedCount = dataTable.getSelectedRowCount();
       if (selectedCount <= 0) {
         selectedObj = null;
       } else if (selectedCount == 1) {
         selectedObj = (ICFSecurityISOTimezoneObj) selectedRowData;
       } else {
         selectedObj = null;
       }
     } else {
       selectedObj = null;
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(),
               S_ProcName,
               "selectedRowData",
               selectedRowData,
               "ICFSecurityISOTimezoneObj");
     }
   } else {
     selectedObj = null;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof CFJInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     CFJInternalFrame frame = (CFJInternalFrame) cont;
     if (frame instanceof ICFSecuritySwingISOTimezoneJPanelCommon) {
       ICFSecuritySwingISOTimezoneJPanelCommon jpanelCommon =
           (ICFSecuritySwingISOTimezoneJPanelCommon) frame;
       jpanelCommon.setSwingFocus(selectedObj);
     }
   }
 }
 void this_mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 1) {
     int row = this.getSelectedRow();
     ItemTableDwnld item = (ItemTableDwnld) getMessageList().get(row);
     Container parent = (Container) this;
     while ((parent != null) && !(parent instanceof FrmMain)) parent = parent.getParent();
     if (parent != null) {
       ((FrmMain) parent).setTxtName(item.getTextName());
       ((FrmMain) parent).setTxtTextStart(item.getTextStart());
       ((FrmMain) parent).setTxtTextEnd(item.getTextEnd());
       ((FrmMain) parent).setTxtPath(item.getTextPath());
       ((FrmMain) parent).setCboxType(item.getTextType());
       ((FrmMain) parent).enableBtnUpDown(row);
     }
   }
 }
 public void actionPerformed(ActionEvent e) {
   if (fileChooser == null) {
     fileChooser = new JFileChooser();
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JDesktopPane))) {
     cont = cont.getParent();
   }
   int retval = fileChooser.showOpenDialog(cont);
   if (retval == JFileChooser.APPROVE_OPTION) {
     File chosen = fileChooser.getSelectedFile();
     if (chosen != null) {
       String path = chosen.getAbsolutePath();
       textFileName.setText(path);
     }
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFInternetSchemaObj schemaObj = swingSchema.getSchema();
   if (schemaObj == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj");
   }
   invokeWhenChosen.choseISOCountry(null);
   try {
     Container cont = getParent();
     while ((cont != null) && (!(cont instanceof JInternalFrame))) {
       cont = cont.getParent();
     }
     if (cont != null) {
       ((JInternalFrame) cont).setClosed(true);
     }
   } catch (Exception x) {
   }
 }
  @Nullable
  private static Container getContainer(@Nullable final Component focusOwner) {
    if (focusOwner == null) return null;
    if (focusOwner.isLightweight()) {
      Container container = focusOwner.getParent();
      while (container != null) {
        final Container parent = container.getParent();
        if (parent instanceof JLayeredPane) break;
        if (parent != null && parent.isLightweight()) {
          container = parent;
        } else {
          break;
        }
      }
      return container;
    }

    return SwingUtilities.windowForComponent(focusOwner);
  }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFFreeSwitchSchemaObj schemaObj = swingSchema.getSchema();
   if (schemaObj == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj");
   }
   ICFSecurityTSecGroupMemberObj selectedInstance = getSwingFocusAsTSecGroupMember();
   invokeWhenChosen.choseTSecGroupMember(selectedInstance);
   try {
     Container cont = getParent();
     while ((cont != null) && (!(cont instanceof JInternalFrame))) {
       cont = cont.getParent();
     }
     if (cont != null) {
       ((JInternalFrame) cont).setClosed(true);
     }
   } catch (Exception x) {
   }
 }
 public void setVisible(boolean visible) {
   if (!visible && myView != null) {
     disposeAndUpdate(false);
   } else if (visible && myView == null) {
     Window owner = UIUtil.getWindow(myOwner);
     if (owner != null) {
       if (myHeavyWeight) {
         Window view = pop(owner);
         if (view == null) {
           view = new JWindow(owner);
           setPopupType(view);
         }
         setAlwaysOnTop(view, myAlwaysOnTop);
         setWindowFocusable(view, myWindowFocusable);
         setWindowShadow(view, myWindowShadow);
         myView = view;
       } else if (owner instanceof RootPaneContainer) {
         JLayeredPane parent = ((RootPaneContainer) owner).getLayeredPane();
         if (parent != null) {
           JPanel view = new JPanel(new BorderLayout());
           view.setVisible(false);
           parent.add(view, JLayeredPane.POPUP_LAYER, 0);
           myView = view;
         }
       }
     }
     if (myView != null) {
       myView.add(myContent);
       Component parent = myView instanceof Window ? null : myView.getParent();
       if (parent != null) {
         Point location = myViewBounds.getLocation();
         SwingUtilities.convertPointFromScreen(location, parent);
         myViewBounds.setLocation(location);
       }
       myView.setBackground(UIUtil.getLabelBackground());
       myView.setBounds(myViewBounds);
       myView.setVisible(true);
       myViewBounds = null;
     }
   }
 }
Beispiel #29
0
 private void configureEnclosingScrollPaneUI() {
   final Container p = getParent();
   if (p instanceof JViewport) {
     final Container gp = p.getParent();
     if (gp instanceof JScrollPane) {
       final JScrollPane scrollPane = (JScrollPane) gp;
       // Make certain we are the viewPort's view and not, for
       // example, the rowHeaderView of the scrollPane -
       // an implementor of fixed columns might do this.
       final JViewport viewport = scrollPane.getViewport();
       if (viewport == null || viewport.getView() != this) {
         return;
       }
       //  scrollPane.getViewport().setBackingStoreEnabled(true);
       //                Border border = scrollPane.getBorder ();
       //                if ( border == null || border instanceof UIResource )
       //                {
       //                    Border scrollPaneBorder = UIManager.getBorder (
       // "Table.scrollPaneBorder" );
       //                    if ( scrollPaneBorder != null )
       //                    {
       //                        scrollPane.setBorder ( scrollPaneBorder );
       //                    }
       //                }
       // add JScrollBar corner component if available from LAF and not already set by the user
       Component corner = scrollPane.getCorner(JScrollPane.UPPER_TRAILING_CORNER);
       if (corner == null || corner instanceof UIResource) {
         corner = null;
         final Object componentClass = UIManager.get("Table.scrollPaneCornerComponent");
         if (componentClass instanceof Class) {
           try {
             corner = (Component) ((Class) componentClass).newInstance();
           } catch (final Exception e) {
             // just ignore and don't set corner
           }
         }
         scrollPane.setCorner(JScrollPane.UPPER_TRAILING_CORNER, corner);
       }
     }
   }
 }
 private void setBounds(Point location, Dimension size) {
   if (myView != null) {
     if (size == null) {
       size = myView.getSize();
     }
     if (location == null) {
       location = myView.getLocation();
     } else {
       Component parent = myView instanceof Window ? null : myView.getParent();
       if (parent != null) {
         SwingUtilities.convertPointFromScreen(location, parent);
       }
     }
     myView.setBounds(location.x, location.y, size.width, size.height);
     if (myView.isVisible()) {
       myView.invalidate();
       myView.validate();
       myView.repaint();
     }
   }
 }