Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7411713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:25:48+00:00 2026-05-29T06:25:48+00:00

I am looking for a pattern that applies to configuring placement of graphic objects.

  • 0

I am looking for a pattern that applies to configuring placement of graphic objects.

Here’s my problem:

I have some data objects with properties such as name, description, image etc.
I want to draw representations of these objects onto a canvas.

There are different “layouts” that can be applied. All the layout definitions are there at compile time.

In the layout description I want to be able to define the following for any of the object properties:

size: for text of course this doesn’t mean the length/height of the whole text but of a character

position:

  • either absolute to the starting point of the representation

  • or relative to other displayed properties (e.g. thisPropertyDisplay.x = anotherPropertyDisplay.x + anotherPropertyDisplay.length)

Of course I could explicitly code the placement in n blocks/methods, one for each layout. Is there a better practise or an idiom how to implement this problem in Java?

What I actually want to do is I want to describe something like that:

property1.x = 0; property1.y = 0;
property2.x = property1.Endpoint.x; property2.y = property1.y;
property3.x = property1.Endpoint.x; property3.y = property2.Endpoint.y;

That definition is not explicitly coded in n Java methods, but there is one method able to parse all layout definition and apply them to the objects.

If the computation of the text size is beyond a useful pattern, just assume the length and height is always given.

Does that make sense? Is there a pattern / idiom name for it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:25:49+00:00Added an answer on May 29, 2026 at 6:25 am

    Decorator pattern seems to be the right one:

    http://en.wikipedia.org/wiki/Decorator_pattern

    The idea is you will have another class that will extend the behavior to handling the position and size information.

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's an interesting problem, and I'm looking for a pattern that will keep it
I am looking for a design pattern that handles large data sets over the
I am looking at pattern recognition in images and video and have thought that
I am looking for a regex pattern that would match several different combinations of
I am looking for a Repository pattern implementation example/resource that follows domain driven design
We're looking at patterns such as MVP that can help make us seperate UI
I'm looking for a design pattern to manage a pool of objects. A thread
I am looking for a regex pattern that ensures the user puts in a
Here is a simple thread pattern that I use when writing a class that
I have been trying to create a regular expressions pattern that matches any reference

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.