package seedu.todo.ui.components;

import java.util.List;

import javafx.fxml.FXML;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import seedu.todo.ui.UiPartLoader;

public class TagList extends Component {

    private static final String FXML_PATH = "components/TagList.fxml";

    // Links
    private static final String TASKS_LABEL = "Tasks";
    private static final String TASKS_ICON_PATH = "/images/icon-pin.png";
    private static final String OVERDUE_LABEL = "Overdue Tasks";
    private static final String OVERDUE_ICON_PATH = "/images/icon-siren.png";
    private static final String EVENTS_LABEL = "Events";
    private static final String EVENTS_ICON_PATH = "/images/icon-calendar.png";
    private static final String COMPLETED_LABEL = "Completed Tasks";
    private static final String COMPLETED_ICON_PATH = "/images/icon-tick.png";
    private static final String TAG_LABEL = "Tags";
    private static final String SPACE = " ";
    private static final String LEFT_BRACKET  = "(";
    private static final String RIGHT_BRACKET = ")";
    
    // Props
    public List<String> tags; // stub

    // FXML
    @FXML
    private Text titleText;
    @FXML
    private VBox tagListLinksPlaceholder;
    @FXML
    private VBox tagListTagsPlaceholder;

    public static TagList load(Stage primaryStage, Pane placeholderPane) {
        return UiPartLoader.loadUiPart(primaryStage, placeholderPane, new TagList());
    }

    @Override
    public String getFxmlPath() {
        return FXML_PATH;
    }

    @Override
    public void componentDidMount() {
        titleText.setText(formatTagSize(tags.size()));

        // Load TagListLinks
        loadLinks();

        // Load TagListItems
        loadTags();
    }
    
    private String formatTagSize(int size) {
        return TAG_LABEL + SPACE + LEFT_BRACKET + size + RIGHT_BRACKET;
    }
    
    private void loadLinks() {
        TagListLink.reset(tagListLinksPlaceholder);

        String[] linkLabels = { TASKS_LABEL, OVERDUE_LABEL, EVENTS_LABEL, COMPLETED_LABEL };
        String[] linkIconPaths = { TASKS_ICON_PATH, OVERDUE_ICON_PATH, EVENTS_ICON_PATH, COMPLETED_ICON_PATH };

        for (int i = 0; i < linkLabels.length; i++) {
            TagListLink link = TagListLink.load(primaryStage, tagListLinksPlaceholder);
            link.linkLabel = linkLabels[i];
            link.iconPath = linkIconPaths[i];
            link.render();
        }
    }

    private void loadTags() {
        TagListItem.reset(tagListTagsPlaceholder);

        for (String tag : tags) {
            TagListItem item = TagListItem.load(primaryStage, tagListTagsPlaceholder);
            item.tag = tag;
            item.render();
        }
    }

}

@@ -1022,114 +1022,8 @@
  %22;%0A
-    private static final String LEFT_BRACKET  = %22(%22;%0A    private static final String RIGHT_BRACKET = %22)%22;%0A
     
@@ -1781,43 +1781,35 @@
 E + 
-LEFT_BRACKET + size + RIGHT_BRACKET
+String.format(%22(%25s)%22, size)
 ;%0A  

Remove bracket variable and use StringFormat as suggested