com.kotcrab.vis.ui.widget.VisTable Java Examples

The following examples show how to use com.kotcrab.vis.ui.widget.VisTable. 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: TestVertical.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
private void addVisWidgets () {
	VisProgressBar progressbar = new VisProgressBar(0, 100, 1, true);
	VisSlider slider = new VisSlider(0, 100, 1, true);
	VisSlider sliderDisabled = new VisSlider(0, 100, 1, true);

	progressbar.setValue(50);
	slider.setValue(50);
	sliderDisabled.setValue(50);
	sliderDisabled.setDisabled(true);

	VisTable progressbarTable = new VisTable(true);
	progressbarTable.add(progressbar);
	progressbarTable.add(slider);
	progressbarTable.add(sliderDisabled);

	add(progressbarTable);
}
 
Example #2
Source File: TestVertical.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
private void addNormalWidgets () {
	ProgressBar progressbar = new ProgressBar(0, 100, 1, true, VisUI.getSkin());
	Slider slider = new Slider(0, 100, 1, true, VisUI.getSkin());
	Slider sliderDisabled = new Slider(0, 100, 1, true, VisUI.getSkin());

	progressbar.setValue(50);
	slider.setValue(50);
	sliderDisabled.setValue(50);
	sliderDisabled.setDisabled(true);

	VisTable progressbarTable = new VisTable(true);
	progressbarTable.add(progressbar);
	progressbarTable.add(slider);
	progressbarTable.add(sliderDisabled);

	add(progressbarTable);
}
 
Example #3
Source File: BasicColorPicker.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
private VisTable createColorsPreviewTable () {
	VisTable table = new VisTable(false);
	table.add(currentColorImg = new AlphaImage(commons, 5 * sizes.scaleFactor))
			.height(25 * sizes.scaleFactor).width(80 * sizes.scaleFactor).expandX().fillX();
	table.add(new Image(style.iconArrowRight)).pad(0, 2, 0, 2);
	table.add(newColorImg = new AlphaImage(commons, 5 * sizes.scaleFactor))
			.height(25 * sizes.scaleFactor).width(80 * sizes.scaleFactor).expandX().fillX();

	currentColorImg.setColor(color);
	newColorImg.setColor(color);

	currentColorImg.addListener(new ClickListener() {
		@Override
		public void clicked (InputEvent event, float x, float y) {
			restoreLastColor();
		}
	});

	return table;
}
 
Example #4
Source File: TabbedPane.java    From riiablo with Apache License 2.0 6 votes vote down vote up
public void addTab(String text, VisTable content) {
  VisTextButton button = new VisTextButton(text) {{
    setName(getText().toString());
    setStyle(new TextButtonStyle(getStyle()) {{
      checked = down;
    }});
    setProgrammaticChangeEvents(false);
    setFocusBorderEnabled(false);
    addListener(clickListener);
  }};
  if (buttons.getCheckedIndex() == -1) {
    contentPanel.setActor(content);
    notifyTabSwitched(null, button.getName());
  }
  buttons.add(button);
  tabs.add(button).growX();
  map.put(button.getName(), content);
}
 
Example #5
Source File: BasicColorPicker.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
private VisTable createHexTable () {
	VisTable table = new VisTable(true);
	table.add(new VisLabel(HEX.get()));
	table.add(hexField = new VisValidatableTextField("00000000")).width(HEX_FIELD_WIDTH * sizes.scaleFactor);
	table.row();

	hexField.setMaxLength(HEX_COLOR_LENGTH);
	hexField.setProgrammaticChangeEvents(false);
	hexField.setTextFieldFilter(new TextFieldFilter() {
		@Override
		public boolean acceptChar (VisTextField textField, char c) {
			return Character.isDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
		}
	});

	hexField.addListener(new ChangeListener() {
		@Override
		public void changed (ChangeEvent event, Actor actor) {
			if (hexField.getText().length() == (allowAlphaEdit ? HEX_COLOR_LENGTH_WITH_ALPHA : HEX_COLOR_LENGTH)) {
				setColor(Color.valueOf(hexField.getText()), false);
			}
		}
	});

	return table;
}
 
