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


Java Suggestion类代码示例

本文整理汇总了Java中net.sf.freecol.common.model.WorkLocation.Suggestion的典型用法代码示例。如果您正苦于以下问题:Java Suggestion类的具体用法?Java Suggestion怎么用?Java Suggestion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Suggestion类属于net.sf.freecol.common.model.WorkLocation包,在下文中一共展示了Suggestion类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSuggestion

import net.sf.freecol.common.model.WorkLocation.Suggestion; //导入依赖的package包/类
private void addSuggestion(Map<UnitType, Suggestion> suggestions,
    UnitType expert, Suggestion suggestion) {
    if (suggestion == null || expert == null) return;
    Suggestion now = suggestions.get(expert);
    if (now == null || now.amount < suggestion.amount) {
        suggestions.put(expert, suggestion);
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:9,代码来源:ReportCompactColonyPanel.java

示例2: unitButtons

import net.sf.freecol.common.model.WorkLocation.Suggestion; //导入依赖的package包/类
private List<JButton> unitButtons(final Map<UnitType, Suggestion> suggestions,
                                  List<UnitType> have, Colony colony) {
    final String cac = colony.getId();
    List<JButton> result = new ArrayList<>();
    final Comparator<UnitType> buttonComparator
        = Comparator.comparing(ut -> suggestions.get(ut),
                               Suggestion.descendingAmountComparator);
    for (UnitType type : sort(suggestions.keySet(), buttonComparator)) {
        boolean present = have.contains(type);
        Suggestion suggestion = suggestions.get(type);
        String label = Integer.toString(suggestion.amount);
        ImageIcon icon
            = new ImageIcon(this.lib.getTinyUnitImage(type, false));
        StringTemplate tip = (suggestion.oldType == null)
            ? stpld("report.colony.wanting")
                .addName("%colony%", colony.getName())
                .addNamed("%unit%", type)
                .addStringTemplate("%location%",
                    suggestion.workLocation.getLabel())
                .addNamed("%goods%", suggestion.goodsType)
                .addAmount("%amount%", suggestion.amount)
            : stpld("report.colony.improving")
                .addName("%colony%", colony.getName())
                .addNamed("%oldUnit%", suggestion.oldType)
                .addNamed("%unit%", type)
                .addStringTemplate("%location%",
                    suggestion.workLocation.getLabel())
                .addNamed("%goods%", suggestion.goodsType)
                .addAmount("%amount%", suggestion.amount);
        JButton b = newButton(cac, label, icon,
                              (present) ? cGood : cPlain, tip);
        if (present) b.setFont(b.getFont().deriveFont(Font.BOLD));
        result.add(b);
    }
    return result;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:37,代码来源:ReportCompactColonyPanel.java


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