/** Creates and configures the UI components; */ private void initComponents() { validationModel = new TrackValidationModel(new Track()); headerToolbar = buildToolBar(); titleField = ComponentFactory.createTextField(validationModel.getModel(Track.PROPERTYNAME_NAME), false); trackNumber = ComponentFactory.createTextField( validationModel.getModel(Track.PROPERTYNAME_TRACK_NUMBER), false); ((JTextField) trackNumber).setColumns(4); // comment = // ComponentFactory.createTextField(validationModel.getModel(Track.PROPERTYNAME_COMMENT), // false); /** AZ - use multi-line area for comment * */ comment = ComponentFactory.createTextArea( validationModel.getModel(Track.PROPERTYNAME_COMMENT), false); comment.setLineWrap(true); comment.setWrapStyleWord(true); comment.setRows(3); location = ComponentFactory.createLabel(getValidationModel().getModel(Track.PROPERTYNAME_TRACK_URL)); duration = UIFactory.createBoldLabel(""); layer = UIFactory.createBoldLabel(""); version = UIFactory.createBoldLabel(""); bitRate = UIFactory.createBoldLabel(""); frequency = UIFactory.createBoldLabel(""); mode = UIFactory.createBoldLabel(""); fileSize = UIFactory.createBoldLabel(""); emphasis = UIFactory.createBoldLabel(""); copyrighted = UIFactory.createBoldLabel(""); albumImage = new AlbumImage( new Dimension( this.getSettings().getCoverSizeSmall(), this.getSettings().getCoverSizeSmall())); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent event) { AlbumImage preview = (AlbumImage) event.getSource(); if (preview.getDisc() != null) { setBusyCursor(true); getMainModule().selectNodeInTree(preview.getDisc()); setBusyCursor(false); } } }; albumImage.addActionListener(actionListener); }
private JToolBar buildToolBar() { final ToolBarBuilder bar = new ToolBarBuilder("Track Toolbar"); ToolBarButton button = null; button = (ToolBarButton) ComponentFactory.createToolBarButton(Actions.UNLOCK_ID); button.putClientProperty(Resources.EDITOR_COMPONENT, this); bar.add(button); button = (ToolBarButton) ComponentFactory.createToolBarButton(Actions.COMMIT_ID); button.putClientProperty(Resources.EDITOR_COMPONENT, this); bar.add(button); button = (ToolBarButton) ComponentFactory.createToolBarButton(Actions.ROLLBACK_ID); button.putClientProperty(Resources.EDITOR_COMPONENT, this); bar.add(button); button = (ToolBarButton) ComponentFactory.createToolBarButton(Actions.DELETE_ID); button.putClientProperty(Resources.EDITOR_COMPONENT, this); bar.add(button); button = (ToolBarButton) ComponentFactory.createToolBarButton(Actions.FILE_RENAME_ID); button.putClientProperty(Resources.EDITOR_COMPONENT, this); bar.add(button); return bar.getToolBar(); }
/** * Builds the Track editor panel. * * <p> * * @return the panel to edit track info. AZ - FormLayout corrections */ private JComponent buildTrackPanel() { FormLayout layout = new FormLayout( "right:max(14dlu;pref), 4dlu, left:20dlu, left:140dlu, 4dlu, left:25px, right:pref:grow", "4px, p, 4px, p, 4px, p, " + this.getSettings().getCoverSizeSmall() + "px"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.addLabel(Resources.getString("label.tracknumber") + ": ", cc.xy(1, 2)); builder.add(trackNumber, cc.xy(3, 2)); builder.add(albumImage, cc.xywh(7, 2, 1, 6, "right, top")); builder.addLabel(Resources.getString("label.title") + ": ", cc.xy(1, 4)); builder.add(titleField, cc.xyw(3, 4, 2)); builder.add(ComponentFactory.createTitleCaseButton(titleField), cc.xy(6, 4)); builder.addLabel(Resources.getString("label.comment") + ": ", cc.xy(1, 6, "right, top")); builder.add(comment, cc.xyw(3, 6, 2)); return new IconFeedbackPanel( getValidationModel().getValidationResultModel(), builder.getPanel()); }