Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 
 package org.apache.cayenne.modeler.dialog.objentity;
 
 
 
 import  org.apache.cayenne.map.Embeddable;
 
 import  com.jgoodies.forms.builder.PanelBuilder;
 import  com.jgoodies.forms.layout.CellConstraints;
 import  com.jgoodies.forms.layout.FormLayout;
 import  com.jgoodies.forms.layout.RowSpec;
 
 public class ObjAttributeInfoDialogView extends JDialog {

    
// * Browser to select path for attribute //
 
     protected MultiColumnBrowser pathBrowser;
 
     protected JButton cancelButton;
     protected JButton saveButton;
     protected JButton selectPathButton;
 
     protected JTextField attributeName;
     protected JLabel currentPathLabel;
     protected JLabel sourceEntityLabel;
 
     protected JComboBox type;
     protected JPanel typeManagerPane;
 
     protected CayenneTable overrideAttributeTable;
 
 
     static final Dimension BROWSER_CELL_DIM = new Dimension(130, 200);
     
     static final String EMBEDDABLE_PANEL = "EMBEDDABLE_PANEL"
     static final String FLATTENED_PANEL = "FLATTENED_PANEL"
 
     public ObjAttributeInfoDialogView(final ProjectController mediator) {
 
         this. = mediator;
 
         // create widgets
         this. = new JButton("Cancel");
         this. = new JButton("Done");
         this. = new JButton("Select path");
 
         this. = new JTextField(25);
         this. = new JLabel();
         this. = new JLabel();
 
         this. = CayenneWidgetFactory.createComboBox(ModelerUtil
                 .getRegisteredTypeNames(), false);
         AutoCompletion.enable(falsetrue);
         .getRenderer();
 
          = new CayenneTable();
        .setEnabled(false);
        .setEnabled(true);
        .setEnabled(false);
        setTitle("ObjAttribute Inspector");
        setLayout(new BorderLayout());
        CellConstraints cc = new CellConstraints();
        final PanelBuilder builder = new PanelBuilder(
                new FormLayout(
                        "right:max(50dlu;pref), 3dlu, 200dlu, 15dlu, right:max(30dlu;pref), 3dlu, 200dlu",
                        "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 6dlu, p, 6dlu, p, 3dlu, fill:p:grow"));
        builder.setDefaultDialogBorder();
        builder.addSeparator("ObjAttribute Information"cc.xywh(1, 1, 7, 1));
        builder.addLabel("Attribute:"cc.xy(1, 3));
        builder.add(cc.xywh(3, 3, 1, 1));
        builder.addLabel("Current Db Path:"cc.xy(1, 5));
        builder.add(cc.xywh(3, 5, 5, 1));
        builder.addLabel("Source:"cc.xy(1, 7));
        builder.add(cc.xywh(3, 7, 1, 1));
        builder.addLabel("Type:"cc.xy(1, 9));
        builder.add(cc.xywh(3, 9, 1, 1));
        builder.addSeparator("Mapping to Attributes"cc.xywh(1, 11, 7, 1));
         = new JPanel();
        .setLayout(new CardLayout());
        final FormLayout fL = new FormLayout(
                "493dlu ",
                "p, 3dlu, fill:min(128dlu;pref):grow");
        // panel for Flattened attribute
        final PanelBuilder builderPathPane = new PanelBuilder(fL);
        JPanel buttonsPane = new JPanel(new FlowLayout(.));
        buttonsPane.add();
        builderPathPane.add(buttonsPanecc.xywh(1, 1, 1, 1));
        builderPathPane.add(new JScrollPane(
                ,
                .,
                .), cc.xywh(1, 3, 1, 1));
        // panel for embeddable attribute
        final FormLayout fLEmb = new FormLayout(
                "493dlu ",
                "fill:min(140dlu;pref):grow");
        final PanelBuilder embeddablePane = new PanelBuilder(fLEmb);
        embeddablePane.add(new JScrollPane(,
              .,
              .),
              cc.xywh(1, 1, 1, 1));
        .add(builderPathPane.getPanel(), );
        .add(embeddablePane.getPanel(), );
        builder.add(cc.xywh(1, 13, 7, 1));
        add(builder.getPanel(), .);
        this.addComponentListener(new ComponentListener() {
            int height;
            public void componentHidden(ComponentEvent e) {
            }
            public void componentMoved(ComponentEvent e) {
            }
            public void componentResized(ComponentEvent e) {
                int delta = e.getComponent().getHeight() - ;
                if (delta < 0) {
                    fL.setRowSpec(3, new RowSpec("fill:min(10dlu;pref):grow"));
                    fLEmb.setRowSpec(1, new RowSpec("fill:min(10dlu;pref):grow"));
                }
            }
            public void componentShown(ComponentEvent e) {
                 = e.getComponent().getHeight();
            }
        });
        add(PanelFactory.createButtonPanel(new JButton[] {
                
        }), .);
        .addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                boolean isType = false;
                String[] typeNames = ModelerUtil.getRegisteredTypeNames();
                for (int i = 0; i < typeNames.lengthi++) {
                    if (.getSelectedItem() == null || typeNames[i].equals(.getSelectedItem().toString())) {
                        isType = true;
                    }
                }
                Iterator<Embeddable> embs = mediator.getEmbeddableNamesInCurRentDataDomain().iterator();
                ArrayList<StringembNames = new ArrayList<String>();
                while (embs.hasNext()) {
                embNames.add(embs.next().getClassName());
               }
                
                if (isType || !embNames.contains(.getSelectedItem()) ) {
                    ((CardLayout.getLayout()).show();
                }
                else {
                    ((CardLayout.getLayout()).show();
                    getCurrentPathLabel().setText("");
                    
                }
            }
        });
    }
        return ;
    }
    public JComboBox getType() {
        return ;
    }
        return ;
    }
    public JButton getCancelButton() {
        return ;
    }
    public JButton getSaveButton() {
        return ;
    }
    public JButton getSelectPathButton() {
        return ;
    }
    public JTextField getAttributeName() {
        return ;
    }
    public JLabel getCurrentPathLabel() {
        return ;
    }
    public JLabel getSourceEntityLabel() {
        return ;
    }
New to GrepCode? Check out our FAQ X