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 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.scopemvc.view.swing.SAction;
 import  org.scopemvc.view.swing.SButton;
 import  org.scopemvc.view.swing.SCheckBox;
 import  org.scopemvc.view.swing.SComboBox;
 import  org.scopemvc.view.swing.SListCellRenderer;
 import  org.scopemvc.view.swing.SPanel;
 import  org.scopemvc.view.swing.SwingView;
 import  com.jgoodies.forms.builder.PanelBuilder;
 import  com.jgoodies.forms.layout.CellConstraints;
 import  com.jgoodies.forms.layout.FormLayout;

Dialog to select source, target and cardinality for DbRelationship
 public class DbRelationshipTargetDialog extends SPanel {
     public DbRelationshipTargetDialog(DbEntity source1, DbEntity source2) {
     protected void init(DbEntity source1, DbEntity source2) {
         // create widgets
         SButton saveButton = new SButton(new SAction(
         SButton cancelButton = new SButton(new SAction(
         SComboBox targetCombo = new SComboBox();
         SListCellRenderer renderer = (SListCellRenderer) targetCombo.getRenderer();
          = new JRadioButton();
          = new JRadioButton();
         .setEnabled(source2 != null);
         ButtonGroup bg = new ButtonGroup();
         SCheckBox toManyCheckBox = new SCheckBox();
         setTitle("Create New DbRelationship");
         setLayout(new BorderLayout());
         CellConstraints cc = new CellConstraints();
         PanelBuilder builder = new PanelBuilder(
                 new FormLayout(
                         "right:max(100dlu;pref), 3dlu, fill:min(150dlu;pref)",
                         "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, top:p:grow"));
         builder.addLabel("Source: " + source1.getName(), cc.xy(1, 1));
         builder.add(cc.xy(3, 1));
         builder.addLabel("Source: " + (source2 == null ? "" : source2.getName()), cc.xy(1, 3));
         builder.add(cc.xy(3, 3));
         builder.addLabel("Target:"cc.xy(1, 5));
         builder.add(targetCombocc.xywh(3, 5, 1, 1));
        builder.addLabel("To Many:"cc.xy(1, 7));
        builder.add(toManyCheckBoxcc.xywh(3, 7, 1, 1));
        add(builder.getPanel(), .);
        add(PanelFactory.createButtonPanel(new JButton[] {
            }), .);
        return ;
        return ;
New to GrepCode? Check out our FAQ X