1c: Used new FrameDecorator in Client example code

This commit is contained in:
0nlineSam 2024-11-25 14:55:28 +01:00
parent 70c90c1a21
commit f7e214eb7e

View File

@ -1,20 +1,25 @@
package client;
import decorator.FrameDecorator;
import model.Article;
import model.Image;
import model.NewsCollection;
public class Client {
public static void main() {
public static void main(String[] args) {
FrameDecorator framedCat1 = new FrameDecorator(new Image("Athletic cat contest", 800, 600, "zdf"));
FrameDecorator framedCat2 = new FrameDecorator(new Article("Missing Cat missed.", "mfg"));
FrameDecorator framedCat3 = new FrameDecorator(new Image("Missing cat", 1280, 720, "anonymous"));
NewsCollection masterCollection = new NewsCollection("Daily news");
masterCollection.addItem(new NewsCollection("Sports")
.addItem(new Article("Harder, Better, Faster, Stronger. Doping controls loosened","ups"))
.addItem(new Image("Athletic cat contest", 800, 600, "zdf")))
.addItem(framedCat1))
.addItem(new NewsCollection("Local news")
.addItem(new Article("Missing Cat missed.", "mfg"))
.addItem(framedCat2)
.addItem(new Article("Corrupted local politician selling cats.", "ard"))
.addItem(new Image("Missing cat", 1280, 720, "anonymous")));
.addItem(framedCat3));
System.out.println("\n===List===\n");
System.out.print(masterCollection.getOverview());