Java Code Examples for org.eclipse.swt.SWT#Collapse

The following examples show how to use org.eclipse.swt.SWT#Collapse . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: nebula   File: CTree.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <p>
 *  Event types:
 *  <ul>
 *   <li>SWT.Collapse</li>
 *   <li>SWT.Expand</li>
 *   <li>SWT.Hide</li>
 *   <li>SWT.Move</li>
 *   <li>SWT.Show</li>
 *  </ul>
 * </p>
 * @param eventType
 * @param item
 */
void layout(int eventType, CTreeItem item) {
	if(SWT.Collapse == eventType) {
		layout.layout(eventType, item);
		visibleItems = null;
		updatePaintedList = true;
	} else if(SWT.Expand == eventType) {
		layout.layout(eventType, item);
		visibleItems = null;
		updatePaintedList = true;
	} else if(SWT.Hide == eventType && isVisible((CTreeItem)item)) {
		layout.layout(eventType, item);
		updatePaintedList = true;
		item.setVisible(false);
	} else if(SWT.Show == eventType && !isVisible((CTreeItem)item)) {
		layout.layout(eventType, item);
		updatePaintedList = true;
		item.setVisible(true);
	}
}
 
Example 2
@Override
protected Control createContents(Composite parent) {
	final Composite container = new Composite(parent, SWT.FILL);
	container.setLayout(new GridLayout(1, true));
	notifyBasicPreferenceListeners(container);

	new Label(container, SWT.NONE);
	final ExpandableComposite collap = new ExpandableComposite(container, SWT.Collapse);
	collap.setText("Advanced Options");

	final Composite advancedOptions = new Composite(collap, SWT.None);
	collap.setClient(advancedOptions);
	advancedOptions.setLayout(new RowLayout(SWT.VERTICAL));
	notifyAdvancedPreferenceListeners(advancedOptions);

	collap.setExpanded(true);
	return container;
}
 
Example 3
Source Project: uima-uimaj   File: CapabilitySection.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void handleEvent(Event event) {
  if (event.type == SWT.Expand || event.type == SWT.Collapse) {
    pack04();
    return;
  }
  if (event.widget == addCapabilityButton) {
    handleAddCapability();
    enable();
    return;
  }

  TreeItem selItem = tt.getSelection()[0];
  int itemKind = getItemKind(selItem);

  if (event.widget == addLangButton) {
    handleAddLang(selItem, itemKind);
  } else if (event.widget == addTypeButton) {
    handleAddType(selItem, itemKind);
  } else if (event.widget == addSofaButton) {
    handleAddSofa(selItem, itemKind);
  } else if (event.widget == addEditFeatureButton) {
    handleAddEditFeature(selItem, itemKind);
  } else if (event.widget == editButton || event.type == SWT.MouseDoubleClick) {
    handleEdit(selItem, itemKind);
  } else if (event.widget == removeButton
          || (event.widget == tt && event.type == SWT.KeyUp && event.character == SWT.DEL)) {
    handleRemove(selItem, itemKind);
  }

  enable();
}
 
Example 4
Source Project: nebula   File: CTree.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private void fireTreeEvent(Widget item, boolean collapse) {
	Event event = new Event();
	event.type = collapse ? SWT.Collapse : SWT.Expand;
	event.item = item;
	notifyListeners(event.type, event);
}
 
Example 5
Source Project: nebula   File: CTreeCombo.java    License: Eclipse Public License 2.0 4 votes vote down vote up
void createPopup(Collection<CTreeComboItem> items, CTreeComboItem selectedItem) {
	// create shell and list
	popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP);
	final int style = getStyle();
	int listStyle = SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE;
	if ((style & SWT.FLAT) != 0) {
		listStyle |= SWT.FLAT;
	}
	if ((style & SWT.RIGHT_TO_LEFT) != 0) {
		listStyle |= SWT.RIGHT_TO_LEFT;
	}
	if ((style & SWT.LEFT_TO_RIGHT) != 0) {
		listStyle |= SWT.LEFT_TO_RIGHT;
	}
	tree = new Tree(popup, listStyle);
	tree.addTreeListener(hookListener);
	if (font != null) {
		tree.setFont(font);
	}
	if (foreground != null) {
		tree.setForeground(foreground);
	}
	if (background != null) {
		tree.setBackground(background);
	}

	final int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate };
	for (int i = 0; i < popupEvents.length; i++) {
		popup.addListener(popupEvents[i], listener);
	}
	final int[] listEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose, SWT.Collapse, SWT.Expand };
	for (int i = 0; i < listEvents.length; i++) {
		tree.addListener(listEvents[i], listener);
	}

	for (final CTreeComboColumn c : columns) {
		final TreeColumn col = new TreeColumn(tree, SWT.NONE);
		c.setRealTreeColumn(col);
	}

	if (items != null) {
		createTreeItems(items.toArray(new CTreeComboItem[0]));
	}

	if (selectedItem != null) {
		tree.setSelection(selectedItem.getRealTreeItem());
	}
}