Skip to content

Instantly share code, notes, and snippets.

View hjohn's full-sized avatar

John Hendrikx hjohn

  • The Hague, Netherlands
View GitHub Profile
@hjohn
hjohn / Behavior Public API Proposal V2.md
Created November 25, 2023 01:59
Behavior Public API Proposal V2

Behavior Public API Proposal V2

Overview

Introduce a new Behavior interface that can be set on a control to replace its current behavior. The new behavior can be fully custom or composed (or later subclassed) from a default behavior. Some default behaviors will be provided as part of this proposal, but not all.

Goals

  • Allow changing the Behavior of a Control without changing its skin
  • Allow changing the Skin of a Control without having to recreate Behavior
@hjohn
hjohn / BehaviorPublicAPIProposal.md
Last active November 11, 2023 05:06
Behavior Public API Proposal

Behavior Public API Proposal

Summary

Introduce a new Behavior interface that can be set on a control to replace its current behavior. The new behavior can be fully custom or composed (or later subclassed) from a default behavior. Some default behaviors will be provided as part of this proposal, but not all.

Definitions

Term Description
@hjohn
hjohn / ActionProposal.md
Last active November 6, 2023 02:02
Customizable key bindings for default behaviors

Customizable key bindings for default behaviors

Summary

Provide an opportunity to customize key bindings during construction time of standard behaviors, without exposing the internal InputMaps. The API is constructed in such a way to not block later enhancements to allow InputMaps to be shared or made immutable.

Goals

  • Provide API to customize key bindings provided by default behaviors
  • Provide a public class KeyBinding which is lighter weight, and immutable
@hjohn
hjohn / ExpressionHelper.java
Created July 8, 2022 20:59
ExpressionHelper using a different collection for large lists and different locking
/*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
@hjohn
hjohn / OrderedCollection.java
Created July 8, 2022 20:58
OrderedCollection
package com.sun.javafx.binding;
import java.util.AbstractCollection;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;
@hjohn
hjohn / DebugSceneFX.java
Created March 28, 2021 11:46
Code to monitor children that have been removed from a scene but are not getting garbage collected
package hs.mediasystem.runner.util;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@hjohn
hjohn / gist:9427646
Created March 8, 2014 09:07
Lambda reference to container class causes problems
package lambda;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class LambdaReferenceTest {
private static final ScheduledExecutorService SCHEDULED_EXECUTOR_SERVICE = Executors.newSingleThreadScheduledExecutor();
public static void main(String[] args) {