protected static int cellOversize(SGridBagLayout layout, Insets insets) { return insets.top + insets.bottom + layout.getBorder(); } }
/** * Copy and paste extracted method to determine an optional row height of the passed row. * Was necessary to avoid a rendering bug with Gecko engines leading to a messed up layout. * Refer to http://jira.j-wings.org/browse/WGS-120 * * @param layout The gridbaglayout * @param row The row * @return Row height percentage as int or 0 */ protected int determineRowHeight(SGridBagLayout layout, int row) { final SGridBagLayout.Grid grid = layout.getGrid(); int rowHeight = 0; for (int col = grid.firstCol; col < grid.cols; col++) { SComponent comp = grid.grid[col][row]; if (comp != null) { GridBagConstraints c = layout.getConstraints(comp); if ((c.gridx == SGridBagLayout.LAST_CELL || c.gridx == col) && (c.gridy == SGridBagLayout.LAST_CELL || c.gridy == row)) { if (c.weighty > 0 && grid.rowweight[col] > 0) { int cellHeight = (int) (100 * c.weighty / grid.rowweight[col]); if (cellHeight > rowHeight) { rowHeight = cellHeight; } } } } } return rowHeight; }
@Override protected int getLayoutHGap(SLayoutManager layout) { return ((SGridBagLayout)layout).getHgap(); }
/** * Constructs a new <code>SActionField</code> instance. * * @param showTextField * is the text field visible to the user. */ public SActionField(boolean showTextField) { super(new SGridBagLayout()); textField = new STextField(); if (showTextField) { add(textField, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets( 0, 0, 0, 0), 0, 0)); textField.setPreferredSize(SDimension.FULLWIDTH); } this.showTextField = showTextField; buttonPanel = new SPanel(); buttonPanel.setLayout(new SBoxLayout(buttonPanel, SBoxLayout.X_AXIS)); int buttonPosition; if (showTextField) { buttonPosition = 1; } else { buttonPosition = 0; } add(buttonPanel, new GridBagConstraints(buttonPosition, 0, 1, 1, 0, 1, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); }
throws IOException { final SGridBagLayout layout = (SGridBagLayout) l; final SContainer container = layout.getContainer(); final boolean header = layout.getHeader(); final boolean useCellInsets = layout.getVgap() == -1 && layout.getHgap() == -1; final SGridBagLayout.Grid grid = layout.getGrid(); final TableCellStyle cellStyle = cellLayoutStyle(layout); final SComponent comp = grid.grid[col][row]; if (comp != null) { GridBagConstraints c = layout.getConstraints(comp); Insets insets = c.insets; if (insets != null) closeLayouterCell(d, null, cellStyle.renderAsTH); } else { GridBagConstraints c = layout.getConstraints(comp); switch(c.anchor) { case GridBagConstraints.NORTHWEST:
/** * Retrieve the constraint of a SComponent. The constraint must * not be altered! * * @param comp the component * @return the constraint or null if the component is unknown */ public GridBagConstraints getConstraints(SComponent comp) { // It might be better to return a copy of the constraint, // but that would hurt the performance return (GridBagConstraints) getGrid().modifiedConstraints.get(comp); } }
rows = 0; for (Object o1 : getContainer().getComponentList()) { SComponent comp = (SComponent) o1; if (!comp.isVisible()) { colweight = new double[rows]; for (Object o : getContainer().getComponentList()) { SComponent comp = (SComponent) o; if (!comp.isVisible()) {
private ICompositeView<SComponent> createConstrainedGridView( IConstrainedGridViewDescriptor viewDescriptor, IActionHandler actionHandler, Locale locale) { SPanel viewComponent = createSPanel(new SGridBagLayout()); BasicCompositeView<SComponent> view = constructCompositeView(viewComponent, viewDescriptor); List<IView<SComponent>> childrenViews = new ArrayList<IView<SComponent>>(); for (IViewDescriptor childViewDescriptor : viewDescriptor .getChildViewDescriptors()) { IView<SComponent> childView = createView(childViewDescriptor, actionHandler, locale); viewComponent.add(childView.getPeer(), createGridBagConstraints(viewDescriptor .getViewConstraints(childViewDescriptor))); childrenViews.add(childView); } view.setChildren(childrenViews); return view; }
SPanel pane = new SPanel(new SGridBagLayout()); 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, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,
/** * {@inheritDoc} */ @Override protected ICompositeView<SComponent> createConstrainedGridView( IConstrainedGridViewDescriptor viewDescriptor, IActionHandler actionHandler, Locale locale) { SPanel viewComponent = createSPanel(new SGridBagLayout()); BasicCompositeView<SComponent> view = constructCompositeView(viewComponent, viewDescriptor); List<IView<SComponent>> childrenViews = new ArrayList<IView<SComponent>>(); for (IViewDescriptor childViewDescriptor : viewDescriptor .getChildViewDescriptors()) { IView<SComponent> childView = createView(childViewDescriptor, actionHandler, locale); viewComponent.add(childView.getPeer(), createGridBagConstraints(viewDescriptor .getCellConstraints(childViewDescriptor))); childrenViews.add(childView); } view.setChildren(childrenViews); return view; }
optionButtons.setStyle("SOptionPaneButtons"); setLayout(new SGridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(10, 10, 10, 10);
ISplitViewDescriptor viewDescriptor, IActionHandler actionHandler, Locale locale) { SPanel viewComponent = createSPanel(new SGridBagLayout()); BasicCompositeView<SComponent> view = constructCompositeView(viewComponent, viewDescriptor);
SPanel workspaceView = new SPanel(new SGridBagLayout()); workspaceView.setPreferredSize(SDimension.FULLAREA);
private ICompositeView<SComponent> createSplitView( ISplitViewDescriptor viewDescriptor, IActionHandler actionHandler, Locale locale) { SPanel viewComponent = createSPanel(new SGridBagLayout()); BasicCompositeView<SComponent> view = constructCompositeView(viewComponent, viewDescriptor);
.createCompositeValueConnector( getConnectorIdForBeanView(viewDescriptor), null); SPanel viewComponent = createSPanel(new SGridBagLayout()); IView<SComponent> view = constructView(viewComponent, viewDescriptor, connector);
.createCompositeValueConnector( getConnectorIdForComponentView(viewDescriptor), null); SPanel viewComponent = createSPanel(new SGridBagLayout()); IView<SComponent> view = constructView(viewComponent, viewDescriptor, connector);