clevic 0.12.0 → 0.13.0.b1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Manifest.txt +209 -30
- data/README.txt +16 -20
- data/Rakefile +8 -8
- data/TODO +6 -7
- data/bin/clevic +12 -73
- data/lib/clevic/action_builder.rb +168 -0
- data/lib/clevic/ar_methods.rb +120 -0
- data/lib/clevic/attribute_list.rb +56 -0
- data/lib/clevic/cache_table.rb +60 -37
- data/lib/clevic/default_view.rb +3 -16
- data/lib/clevic/delegate.rb +46 -0
- data/lib/clevic/emitter.rb +38 -0
- data/lib/clevic/extensions.rb +61 -114
- data/lib/clevic/field.rb +159 -228
- data/lib/clevic/field_valuer.rb +165 -0
- data/lib/clevic/filter_command.rb +2 -6
- data/lib/clevic/generic_format.rb +52 -0
- data/lib/clevic/{ui → icons}/icon.png +0 -0
- data/lib/clevic/many_field.rb +7 -0
- data/lib/clevic/model_builder.rb +234 -146
- data/lib/clevic/model_column.rb +61 -13
- data/lib/clevic/order_attribute.rb +10 -0
- data/lib/clevic/qt.rb +35 -0
- data/lib/clevic/qt/action_builder.rb +47 -0
- data/lib/clevic/qt/boolean_delegate.rb +8 -0
- data/lib/clevic/{browser.rb → qt/browser.rb} +35 -14
- data/lib/clevic/qt/clipboard.rb +35 -0
- data/lib/clevic/qt/combo_delegate.rb +198 -0
- data/lib/clevic/qt/delegates.rb +1 -0
- data/lib/clevic/qt/distinct_delegate.rb +35 -0
- data/lib/clevic/qt/extensions.rb +52 -0
- data/lib/clevic/qt/field.rb +18 -0
- data/lib/clevic/{item_delegate.rb → qt/item_delegate.rb} +8 -4
- data/lib/clevic/qt/relational_delegate.rb +87 -0
- data/lib/clevic/{search_dialog.rb → qt/search_dialog.rb} +1 -11
- data/lib/clevic/qt/set_delegate.rb +44 -0
- data/lib/clevic/qt/table_model.rb +331 -0
- data/lib/clevic/qt/table_view.rb +344 -0
- data/lib/clevic/qt/text_area_delegate.rb +8 -0
- data/lib/clevic/{text_delegate.rb → qt/text_delegate.rb} +6 -4
- data/lib/clevic/{ui → qt/ui}/.gitignore +0 -0
- data/lib/clevic/{ui → qt/ui}/browser.ui +0 -0
- data/lib/clevic/{ui → qt/ui}/search_dialog.ui +0 -0
- data/lib/clevic/rails_models_loaders.rb +56 -0
- data/lib/clevic/record.rb +2 -17
- data/lib/clevic/sampler.rb +81 -0
- data/lib/clevic/sequel_ar_adapter.rb +215 -0
- data/lib/clevic/sequel_length_validation.rb +23 -0
- data/lib/clevic/sequel_meta.rb +65 -0
- data/lib/clevic/sequel_naked.rb +30 -0
- data/lib/clevic/swing.rb +38 -0
- data/lib/clevic/swing/action.rb +125 -0
- data/lib/clevic/swing/action_builder.rb +47 -0
- data/lib/clevic/swing/boolean_delegate.rb +26 -0
- data/lib/clevic/swing/browser.rb +282 -0
- data/lib/clevic/swing/cell_editor.rb +95 -0
- data/lib/clevic/swing/cell_renderer.rb +44 -0
- data/lib/clevic/swing/clipboard.rb +135 -0
- data/lib/clevic/swing/combo_delegate.rb +336 -0
- data/lib/clevic/swing/confirm_dialog.rb +57 -0
- data/lib/clevic/swing/delegate.rb +40 -0
- data/lib/clevic/swing/distinct_delegate.rb +30 -0
- data/lib/clevic/swing/extensions.rb +274 -0
- data/lib/clevic/swing/field.rb +35 -0
- data/lib/clevic/swing/relational_delegate.rb +48 -0
- data/lib/clevic/swing/row_header.rb +210 -0
- data/lib/clevic/swing/search_dialog.rb +230 -0
- data/lib/clevic/swing/selection_model.rb +90 -0
- data/lib/clevic/swing/set_delegate.rb +41 -0
- data/lib/clevic/swing/swing_table_index.rb +43 -0
- data/lib/clevic/swing/table_model.rb +200 -0
- data/lib/clevic/swing/table_view.rb +385 -0
- data/lib/clevic/swing/table_view_focus.rb +47 -0
- data/lib/clevic/swing/tag_delegate.rb +127 -0
- data/lib/clevic/swing/tag_editor.rb +101 -0
- data/lib/clevic/swing/text_area_delegate.rb +46 -0
- data/lib/clevic/swing/text_delegate.rb +31 -0
- data/lib/clevic/swing/ui/build.xml +74 -0
- data/lib/clevic/swing/ui/dist/README.TXT +33 -0
- data/lib/clevic/swing/ui/dist/lib/swing-layout-1.0.3.jar +0 -0
- data/lib/clevic/swing/ui/manifest.mf +3 -0
- data/lib/clevic/swing/ui/nbproject/build-impl.xml +731 -0
- data/lib/clevic/swing/ui/nbproject/genfiles.properties +8 -0
- data/lib/clevic/swing/ui/nbproject/private/config.properties +0 -0
- data/lib/clevic/swing/ui/nbproject/private/private.properties +6 -0
- data/lib/clevic/swing/ui/nbproject/private/private.xml +4 -0
- data/lib/clevic/swing/ui/nbproject/project.properties +70 -0
- data/lib/clevic/swing/ui/nbproject/project.xml +14 -0
- data/lib/clevic/swing/ui/src/SearchDialog.form +158 -0
- data/lib/clevic/swing/ui/src/SearchDialog.java +163 -0
- data/lib/clevic/swing/ui/src/TagEditor.form +106 -0
- data/lib/clevic/swing/ui/src/TagEditor.java +108 -0
- data/lib/clevic/swing/ui/src/resources/SearchDialog.properties +0 -0
- data/lib/clevic/table_index.rb +100 -0
- data/lib/clevic/table_model.rb +54 -425
- data/lib/clevic/table_searcher.rb +113 -116
- data/lib/clevic/table_view.rb +171 -399
- data/lib/clevic/table_view_paste.rb +199 -0
- data/lib/clevic/version.rb +3 -2
- data/lib/clevic/view.rb +94 -43
- data/models/accounts_models.rb +13 -13
- data/models/minimal_models.rb +5 -9
- data/models/times_models.rb +19 -14
- data/models/times_psql_models.rb +10 -0
- data/models/times_sqlite_models.rb +1 -8
- data/models/values_models.rb +2 -8
- data/tasks/clevic.rake +1 -1
- data/tasks/rdoc.rake +1 -5
- data/tasks/website.rake +1 -1
- data/test/test_cache_table.rb +15 -29
- data/test/test_helper.rb +14 -83
- data/test/test_order_attribute.rb +1 -1
- data/test/test_table_model.rb +0 -21
- data/test/test_table_searcher.rb +67 -61
- metadata +262 -78
- data/lib/clevic.rb +0 -4
- data/lib/clevic/db_options.rb +0 -112
- data/lib/clevic/delegates.rb +0 -386
@@ -0,0 +1,47 @@
|
|
1
|
+
module Clevic
|
2
|
+
|
3
|
+
class TableViewFocus < java.awt.FocusTraversalPolicy
|
4
|
+
def initialize( table_view )
|
5
|
+
super()
|
6
|
+
@table_view = table_view
|
7
|
+
@table_view.focus_cycle_root = true
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns the Component that should receive the focus after aComponent.
|
11
|
+
# def getComponentAfter(Container aContainer, Component aComponent)
|
12
|
+
def getComponentAfter(container, component)
|
13
|
+
@table_view.jtable
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns the Component that should receive the focus before aComponent.
|
17
|
+
# def getComponentBefore(Container aContainer, Component aComponent)
|
18
|
+
def getComponentBefore(container, component)
|
19
|
+
@table_view.jtable
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns the default Component to focus.
|
23
|
+
# def getDefaultComponent(Container aContainer)
|
24
|
+
def getDefaultComponent(container)
|
25
|
+
@table_view.jtable
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns the first Component in the traversal cycle.
|
29
|
+
# def getFirstComponent(Container aContainer)
|
30
|
+
def getFirstComponent(container)
|
31
|
+
@table_view.jtable
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the Component that should receive the focus when a Window is made visible for the first time.
|
35
|
+
# Component getInitialComponent(Window window)
|
36
|
+
def getInitialComponent(window)
|
37
|
+
@table_view.jtable
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns the last Component in the traversal cycle.
|
41
|
+
# def getLastComponent(Container aContainer)
|
42
|
+
def getLastComponent(container)
|
43
|
+
@table_view.jtable
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'clevic/swing/delegate'
|
2
|
+
require 'clevic/swing/tag_editor.rb'
|
3
|
+
|
4
|
+
module Clevic
|
5
|
+
|
6
|
+
=begin rdoc
|
7
|
+
Delegate for doing simple multi-value fields. Tags, basically.
|
8
|
+
=end
|
9
|
+
class TagDelegate < Delegate
|
10
|
+
# Create a GUI widget and fill it with the possible values.
|
11
|
+
def init_component( cell_editor = nil )
|
12
|
+
line_editor edit_value
|
13
|
+
# This should be a collection of entities from the related table
|
14
|
+
@items = attribute_value
|
15
|
+
end
|
16
|
+
|
17
|
+
# Return the GUI component / widget that is displayed when editing.
|
18
|
+
# Usually this will be a combo box widget, but it can be a text editor
|
19
|
+
# in some cases.
|
20
|
+
attr_reader :editor
|
21
|
+
|
22
|
+
# the cell must be selected before the edit can be clicked
|
23
|
+
def needs_pre_selection?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
# Return a string to be shown to the user.
|
28
|
+
# model_value is an item stored in the combo box model.
|
29
|
+
def display_for( model_value )
|
30
|
+
field.transform_attribute( model_value )
|
31
|
+
end
|
32
|
+
|
33
|
+
def line_editor( value = nil )
|
34
|
+
@line_editor ||= javax.swing.JTextField.new( value ).tap do |line|
|
35
|
+
line.font = Clevic.tahoma
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def editor
|
40
|
+
line_editor
|
41
|
+
end
|
42
|
+
|
43
|
+
# Recreate the model and fill it with anything in population that
|
44
|
+
# matches the prefix first, followed by anything in the population that
|
45
|
+
# doesn't match the prefix.
|
46
|
+
# Then set the editor text value to either text, or to the previous
|
47
|
+
# value.
|
48
|
+
# Order is important: if the text is set first it's overridden when
|
49
|
+
# the model is populated.
|
50
|
+
def repopulate( prefix = nil, text = nil )
|
51
|
+
autocomplete do
|
52
|
+
# save text and popup
|
53
|
+
save_item = editor.editor.item
|
54
|
+
dropdown_visible = editor.popup_visible?
|
55
|
+
|
56
|
+
# repopulate based on the prefix
|
57
|
+
prefix ||= editor.editor.item
|
58
|
+
editor.model = editor.model.class.new
|
59
|
+
# split set into things to display at the top, and things to display further down
|
60
|
+
matching, non_matching = population.partition{ |item| display_for( item ) =~ /^#{prefix}/i }
|
61
|
+
matching.each {|item| editor << item}
|
62
|
+
non_matching.each {|item| editor << item}
|
63
|
+
|
64
|
+
# restore text and popup
|
65
|
+
editor.editor.item = text || save_item
|
66
|
+
editor.popup_visible = dropdown_visible
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# make sure we don't react to document change events
|
71
|
+
# while we're doing autocompletion. Reentrant
|
72
|
+
def autocomplete( &block )
|
73
|
+
@autocompleting = true
|
74
|
+
yield
|
75
|
+
ensure
|
76
|
+
@autocompleting = false
|
77
|
+
end
|
78
|
+
|
79
|
+
# http://www.drdobbs.com/184404457 for autocompletion steps
|
80
|
+
def filter_prefix( prefix )
|
81
|
+
# search for matching item in the UI display_for for the items in the combo model
|
82
|
+
candidate = population.map{|item| display_for( item ) }.select {|x| x =~ /^#{prefix}/i }.first
|
83
|
+
unless candidate.nil?
|
84
|
+
first_not_of = candidate.match( /^#{prefix}/i ).offset(0).last
|
85
|
+
invoke_later do
|
86
|
+
autocomplete do
|
87
|
+
# set the shortlist, and the text editor value
|
88
|
+
repopulate prefix, candidate
|
89
|
+
|
90
|
+
# set the suggestion selection
|
91
|
+
editor.editor.editor_component.with do |text_edit|
|
92
|
+
# highlight the suggested match, and leave caret
|
93
|
+
# at the beginning of the suggested text
|
94
|
+
text_edit.caret_position = candidate.length
|
95
|
+
text_edit.move_caret_position( first_not_of )
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# open the combo box, just like if F4 was pressed
|
103
|
+
# big trouble here with JComboBox firing an comboEdited action
|
104
|
+
# (probably) on focusGained
|
105
|
+
# which causes the popup to be hidden again
|
106
|
+
def full_edit
|
107
|
+
# Must request focus and then once focus is received, show popup.
|
108
|
+
# Otherwise focus received hides popup.
|
109
|
+
invoke_later do
|
110
|
+
#~ editor.add_focus_listener( LittleFocusPopper.new )
|
111
|
+
#~ editor.request_focus_in_window
|
112
|
+
editor.show_popup
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# open the text editor component
|
117
|
+
#~ def minimal_edit
|
118
|
+
#~ end
|
119
|
+
|
120
|
+
# return an array of related entity objects, to be
|
121
|
+
# passed into the attribute setter
|
122
|
+
def value
|
123
|
+
"the value"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'clevic/swing/delegate'
|
2
|
+
|
3
|
+
module Clevic
|
4
|
+
|
5
|
+
# all this just to format a display item...
|
6
|
+
# .... and work around various other Swing stupidities
|
7
|
+
class TagEditor < javax.swing.JComponent
|
8
|
+
def initialize( field )
|
9
|
+
super()
|
10
|
+
@field = field
|
11
|
+
|
12
|
+
create_fields
|
13
|
+
init_layout
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :field
|
17
|
+
attr_reader :entity
|
18
|
+
|
19
|
+
# Hopefully called by the editor framework
|
20
|
+
# might be init_component
|
21
|
+
def configureEditor( editor, entity )
|
22
|
+
@entity = entity
|
23
|
+
item_list.model.one = entity
|
24
|
+
end
|
25
|
+
|
26
|
+
attr_reader :text_field, :item_list, :ok_button, :cancel_button, :add_button, :remove_button
|
27
|
+
|
28
|
+
def create_fields
|
29
|
+
@item_list = TableView.new( field.many_view )
|
30
|
+
|
31
|
+
@text_field = javax.swing.JTextField.new
|
32
|
+
@ok_button = javax.swing.JButton.new
|
33
|
+
@cancel_button = javax.swing.JButton.new
|
34
|
+
@add_button = javax.swing.JButton.new
|
35
|
+
@remove_button = javax.swing.JButton.new
|
36
|
+
end
|
37
|
+
|
38
|
+
def init_layout
|
39
|
+
# This is mostly cut-n-pasted from the Netbeans Java sources. So don't tweak it.
|
40
|
+
text_field.setName("text_field");
|
41
|
+
|
42
|
+
item_list.setName("item_list");
|
43
|
+
|
44
|
+
ok_button.setText("OK");
|
45
|
+
ok_button.setToolTipText("Accept edits");
|
46
|
+
ok_button.setName("ok_button");
|
47
|
+
|
48
|
+
cancel_button.setText("Cancel");
|
49
|
+
cancel_button.setToolTipText("Cancel edits");
|
50
|
+
cancel_button.setName("cancel_button");
|
51
|
+
|
52
|
+
add_button.setText("+");
|
53
|
+
add_button.setToolTipText("Add a new item");
|
54
|
+
add_button.setBorder(nil);
|
55
|
+
add_button.setName("add_button");
|
56
|
+
|
57
|
+
remove_button.setText("-");
|
58
|
+
remove_button.setToolTipText("Remove selected item");
|
59
|
+
remove_button.setBorder(nil);
|
60
|
+
remove_button.setName("remove_button");
|
61
|
+
|
62
|
+
layout = org.jdesktop.layout.GroupLayout.new( self );
|
63
|
+
setLayout(layout);
|
64
|
+
layout.setHorizontalGroup(
|
65
|
+
layout.createParallelGroup(org.jdesktop.layout.GroupLayout::LEADING) \
|
66
|
+
.add(layout.createSequentialGroup() \
|
67
|
+
.addContainerGap() \
|
68
|
+
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout::LEADING) \
|
69
|
+
.add(item_list, org.jdesktop.layout.GroupLayout::DEFAULT_SIZE, 210, java.lang.Short::MAX_VALUE) \
|
70
|
+
.add(text_field, org.jdesktop.layout.GroupLayout::DEFAULT_SIZE, 210, java.lang.Short::MAX_VALUE) \
|
71
|
+
.add(layout.createSequentialGroup() \
|
72
|
+
.add(ok_button) \
|
73
|
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle::RELATED, 82, java.lang.Short::MAX_VALUE) \
|
74
|
+
.add(cancel_button)) \
|
75
|
+
.add(layout.createSequentialGroup() \
|
76
|
+
.add(add_button, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE, 27, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE) \
|
77
|
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle::RELATED) \
|
78
|
+
.add(remove_button, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE, 27, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE))) \
|
79
|
+
.addContainerGap()) \
|
80
|
+
);
|
81
|
+
layout.setVerticalGroup(
|
82
|
+
layout.createParallelGroup(org.jdesktop.layout.GroupLayout::LEADING) \
|
83
|
+
.add(layout.createSequentialGroup() \
|
84
|
+
.addContainerGap() \
|
85
|
+
.add(text_field, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE, org.jdesktop.layout.GroupLayout::DEFAULT_SIZE, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE) \
|
86
|
+
.add(18, 18, 18) \
|
87
|
+
.add(item_list, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE, 202, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE) \
|
88
|
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle::RELATED) \
|
89
|
+
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout::BASELINE) \
|
90
|
+
.add(add_button, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE) \
|
91
|
+
.add(remove_button, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout::PREFERRED_SIZE)) \
|
92
|
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle::RELATED, 30, java.lang.Short::MAX_VALUE) \
|
93
|
+
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout::BASELINE) \
|
94
|
+
.add(ok_button) \
|
95
|
+
.add(cancel_button)) \
|
96
|
+
.addContainerGap()) \
|
97
|
+
);
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'clevic/swing/delegate'
|
2
|
+
|
3
|
+
module Clevic
|
4
|
+
|
5
|
+
class EditorScrollPane < javax.swing.JScrollPane
|
6
|
+
# work around stupid JTable non-api for setting
|
7
|
+
# cell editor component size
|
8
|
+
# rectangle is a java.awt.Rectangle
|
9
|
+
def setBounds( rectangle )
|
10
|
+
height = 100
|
11
|
+
newrect = java.awt.Rectangle.new( rectangle.x, rectangle.y, rectangle.width, height )
|
12
|
+
super( newrect )
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class TextAreaDelegate < Delegate
|
17
|
+
# TODO check that Ctrl-VK_ENTER stops editing
|
18
|
+
def init_component( cell_editor )
|
19
|
+
@cell_editor = cell_editor
|
20
|
+
text_component.text = edit_value
|
21
|
+
text_component.rows = ( edit_value.andand.count( "\n" ) || 0 ) + 2
|
22
|
+
text_component.select_all
|
23
|
+
end
|
24
|
+
|
25
|
+
def editor
|
26
|
+
@editor ||= EditorScrollPane.new( text_component, javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS )
|
27
|
+
end
|
28
|
+
|
29
|
+
def text_component
|
30
|
+
@text_component ||= javax.swing.JTextArea.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def value
|
34
|
+
text_component.text
|
35
|
+
end
|
36
|
+
|
37
|
+
def minimal_edit
|
38
|
+
text_component.select_all
|
39
|
+
end
|
40
|
+
|
41
|
+
def needs_pre_selection?
|
42
|
+
true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'clevic/swing/delegate'
|
2
|
+
|
3
|
+
module Clevic
|
4
|
+
|
5
|
+
class TextDelegate < Delegate
|
6
|
+
# TODO check that VK_ENTER stops editing
|
7
|
+
def init_component( cell_editor )
|
8
|
+
editor.text = edit_value
|
9
|
+
editor.select_all
|
10
|
+
end
|
11
|
+
|
12
|
+
def editor
|
13
|
+
@editor ||= javax.swing.JTextField.new.tap do |e|
|
14
|
+
e.horizontal_alignment = field.swing_alignment
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def value
|
19
|
+
editor.text
|
20
|
+
end
|
21
|
+
|
22
|
+
def minimal_edit
|
23
|
+
editor.select_all
|
24
|
+
end
|
25
|
+
|
26
|
+
def needs_pre_selection?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- You may freely edit this file. See commented blocks below for -->
|
3
|
+
<!-- some examples of how to customize the build. -->
|
4
|
+
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
5
|
+
<!-- By default, only the Clean and Build commands use this build script. -->
|
6
|
+
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
7
|
+
<!-- the Compile on Save feature is turned off for the project. -->
|
8
|
+
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
9
|
+
<!-- in the project's Project Properties dialog box.-->
|
10
|
+
<project name="ui" default="default" basedir=".">
|
11
|
+
<description>Builds, tests, and runs the project ui.</description>
|
12
|
+
<import file="nbproject/build-impl.xml"/>
|
13
|
+
<!--
|
14
|
+
|
15
|
+
There exist several targets which are by default empty and which can be
|
16
|
+
used for execution of your tasks. These targets are usually executed
|
17
|
+
before and after some main targets. They are:
|
18
|
+
|
19
|
+
-pre-init: called before initialization of project properties
|
20
|
+
-post-init: called after initialization of project properties
|
21
|
+
-pre-compile: called before javac compilation
|
22
|
+
-post-compile: called after javac compilation
|
23
|
+
-pre-compile-single: called before javac compilation of single file
|
24
|
+
-post-compile-single: called after javac compilation of single file
|
25
|
+
-pre-compile-test: called before javac compilation of JUnit tests
|
26
|
+
-post-compile-test: called after javac compilation of JUnit tests
|
27
|
+
-pre-compile-test-single: called before javac compilation of single JUnit test
|
28
|
+
-post-compile-test-single: called after javac compilation of single JUunit test
|
29
|
+
-pre-jar: called before JAR building
|
30
|
+
-post-jar: called after JAR building
|
31
|
+
-post-clean: called after cleaning build products
|
32
|
+
|
33
|
+
(Targets beginning with '-' are not intended to be called on their own.)
|
34
|
+
|
35
|
+
Example of inserting an obfuscator after compilation could look like this:
|
36
|
+
|
37
|
+
<target name="-post-compile">
|
38
|
+
<obfuscate>
|
39
|
+
<fileset dir="${build.classes.dir}"/>
|
40
|
+
</obfuscate>
|
41
|
+
</target>
|
42
|
+
|
43
|
+
For list of available properties check the imported
|
44
|
+
nbproject/build-impl.xml file.
|
45
|
+
|
46
|
+
|
47
|
+
Another way to customize the build is by overriding existing main targets.
|
48
|
+
The targets of interest are:
|
49
|
+
|
50
|
+
-init-macrodef-javac: defines macro for javac compilation
|
51
|
+
-init-macrodef-junit: defines macro for junit execution
|
52
|
+
-init-macrodef-debug: defines macro for class debugging
|
53
|
+
-init-macrodef-java: defines macro for class execution
|
54
|
+
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
55
|
+
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
56
|
+
run: execution of project
|
57
|
+
-javadoc-build: Javadoc generation
|
58
|
+
test-report: JUnit report generation
|
59
|
+
|
60
|
+
An example of overriding the target for project execution could look like this:
|
61
|
+
|
62
|
+
<target name="run" depends="ui-impl.jar">
|
63
|
+
<exec dir="bin" executable="launcher.exe">
|
64
|
+
<arg file="${dist.jar}"/>
|
65
|
+
</exec>
|
66
|
+
</target>
|
67
|
+
|
68
|
+
Notice that the overridden target depends on the jar target and not only on
|
69
|
+
the compile target as the regular run target does. Again, for a list of available
|
70
|
+
properties which you can use, check the target you are overriding in the
|
71
|
+
nbproject/build-impl.xml file.
|
72
|
+
|
73
|
+
-->
|
74
|
+
</project>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
========================
|
2
|
+
BUILD OUTPUT DESCRIPTION
|
3
|
+
========================
|
4
|
+
|
5
|
+
When you build an Java application project that has a main class, the IDE
|
6
|
+
automatically copies all of the JAR
|
7
|
+
files on the projects classpath to your projects dist/lib folder. The IDE
|
8
|
+
also adds each of the JAR files to the Class-Path element in the application
|
9
|
+
JAR files manifest file (MANIFEST.MF).
|
10
|
+
|
11
|
+
To run the project from the command line, go to the dist folder and
|
12
|
+
type the following:
|
13
|
+
|
14
|
+
java -jar "ui.jar"
|
15
|
+
|
16
|
+
To distribute this project, zip up the dist folder (including the lib folder)
|
17
|
+
and distribute the ZIP file.
|
18
|
+
|
19
|
+
Notes:
|
20
|
+
|
21
|
+
* If two JAR files on the project classpath have the same name, only the first
|
22
|
+
JAR file is copied to the lib folder.
|
23
|
+
* Only JAR files are copied to the lib folder.
|
24
|
+
If the classpath contains other types of files or folders, none of the
|
25
|
+
classpath elements are copied to the lib folder. In such a case,
|
26
|
+
you need to copy the classpath elements to the lib folder manually after the build.
|
27
|
+
* If a library on the projects classpath also has a Class-Path element
|
28
|
+
specified in the manifest,the content of the Class-Path element has to be on
|
29
|
+
the projects runtime path.
|
30
|
+
* To set a main class in a standard Java project, right-click the project node
|
31
|
+
in the Projects window and choose Properties. Then click Run and enter the
|
32
|
+
class name in the Main Class field. Alternatively, you can manually type the
|
33
|
+
class name in the manifest Main-Class element.
|