use of com.kotcrab.vis.ui.widget.VisTextField in project HyperLap2D by rednblackgames.
the class TagsPanel method updateView.
public void updateView() {
mainTable.clear();
tagTable = new VisTable();
VisTable inputTable = new VisTable();
List<String> sorted = new LinkedList<>(tags);
Collections.sort(sorted);
for (String tag : sorted) {
tagTable.add(new TagItem(tag, tagItemListener)).pad(5).left().expandX().fillX();
tagTable.row();
}
VisTextField newTagField = StandardWidgetsFactory.createTextField();
VisTextButton createTagBtn = new VisTextButton("add");
inputTable.add(newTagField).width(200);
inputTable.add(createTagBtn).padLeft(5);
createTagBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
String tag = newTagField.getText();
if (!tagExists(tag)) {
newTagField.setText("");
addTag(tag);
facade.sendNotification(ITEM_ADD, tag);
}
}
});
mainTable.add(inputTable);
mainTable.row();
mainTable.add(tagTable).expandX().fillX();
invalidateHeight();
}
use of com.kotcrab.vis.ui.widget.VisTextField in project vis-ui by kotcrab.
the class BasicColorPicker method createHexTable.
private VisTable createHexTable() {
VisTable table = new VisTable(true);
table.add(new VisLabel(HEX.get()));
table.add(hexField = new VisValidatableTextField("00000000")).width(HEX_FIELD_WIDTH * sizes.scaleFactor);
table.row();
hexField.setMaxLength(HEX_COLOR_LENGTH);
hexField.setProgrammaticChangeEvents(false);
hexField.setTextFieldFilter(new TextFieldFilter() {
@Override
public boolean acceptChar(VisTextField textField, char c) {
return Character.isDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
}
});
hexField.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (hexField.getText().length() == (allowAlphaEdit ? HEX_COLOR_LENGTH_WITH_ALPHA : HEX_COLOR_LENGTH)) {
setColor(Color.valueOf(hexField.getText()), false);
}
}
});
return table;
}
use of com.kotcrab.vis.ui.widget.VisTextField in project HyperLap2D by rednblackgames.
the class UILayerBox method addItem.
public void addItem(LayerItemVO itemVO) {
UILayerItemSlot itemSlot = new UILayerItemSlot();
UILayerItem item = new UILayerItem(itemVO, itemSlot);
layersTable.add(itemSlot).left().expandX().fillX();
layersTable.row().padTop(1);
SlotSource sourceItem = new SlotSource(item, this);
dragAndDrop.addSource(sourceItem);
dragAndDrop.addTarget(new SlotTarget(itemSlot));
dragAndDrop.setDragActorPosition(0, 0);
rows.add(itemSlot);
itemSlot.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
VisTextField textField = itemSlot.getUiLayerItem().getNameField();
if (sourceInEdition != null) {
VisTextField prevField = sourceInEdition.getActor().getNameField();
if (textField != prevField) {
prevField.clearSelection();
prevField.setDisabled(true);
enableDraggingInEditedSlot();
}
}
clearSelection();
itemSlot.getUiLayerItem().setSelected(true);
currentSelectedLayerIndex = rows.size - rows.indexOf(itemSlot, true) - 1;
facade.sendNotification(LAYER_ROW_CLICKED, itemSlot.getUiLayerItem());
// Change name mode on double click.
if (getTapCount() == 2 && !itemSlot.getUiLayerItem().getData().isLocked && sourceInEdition == null) {
sourceInEdition = sourceItem;
textField.setDisabled(false);
textField.focusField();
textField.selectAll();
disableDraggingInEditedSlot();
}
}
});
}
use of com.kotcrab.vis.ui.widget.VisTextField in project HyperLap2D by rednblackgames.
the class UIResourcesTab method createTextField.
protected VisTextField createTextField() {
VisTextField visTextField = StandardWidgetsFactory.createTextField();
visTextField.setMessageText(getTabTitle());
visTextField.setTextFieldListener(new VisTextField.TextFieldListener() {
@Override
public void keyTyped(VisTextField textField, char c) {
searchString = textField.getText();
HyperLap2DFacade facade = HyperLap2DFacade.getInstance();
facade.sendNotification(MsgAPI.UPDATE_RESOURCES_LIST);
}
});
return visTextField;
}
Aggregations