use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.
the class ActionSet method createTransitionDestinationLabel.
protected Label createTransitionDestinationLabel(Composite parentComposite) {
Label transitionDestinationLabel;
transitionDestinationLabel = new DisplayLabel(parentComposite, SWT.NONE);
transitionDestinationLabel.setText(TRANSITION_DESTINATION_LABEL);
return transitionDestinationLabel;
}
use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.
the class WidgetPropertiesPane method createWidgets.
protected void createWidgets() {
// set up widgets, set disabled for launch
widgetName = new DisplayLabel(this, SWT.NONE);
widgetName.setText(L10N.get("FE.WidgetNameCaption", "Widget Name") + ":");
widgetNameText = new WidgetChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.ChangeNameProperty, view);
widgetTitle = new DisplayLabel(this, SWT.NONE);
widgetTitle.setText(DISPLAYED_LABEL);
widgetTitleText = new WidgetChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.ChangeTitleProperty, view);
widgetAux = new DisplayLabel(this, SWT.NONE);
widgetAux.setText(AUX_TEXT_LABEL);
widgetAuxText = new WidgetChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.ChangeAuxTextProperty, view);
widgetType = new DisplayLabel(this, SWT.NONE);
widgetType.setText(L10N.get("FE.WidgetTypeCaption", "Type") + ":");
widgetTypeLabel = new Label(this, SWT.NONE);
widgetMode = new DisplayLabel(this, SWT.NONE);
widgetMode.setText(L10N.get("FE.WidgetModeCaption", "Mode") + ":");
widgetModeValue = new Label(this, SWT.NONE);
widgetRender = new Button(this, SWT.CHECK);
widgetRender.setText(L10N.get("FE.WidgetRenderedCaption", "Render Widget Skin"));
// Add listener to the rendered widget property
widgetRender.addSelectionListener(view.createWidgetChgHandler(FrameEditorLID.SetRenderSkin));
remoteLabel = new DisplayLabel(this, SWT.NONE);
remoteLabel.setText(L10N.get("FE.RemoteLabelCaption", "Remote Label") + ":");
remoteLabelFind = new Link(this, SWT.NONE);
remoteLabelFind.setText(L10N.get("FE.RemoteLabelFind", "<a>Find</a>"));
remoteLabelFind.setFont(FontUtils.getAdjustedFont(remoteLabelFind.getFont(), 8, SWT.BOLD));
remoteLabelText = new WidgetChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.SetRemoteLabelText, view);
remoteLabelOwner = new DisplayLabel(this, SWT.NONE);
remoteLabelOwner.setText(L10N.get("FE.RemoteLabelOwnerCaption", "Remote Label Owner") + ":");
remoteLabelOwnerName = new Link(this, SWT.NONE);
remoteLabelType = new DisplayLabel(this, SWT.NONE);
remoteLabelType.setText(L10N.get("FE.RemoteLabelTypeCaption", "Remote Label Type") + ":");
remoteLabelTypeCombo = new View.PerformActionCombo(this, SWT.DROP_DOWN | SWT.READ_ONLY) {
@Override
protected boolean doChangeAction() {
int selectedType = remoteLabelTypeCombo.getSelectionIndex();
FrameEditorUI.SetRemoteLabelTypeParms setTypeParms = new FrameEditorUI.SetRemoteLabelTypeParms(widgetTypeChoices[selectedType], view.selection.getSelectedIWidgets()[0]);
return view.performAction(FrameEditorLID.SetRemoteLabelType, setTypeParms, true);
}
};
for (WidgetType widgetTypeChoice : widgetTypeChoices) {
remoteLabelTypeCombo.add(widgetTypeChoice.toString());
}
imagePath = new DisplayLabel(this, SWT.NONE);
imagePath.setText(IMAGE_PATH);
imagePathText = new TextWithEnableFix(this, SWT.SINGLE | SWT.READ_ONLY);
isInitiallySelected = new Button(this, SWT.CHECK);
isInitiallySelected.setText(L10N.get("FE.InitiallySelected", "Initially Selected"));
WidgetAttributeListener listener = new WidgetAttributeListener(WidgetAttributes.IS_SELECTED_ATTR) {
@Override
public Object getValue() {
return new Boolean(isInitiallySelected.getSelection());
}
};
isInitiallySelected.addSelectionListener(listener);
isButtonSelected = new Button(this, SWT.CHECK);
isButtonSelected.setText(L10N.get("FE.InitiallySelected", "Initially Selected"));
isButtonSelected.setEnabled(false);
listener = new WidgetAttributeListener(WidgetAttributes.IS_SELECTED_ATTR) {
@Override
public Object getValue() {
return new Boolean(isButtonSelected.getSelection());
}
};
isButtonSelected.addSelectionListener(listener);
isToggleable = new Button(this, SWT.CHECK);
isToggleable.setText(L10N.get("FE.Togglable", "Can be toggled"));
listener = new WidgetAttributeListener(WidgetAttributes.IS_TOGGLEABLE_ATTR) {
@Override
public Object getValue() {
boolean sel = isToggleable.getSelection();
isButtonSelected.setEnabled(sel);
return new Boolean(sel);
}
};
isToggleable.addSelectionListener(listener);
/*this.isMultiLine = new Button(parent, SWT.CHECK);
this.isMultiLine.setText(L10N.get("FE.MultiLine", "Multiple Lined"));
listener = new WidgetAttributeListener(WidgetType.IS_MULTILINE_ATTR) {
@Override
public Object getValue() {
return new Boolean(isMultiLine.getSelection());
}
};
this.isMultiLine.addSelectionListener(listener);*/
selectLabel = new DisplayLabel(this, SWT.NONE);
selectLabel.setText(L10N.get("FE.ComboSelectCaption", "Initially Selected Item") + ":");
initiallySelected = new ComboWithEnableFix(this, SWT.DROP_DOWN | SWT.READ_ONLY);
initiallySelected.setVisibleItemCount(8);
initiallySelected.addSelectionListener(selectionAttrListener);
isSeparator = new Button(this, SWT.CHECK);
isSeparator.setText(L10N.get("FE.Separator", "Separator"));
listener = new WidgetAttributeListener(WidgetAttributes.IS_SEPARATOR_ATTR) {
@Override
public Object getValue() {
return (isSeparator.getSelection()) ? WidgetAttributes.IS_SEPARATOR : WidgetAttributes.NON_SEPARATOR;
}
};
isSeparator.addSelectionListener(listener);
isSeparator.moveAbove(widgetTypeLabel);
submenuActionLabel = new DisplayLabel(this, SWT.NONE);
submenuActionLabel.setText(L10N.get("FE.SubmenuActionLabel", "Submenu transition action") + ":");
submenuAction = new ComboWithEnableFix(this, SWT.DROP_DOWN | SWT.READ_ONLY);
// Maximize the possible set of values.
submenuActions = new Integer[] { WidgetAttributes.HOVER_SUBMENU_ACTION, null, null };
submenuAction.add(L10N.get("FE.HoverSubmenuAction", "Hover"));
listener = new WidgetAttributeListener(WidgetAttributes.SUBMENU_ACTION_ATTR) {
@Override
public Object getValue() {
Object a = submenuActions[submenuAction.getSelectionIndex()];
submenuDelay.setEnabled(a == WidgetAttributes.HOVER_SUBMENU_ACTION);
return a;
}
};
submenuAction.addSelectionListener(listener);
submenuDelayLabel = new DisplayLabel(this, SWT.NONE);
submenuDelayLabel.setText(L10N.get("FE.SubmenuDelay", "Submenu transition delay") + ":");
// TODO: remove READ_ONLY when editing allowed (check exception in setSubmenuDelayAttr)
submenuDelay = new ComboWithEnableFix(this, SWT.DROP_DOWN | SWT.READ_ONLY);
submenuDelay.add("0.0 s (" + L10N.get("FE.TypicalForMac", "typical for a Mac") + ")");
submenuDelay.add("0.5 s (" + L10N.get("FE.TypicalForPC", "typical for a PC") + ")");
listener = new WidgetAttributeListener(WidgetAttributes.SUBMENU_DELAY_ATTR) {
@Override
public Object getValue() {
switch(submenuDelay.getSelectionIndex()) {
case 0:
{
return WidgetAttributes.NO_SUBMENU_DELAY;
}
case 1:
{
return WidgetAttributes.PC_SUBMENU_DELAY;
}
}
// should be the current value!
return null;
}
@Override
public void widgetDefaultSelected(SelectionEvent evt) {
view.setSubmenuDelayAttr(view.selection.getSelectedIWidgets()[0], submenuDelay.getText());
}
};
submenuDelay.addSelectionListener(listener);
submenuDelay.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent evt) {
/*
* We can allow certain types of characters here:
* Control characters (arrow keys, etc): Character.CONTROL
* Numerics: Character.DECIMAL_DIGIT_NUMBER
* Decimal Point: keycodes 46 and 16777262
*
* Disallow anything else
*/
int characterType = Character.getType(evt.character);
if ((characterType == Character.CONTROL) || (characterType == Character.DECIMAL_DIGIT_NUMBER) || (evt.keyCode == 46) || (evt.keyCode == 16777262)) {
evt.doit = true;
} else {
evt.doit = false;
}
}
// listen for the enter key on the number pad for OS X
public void keyReleased(KeyEvent evt) {
if (OSUtils.MACOSX) {
if (evt.keyCode == SWT.KEYPAD_CR) {
view.setSubmenuDelayAttr(view.selection.getSelectedIWidgets()[0], submenuDelay.getText());
}
}
}
});
contextMenuActionLabel = new DisplayLabel(this, SWT.NONE);
contextMenuActionLabel.setText(L10N.get("FE.ContextMenuAction", "Context Menu Action") + ":");
// Maximize the possible set of values.
contextMenuActions = new Integer[] { null, null, null };
contextMenuAction = new ComboWithEnableFix(this, SWT.DROP_DOWN | SWT.READ_ONLY);
//TODO: this.contextMenuAction.add(L10N.get("FE.MenuKeyPress", "Menu Key Press"));
listener = new WidgetAttributeListener(WidgetAttributes.CONTEXT_MENU_ACTION_ATTR) {
@Override
public Object getValue() {
return contextMenuActions[contextMenuAction.getSelectionIndex()];
}
};
contextMenuAction.addSelectionListener(listener);
// Set initial selection
//widgetShapeCombo.select(0);
widgetTypeLabel.setText(N_A);
widgetModeValue.setText(N_A);
}
use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.
the class FramePropertiesPane method createWidgets.
protected void createWidgets(final View view) {
ListenerIdentifierMap lidMap = view.getLIDMap();
frameNameLabel = new DisplayLabel(this, SWT.NONE);
frameNameLabel.setText(NAME_LABEL);
frameName = new View.PerformActionText(this, SWT.SINGLE | SWT.BORDER) {
@Override
protected void onFocus() {
super.onFocus();
view.getTransmuter().setLIDEnabledState();
}
@Override
protected boolean doChangeAction() {
Frame frame = (Frame) getData();
DesignEditorUI.FrameRenameParameters evt = new DesignEditorUI.FrameRenameParameters(frame, getText());
boolean changed = view.performAction(DesignEditorLID.RenameFrame, evt, true);
if (!changed) {
setText(frame.getName());
}
return changed;
}
};
imagePath = new DisplayLabel(this, SWT.NONE);
imagePath.setText(IMAGE_PATH);
imagePathText = new TextWithEnableFix(this, SWT.SINGLE | SWT.READ_ONLY);
widgetTreeLabel = new DisplayLabel(this, SWT.NONE);
widgetTreeLabel.setText(WIDGETS);
widgetTree = new Tree(this, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
widgetTree.setLinesVisible(true);
widgetUpdater = new TreeItemUpdater.WidgetItemUpdater(widgetTree);
if (CogToolPref.RESEARCH.getBoolean()) {
eltGroupTreeLabel = new DisplayLabel(this, SWT.NONE);
eltGroupTreeLabel.setText(ELEMENT_GROUPS);
eltGroupTree = new Tree(this, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
eltGroupTree.setLinesVisible(true);
eltGroupUpdater = new TreeItemUpdater.EltGroupItemUpdater(eltGroupTree);
implicitGroupTreeLabel = new DisplayLabel(this, SWT.NONE);
implicitGroupTreeLabel.setText(IMPLICIT_GROUPS);
implicitGroupTree = new Tree(this, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
implicitGroupTree.setLinesVisible(true);
implicitGroupUpdater = new TreeItemUpdater.ImplicitGroupItemUpdater(implicitGroupTree);
}
}
Aggregations