Examples of panelRack


Examples of client.views.swing.common.panelRack

     * * Methods used to modify the view from model notifications **
     */
    @Override
    public void tileMovedFromRackToGrid(TileFromRackToGridEvent event) {
        Point tP = event.getTargetPosition();
        panelRack sourceParent = (panelRack) rack.getInnerRack().getComponent(event.getSourcePosition());
        panelGrid targetParent = (panelGrid) gameboard.getInnerGrid().getComponent((tP.y * 15) + tP.x);
        targetParent.addDTElement((DTPicture) sourceParent.getComponent(0));
        rack.downTileNumber();
        if (event.isBlank()) {
            BlankDialog blankPopup = new BlankDialog(frame);
            blankPopup.showBlank();
            updateDTPictureBlank((DTPicture) targetParent.getComponent(0), tileBlank);
View Full Code Here

Examples of client.views.swing.common.panelRack

        }
    }

    @Override
    public void tileMovedFromRackToRack(TileFromRackToRackEvent event) {
        panelRack sourceParent = (panelRack) rack.getInnerRack().getComponent(event.getSourcePosition());
        panelRack targetParent = (panelRack) rack.getInnerRack().getComponent(event.getTargetPosition());
        targetParent.addDTElement((DTPicture) sourceParent.getComponent(0));
        // Set the targetParent component visible.
    }
View Full Code Here

Examples of client.views.swing.common.panelRack

        // Set the targetParent component visible.
    }

    @Override
    public void tileMovedFromRackToRackWithShift(TileFromRackToRackWithShiftEvent event) {
        panelRack sourceParent = (panelRack) rack.getInnerRack().getComponent(event.getSourcePosition());
        DTPicture DTPtmp = (DTPicture) sourceParent.getComponent(0);
        rack.shiftTiles(event.getSourcePosition(), event.getTargetPosition());
        panelRack targetParent = (panelRack) rack.getInnerRack().getComponent(event.getTargetPosition());
        targetParent.addDTElement(DTPtmp);
    }
View Full Code Here

Examples of client.views.swing.common.panelRack

    @Override
    public void tileMovedFromGridToRack(TileFromGridToRackEvent event) {
        Point sP = event.getSourcePosition();
        panelGrid sourceParent = (panelGrid) gameboard.getInnerGrid().getComponent((sP.y * 15) + sP.x);
        panelRack targetParent = (panelRack) rack.getInnerRack().getComponent(event.getTargetPosition());
        targetParent.addDTElement((DTPicture) sourceParent.getComponent(0));
        rack.upTileNumber();
        if (event.isBlank()) {
            updateDTPictureBlank((DTPicture) targetParent.getComponent(0), "?");
            getController().notifyBackTileBlank(event.getTargetPosition());
        }
    }
View Full Code Here

Examples of client.views.swing.common.panelRack

    @Override
    public void tileMovedFromGridToRackWithShift(TileFromGridToRackWithShiftEvent event) {
        rack.shiftTiles(rack.findEmptyParent(event.getTargetPosition()), event.getTargetPosition());
        Point sP = event.getSourcePosition();
        panelGrid sourceParent = (panelGrid) gameboard.getInnerGrid().getComponent((sP.y * 15) + sP.x);
        panelRack targetParent = (panelRack) rack.getInnerRack().getComponent(event.getTargetPosition());
        targetParent.addDTElement((DTPicture) sourceParent.getComponent(0));
        rack.upTileNumber();
        if (event.isBlank()) {
            updateDTPictureBlank((DTPicture) targetParent.getComponent(0), "?");
            getController().notifyBackTileBlank(event.getTargetPosition());
        }
    }
View Full Code Here

Examples of client.views.swing.common.panelRack

        innerRack.setBounds(192, 737, (TILE_WIDTH + 7) * 7, TILE_HEIGHT);
        innerRack.setOpaque(false);

        for (int i = 0; i < RACK_LENGTH; i++) {
            // Construct panelRack Element in the background of the rack and add it a DTPicture instance.
            panelRack panelRackElement = new panelRack(TILE_WIDTH, TILE_HEIGHT, i);
            if (debug) {
                panelRackElement.setBorder(BorderFactory.createLineBorder(Color.GREEN)); // Used for DEBUG
            }
            innerRack.add(panelRackElement, i);
        }
    }
View Full Code Here

Examples of client.views.swing.common.panelRack

    private void putTile(DTPicture dtp) {
        boolean found = false;
        int i = 0;
        while (!found && i < RACK_LENGTH) {
            panelRack parent = (panelRack) innerRack.getComponent(i);
            if (parent.getComponentCount() == 0) {
                parent.addDTElement(dtp);
                found = true;
            }
            i++;
        }
    }
View Full Code Here

Examples of client.views.swing.common.panelRack

        newInnerRack.setSize(TILE_WIDTH * 7, TILE_HEIGHT);
        newInnerRack.setBounds(192, 737, (TILE_WIDTH + 7) * 7, TILE_HEIGHT);
        newInnerRack.setOpaque(false);

        for (int i = 0; i < RACK_LENGTH; i++) {
            panelRack reader = (panelRack) this.innerRack.getComponent(positions[i]);
            panelRack panelRackElement = new panelRack(TILE_WIDTH, TILE_HEIGHT, i);
            panelRackElement.addDTElement((DTPicture) reader.getComponent(0));
            newInnerRack.add(panelRackElement, i);
        }
        this.innerRack = newInnerRack;
        this.innerRack.validate();
        this.innerRack.repaint();
View Full Code Here

Examples of client.views.swing.common.panelRack

        DTPicture DTPtmp = null;
        // STEP 1 : Check the direction of shift and set index
        int DEC = (startPos - stopPos < 0) ? 1 : -1;

        // STEP 2 : Save the first element in a temp variable
        panelRack tmpParent = (panelRack) innerRack.getComponent(startPos);
        if (tmpParent.getComponentCount() > 0 && tmpParent.getComponent(0) instanceof DTPicture) {
            DTPtmp = (DTPicture) tmpParent.getComponent(0);
        }

        // STEP 3 : Loop over the rack to shift tiles.
        while (startPos != stopPos) {
            panelRack writerP = (panelRack) innerRack.getComponent(startPos);
            panelRack readerP = (panelRack) innerRack.getComponent(startPos + DEC);

            if (readerP.getComponentCount() > 0 && readerP.getComponent(0) instanceof DTPicture) {
                writerP.add(readerP.getComponent(0));
            }
            writerP.validate();
            writerP.repaint();
            startPos += DEC;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.