Example #6
Source File: TestButtonBar.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
private VisTable createTable (String order) {
	ButtonBar buttonBar = new ButtonBar(order);

	ChangeListener dummyListener = new ChangeListener() {
		@Override
		public void changed (ChangeEvent event, Actor actor) {

		}
	};

	buttonBar.setButton(ButtonType.LEFT, dummyListener);
	buttonBar.setButton(ButtonType.RIGHT, dummyListener);
	buttonBar.setButton(ButtonType.HELP, dummyListener);
	buttonBar.setButton(ButtonType.NO, dummyListener);
	buttonBar.setButton(ButtonType.YES, dummyListener);
	buttonBar.setButton(ButtonType.CANCEL, dummyListener);
	buttonBar.setButton(ButtonType.BACK, dummyListener);
	buttonBar.setButton(ButtonType.NEXT, dummyListener);
	buttonBar.setButton(ButtonType.APPLY, dummyListener);
	buttonBar.setButton(ButtonType.FINISH, dummyListener);
	buttonBar.setButton(ButtonType.OK, dummyListener);
	return buttonBar.createTable();
}
 
Example #7
Source File: ExtendedColorPicker.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
@Override
protected void createUI () {
	super.createUI();

	VisTable extendedTable = new VisTable(true); //displayed next to mainTable

	extendedTable.add(hBar).row();
	extendedTable.add(sBar).row();
	extendedTable.add(vBar).row();

	extendedTable.add();
	extendedTable.row();

	extendedTable.add(rBar).row();
	extendedTable.add(gBar).row();
	extendedTable.add(bBar).row();

	extendedTable.add();
	extendedTable.row();

	extendedTable.add(aBar).row();

	add(extendedTable).expand().left().top().pad(0, 9, 4, 4);
}
 
Example #8
Source File: AbstractListAdapter.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
@Override
public void fillTable (VisTable itemsTable) {
	if (itemsComparator != null) sort(itemsComparator);
	for (final ItemT item : iterable()) {
		final ViewT view = getView(item);
		prepareViewBeforeAddingToTable(item, view);
		itemsTable.add(view).growX();
		itemsTable.row();
	}
}
 
Example #9
Source File: ColorPicker.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
private VisTable createButtons () {
	ButtonBar buttonBar = new ButtonBar();
	buttonBar.setIgnoreSpacing(true);
	buttonBar.setButton(ButtonType.LEFT, restoreButton = new VisTextButton(RESTORE.get()));
	buttonBar.setButton(ButtonType.OK, okButton = new VisTextButton(OK.get()));
	buttonBar.setButton(ButtonType.CANCEL, cancelButton = new VisTextButton(CANCEL.get()));
	return buttonBar.createTable();
}
 
Example #10
Source File: PackListAdapter.java    From gdx-texture-packer-gui with Apache License 2.0 5 votes vote down vote up
@Override
protected VisTable createView(PackModel item) {
    ViewHolder viewHolder = new ViewHolder(lmlParser.getData().getDefaultSkin(), item);
    lmlParser.createView(viewHolder, Gdx.files.internal("lml/packListItem.lml"));
    viewHolder.root.setUserObject(viewHolder);
    return viewHolder.root;
}
 
Example #11
Source File: SimpleListAdapter.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
@Override
protected VisTable createView (ItemT item) {
	VisTable table = new VisTable();
	table.left();
	table.add(new VisLabel(item.toString()));
	return table;
}
 
Example #12
Source File: Toast.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
protected void createMainTable () {
	mainTable = new VisTable();
	mainTable.setBackground(style.background);

	VisImageButton closeButton = new VisImageButton(style.closeButtonStyle);
	closeButton.addListener(new ChangeListener() {
		@Override
		public void changed (ChangeEvent event, Actor actor) {
			close();
		}
	});

	mainTable.add(contentTable).pad(3).fill().expand();
	mainTable.add(closeButton).top();
}
 
Example #13
Source File: TestTabbedPane.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
public TestTab (String title) {
	super(false, true);
	this.title = title;

	content = new VisTable();
	content.add(new VisLabel(title));
}
 
Example #14
Source File: TestSplitPane.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
private void addVisWidgets () {
	VisLabel label = new VisLabel("Lorem \nipsum \ndolor \nsit \namet");
	VisLabel label2 = new VisLabel("Consectetur \nadipiscing \nelit");
	VisTable table = new VisTable(true);
	VisTable table2 = new VisTable(true);

	table.add(label);
	table2.add(label2);

	VisSplitPane splitPane = new VisSplitPane(table, table2, vertical);
	add(splitPane).fill().expand();
}
 
