本文整理汇总了Java中com.github.czyzby.lml.parser.tag.LmlTag类的典型用法代码示例。如果您正苦于以下问题:Java LmlTag类的具体用法?Java LmlTag怎么用?Java LmlTag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LmlTag类属于com.github.czyzby.lml.parser.tag包,在下文中一共展示了LmlTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
VisLabel lblText = new VisLabel(parser.parseString(rawAttributeData, actor));
lblText.setAlignment(Align.center);
boolean needLineWrap = lblText.getPrefWidth() > LINE_WRAP_THRESHOLD;
if (needLineWrap) {
lblText.setWrap(true);
}
final Tooltip tooltip = new Tooltip();
tooltip.clearChildren(); // Removing empty cell with predefined paddings.
Cell<VisLabel> tooltipCell = tooltip.add(lblText).center().pad(0f, 4f, 2f, 4f);
if (needLineWrap) { tooltipCell.width(LINE_WRAP_THRESHOLD); }
tooltip.pack();
tooltip.setTarget(actor);
}
示例2: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
final ActorConsumer<?, Params> action = parser.parseAction(rawAttributeData, tmpParams);
if (action == null) {
parser.throwError("Could not find action for: " + rawAttributeData + " with actor: " + actor);
}
actor.addListener(new ClickListener(1) {
@Override
public void clicked(final InputEvent event, final float x, final float y) {
tmpParams.actor = actor;
tmpParams.x = x;
tmpParams.y = y;
tmpParams.stageX = event.getStageX();
tmpParams.stageY = event.getStageY();
action.consume(tmpParams);
tmpParams.reset();
}
});
}
示例3: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
final ActorConsumer<?, Params> action = parser.parseAction(rawAttributeData, tmpParams);
if (action == null) {
parser.throwError("Could not find action for: " + rawAttributeData + " with actor: " + actor);
}
actor.addListener(new FocusListener() {
@Override public void keyboardFocusChanged(FocusEvent event, Actor target, boolean focused) {
if (target == actor) {
tmpParams.actor = actor;
tmpParams.focused = focused;
action.consume(tmpParams);
tmpParams.reset();
}
}
});
}
示例4: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, Actor actor, final String rawAttributeData) {
// Due to ListView tricky structure we should dig a little to get to the scrollable actor
if (actor instanceof ListView.ListViewTable) {
actor = ((ListView.ListViewTable) actor).getListView().getScrollPane();
}
boolean value = Boolean.parseBoolean(rawAttributeData);
if (value) {
// Add scroll focus capture listeners
actor.addListener(new ScrollFocusCaptureInputListener());
} else {
// Remove scroll focus capture listener
Iterator<EventListener> iterator = actor.getListeners().iterator();
while (iterator.hasNext()) {
EventListener listener = iterator.next();
if (listener instanceof ScrollFocusCaptureInputListener) {
iterator.remove();
}
}
}
}
示例5: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
protected void process(final LmlParser parser, final LmlTag tag, final TabbedPane tabbedPane,
final String rawAttributeData) {
final ActorConsumer<?, TabbedPane> action = parser.parseAction(rawAttributeData, tabbedPane);
if (action == null) {
parser.throwErrorIfStrict(
"All tabs removal listener attribute requires an action ID. Action not found for ID: "
+ rawAttributeData);
return;
}
tabbedPane.addListener(new TabbedPaneAdapter() {
@Override
public void removedAllTabs() {
action.consume(tabbedPane);
}
});
}
示例6: processForActor
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof Table) {
final Value verticalValue = LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor,
rawAttributeData);
((Table) actor).padBottom(verticalValue);
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).padBottom(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).padBottom(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof Container<?>) {
((Container<?>) actor)
.padBottom(LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
示例7: processRegularTag
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
/** @param tagName name of the tag to be parsed.
* @param rawTagData raw data of a regular widget tag. */
private void processRegularTag(final String tagName, final StringBuilder rawTagData) {
final LmlTagProvider tagProvider = syntax.getTagProvider(tagName);
if (tagProvider == null) {
throwError("No tag parser found for name: " + tagName);
}
final LmlTag tag = tagProvider.create(this, currentParentTag, rawTagData);
if (tag.isParent()) {
currentParentTag = tag;
} else {
// The tag is a child, so we're closing it immediately.
tag.closeTag();
if (currentParentTag != null) {
// Tag is child - adding to current parent:
currentParentTag.handleChild(tag);
} else {
// Tag is a root - adding to the result:
if (tag.getActor() != null) {
actors.add(tag.getActor());
}
}
mapActorById(tag.getActor());
}
}
示例8: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final VisTextField actor,
final String rawAttributeData) {
final ActorConsumer<?, Character> listener = parser.parseAction(rawAttributeData, Character.valueOf(' '));
if (listener == null) {
parser.throwErrorIfStrict(
"Text field listener attribute requires ID of an action that consumes a Character. Valid action not found for name: "
+ rawAttributeData);
return;
}
actor.setTextFieldListener(new TextFieldListener() {
@Override
public void keyTyped(final VisTextField textField, final char character) {
listener.consume(character);
}
});
}
示例9: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
protected void process(final LmlParser parser, final LmlTag tag, final TabbedPane tabbedPane,
final String rawAttributeData) {
final ActorConsumer<?, Tab> action = parser.parseAction(rawAttributeData, MOCK_UP_TAB);
if (action == null) {
parser.throwErrorIfStrict("Tab switch listener attribute requires an action ID. Action not found for ID: "
+ rawAttributeData);
return;
}
tabbedPane.addListener(new TabbedPaneAdapter() {
@Override
public void switchedTab(final Tab tab) {
action.consume(tab);
}
});
}
示例10: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
final Dialog dialog = getDialogParent(tag);
if (dialog != null) {
dialog.setObject(actor, parser.parseAction(rawAttributeData, dialog));
} else {
final VisDialog visDialog = getVisDialogParent(tag);
if (visDialog == null) {
parser.throwErrorIfStrict(
"On result actions can be attached only to children of dialogs. Received on result action: "
+ rawAttributeData + " on a tag without dialog parent: " + tag.getTagName());
return;
}
visDialog.setObject(actor, parser.parseAction(rawAttributeData, dialog));
}
}
示例11: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
String hexValue = parser.parseString(rawAttributeData, actor);
try {
Color color = Color.valueOf(hexValue);
actor.setColor(color);
} catch (Exception exception) {
parser.throwErrorIfStrict(
"Unable to parse HEX color value from string \"" + hexValue + "\"",
exception);
}
}
示例12: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final MenuItem actor, final String rawAttributeData) {
Image image = new Image(parser.getData().getDefaultSkin().getDrawable(rawAttributeData));
Container<Image> imageContainer = new Container<>(image);
imageContainer.setFillParent(true);
imageContainer.align(Align.left);
imageContainer.padLeft(25f);
actor.addActor(imageContainer);
}
示例13: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
final ActorConsumer<?, Params> action = parser.parseAction(rawAttributeData, tmpParams);
if (action == null) {
parser.throwError("Could not find action for: " + rawAttributeData + " with actor: " + actor);
}
actor.addListener(new ClickListener(0) {
private boolean firstClickCaught = false;
private long lastClickTime = 0;
@Override
public void clicked(final InputEvent event, final float x, final float y) {
long currentEventTime = Gdx.input.getCurrentEventTime();
long deltaTime = currentEventTime - lastClickTime;
lastClickTime = currentEventTime;
if (!firstClickCaught) {
firstClickCaught = true;
} else {
if (deltaTime < SECOND_CLICK_TIME) {
firstClickCaught = false;
tmpParams.actor = actor;
tmpParams.x = x;
tmpParams.y = y;
tmpParams.stageX = event.getStageX();
tmpParams.stageY = event.getStageY();
action.consume(tmpParams);
tmpParams.reset();
}
}
}
});
}
示例14: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
final int origin = LmlUtilities.parseAlignment(parser, actor, rawAttributeData);
// Simple trick to make this attribute applied after actor is laid out (likely)
actor.addAction(ActionsExt.post(Actions.run(new Runnable() {
@Override
public void run() {
actor.setOrigin(origin);
}
})));
}
示例15: process
import com.github.czyzby.lml.parser.tag.LmlTag; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
final ActorConsumer<?, Actor> action = parser.parseAction(rawAttributeData, actor);
if (action == null) {
parser.throwError("Could not find action for: " + rawAttributeData + " with actor: " + actor);
}
actor.addListener(new ClickListener() {
@Override
public void clicked(final InputEvent event, final float x, final float y) {
if (event.isCancelled()) return;
action.consume(actor);
}
});
}