本文整理匯總了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);
}
}
示例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;
}