@Override public String getDescription(float relativeX, float relativeY) { return Labels.getName(material, plural); }
/** * Gets the name of a {@link ESoldierType}. * * @param type * The soldier type * @return The localized name. */ public static String getName(ESoldierType type) { return getString("soldier_" + type); }
private void localize() { messageLabel.setText(Labels.getProgress(EProgressState.LOADING)); }
/** * Gets a string. * * @param key * The name of the string * @return The localized string */ public static String getString(String key) { return INSTANCE.getSingleString(key); }
/** * Sets the type of the building to display. * * @param type * The type. * @param workplace * <code>true</code> if it is currently under construction. */ public void setType(EBuildingType type, boolean workplace) { String text = Labels.getName(type); if (workplace) { text = Labels.getString("building-build-in-progress", text); } setText(text); } }
/** * Gets the name of a movable. * * @param type * The movable type * @return The name. */ public static String getName(EMovableType type) { return getString("movable_" + type); }
@Override public String getDescription(float relativeX, float relativeY) { return Labels.getName(material, plural); }
public Row(final EMaterialType materialType) { type = materialType; goodsIcon = new UIPanel(); goodsIcon.setBackground(materialType.getIcon()); lblQuantity = new Label(Labels.getString(Integer.toString(quantity)), EFontSize.NORMAL); IPositionSupplier positionSupplier = () -> position; Button upButton = new SetMaterialProductionButton(positionSupplier, type, SetMaterialProductionAction.EMaterialProductionType.INCREASE); Button downButton = new SetMaterialProductionButton(positionSupplier, type, SetMaterialProductionAction.EMaterialProductionType.DECREASE); arrows = new UIPanel(); arrows.setBackground(arrowsImageLink); arrows.addChild(upButton, 0f, 0.5f, 1f, 1f); arrows.addChild(downButton, 0f, 0f, 1f, 0.5f); barFill = new ActionProvidedBarFill(fillForClick -> new SetMaterialProductionAction(position, materialType, SetMaterialProductionAction.EMaterialProductionType.SET_RATIO, fillForClick), Labels.getName(materialType, false) + "-production-barfill"); float left = 0; addChild(goodsIcon, left, 0f, left += iconWidth, 1f); addChild(lblQuantity, left, quantityTextMarginV, left += quantityTextWidth, 1f - quantityTextMarginV); addChild(arrows, left, 0f, left += arrowsWidth, 1f); addChild(barFill, left + barPaddingLeft, barMarginV, 1f, 1f - barMarginV); }
@Override public void startProgressChanged(EProgressState state, float progress) { SwingUtilities.invokeLater(() -> messageLabel.setText(Labels.getProgress(state))); }
/** * Gets a String for a progress constant. * * @param progress * The progress constant. * @return The localized name, */ public static String getProgress(EProgressState progress) { return getString("progress_" + progress); } }
public PlaceMovableTool(EMovableType type, IPlayerSetter player) { super(null); this.type = type; this.player = player; this.translatedName = String.format(Locale.ENGLISH, EditorLabels.getLabel("tool.place"), Labels.getName(type)); }
/** * Gets the name of a resource. * * @param type * The resource type * @return The name. */ public static String getName(EResourceType type) { return getString("resource_" + type); }
private static String getName(int row) { if (row >= BUILDING_START) { return Labels.getName(EBuildingType.values()[row - BUILDING_START]); } else if (row >= MOVABLE_START) { return Labels.getName(EMovableType.values()[row - MOVABLE_START]); } else if (row >= MATERIAL_START) { return Labels.getName(EMaterialType.values()[row - MATERIAL_START], true); } return ""; }
/** * Gets the name of a building. * * @param type * The building type * @return The name. */ public static String getName(EBuildingType type) { return getString("building_" + type); }
public SimpleActionButton(EActionType actionType, ImageLink image, ImageLink active) { super(new Action(actionType), image, active, Labels.getName(actionType)); }
/** * Gets the name for an action type. * * @param action * The action type. * @return The localized name. */ public static String getName(EActionType action) { return getString("action_" + action); }
/** * Constructor * * @param type * Type of the building to place * @param player * Interface to query which player owns the building */ public PlaceBuildingTool(EBuildingType type, IPlayerSetter player) { super(null); this.type = type; this.player = player; this.translatedName = String.format(Locale.ENGLISH, EditorLabels.getLabel("tool.building"), Labels.getName(type)); }
@Override public String getDescription(float relativex, float relativey) { return Labels.getString("priority_" + next); }
/** * Constructor * * @param type * Type to place, <code>null</code> to delete resources */ public PlaceResource(EResourceType type) { super(type == null ? ToolIcon.loadIcon("remove-resource.png") : null, type == null ? EditorLabels.getLabel("tool.remove-resource") : Labels.getName(type)); this.type = type; shapeTypes.add(EShapeType.POINT); shapeTypes.add(EShapeType.LINE); shapeTypes.add(EShapeType.LINE_CIRCLE); shapeTypes.add(EShapeType.NOISY_LINE_CIRCLE); shapeTypes.add(EShapeType.GRID_CIRCLE); }