当前位置: 首页>>代码示例>>Java>>正文


Java ObservableList.get方法代码示例

本文整理汇总了Java中javafx.collections.ObservableList.get方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableList.get方法的具体用法?Java ObservableList.get怎么用?Java ObservableList.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.collections.ObservableList的用法示例。


在下文中一共展示了ObservableList.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import javafx.collections.ObservableList; //导入方法依赖的package包/类
public void start(final Stage initStage) {        
    initStage.getIcons().add(new Image(APPLICATION_ICON));
    initStage.setResizable(false);
    initStage.setAlwaysOnTop(true);
    final Task<ObservableList<String>> friendTask = new Task<ObservableList<String>>() {
        @Override
        protected ObservableList<String> call() throws InterruptedException {
            ObservableList<String> titles = FXCollections.<String>observableArrayList();
            ObservableList<String> loadings = FXCollections.observableArrayList(
                    "Validate Version", "Running", "Initialize application", "Preparing ...", "Please Wait", "Done"
            );

            updateMessage("Checking Version");
            for (int i = 0; i < loadings.size(); i++) {
                Thread.sleep(400);
                updateProgress(i + 1, loadings.size());
                String nextFriend = loadings.get(i);
                titles.add(nextFriend);
                updateMessage("Chess Bot 1.0.0 ...  " + nextFriend);
            }

            Thread.sleep(400);

            return titles;
        }
    };

    showSplash(initStage, friendTask, () -> showMainStage());
    new Thread(friendTask).start();
}
 
开发者ID:mhusam,项目名称:ChessBot,代码行数:31,代码来源:ChessBotAppSplash.java

示例2: getTreeTableItemText

