1package com.example.graphics;
3import com.example.graphics.adapter.MockThirdPartyRenderer;
4import com.example.graphics.adapter.ThirdPartyRendererAdapter;
5import com.example.graphics.factory.ConsoleRendererFactory;
6import com.example.graphics.factory.RendererFactory;
7import com.example.graphics.factory.ShapeFactory;
8import com.example.graphics.factory.SvgRendererFactory;
9import com.example.graphics.model.Circle;
10import com.example.graphics.model.Line;
11import com.example.graphics.model.Rectangle;
12import com.example.graphics.model.Shape;
13import com.example.graphics.observer.ConsoleLogger;
14import com.example.graphics.proxy.RemoteRendererProxy;
15import com.example.graphics.render.Renderer;
16import com.example.graphics.singleton.RenderingConfig;
17import com.example.graphics.visitor.JsonExportVisitor;
18import com.example.graphics.visitor.XmlExportVisitor;
24 public static void main(String[] args) {
25 System.out.println(
"Graphics Rendering System Demonstration");
26 System.out.println(
"======================================");
30 System.out.println(
"Using configuration: " + config.
getDefaultWidth() +
"x" +
51 System.out.println(
"\nCreating and adding shapes...");
62 System.out.println(
"\nRendering with SVG renderer:");
66 System.out.println(
"\nSwitching to console renderer...");
71 System.out.println(
"\nSwitching to third-party renderer via adapter...");
78 System.out.println(
"\nSwitching to remote renderer via proxy...");
87 System.out.println(
"\nMoving the circle...");
94 System.out.println(
"\nUndoing the move...");
98 System.out.println(
"\nRedoing the move...");
103 System.out.println(
"\nExporting to JSON:");
108 System.out.println(
"\nExporting to XML:");
113 System.out.println(
"\nDemonstration complete.");
void setRenderer(Renderer renderer)
void moveShape(Shape shape, int x, int y)
void addShape(Shape shape)
void acceptVisitor(ShapeVisitor visitor)
void addObserver(ShapeObserver observer)
static void main(String[] args)
Shape createRectangle(int x, int y, int width, int height)
Shape createCircle(int x, int y, int radius)
Shape createLine(int x1, int y1, int x2, int y2)
String getDefaultRendererType()
static synchronized RenderingConfig getInstance()
Renderer createRenderer(int width, int height)