org.netbeans.api.visual.vmd.VMDPinWidget Java Examples

The following examples show how to use org.netbeans.api.visual.vmd.VMDPinWidget. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DB_VMDGraph.java    From BART with MIT License 6 votes vote down vote up
private void createAttribute(String table , Attribute attribute)   {
    VMDPinWidget attributeWidget = (VMDPinWidget)scene.addPin(table,table+attribute.getName());
    attributeWidget.setPinName(attribute.getName());
    attributeWidget.setToolTipText("Double click for View Table data");
    attributeWidget.setLayout(LayoutFactory.createHorizontalFlowLayout(
                                LayoutFactory.SerialAlignment.JUSTIFY, 7));
    
    LabelWidget type = new LabelWidget(scene);
    type.setForeground(Color.GRAY);
    type.setLabel(attribute.getType());
    attributeWidget.addChild(type);
    
    for(Key k : db.getKeys(table))   {
        for(AttributeRef attr : k.getAttributes())   {
            if(attr.getName().equals(attribute.getName()) && k.isPrimaryKey())   {
                LabelWidget pk = new LabelWidget(scene);
                pk.setForeground(Color.BLUE);
                pk.setLabel(" PK");
                attributeWidget.addChild(pk);    
            }
        }
    }
}
 
Example #2
Source File: VmdEgdSceneGenerator.java    From Llunatic with GNU General Public License v3.0 6 votes vote down vote up
private List<VMDNodeWidget> createPremiseNodes(VMDGraphScene scene) {
    List<VMDNodeWidget> result = new ArrayList<VMDNodeWidget>();
    for (String commonValue : commonValues.keySet()) {
        Collection<String> cells = commonValues.get(commonValue);
        if (cells.size() > 1) {
            VMDNodeWidget node = (VMDNodeWidget) scene.addNode(commonValue);
            node.setNodeName(commonValue);
            node.setBorder(premiseBorder);
            createNodePin(scene, node);
            result.add(node);
            for (String cell : cells) {
                VMDPinWidget pin = (VMDPinWidget) scene.addPin(commonValue, cell + ":" + commonValue);
                pin.setPinName(cell);
            }
        }
    }
    return result;
}
 
Example #3
Source File: VmdTgdDepSceneGenerator.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
private void addAtom(RelationalAtom atom) {
    logger.debug("FORMULA ATOM: " + atom.toString());
    String atomId = atom.getTableNameWithAlias();
    VMDNodeWidget n1 = (VMDNodeWidget) scene.addNode(atomId);
    n1.setNodeName(atom.getTableNameWithAlias());
    nodes.add(n1);
    for (FormulaAttribute formulaVariable : atom.getAttributes()) {
        logger.debug("FORMULA ATTRIBUTE PIN: " + formulaVariable.toString());
        VMDPinWidget pin = (VMDPinWidget) scene.addPin(atomId, formulaVariable.hashCode() + "");
        pin.setPinName(formulaVariable.toString());
    }
}
 
Example #4
Source File: LunaticDepScene.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Implements attaching a widget to a pin. The widget is VMDPinWidget and
 * has object-hover and select action.
 *
 * @param node the node
 * @param pin the pin
 * @return the widget attached to the pin, null, if it is a default pin
 */
@Override
protected Widget attachPinWidget(GraphNode node, PinNode pin) {
    if (pin.isHidden()) {
        return null;
    }
    VMDPinWidget widget = new VMDPinWidget(this, scheme);
    ((VMDNodeWidget) findWidget(node)).attachPinWidget(widget);
    widget.getActions().addAction(createObjectHoverAction());
    widget.getActions().addAction(createSelectAction());
    return widget;
}
 
Example #5
Source File: GraphColorScheme.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
    public void updateUI(VMDPinWidget widget, ObjectState previousState, ObjectState state) {
        widget.setOpaque(state.isSelected());
        if (state.isFocused() || state.isHovered()) {
            widget.setBorder(BORDER_PIN_HOVERED);
        } else {
            widget.setBorder(BORDER_PIN);
        }
//        LookFeel lookFeel = getScene ().getLookFeel ();
//        setBorder (BorderFactory.createCompositeBorder (BorderFactory.createEmptyBorder (8, 2), lookFeel.getMiniBorder (state)));
//        setForeground (lookFeel.getForeground (state));
    }
 
Example #6
Source File: LunaticDepScene.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
@Override
public VMDPinWidget createPin(PinNode pinNode) {
    VMDPinWidget widget = (VMDPinWidget) addPin(pinNode.getGraphNode(), pinNode);
    widget.setPinName(pinNode.getDisplayName());
    return widget;
}
 
Example #7
Source File: GraphColorScheme.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void installUI(VMDPinWidget widget) {
    widget.setBorder(BORDER_PIN);
    widget.setBackground(COLOR_SELECTED);
    widget.setOpaque(false);
}
 
Example #8
Source File: IVmdScene.java    From Llunatic with GNU General Public License v3.0 votes vote down vote up
VMDPinWidget createPin(PinNode pinNode);