当前位置: 首页>>代码示例>>Java>>正文


Java LmlTag类代码示例

本文整理汇总了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);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:17,代码来源:TooltipLmlAttribute.java

示例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();
        }
    });
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:20,代码来源:OnRightClickLmlAttribute.java

示例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();
            }
        }
    });
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:18,代码来源:KeyboardFocusChangedLmlAttribute.java

示例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();
            }
        }
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:23,代码来源:ScrollFocusCaptureLmlAttribute.java

示例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);
        }
    });
}
 
开发者ID:gdx-libs,项目名称:gdx-lml-vis,代码行数:18,代码来源:OnAllTabsRemovalLmlAttribute.java

示例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);
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:21,代码来源:CellPadBottomLmlAttribute.java

示例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());
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:26,代码来源:DefaultLmlParser.java

示例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);
        }
    });
}
 
开发者ID:gdx-libs,项目名称:gdx-lml-vis,代码行数:18,代码来源:TextFieldListenerLmlAttribute.java

示例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);
        }
    });
}
 
开发者ID:gdx-libs,项目名称:gdx-lml-vis,代码行数:17,代码来源:OnTabSwitchLmlAttribute.java

示例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));
    }
}
 
开发者ID:gdx-libs,项目名称:gdx-lml-vis,代码行数:17,代码来源:OnResultLmlAttribute.java

示例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);
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:13,代码来源:HexColorLmlAttribute.java

示例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);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:10,代码来源:MenuItemFillImageLmlAttribute.java

示例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();
                }
            }
        }
    });
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:35,代码来源:OnDoubleClickLmlAttribute.java

示例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);
        }
    })));
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:12,代码来源:OriginLmlAttribute.java

示例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);
        }
    });
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:15,代码来源:PatchedOnClickLmlAttribute.java


注:本文中的com.github.czyzby.lml.parser.tag.LmlTag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。