import javafx.collections.ObservableList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") private String getTreeTableItemText(TreeTableView<?> treeTableView,
        TreeItem<?> lastPathComponent) {
    @SuppressWarnings("rawtypes")
    TreeTableColumn treeTableColumn = treeTableView.getTreeColumn();
    if (treeTableColumn == null) {
        treeTableColumn = treeTableView.getColumns().get(0);
    }
    ObservableValue<?> cellObservableValue = treeTableColumn.getCellObservableValue(lastPathComponent);
    String original = cellObservableValue.getValue().toString();
    String itemText = original;
    int suffixIndex = 0;
    TreeItem<?> parent = lastPathComponent.getParent();
    if (parent == null)
        return itemText;
    ObservableList<?> children = parent.getChildren();
    for (int i = 0; i < children.indexOf(lastPathComponent); i++) {
        TreeItem<?> child = (TreeItem<?>) children.get(i);
        cellObservableValue = treeTableColumn.getCellObservableValue(child);
        String current = cellObservableValue.getValue().toString();
        if (current.equals(original)) {
            itemText = String.format("%s(%d)", original, ++suffixIndex);
        }
    }
    return itemText;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:26,代码来源:JavaFXElementPropertyAccessor.java

示例3: launch

import javafx.collections.ObservableList; //导入方法依赖的package包/类
public static SecondScreen launch() {

        ObservableList<Screen> screens = Screen.getScreens();

        if (screens.size() < 2)
            return null;

        Screen screen1 = screens.get(0);
        Screen screen2 = screens.get(1);
        log.info("screen1.getBounds() = " + screen1.getBounds());
        log.info("screen2.getBounds() = " + screen2.getBounds());
        Stage stage2 = new Stage();
        stage2.setScene(new Scene(new Label("primary")));
        stage2.setX(screen2.getVisualBounds().getMinX());
        stage2.setY(screen2.getVisualBounds().getMinY());
        stage2.setWidth(screen1.getBounds().getWidth());
        stage2.setHeight(screen1.getBounds().getHeight());
        Group root = new Group();
        Scene scene = new Scene(root, screen1.getBounds().getWidth(), screen1.getBounds().getHeight(), Color.BLACK);

        makeLighting(root, screen2.getBounds());

        stage2.setScene(scene);

        stage2.show();

        SecondScreen sc = new SecondScreen();

        Configuration config = ConfigurationBuilder.createFromPropertiesResource().build();

        /*
         * if (config.eyetracker.equals("tobii")) Tobii.execProg(sc); else
         */
        if (config.isGazeMode())
            gazeListener = new EyeTribeGazeListener(sc);
        else
            gazeListener = new FuzzyGazeListener(sc);

        return sc;
    }
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:41,代码来源:SecondScreen.java

示例4: add

import javafx.collections.ObservableList; //导入方法依赖的package包/类
public void add(VLToolBar toolbar) {
    ObservableList<Node> children = getChildren();
    if (children.size() > 0 && orientation == Orientation.LEFT) {
        VLToolBar last = (VLToolBar) children.get(children.size() - 1);
        HBox.setHgrow(last, Priority.NEVER);
        HBox.setHgrow(toolbar, Priority.ALWAYS);
    }
    if (children.size() == 0 && orientation == Orientation.RIGHT) {
        // YUK!!!
        toolbar.getItems().add(0, createFiller());
        HBox.setHgrow(toolbar, Priority.ALWAYS);
    }
    children.add(toolbar);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:ToolBarPanel.java

示例5: getIndexOfComponentInParent

import javafx.collections.ObservableList; //导入方法依赖的package包/类
private int getIndexOfComponentInParent(Node component) {
    Parent parent = component.getParent();
    if (parent == null) {
        return -1;
    }
    ObservableList<Node> components = parent.getChildrenUnmodifiable();
    for (int i = 0; i < components.size(); i++) {
        if (components.get(i) == component) {
            return i;
        }
    }
    return -1;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:AdjacentSiblingSelector.java

示例6: showEventDetailView

import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void showEventDetailView() {
    try {
        ObservableList<Agenda.Appointment> appointments = agenda.selectedAppointments();
        if(!appointments.isEmpty()) {
            Agenda.Appointment appointment = appointments.get(0);
            EventDutyDTO eventDutyDTO = getEventForAppointment(appointment);

            if(EventType.Opera.equals(eventDutyDTO.getEventType())) {
                scrollPane.setContent(FXMLLoader.load(getClass().getResource("EditOpera.fxml")));
                editOpen = true;
            } else if(EventType.Concert.equals(eventDutyDTO.getEventType())) {
                scrollPane.setContent(FXMLLoader.load(getClass().getResource("EditConcert.fxml")));
                editOpen = true;
            } else if(EventType.Tour.equals(eventDutyDTO.getEventType())) {
                scrollPane.setContent(FXMLLoader.load(getClass().getResource("EditTour.fxml")));
                editOpen = true;
            } else if(EventType.Hofkapelle.equals(eventDutyDTO.getEventType())) {
                scrollPane.setContent(FXMLLoader.load(getClass().getResource("EditHofkapelle.fxml")));
                editOpen = true;
            } else if(EventType.NonMusicalEvent.equals(eventDutyDTO.getEventType())) {
                scrollPane.setContent(FXMLLoader.load(getClass().getResource("EditNonMusicalEvent.fxml")));
                editOpen = true;
            } else if(EventType.Rehearsal.equals(eventDutyDTO.getEventType())) {
                scrollPane.setContent(FXMLLoader.load(getClass().getResource("EditRehearsal.fxml")));
                editOpen = true;
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:ITB15-S4-GroupD,项目名称:Planchester,代码行数:32,代码来源:EventScheduleController.java

示例7: run

import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override
public void run() {
    Clipboard clipboard = Clipboard.getSystemClipboard();
    ClipboardContent content = new ClipboardContent();

    int row = tableView.getSelectionModel().getSelectedIndex();
    ObservableList<TablePosition> selectedCells = tableView.getSelectionModel().getSelectedCells();
    if (!selectedCells.isEmpty()) {
        TablePosition tablePosition = selectedCells.get(0);
        Object cellData = tablePosition.getTableColumn().getCellData(row);
        content.putString(Objects.toString(cellData));
        clipboard.setContent(content);
    }
}
 
开发者ID:Kindrat,项目名称:cassandra-client,代码行数:15,代码来源:TableCellCopyHandler.java

示例8: getTreeTableSelection

import javafx.collections.ObservableList; //导入方法依赖的package包/类
public String getTreeTableSelection(TreeTableView<?> treeTableView) {
    TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel();
    ObservableList<Integer> selectedIndices = selectionModel.getSelectedIndices();
    ObservableList<?> selectedCells = selectionModel.getSelectedCells();
    int rowCount = treeTableView.getExpandedItemCount();
    int columnCount = treeTableView.getColumns().size();
    if (selectedIndices.size() == 0 || selectedCells.size() == 0) {
        return "";
    } else if (!selectionModel.isCellSelectionEnabled() && selectedIndices.size() == treeTableView.getExpandedItemCount()
            || selectionModel.isCellSelectionEnabled() && selectedCells.size() == rowCount * columnCount) {
        return "all";
    } else if (!selectionModel.isCellSelectionEnabled()) {
        return getTreeTableRowSelectionText(treeTableView, selectionModel.getSelectedItems());
    } else {
        int[] rows = new int[selectedCells.size()];
        int[] columns = new int[selectedCells.size()];
        JSONObject cells = new JSONObject();
        JSONArray value = new JSONArray();
        for (int i = 0; i < selectedCells.size(); i++) {
            TreeTablePosition<?, ?> cell = (TreeTablePosition<?, ?>) selectedCells.get(i);
            rows[i] = cell.getRow();
            columns[i] = cell.getColumn();
            List<String> cellValue = new ArrayList<>();
            cellValue.add(getTreeTableNodePath(treeTableView, selectionModel.getModelItem(cell.getRow())));
            cellValue.add(getTreeTableColumnName(treeTableView, cell.getColumn()));
            value.put(cellValue);
        }
        cells.put("cells", value);
        return cells.toString();
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:32,代码来源:JavaFXElementPropertyAccessor.java

示例9: getMenuText

import javafx.collections.ObservableList; //导入方法依赖的package包/类
private String getMenuText(ObservableList<Menu> menus, int index) {
    Menu menu = menus.get(index);
    String text = menu.getText();
    if (text == null || "".equals(text)) {
        return getMenuTextFromIcon(menu, index);
    }
    return text;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:JavaFXElementPropertyAccessor.java

示例10: testUpdateFirstLevelEntry

import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Test
public void testUpdateFirstLevelEntry() {
  SourceEntry entry = sourceType.createSourceEntryForUri("firstLevel");
  tree.updateEntry(entry);
  ObservableList<TreeItem<SourceEntry>> children = root.getChildren();
  assertEquals(1, children.size(), "Should be 1 child");
  TreeItem<SourceEntry> child = children.get(0);
  assertAll("", () -> {
    assertEquals("firstLevel", child.getValue().getName());
  });
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:12,代码来源:SourceTreeTableTest.java

示例11: search

import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void search(UIPlatform uiPlatform, Parent parent)
{
    ObservableList<Node> list = parent.getChildrenUnmodifiable();
    if (list.size() == 0)
    {
        return;
    }
    final String idPrefix = getPrefix().idPrefix;
    final String pathPrefix = getPrefix().pathPrefix;
    IdDeal idDeal = uiPlatform.getIdDeal();
    BinderFactory factory = uiPlatform.getBinderFactory();
    for (int i = 0; i < list.size(); i++)
    {
        Node node = list.get(i);
        UiId id = UiId.newInstance(node.getId(), idPrefix);
        if (id != null)
        {
            IdDeal.Result result = idDeal.dealId(id, pathPrefix);
            if (result != null)
            {
                hashMap.put(id, factory.getBinder(node));
            }
        }
        if (node instanceof Parent)
        {
            search(uiPlatform, (Parent) node);
        }
        if (node instanceof MenuBar)
        {
            search(uiPlatform, (MenuBar) node);
        }
    }
}
 
开发者ID:gzxishan,项目名称:OftenPorter,代码行数:34,代码来源:FXUIProvider.java

示例12: testFirstLevel

import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Test
public void testFirstLevel() {
  table.getEntry("entry").setString("value");
  NetworkTableInstance.getDefault().waitForEntryListenerQueue(-1.0);
  waitForFxEvents();

  ObservableList<TreeItem<NetworkTableSourceEntry>> children = root.getChildren();
  assertEquals(1, children.size(), "There should be a single child");
  TreeItem<NetworkTableSourceEntry> child = children.get(0);
  assertThat(child, hasKey("/entry"));
  assertThat(child, hasSimpleKey("entry"));
  assertThat(child, hasDisplayString("value"));
  assertThat("Child should be a leaf", child, isLeaf());
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:15,代码来源:NetworkTableTreeTest.java

示例13: smooth

import javafx.collections.ObservableList; //导入方法依赖的package包/类
private static void smooth(ObservableList<PathElement> strokeElements, ObservableList<PathElement> fillElements) {
    // as we do not have direct access to the data, first recreate the list of all the data points we have
    final Point2D[] dataPoints = new Point2D[strokeElements.size()];
    for (int i = 0; i < strokeElements.size(); i++) {
        final PathElement element = strokeElements.get(i);
        if (element instanceof MoveTo) {
            final MoveTo move = (MoveTo) element;
            dataPoints[i] = new Point2D(move.getX(), move.getY());
        } else if (element instanceof LineTo) {
            final LineTo line = (LineTo) element;
            final double x = line.getX(), y = line.getY();
            dataPoints[i] = new Point2D(x, y);
        }
    }
    // next we need to know the zero Y value
    final double zeroY = ((MoveTo) fillElements.get(0)).getY();

    // now clear and rebuild elements
    strokeElements.clear();
    fillElements.clear();
    Pair<Point2D[], Point2D[]> result = calcCurveControlPoints(dataPoints);
    Point2D[] firstControlPoints = result.getKey();
    Point2D[] secondControlPoints = result.getValue();
    // start both paths
    strokeElements.add(new MoveTo(dataPoints[0].getX(), dataPoints[0].getY()));
    fillElements.add(new MoveTo(dataPoints[0].getX(), zeroY));
    fillElements.add(new LineTo(dataPoints[0].getX(), dataPoints[0].getY()));
    // add curves
    for (int i = 1; i < dataPoints.length; i++) {
        final int ci = i - 1;
        strokeElements.add(new CubicCurveTo(
                firstControlPoints[ci].getX(), firstControlPoints[ci].getY(),
                secondControlPoints[ci].getX(), secondControlPoints[ci].getY(),
                dataPoints[i].getX(), dataPoints[i].getY()));
        fillElements.add(new CubicCurveTo(
                firstControlPoints[ci].getX(), firstControlPoints[ci].getY(),
                secondControlPoints[ci].getX(), secondControlPoints[ci].getY(),
                dataPoints[i].getX(), dataPoints[i].getY()));
    }
    // end the paths
    fillElements.add(new LineTo(dataPoints[dataPoints.length - 1].getX(), zeroY));
    fillElements.add(new ClosePath());
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:44,代码来源:CurveFittedAreaChartSample.java

示例14: drawBarChart

import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
 * Draw bar chart
 */
public void drawBarChart() {
    BaseTimeCanvas timeCanvas = this.getTimeCanvas();
    if (timeCanvas == null) {
        return;
    }
    
    BaseYCanvas priceCanvas = this.getYCanvas();
    if (priceCanvas == null) {
        return;
    }
    
    GraphicsContext gc = getGraphicsContext2D();
    ObservableList<OHLC> data = FXCollections.observableArrayList();
    if (this.ChartTypeProperty.getValue() == ChartType.DAY.ordinal()){
        data.setAll(dailyData);
    }
    else if (this.ChartTypeProperty.getValue() == ChartType.WEEK.ordinal()) {
        data.setAll(weeklyData);
    }
    else if (this.ChartTypeProperty.getValue() == ChartType.MONTH.ordinal()) {
        data.setAll(monthlyData);
    }
    else if (this.ChartTypeProperty.getValue() == ChartType.YEAR.ordinal()) {
        data.setAll(yearlyData);
    }
    
    for (int i = 0; i<data.size(); i++) {
        OHLC cur = data.get(i);
        Color curColor = getBarColor(data, i);
        Calendar calendar = cur.getDate();
        Double xCenter = timeCanvas.getXPosByDay(calendar);
        if (xCenter == null){
            //System.out.println("getXPOSByDate returns Null: " + calendar.getTime().toString());
            continue;
        }
        Double xOpen = xCenter - new Double((xIntervalProperty.getValue()/2)).intValue() + 1;
        Double xClose = xCenter + new Double((xIntervalProperty.getValue()/2)).intValue() - 1;
        Double yHigh = priceCanvas.getYPosByValue(cur.getHigh());
        if (yHigh == null) {
            continue;
        }
        Double yLow = priceCanvas.getYPosByValue(cur.getLow());
        if (yLow == null) {
            continue;
        }
        Double yOpen = priceCanvas.getYPosByValue(cur.getOpen());
        if (yOpen == null) {
            continue;
        }
        Double yClose = yOpen;
        if (cur.getOpen()!= cur.getClose()){
            yClose = priceCanvas.getYPosByValue(cur.getClose());
            if (yClose == null) {
                continue;
            }
        }
        //Draw Bar
        gc.setLineWidth(1);
        gc.setStroke(curColor);
        gc.strokeLine(xCenter, yHigh, xCenter, yLow);
        gc.strokeLine(xCenter, yHigh, xCenter, yLow);
        gc.strokeLine(xCenter, yHigh, xCenter, yLow);
        //Draw tick open
        gc.strokeLine(xOpen, yOpen, xCenter, yOpen);
        gc.strokeLine(xOpen, yOpen, xCenter, yOpen);
        gc.strokeLine(xOpen, yOpen, xCenter, yOpen);
        //Draw tick close
        gc.strokeLine(xCenter, yClose, xClose, yClose);
        gc.strokeLine(xCenter, yClose, xClose, yClose);
        gc.strokeLine(xCenter, yClose, xClose, yClose);
        
    }
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:77,代码来源:MainChartCanvas.java

示例15: drawVolume

import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
 * Draw Volume bars
 */
public void drawVolume() {
    BaseTimeCanvas timeCanvas = this.getTimeCanvas();
    if (timeCanvas == null) {
        return;
    }
    
    BaseYCanvas priceCanvas = this.getYCanvas();
    if (priceCanvas == null) {
        return;
    }
    
    GraphicsContext gc = getGraphicsContext2D();
    ObservableList<OHLC> data = FXCollections.observableArrayList();
    if (this.ChartTypeProperty.getValue() == ChartType.DAY.ordinal()){
        data.setAll(dailyData);
    }
    else if (this.ChartTypeProperty.getValue() == ChartType.WEEK.ordinal()) {
        data.setAll(weeklyData);
    }
    else if (this.ChartTypeProperty.getValue() == ChartType.MONTH.ordinal()) {
        data.setAll(monthlyData);
    }
    else if (this.ChartTypeProperty.getValue() == ChartType.YEAR.ordinal()) {
        data.setAll(yearlyData);
    }
    
    boolean bIsStroke = true;
    for (int i = 0; i<data.size(); i++) {
        OHLC cur = data.get(i);
        Color curColor = getBarColor(data, i);
        
        //Draw tail up
        Calendar calendar = cur.getDate();
        Double x = timeCanvas.getXPosByDay(calendar);
        if (x == null){
            //continue;
            return;
        }
        
        Double y = priceCanvas.getYPosByValue(0f);
        if (y == null){
            //continue;
            return;
        }
        
        Double volume = new Double(cur.getVolume());
        float value = volume.floatValue();
        value/=1000000;
        value *= 10000;
        value = (float)Math.round(value);
        value /= 10000;
 
        Double yy= priceCanvas.getYPosByValue(value);
        if (yy == null){
            System.out.println("Volume is not found at value: " + value + " Date should be : " + cur.getDate().getTime().toString());
            continue;   
        }

        gc.setLineWidth(1);
        gc.setStroke(curColor);
        gc.strokeLine(x, y, x, yy);
    }
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:67,代码来源:VolumeCanvas.java


注:本文中的javafx.collections.ObservableList.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。