Drawing and some layout help for a simple control: thin lines and application start

I am trying to create a new, simple control. The control should act as a grouping marker much like that found in the Mathematica notebook interface. It is designed to sit to the right of a node and draw a simple bracket. The look of the bracket changes depending on whether the node is logically marked open or closed.
After looking at some blogs and searching, I tried setting the snapToPixels to true in the container holding the marker control as well as the strokewidth but I am still finding that the bracket line is too thick. I am trying to draw a thin line. Also, I am unable to get the layout to work when the test application is first opened. One of the outer brackets is cut-off. I hardcoded some numbers into the skin just to get something to work.
Is there a better way to implement this control?
How can I get the fine line drawn as well as the layout correct at application start?
package org.notebook;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.scene.control.Control;
* Provide a simple and thin bracket that changes
* it appearance based on whether its closed or open.
public class GroupingMarker extends Control {
  private final static String DEFAULT_STYLE_CLASS = "grouping-marker";
  private BooleanProperty open;
  private IntegerProperty depth;
  public BooleanProperty openProperty() { return open; }
  public IntegerProperty depthProperty() { return depth; }
  public GroupingMarker(boolean open) {
  this();
  setOpen(open);
  public GroupingMarker() {
  open = new SimpleBooleanProperty(true);
  depth = new SimpleIntegerProperty(0);
  getStyleClass().add(DEFAULT_STYLE_CLASS);
  // TODO: Change to use CSS directly
  setSkin(new GroupingMarkerSkin(this));
  public boolean isOpen() {
  return open.get();
  public void setOpen(boolean flag) {
  open.set(flag);
  public int getDepth() {
  return depth.get();
  public void setDepth(int depth) {
  this.depth.set(depth);
package org.notebook;
import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.scene.shape.FillRule;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import com.sun.javafx.scene.control.skin.SkinBase;
* The skin draws some simple lines on the right hand side of
* the control. The lines reflect whether the control is considered
* open or closed. Since there is no content, there is no
* content handling code needed.
public class GroupingMarkerSkin extends SkinBase<GroupingMarker, GroupingMarkerBehavior> {
  GroupingMarker control;
  Color lineColor;
  double shelfLength;
  double thickness;
  private Group lines;
  public GroupingMarkerSkin(GroupingMarker control) {
  super(control, new GroupingMarkerBehavior(control));
  this.control = control;
  lineColor = Color.BLUE;
  shelfLength = 5.0;
  thickness = 1.0;
  init();
  * Attached listeners to the properties in the control.
  protected void init() {
  registerChangeListener(control.openProperty(), "OPEN");
  registerChangeListener(control.depthProperty(), "DEPTH");
  lines = new Group();
  repaint();
  @Override
  protected void handleControlPropertyChanged(String arg0) {
  super.handleControlPropertyChanged(arg0);
    @Override public final GroupingMarker getSkinnable() {
        return control;
    @Override public final void dispose() {
    super.dispose();
        control = null;
    @Override
    protected double computePrefHeight(double arg0) {
    System.out.println("ph: " + arg0);
    return super.computePrefHeight(arg0);
    @Override
    protected double computePrefWidth(double arg0) {
    System.out.println("pw: " + arg0);
    return super.computePrefWidth(40.0);
     * Call this if a property changes that affects the visible
     * control.
    public void repaint() {
    requestLayout();
    @Override
    protected void layoutChildren() {
    if(control.getScene() != null) {
    drawLines();
    getChildren().setAll(lines);
    super.layoutChildren();
    protected void drawLines() {
    lines.getChildren().clear();
    System.out.println("bounds local: " + control.getBoundsInLocal());
    System.out.println("bounds parent: " + control.getBoundsInParent());
    System.out.println("bounds layout: " + control.getLayoutBounds());
    System.out.println("pref wxh: " + control.getPrefWidth() + "x" + control.getPrefHeight());
    double width = Math.max(0, 20.0 - 2 * 2.0);
    double height = control.getPrefHeight() - 4.0;
    height = Math.max(0, control.getBoundsInLocal().getHeight()-4.0);
    System.out.println("w: " + width + ", h: " + height);
    double margin = 4.0;
    final Path VERTICAL = new Path();
    VERTICAL.setFillRule(FillRule.EVEN_ODD);
    VERTICAL.getElements().add(new MoveTo(margin, margin)); // start
    VERTICAL.getElements().add(new LineTo(margin + shelfLength, margin)); // top horz line
    VERTICAL.getElements().add(new LineTo(margin + shelfLength, height - margin)); // vert line
    if(control.isOpen()) {
    VERTICAL.getElements().add(new LineTo(margin, height - margin)); // bottom horz line
    } else {
    VERTICAL.getElements().add(new LineTo(margin, height-margin-4.0));
    //VERTICAL.getElements().add(new ClosePath());
    VERTICAL.setStrokeWidth(thickness);
    VERTICAL.setStroke(lineColor);
    lines.getChildren().addAll(VERTICAL);
    lines.setCache(true);
package org.notebook;
import com.sun.javafx.scene.control.behavior.BehaviorBase;
public class GroupingMarkerBehavior extends BehaviorBase<GroupingMarker> {
  public GroupingMarkerBehavior(final GroupingMarker control) {
  super(control);
package org.notebook;
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TestGroupingMarker extends Application {
  public static void main(String args[]) {
  launch(TestGroupingMarker.class, args);
  @Override
  public void start(Stage stage) throws Exception {
  VBox vbox = new VBox();
  BorderPane p = new BorderPane();
  VBox first = new VBox();
  first.getChildren().add(makeEntry("In[1]=", "my label", 200.0, true));
  first.getChildren().add(makeEntry("Out[1]=", "the output!", 200.0, true));
  p.setCenter(first);
  p.setRight(new GroupingMarker(true));
  vbox.getChildren().add(p);
  vbox.getChildren().add(makeEntry("In[2]=", "my label 2", 100.0, false));
  Scene scene = new Scene(vbox,500,700);
  scene.getStylesheets().add(TestGroupingMarker.class.getResource("main.css").toExternalForm());
  stage.setScene(scene);
  stage.setTitle("GroupingMarker test");
  stage.show();
  protected Node makeEntry(String io, String text, double height, boolean open) {
  BorderPane pane2 = new BorderPane();
  pane2.setSnapToPixel(true);
  Label label2 = new Label(io);
  label2.getStyleClass().add("io-label");
  pane2.setLeft(label2);
  TextArea area2 = new TextArea(text);
  area2.getStyleClass().add("io-content");
  area2.setPrefHeight(height);
  pane2.setCenter(area2);
  GroupingMarker marker2 = new GroupingMarker();
  marker2.setOpen(open);
  pane2.setRight(marker2);
  return pane2;

The test interfaces are already defined for you - the 3rd party session bean remote/local interfaces.
It is pretty trivial to create implementations of those interfaces to return the test data from your XML files.
There are a number of ways to handle the switching, if you have used the service locator pattern, then I would personally slot the logic in to the service locator, to either look up the 3rd party bean or return a POJO test implementation of the interface according to configuration.
Without the service locator, you are forced to do a little more work, you will have to implement your own test session beans to the same interfaces as the 3rd party session beans.
You can then either deploy them instead of the 3rd party beans or you can deploy both the test and the 3rd party beans under different JNDI names,and use ejb-ref tags and allow you to switch between test and real versions by changing the ejb-link value.
Hope this helps.
Bob B.

Similar Messages

  • Just got my Mac air and i would like to make a file to store some web addresses for my new business with rodan and fields and I can't do it. Made the file but i cant copy and paste the web addresses in the file to save them. Please help and thank you.

    Just got my Mac air and i would like to make a file to store some web addresses for my new business with rodan and fields and I can't do it. Made the file but i cant copy and paste the web addresses in the file to save them. Please help and thank you.

    Yes - well you have to make the file in a word processing Application.
    You could use TextEdit (it's free) Pages (words only), or Numbers (data base) (they are part of iWorks - and may or may not be free (included) on your machine.  You could use MS Office (it is not free) You could use any Open source word processor that plays well with Office (NeoOffice, StarOffice) they are free.
    That's how you create content and copy/paste URLS. Then you save the file to the desktop. If you are going to make more than one file... you make a folder on the desktop and save, or drag the file(s) into it.
    You attach it to your e-mail client which will compress it and e-mail it. An excellent reference is to use Help, from the menu bar, also from inside any application. From your library or book store the OS X for Dummies has a lot of useful information (you don't read it cover to cover but look up chapters about what you'd like to do)
    You can also make appointments at your local Apple store for individualized help (if a store is nearby)

  • Pls i need help for this simple problem. i appreciate if somebody would share thier ideas..

    pls i need help for this simple problem of my palm os zire 72. pls share your ideas with me.... i tried to connect my palm os zire72 in my  desktop computer using my usb cable but i can't see it in my computer.. my palm has no problem and it works well. the only problem is that, my  desktop computer can't find my palm when i tried to connect it using usb cable. is thier any certain driver or installer needed for it so that i can view my files in my palm using the computer. where i can download its driver? is there somebody can help me for this problem? just email me pls at [email protected] i really accept any suggestions for this problem. thanks for your help...

    If you are using Windows Vista go to All Programs/Palm and click on the folder and select Hot Sync Manager and then try to sync with the USB cable. If you are using the Windows XP go to Start/Programs/Palm/Hot Sync Manager and then try to sync. If you don’t have the palm folder at all on your PC you have to install it. Here is the link http://kb.palm.com/wps/portal/kb/common/article/33219_en.html that version 4.2.1 will be working for your device Zire 72.

  • [svn:fx-trunk] 10075: Cleanups from the spark text changes and some bug fixes for VideoElement.

    Revision: 10075
    Author:   [email protected]
    Date:     2009-09-08 18:01:58 -0700 (Tue, 08 Sep 2009)
    Log Message:
    Cleanups from the spark text changes and some bug fixes for VideoElement.  Also some PARB changes for UIComponent.
    TitleBar: Changing the skin part type from Label to Textbase
    UIComponent: skipMeasure()->canSkipMeasurement() to be in line with GraphicElement.  This has been PARB approved.
    UIComponent: same with hasComplexLayoutMatrix...this replaces hasDeltaIdentityTransform.  This has been PARB approved.
    StyleProtoChain: cleanup around what interfaces to use
    TextBase: clean up code that?\226?\128?\153s no longer needed.
    VideoElement: Fixing 4 bugs:
    SDK-22824: sourceLastPlayed keeps track of what video file we?\226?\128?\153ve called play() with last.  This way if a user pauses the video and wants to start it up again at the same point, we can call play(null) on the underlying FLVPlayback videoPlayer.  However, anytime the souce changes, we want to null out sourceLastPlayed.  This was causing a bug when someone set the source to null and then reset it to it?\226?\128?\153s previous value.
    SDK-23034 (GUMBO_PRIORITY): This deals with some FLVPlayback quirks around sizing.  I had put in a fix so we weren?\226?\128?\153t setting width/height on the underlying videoPlayer too many times, but apparently we need to make sure it always gets called once.  Hopefully when switching to Strobe we can cleanup this logic...I put a FIXME in to do this.
    SDK-21947/ SDK-22533 - some video files don?\226?\128?\153t always send out a metadata event.  I?\226?\128?\153m not quite sure why this is, but in case this happens, we do a check in the ready handler to see whether we should call invalidateSize() to make sure it gets sized properly.
    QE notes:-
    Doc notes:-
    Bugs: SDK-22824, SDK-23034, SDK-21947, SDK-22533
    Reviewer: Glenn, Corey
    Tests run: checkintests, Button, GraphicTags, VideoElement, and VideoPlayer (some VideoPlayer were failing, but I think it should be fine)
    Is noteworthy for integration: Yes
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22824
        http://bugs.adobe.com/jira/browse/SDK-23034
        http://bugs.adobe.com/jira/browse/SDK-21947
        http://bugs.adobe.com/jira/browse/SDK-22533
        http://bugs.adobe.com/jira/browse/SDK-22824
        http://bugs.adobe.com/jira/browse/SDK-23034
        http://bugs.adobe.com/jira/browse/SDK-21947
        http://bugs.adobe.com/jira/browse/SDK-22533
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/airframework/src/spark/components/windowClasses/TitleB ar.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleProtoChain.as
        flex/sdk/trunk/frameworks/projects/spark/src/mx/core/UITLFTextField.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Group.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Label.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichEditableText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Skin.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/TextBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/supportClasses/AddActionInstan ce.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/supportClasses/AnimateTransfor mInstance.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/supportClasses/RemoveActionIns tance.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/VideoElement.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/GraphicEleme nt.as

  • Trying to download songs on iTunes and it's asking for "my 1st car I owned" and other questions that I never answered. It won't let me download anything til I answer them. Can you help me?

    Trying to download songs on iTunes and it's asking for "my 1st car I owned" and other questions that I never answered. It won't let me download anything til I answer them. Can you help me?

    You need to contact Apple to get the questions reset. Click here, phone them, and ask for the Account Security team, or fill out and submit this form.
    (94816)

  • Drag and Drop Layout feature for regions

    Wondering if there is a drag and drop layout feature for regions in 3.1.2 (or below that I might have missed) or if there are plans for it in future releases. I know that this feature is available for items in a region but interested for the many regions I have on a page. I think it would be a nice feature to have instead of having to go into a page template to get the layout I want.
    Thoughts?
    Thanks,
    Russ

    Look at the following link:
    Drag and drop - like the builder?

  • Recommendations for a simple, fast GUI LAN chat application? [Solved]

    We now have 4 ArchLinux machines scattered throughout the house. (My wife is an Archer now!). I am looking for a simple fast GUI LAN chat application. I looked at "qchat" but it is a bit cumbersome and doesn't have the option of a small applet to the panel. Any recommendations appreciated...
    Larry
    Last edited by lagagnon (2010-02-13 21:27:00)

    jwwolf wrote:Found this in AUR
    griv
    I just tried it with a few machines and it works fine.
    Excellent choice! Nice, light and unobtrusive. Works well, thanks for the recommendation.

  • My dad's ipad 2 is glitchy. The icons are small, and some have no design. The dock is gone, and when I unlocked portrait orientation, it won't turn

    I was just checking fb when suddenly i accidentally pressed this app about this battery thing. Now some icons are small, and some icons have no design
    There is no dock, and when I unlocked portrait orientation, it didn't turn. I turned it off and on about many times, and the play, fast forward, and reverse button are overlapping. ITS SO GLITCHY!

    Try a reset: Simultaneously hold down the Home and On buttons until the iPad shuts down. Ignore the off slider if it appears. Once shut down is complete, if it doesn't restart on it own, turn the iPad back on using the On button. In some cases it also helps to double click the Home button and close all apps from the tray before doing the reset.

  • Can we assign 2 IPs for a SCCM 2012 primary site server and use 1 IP for communicating with its 2 DPs and 2nd one for communicating with its upper hierarchy CAS which is in a different .Domain

    Hi,
    Can we assign 2 IPs for a SCCM 2012 primary site server and use 1 Ip for communicating with its 2 DPs and 2nd one for communicating with its upper hierarchy CAS . ?
    Scenario: We are building 1 SCCM 2012 primary site and 2 DPs in one domain . In future this will attach to a CAS server which is in different domain. Can we assign  2 IPs in Primary site server , one IP will use to communicate with its 2 DPs and second
    IP for communicating with the CAS server which is in a different domain.? 
    Details: 
    1)Server : Windows 2012 R2 Std , VM environment .2) SCCM : SCCM 2012 R2 .3)SQL: SQL 2012 Std
    Thanks
    Rajesh Vasudevan

    First, it's not possible. You cannot attach a primary site to an existing CAS.
    Primary sites in 2012 are *not* the same as primary sites in 2007 and a CAS is 2012 is completely different from a central primary site in 2007.
    CASes cannot manage clients. Also, primary sites are *not* used for delegation in 2012. As Torsten points out, multiple primary sites are used for scale-out (in terms of client count) only. Placing primary sites for different organizational units provides
    no functional differences but does add complexity, latency, and additional failure points.
    Thus, as the others have pointed out, your premise for doing this is completely incorrect. What are your actual business goals?
    As for the IP Addressing, that depends upon your networking infrastructure. There is no way to configure ConfigMgr to use different interfaces for different types of traffic. You could potentially manipulate the routing tables in Windows but that's asking
    for trouble IMO.
    Jason | http://blog.configmgrftw.com | @jasonsandys

  • How will Aperture treat Nikon raw images which have been enhanced using Capture NX2 software?  Some are cropped and "developed" and some have been enhanced using the control point technology.  I have NIK sw as a plug-in in aperture.

    How will Aperture treat Nikon raw images which have been enhanced using Capture NX2 software?  Some are cropped and "developed" and some have been enhanced using the control point technology.  I have NIK sw as a plug-in in aperture.

    Actually, there is a Nik/Nikon connection — but I am pretty sure it is irrelevant to the OP's question. The connection is that Capture NX2 was written as a joint venture between Nikon and Nik. (The name similarity is a coincidence.)
    Capture NX2 is a cool program that incorporates the features of Nik's Viveza and Nikon's Raw processing engine, along with some other powerful image adjustment features. It provides, like Aperture, a losses workflow. Unlike Aperture, the adjustments (Edit Steps in C-NX terminology) are saved in the original NEF file along with the un-altered raw data. Multiple versions can be saved in a single NEF.

  • Record about my phone (bought in Verizon store and connected to Verizon for 4 years) has been corrupted and now I can not make any changes to my data plan. Several sessions with the technical support and management have not resolved this issue. Each time

    Record about my phone (bought in Verizon store and connected to Verizon for 4 years) has been corrupted and now I can not make any changes to my data plan. Several sessions with the technical support and management have not resolved this issue. Each time technical people and top managers promised that this issue will be resolve tomorrow and they will cal me. Nothing happend!! I can not even cancel my service not just to upgrade it. Completely locked. 
    Any advice?
    Thanks.
    Alex.

    Cannot figure out what your talking about since it makes no sense.
    If you are the account owner you can go to the My Verizon web portal http://www.verizonwireless.com
    You must log in with your cell number and your my Verizon portal password. Not the account pin.
    Once there you can change your plan and services. However repeated incorrect login attempts will lock you out of the site. It a fraud prevention measure.
    1-800-922-0204 call support with your cell number and or account number and account pin and they can assist you.
    If you don't have the information then there is nothing they can do.
    If you can verify who you are they may be able to reset your account access. But only if you are the account owner.
    Good Luck

  • I bought a new 5s and its front and back camera are not working, showing black image. My phone is IOS 7 updated, and some one insisted that its is software updation problem, and can be resolved by updating to IOS 8. Kindly suggest.

    I bought a new 5s and its front and back camera are not working, showing black image. My phone is IOS 7.1.2 updated, and some one insisted that its is software updation problem, and can be resolved by updating to IOS 8. Kindly suggest.

    I have the same issue on my iPhone 5s
    I've closed the app and re-booted the phone several times but it did not resolve the issue.
    Upgrading to iOS 8.0.2 did not resolve it either.
    Erasing the iPhone and restoring from a backup did not resolve it.
    I'm not sure what else to do.

  • I bought a new iPhone 5s and its front and back camera are not working, showing black image. My phone is IOS 7 updated, and some one insisted that its is software updation problem, and can be resolved by updating to IOS 8. Kindly suggest on this. Wil

    I bought a new iPhone 5s and its front and back camera are not working, showing black image. My phone is IOS 7 updated, and some one insisted that its is software updation problem, and can be resolved by updating to IOS 8. Kindly suggest on this. Will this resolve my issue?

    any advise..?

  • HT1349 I bought an album and some of the songs came up as separate songs and not in an album list.  How do I fix this?

    I bought an album and some of the songs came up as separate songs and not in an album list.  How do I fix this?

    Downloading past purchases from the App Store ... - Support - Apple

  • I was editing vacation photos in aperture 3 all of a sudden the thumbnail disappeared and now all i have is a vertical white line and an orange flag... how do i get my photo back?  thanks

    i was editing vacation photos in aperture 3 all of a sudden the thumbnail disappeared and now all i have is a vertical white line and an orange flag... how do i get my photo back?  thanks

         Hi Frank.
         I have just had jb Atlanta's problem while adjusting the contrast on a photo. I was creating a slideshow at the time. After a lot of reading up I was about to give up when I tried restoring the file to its original settings as you suggested. Bingo!
         However, that would only work for me, if I restored the settings while in the slideshow. All data had 'disappeared' when I attempted to open the photo in its original project folder.
         Hope this is of help. Many thanks.

Maybe you are looking for

  • Not relevant for billing

    Hi I have created a sales order type (XXX)which I only use as template for creating other order types. How du I ensure that orders of type XXX is not relevant for billing. this also means that I don't want it to be a part of vf04 or any other sap rep

  • Error in deleting facebook account

    Iam getting trouble in deleting my facebook account which i have created It gives an error code:0x80048869

  • Audio console crash

    Audio console crash? Good day, I have a PCI Express X-Fi Titanium and I have been trying to get the Audio console to work. I have tried all of the following versions. It seems to install fine but When I attemp to change setting within it it crashes.

  • 10.4.7 update causes weird pixels on my G4 titanium PB

    So, here's the deal, this is the only Apple update release that caused my G4 titanium powerbook to observe weird screen behavior (pixles appearing everywhere making it very hard to read thus impossible to use). The screenshot i took shows just the be

  • Mid 2013 Migration - Can't Sign Directly Into 2013 FE Server

    Migration to 2013 almost complete. While testing ran into the following scenario: 2010 FE Standard Server, 2013 FE Standard Server, 2013 Edge Standard Server. DNS entries still pointing at 2010 FE server (sipinternaltls, lyncdiscover, admin, dialin,