- Common ways to obtain Composite
private void myMethod () {Composite c =
Control control;control.getParent()
StatusDialog zuper;(Composite) zuper.createDialogArea(parent)
TitleAreaDialog zuper;(Composite) zuper.createDialogArea(parent)
- Smart code suggestions by Codota
}
/** * Returns that control given in the parameters which is found first in * the tab order of the given composite or one of its subcomposits. * @param comp the composite where to search for the controls * @param c1, c2 the controls to deside which comes first in tab order * @return the control of the parameters which is found first in the tab order * or null if none of them is found. */ private Widget firstTab(Composite comp,Widget c1, Widget c2) { Control[] conts = comp.getTabList(); for(int i=0;i<conts.length;i++) { if(conts[i] instanceof Composite) { Widget first = firstTab((Composite)conts[i],c1,c2); if(first!=null) return first; } if(c1==conts[i]) return c1; if(c2==conts[i]) return c2; } return null; } }
/** * Returns that control given in the parameters which is found first in * the tab order of the given composite or one of its subcomposits. * @param comp the composite where to search for the controls * @param c1, c2 the controls to deside which comes first in tab order * @return the control of the parameters which is found first in the tab order * or null if none of them is found. */ private Widget firstTab(Composite comp,Widget c1, Widget c2) { Control[] conts = comp.getTabList(); for(int i=0;i<conts.length;i++) { if(conts[i] instanceof Composite) { Widget first = firstTab((Composite)conts[i],c1,c2); if(first!=null) return first; } if(c1==conts[i]) return c1; if(c2==conts[i]) return c2; } return null; } }
private static int computeTabIndices( Composite composite, int startIndex ) { int result = startIndex; for( Control control : composite.getTabList() ) { getControlAdapter( control ).setTabIndex( result ); // for Links, leave a range out to be assigned to hrefs on the client result += control instanceof Link ? 300 : 1; if( control instanceof Composite ) { result = computeTabIndices( ( Composite )control, result ); } } return result; }
private boolean setFocus(Control c, boolean direction) { if (c instanceof Composite) { Composite comp = (Composite)c; Control [] tabList = comp.getTabList(); if (direction) { for (Control element : tabList) { if (setFocus(element, direction)) return true; } } else { for (int i=tabList.length-1; i>=0; i--) { if (setFocus(tabList[i], direction)) return true; } } if (!(c instanceof Canvas)) return false; } return c.setFocus(); }
/** * Recursively computes the tab indices for all child controls of a given * composite and stores the resulting values in the control adapters. */ private static int computeTabIndices( Composite composite, int startIndex ) { Control[] tabList = composite.getTabList(); int result = startIndex; for( int i = 0; i < tabList.length; i++ ) { Control control = tabList[ i ]; IControlAdapter controlAdapter = ControlUtil.getControlAdapter( control ); controlAdapter.setTabIndex( result ); // for Links, leave a range out to be assigned to hrefs on the client if( control instanceof Link ) { result += 300; } else { result += 1; } if( control instanceof Composite ) { result = computeTabIndices( ( Composite )control, result ); } } return result; }
private boolean setFocusToNextSibling(Control c, boolean next) { Composite parent = c.getParent(); Control[] children = parent.getTabList(); for (int i = 0; i < children.length; i++) { Control child = children[i]; if (child == c) { // here if (next) { for (int j = i + 1; j < children.length; j++) { Control nc = children[j]; if (nc.setFocus()) return false; } } else { for (int j = i - 1; j >= 0; j--) { Control pc = children[j]; if (pc.setFocus()) return false; } } } } return false; }
private boolean setFocus(Control c, boolean direction) { if (c instanceof Composite) { Composite comp = (Composite)c; Control [] tabList = comp.getTabList(); if (direction) { for (Control element : tabList) { if (setFocus(element, direction)) return true; } } else { for (int i=tabList.length-1; i>=0; i--) { if (setFocus(tabList[i], direction)) return true; } } if (!(c instanceof Canvas)) return false; } return c.setFocus(); }
private boolean setFocusToNextSibling(Control c, boolean next) { Composite parent = c.getParent(); Control[] children = parent.getTabList(); for (int i = 0; i < children.length; i++) { Control child = children[i]; if (child == c) { // here if (next) { for (int j = i + 1; j < children.length; j++) { Control nc = children[j]; if (nc.setFocus()) return false; } } else { for (int j = i - 1; j >= 0; j--) { Control pc = children[j]; if (pc.setFocus()) return false; } } } } return false; }
Control[] tabList = content.getTabList();
Control control; Control[] tabList = parent.getTabList(); Control lastControl = null; if(tabList.length>0) {
final Control[] tabStops = dataArea.getTabList(); final ArrayList<Control> newTabStops = new ArrayList<>(); for (Control tabStop : tabStops) {
setFocusToFirstControl(actPageInfo.page.getComposite().getTabList());