use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.
the class ActionSet method createTouchComposite.
protected Composite createTouchComposite() {
Composite touchComp = new Composite(actionSettings, SWT.NONE);
touchComp.setLayout(new FormLayout());
touchActionLabel = new DisplayLabel(touchComp, SWT.NONE);
touchActionLabel.setText(L10N.get("DE.ButtonActionCaption", "Action") + ":");
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionSourceLabelTouch = createTransitionSourceLabel(touchComp);
transitionSourceNameTouch = createTransitionSourceName(touchComp);
transitionDestinationLabelTouch = createTransitionDestinationLabel(touchComp);
transitionDestinationNameTouch = createTransitionDestinationName(touchComp);
touchActionCombo = new ComboWithEnableFix(touchComp, SWT.DROP_DOWN | SWT.READ_ONLY);
for (TapPressType element : TapPressType.DISPLAY) {
touchActionCombo.add(element.toString());
}
touchActionCombo.select(0);
touchActionCombo.addSelectionListener(widgetActionChange);
return touchComp;
}
use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.
the class ActionSet method createKeyComposite.
protected Composite createKeyComposite() {
Composite keyComp = new Composite(actionSettings, SWT.NONE);
keyComp.setLayout(new FormLayout());
keyboardTextLabel = new DisplayLabel(keyComp, SWT.NONE);
keyboardTextLabel.setText(L10N.get("DE.KeyboardTextCaption", "Text") + ":");
keyboardText = createKeyboardText(keyComp);
keyboardText.setFont(FontUtils.SYMBOL_FONT);
keyboardIsCmd = new Button(keyComp, SWT.CHECK);
keyboardIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
keyboardIsCmd.addSelectionListener(deviceActionChange);
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionDestinationLabelKeyboard = createTransitionDestinationLabel(keyComp);
transitionDestinationNameKeyboard = createTransitionDestinationName(keyComp);
/* TODO: add back in when single character stuff is straightened out
this.keyboardActionLabel = new DisplayLabel(keyComp, SWT.NONE);
this.keyboardActionLabel.setText(L10N.get("DE.KeyActionCaption",
"Action")
+ ":");
this.keyboardActionCombo =
new ComboWithEnableFix(keyComp,
SWT.DROP_DOWN | SWT.READ_ONLY);
for (int i = 0; i < KeyPressType.DISPLAY.length; i++) {
this.keyboardActionCombo.add(KeyPressType.DISPLAY[i].toString());
}
this.keyboardActionCombo.select(0);
this.keyboardActionCombo.addSelectionListener(this.deviceActionChange);
*/
SelectionListener insertSpecial = new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
Control source = (Control) e.getSource();
keyboardText.insert((String) source.getData());
Point selection = keyboardText.getSelection();
keyboardText.setFocus();
keyboardText.setSelection(selection);
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
};
// TODO: replace alignTo with this.keyboardActionCombo when the above TODO is done!
// can't assign using ?: because Java is stupid
Control alignTo;
if (vertical) {
alignTo = transitionDestinationNameKeyboard;
} else {
alignTo = keyboardText.getOuter();
}
keyboardSpecials = new KeyboardSpecialChars(alignTo, insertSpecial, vertical);
return keyComp;
}
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);
}
}
use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.
the class ActionChangePropertySet method layoutHelper.
@Override
public void layoutHelper() {
actionComposite = new Composite(parent, SWT.NONE);
actionComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
FormData data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(0, 5);
actionComposite.setLayoutData(data);
actionSettings = new Composite(parent, SWT.BORDER);
actionSettings.setLayout(actionSettingsLayout);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(actionComposite, 5, SWT.BOTTOM);
data.right = new FormAttachment(100, -5);
actionSettings.setLayoutData(data);
Label delayLabelLabel = new DisplayLabel(parent, SWT.NONE);
delayLabelLabel.setText(DELAY_LABEL_LABEL);
delayLabel = new ManagedText(parent, SWT.SINGLE | SWT.BORDER, Keypad.FULL_KEYPAD) {
@Override
public boolean confirm(int focusRule) {
if ("".equals(getText())) {
setText(TransitionDelay.DEFAULT_DELAY_LABEL);
}
return super.confirm(focusRule);
}
};
Label delayInSecsLabel = new DisplayLabel(parent, SWT.NONE);
delayInSecsLabel.setText(DELAY_DURATION_LABEL + ":");
delayInSecs = new DoubleEntry(parent, SWT.SINGLE | SWT.BORDER) {
@Override
protected void onModify() {
super.onModify();
delayLabel.setEnabled(getDoubleValue() > 0.0);
}
@Override
public boolean confirm(int focusRule) {
boolean success = super.confirm(focusRule);
if (getDoubleValue() == 0.0) {
setText("");
}
return success;
}
};
delayInSecs.setAllowNegative(false);
delayInSecs.setDecimalPlaces(3);
delayInSecs.setUnits("s");
delayInSecs.moveAbove(delayLabel.getOuter());
data = new FormData();
data.left = new FormAttachment(actionSettings, 5, SWT.LEFT);
data.top = new FormAttachment(delayInSecs.getOuter(), 0, SWT.CENTER);
delayInSecsLabel.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(delayInSecsLabel, 5, SWT.RIGHT);
data.width = 100;
data.top = new FormAttachment(actionSettings, 5, SWT.BOTTOM);
delayInSecs.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(delayInSecs.getOuter(), 5, SWT.RIGHT);
data.top = new FormAttachment(delayInSecs.getOuter(), 0, SWT.CENTER);
delayLabelLabel.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(delayLabelLabel, 5, SWT.RIGHT);
data.top = new FormAttachment(delayInSecs.getOuter(), 0, SWT.CENTER);
data.right = new FormAttachment(actionSettings, -5, SWT.RIGHT);
delayLabel.setLayoutData(data);
}
Aggregations