Search in sources :

Example 1 with PortCalculator

use of org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculator in project netxms by netxms.

the class SlotView method paintControl.

/* (non-Javadoc)
	 * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
	 */
@Override
public void paintControl(PaintEvent e) {
    e.gc.drawText(slotName, HORIZONTAL_MARGIN, (getSize().y - nameSize.y) / 2);
    PortCalculator portCalculator = null;
    switch(numberingScheme) {
        case NDD_PN_DU_LR:
            portCalculator = new PortCalculatorDownUpLeftRight(nameSize.x, rowCount);
            break;
        case NDD_PN_LR_UD:
            portCalculator = new PortCalculatorLeftRightUpDown(nameSize.x, ports.size(), rowCount);
            break;
        case NDD_PN_LR_DU:
            portCalculator = new PortCalculatorLeftRightDownUp(nameSize.x, ports.size(), rowCount);
            break;
        case NDD_PN_CUSTOM:
            break;
        case NDD_PN_UNKNOWN:
        case NDD_PN_UD_LR:
        default:
            portCalculator = new PortCalculatorUpDownLeftRight(nameSize.x, rowCount);
            break;
    }
    for (PortInfo p : ports) {
        drawPort(p, portCalculator.calculateNextPos(), e.gc);
    }
}
Also used : PortInfo(org.netxms.ui.eclipse.topology.widgets.helpers.PortInfo) PortCalculator(org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculator) PortCalculatorLeftRightDownUp(org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculatorLeftRightDownUp) PortCalculatorLeftRightUpDown(org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculatorLeftRightUpDown) PortCalculatorUpDownLeftRight(org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculatorUpDownLeftRight) PortCalculatorDownUpLeftRight(org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculatorDownUpLeftRight)

Aggregations

PortCalculator (org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculator)1 PortCalculatorDownUpLeftRight (org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculatorDownUpLeftRight)1 PortCalculatorLeftRightDownUp (org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculatorLeftRightDownUp)1 PortCalculatorLeftRightUpDown (org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculatorLeftRightUpDown)1 PortCalculatorUpDownLeftRight (org.netxms.ui.eclipse.topology.widgets.helpers.PortCalculatorUpDownLeftRight)1 PortInfo (org.netxms.ui.eclipse.topology.widgets.helpers.PortInfo)1