Sha256: c390ae51c3a6fbe0b96b32a884d13f3644bfd00671aaedfe8f30a6492d3430c7

Contents?: true

Size: 832 Bytes

Versions: 6

Compression:

Stored size: 832 Bytes

Contents

module Rubeus::Extensions::Javax::Swing
  module BoxLayout
    def self.included(base)
      base.extend(ClassMethods)
      base.instance_eval do 
        alias :new_without_nestable :new
        alias :new :new_with_nestable
      end
    end
    
    module ClassMethods
      def new_with_nestable(*args, &block)
        if args.length == 1
          container = Rubeus::Awt::Nestable::Context.container
          raise ArgumentError, "No container! you must specify a Container and an axis" unless container
          args.unshift(container.respond_to?(:content_pane) ? container.content_pane : container)
        end
        
        unless args.last.is_a?(Integer)
          value = args.pop
          args << const_get(value.to_s)
        end
        
        new_without_nestable(*args, &block)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubeus-0.0.8-java lib/rubeus/extensions/javax/swing/box_layout.rb
rubeus-0.0.6-java lib/rubeus/extensions/javax/swing/box_layout.rb
rubeus-0.0.4-java lib/rubeus/extensions/javax/swing/box_layout.rb
rubeus-0.0.5-java lib/rubeus/extensions/javax/swing/box_layout.rb
rubeus-0.0.3-java lib/rubeus/extensions/javax/swing/box_layout.rb
rubeus-0.0.7-java lib/rubeus/extensions/javax/swing/box_layout.rb