UnitButtonGrouped.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:bco.bcozy 作者:
/**
 * Adds a UnitRemote to the list of this button's units. If it is the first unit after construction,
 * the correct icon is added to this button.
 *
 * @param unit UnitRemote that is supposed to be controlled by this grouped button.
 * @throws InterruptedException
 * @throws CouldNotPerformException
 */
public void addUnit(final UnitRemote<? extends GeneratedMessage> unit) throws InterruptedException, CouldNotPerformException {

    try {
        AbstractUnitPane content;
        content = UnitPaneFactoryImpl.getInstance().newInitializedInstance(unit.getConfig());
        content.setDisplayMode(DisplayMode.ICON_ONLY);

        if (groupingPane.getChildren().isEmpty()) {
            SVGIcon icon = content.getIconSymbol();
            iconPane.getChildren().add(icon);
            this.locationId = unit.getConfig().getPlacementConfig().getLocationId();
        }
        content.setVisible(false);
        content.getStyleClass().add("units-button");
        content.setStyle("-fx-background-color: rgb(64.0, 64.0, 64.0)");
        this.groupingPane.getChildren().add(content);
    } catch (CouldNotPerformException ex) {
        throw new CouldNotPerformException("Could not create grouped unit button for config " + this, ex);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号