Example #15
Source File: TabbedPane.java    From riiablo with Apache License 2.0 5 votes vote down vote up
public TabbedPane() {
  clickListener = new ClickListener() {
    @Override
    public void clicked(InputEvent event, float x, float y) {
      Button button = (Button) event.getListenerActor();
      contentPanel.setActor(map.get(button.getName()));
      notifyTabSwitched(buttons.getChecked().getName(), button.getName());
    }
  };

  add(tabs = new VisTable()).growX().row();
  add(new Image(VisUI.getSkin().getDrawable("list-selection"))).growX().row();
  add(contentPanel = new Container<>()).align(Align.top).row();
}
 
Example #16
Source File: Toast.java    From gdx-texture-packer-gui with Apache License 2.0 5 votes vote down vote up
protected void createMainTable () {
	mainTable = new VisTable();
	mainTable.setBackground(style.background);

	VisImageButton closeButton = new VisImageButton(style.closeButtonStyle);
	closeButton.addListener(new ChangeListener() {
		@Override
		public void changed (ChangeEvent event, Actor actor) {
			close();
		}
	});

	mainTable.add(contentTable).pad(3).fill().expand();
	mainTable.add(closeButton).top();
}
 
Example #17
Source File: ToastManager.java    From gdx-texture-packer-gui with Apache License 2.0 5 votes vote down vote up
/** Displays basic toast with provided text as message. Toast will be displayed for given amount of seconds. */
public Toast show (String text, float timeSec) {
	VisTable table = new VisTable();
	Cell<Label> cell = table.add(text).grow();
	cell.getActor().setTouchable(Touchable.disabled);
	return show(table, timeSec);
}
 
Example #18
Source File: TestSplitPane.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
private void addNormalWidgets () {
	Skin skin = VisUI.getSkin();
	Label label = new Label("Lorem \nipsum \ndolor \nsit \namet", skin);
	Label label2 = new Label("Consectetur \nadipiscing \nelit", skin);

	VisTable table = new VisTable(true);
	VisTable table2 = new VisTable(true);

	table.add(label);
	table2.add(label2);

	SplitPane splitPane = new SplitPane(table, table2, false, skin);
	add(splitPane).fill().expand();
}
 
Example #19
Source File: FileHistoryManager.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public VisTable getButtonsTable () {
	return buttonsTable;
}
 
Example #20
Source File: SimpleListAdapter.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
@Override
protected void selectView (VisTable view) {
	view.setBackground(style.selection);
}
 
Example #21
Source File: ListAdapter.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
/** Called by {@link ListView} when this adapter should create and add all views to provided itemsTable. */
void fillTable (VisTable itemsTable);
 
Example #22
Source File: SimpleListAdapter.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
@Override
protected void deselectView (VisTable view) {
	view.setBackground(style.background);
}
 
Example #23
Source File: ToastManager.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
/** Displays basic toast with provided text as message. Toast will be displayed for given amount of seconds. */
public void show (String text, float timeSec) {
	VisTable table = new VisTable();
	table.add(text).grow();
	show(table, timeSec);
}
 
Example #24
Source File: DccInfo.java    From riiablo with Apache License 2.0 4 votes vote down vote up
private static VisTable add(VisTable table, String label, String format, Object... args) {
  table.add(label).right();
  table.add(String.format(format, args)).left();
  table.row();
  return table;
}
 
Example #25
Source File: DccInfo.java    From riiablo with Apache License 2.0 4 votes vote down vote up
private static VisTable add(VisTable table, String label, int value) {
  return add(table, label, String.valueOf(value));
}
 
Example #26
Source File: Dc6Info.java    From riiablo with Apache License 2.0 4 votes vote down vote up
private static VisTable add(VisTable table, String label, String format, Object... args) {
  table.add(label).right();
  table.add(String.format(format, args)).left();
  table.row();
  return table;
}
 
Example #27
Source File: Dc6Info.java    From riiablo with Apache License 2.0 4 votes vote down vote up
private static VisTable add(VisTable table, String label, int value) {
  return add(table, label, String.valueOf(value));
}
 
Example #28
Source File: CofInfo.java    From riiablo with Apache License 2.0 4 votes vote down vote up
private static VisTable add(VisTable table, String label, String format, Object... args) {
  table.add(label).right();
  table.add(String.format(format, args)).left();
  table.row();
  return table;
}
 
Example #29
Source File: CofInfo.java    From riiablo with Apache License 2.0 4 votes vote down vote up
private static VisTable add(VisTable table, String label, int value) {
  return add(table, label, String.valueOf(value));
}
 
Example #30
Source File: PackListAdapter.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
@Override
protected void deselectView(VisTable view) {
    ViewHolder viewHolder = (ViewHolder) view.getUserObject();
    viewHolder.setSelected(false);
}